diff -Nru hypre-2.16.0/AUTOTEST/basic.sh hypre-2.18.2/AUTOTEST/basic.sh --- hypre-2.16.0/AUTOTEST/basic.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/basic.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` diff -Nru hypre-2.16.0/AUTOTEST/check-double.filters hypre-2.18.2/AUTOTEST/check-double.filters --- hypre-2.16.0/AUTOTEST/check-double.filters 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/check-double.filters 2019-10-28 22:30:04.000000000 +0000 @@ -1,11 +1,5 @@ /_hypre_utilities.h: /HYPRE_utilities.h: -/utilities/general.h: -/utilities/gpuErrorCheck.h: -/utilities/gpuErrorCheck.c: -/utilities/gpuMem.h: -/utilities/hypre_nvtx.h: +/utilities/hypre_general.h: /utilities/mpistubs.c -/seq_mv/gpukernels.h: -/seq_mv/seq_mv.h:.*cudaStream_t double-check diff -Nru hypre-2.16.0/AUTOTEST/check-double.sh hypre-2.18.2/AUTOTEST/check-double.sh --- hypre-2.16.0/AUTOTEST/check-double.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/check-double.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` diff -Nru hypre-2.16.0/AUTOTEST/check-glob-symb.sh hypre-2.18.2/AUTOTEST/check-glob-symb.sh --- hypre-2.16.0/AUTOTEST/check-glob-symb.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/check-glob-symb.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` diff -Nru hypre-2.16.0/AUTOTEST/check-int.filters hypre-2.18.2/AUTOTEST/check-int.filters --- hypre-2.16.0/AUTOTEST/check-int.filters 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/check-int.filters 2019-10-28 22:30:04.000000000 +0000 @@ -3,19 +3,14 @@ /hypre_printf.c: /_hypre_utilities.h: /HYPRE_utilities.h: -/utilities/general.h: -/utilities/gpuErrorCheck.h: -/utilities/gpuErrorCheck.c: -/utilities/gpuMem.h: -/utilities/hypre_nvtx.h: +/utilities/hypre_general.h: /utilities/mpistubs.c -/seq_mv/gpukernels.h: -/seq_mv/seq_mv.h:.*cudaStream_t as long as too long long range interpolation long-range interpolation monstrously long get a long msg +long rows utilities/hypre_hopscotch_hash.h: //return _InterlockedCompareExchange utilities/hypre_hopscotch_hash.h: //return _InterlockedExchangeAdd diff -Nru hypre-2.16.0/AUTOTEST/check-int.sh hypre-2.18.2/AUTOTEST/check-int.sh --- hypre-2.16.0/AUTOTEST/check-int.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/check-int.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` diff -Nru hypre-2.16.0/AUTOTEST/check-license.filters hypre-2.18.2/AUTOTEST/check-license.filters --- hypre-2.16.0/AUTOTEST/check-license.filters 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/check-license.filters 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,17 @@ +./AUTOTEST/.*.out +./AUTOTEST/.*.fil +./AUTOTEST/.*.err +./AUTOTEST/.*.log +./src/test/struct_migrate +./src/test/maxwell_unscaled +./src/test/sstruct_fac +./src/test/ams_driver +./src/test/zboxloop +./src/test/ij +./src/test/ij_mv +./src/test/struct +./src/test/sstruct +./src/zerr +./src/config.log +./src/config.status +TVD.v3breakpoints \ No newline at end of file diff -Nru hypre-2.16.0/AUTOTEST/check-license.sh hypre-2.18.2/AUTOTEST/check-license.sh --- hypre-2.16.0/AUTOTEST/check-license.sh 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/check-license.sh 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,92 @@ +#!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +testname=`basename $0 .sh` + +# Echo usage information +case $1 in + -h|-help) + cat < check-license.files + +# Add these file back to the list + +egrep -LR "$LicStr" ./src/test/TEST_* | + egrep '[.](sh|jobs)$' >> check-license.files + +egrep -LR "$LicStr" ./src/test/TEST_* | + egrep 'TEST_.*/.*[.]in($|[.].*$)' >> check-license.files + +# Remove these individual files from the list and echo the result + +cat > check-license.remove <&2 +rm -f check-license.remove check-license.files + +### Next check for files that should not have the license, but do + +# blas and lapack '.c' files should not have an LLNL license +egrep -lR "$LicStr" ./src/blas ./src/lapack | egrep '[.]/src/(blas|lapack)/.*[.]c' >&2 diff -Nru hypre-2.16.0/AUTOTEST/check-mpi.sh hypre-2.18.2/AUTOTEST/check-mpi.sh --- hypre-2.16.0/AUTOTEST/check-mpi.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/check-mpi.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` diff -Nru hypre-2.16.0/AUTOTEST/cleantest.sh hypre-2.18.2/AUTOTEST/cleantest.sh --- hypre-2.16.0/AUTOTEST/cleantest.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/cleantest.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2015, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) # Echo usage information case $1 in diff -Nru hypre-2.16.0/AUTOTEST/cmake.bat hypre-2.18.2/AUTOTEST/cmake.bat --- hypre-2.16.0/AUTOTEST/cmake.bat 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/cmake.bat 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ @echo off +rem Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +rem HYPRE Project Developers. See the top-level COPYRIGHT file for details. +rem +rem SPDX-License-Identifier: (Apache-2.0 OR MIT) + setlocal rem This script can be run from anywhere @@ -32,27 +37,20 @@ rem clean out 'cmbuild' directories cd %srcdir% && rmdir /s /q cmbuild & mkdir cmbuild -cd %srcdir%\test && rmdir /s /q cmbuild & mkdir cmbuild rem run cmake for hypre library and test directory cd %srcdir%\cmbuild -%CMAKE% -G "Visual Studio 15 2017" %cmakeopts% .. > %outdir%\lib-cmake.out -cd %srcdir%\test\cmbuild -%CMAKE% -G "Visual Studio 15 2017" %cmakeopts% .. > %outdir%\test-cmake.out +%CMAKE% -G "Visual Studio 15 2017" %cmakeopts% "-DHYPRE_BUILD_TESTS=ON" .. > %outdir%\lib-cmake.out rem build release version cd %srcdir%\cmbuild %MSBUILD% HYPRE.vcxproj /t:Rebuild /p:Configuration=Release > %outdir%\lib-release.out %MSBUILD% INSTALL.vcxproj /p:Configuration=Release >> %outdir%\lib-release.out -cd %srcdir%\test\cmbuild -%MSBUILD% ALL_BUILD.vcxproj /t:Rebuild /p:Configuration=Release > %outdir%\test-release.out rem build debug version cd %srcdir%\cmbuild %MSBUILD% HYPRE.vcxproj /t:Rebuild /p:Configuration=Debug > %outdir%\lib-debug.out %MSBUILD% INSTALL.vcxproj /p:Configuration=Debug >> %outdir%\lib-debug.out -cd %srcdir%\test\cmbuild -%MSBUILD% ALL_BUILD.vcxproj /t:Rebuild /p:Configuration=Release > %outdir%\test-debug.out rem create error file - inspect output file lines with "Error(s)" substring cd %rundir% @@ -60,7 +58,7 @@ for %%f in (%outdir%\*.out) do ( set sum=0 for /f "tokens=1" %%i in ('findstr "Error(s)" %%f') do set /a sum+=%%i - if %sum% gtr 0 @echo %%f > cmake.err + if %sum% gtr 0 @echo %%f >> cmake.err ) cd %rundir% diff -Nru hypre-2.16.0/AUTOTEST/cmake.sh hypre-2.18.2/AUTOTEST/cmake.sh --- hypre-2.16.0/AUTOTEST/cmake.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/cmake.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` @@ -44,7 +37,7 @@ shift # Parse the rest of the command line -copts="" +copts="-DHYPRE_BUILD_TESTS=ON" mopts="" ropts="" eopts="" @@ -81,7 +74,6 @@ # Clean up the cmbuild directories (do it from src_dir as a precaution) cd $src_dir rm -fr `echo cmbuild/* | sed 's/[^ ]*README.txt//g'` -rm -fr `echo test/cmbuild/* | sed 's/[^ ]*README.txt//g'` # Clean up the previous install cd $src_dir @@ -93,10 +85,9 @@ make $mopts install # Make -cd $src_dir/test/cmbuild -cmake .. +cd $src_dir/cmbuild/test make $mopts -mv -f $drivers .. +mv -f $drivers ../../test cd $test_dir @@ -121,7 +112,6 @@ # Clean up cd $src_dir rm -fr `echo cmbuild/* | sed 's/[^ ]*README.txt//g'` -rm -fr `echo test/cmbuild/* | sed 's/[^ ]*README.txt//g'` rm -fr hypre ( cd $src_dir/test; rm -f $drivers; ./cleantest.sh ) diff -Nru hypre-2.16.0/AUTOTEST/configure.sh hypre-2.18.2/AUTOTEST/configure.sh --- hypre-2.16.0/AUTOTEST/configure.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/configure.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` diff -Nru hypre-2.16.0/AUTOTEST/docs.sh hypre-2.18.2/AUTOTEST/docs.sh --- hypre-2.16.0/AUTOTEST/docs.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/docs.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` diff -Nru hypre-2.16.0/AUTOTEST/examples.sh hypre-2.18.2/AUTOTEST/examples.sh --- hypre-2.16.0/AUTOTEST/examples.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/examples.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` tests="" diff -Nru hypre-2.16.0/AUTOTEST/klocwork.sh hypre-2.18.2/AUTOTEST/klocwork.sh --- hypre-2.16.0/AUTOTEST/klocwork.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/klocwork.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` diff -Nru hypre-2.16.0/AUTOTEST/link.sh hypre-2.18.2/AUTOTEST/link.sh --- hypre-2.16.0/AUTOTEST/link.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/link.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` diff -Nru hypre-2.16.0/AUTOTEST/machine-lassen.sh hypre-2.18.2/AUTOTEST/machine-lassen.sh --- hypre-2.16.0/AUTOTEST/machine-lassen.sh 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/machine-lassen.sh 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,105 @@ +#!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +testname=`basename $0 .sh` + +# Echo usage information +case $1 in + -h|-help) + cat <&2 +done + + diff -Nru hypre-2.16.0/AUTOTEST/machine-mac.sh hypre-2.18.2/AUTOTEST/machine-mac.sh --- hypre-2.16.0/AUTOTEST/machine-mac.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/machine-mac.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` @@ -62,6 +55,10 @@ ./test.sh basic.sh $src_dir -co: $co -mo: $mo ./renametest.sh basic $output_dir/basic--enable-bigint +co="--enable-mixedint --disable-fortran" +./test.sh basic.sh $src_dir -co: $co -mo: $mo +./renametest.sh basic $output_dir/basic--enable-mixedint + # Test linking for different languages link_opts="all++" for opt in $link_opts diff -Nru hypre-2.16.0/AUTOTEST/machine-ray.sh hypre-2.18.2/AUTOTEST/machine-ray.sh --- hypre-2.16.0/AUTOTEST/machine-ray.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/machine-ray.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` @@ -98,6 +91,11 @@ ./test.sh basic.sh $src_dir -co: $co -mo: $mo -ro: $rost ./renametest.sh basic $output_dir/basic-deviceomp-nonum-debug-struct +# CUDA with UM without MPI +#co="--with-cuda --enable-unified-memory --without-MPI --with-extra-CXXFLAGS=\\'-qmaxmem=-1 -qsuppress=1500-029\\'" +#./test.sh basic.sh $src_dir -co: $co -mo: $mo +#./renametest.sh basic $output_dir/basic-cuda-um-without-MPI + # Echo to stderr all nonempty error files in $output_dir for errfile in $( find $output_dir ! -size 0 -name "*.err" ) do diff -Nru hypre-2.16.0/AUTOTEST/machine-rzcereal3.sh hypre-2.18.2/AUTOTEST/machine-rzcereal3.sh --- hypre-2.16.0/AUTOTEST/machine-rzcereal3.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/machine-rzcereal3.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -#!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. -# -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - -testname=`basename $0 .sh` - -# Echo usage information -case $1 in - -h|-help) - cat <&2 -done diff -Nru hypre-2.16.0/AUTOTEST/machine-rztopaz.sh hypre-2.18.2/AUTOTEST/machine-rztopaz.sh --- hypre-2.16.0/AUTOTEST/machine-rztopaz.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/machine-rztopaz.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` @@ -78,6 +71,10 @@ ./test.sh basic.sh $src_dir -co: $co -mo: $mo ./renametest.sh basic $output_dir/basic--enable-bigint +co="--enable-mixedint" +./test.sh basic.sh $src_dir -co: $co -mo: $mo +./renametest.sh basic $output_dir/basic--enable-mixedint + # Echo to stderr all nonempty error files in $output_dir for errfile in $( find $output_dir ! -size 0 -name "*.err" ) do diff -Nru hypre-2.16.0/AUTOTEST/machine-syrah.sh hypre-2.18.2/AUTOTEST/machine-syrah.sh --- hypre-2.16.0/AUTOTEST/machine-syrah.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/machine-syrah.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` @@ -73,6 +66,10 @@ ./test.sh basic.sh $src_dir -co: $co -mo: $mo ./renametest.sh basic $output_dir/basic--enable-bigint +co="--enable-mixedint" +./test.sh basic.sh $src_dir -co: $co -mo: $mo +./renametest.sh basic $output_dir/basic--enable-mixedint + co="--with-blas --with-lapack --with-blas-lib-dirs=/usr/lib64 --with-lapack-lib-dirs=/usr/lib64 --with-blas-libs=blas --with-lapack-libs=lapack" ./test.sh basic.sh $src_dir -co: $co -mo: $mo ./renametest.sh basic $output_dir/basic--with-blas diff -Nru hypre-2.16.0/AUTOTEST/machine-tux-compilers.sh hypre-2.18.2/AUTOTEST/machine-tux-compilers.sh --- hypre-2.16.0/AUTOTEST/machine-tux-compilers.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/machine-tux-compilers.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` diff -Nru hypre-2.16.0/AUTOTEST/machine-tux-exlibs.sh hypre-2.18.2/AUTOTEST/machine-tux-exlibs.sh --- hypre-2.16.0/AUTOTEST/machine-tux-exlibs.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/machine-tux-exlibs.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` diff -Nru hypre-2.16.0/AUTOTEST/machine-tux.sh hypre-2.18.2/AUTOTEST/machine-tux.sh --- hypre-2.16.0/AUTOTEST/machine-tux.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/machine-tux.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` @@ -45,6 +38,11 @@ # Organizing the tests from "fast" to "slow" +# Check license header info +#( cd $src_dir; make distclean ) +./test.sh check-license.sh $src_dir/.. +mv -f check-license.??? $output_dir + # Check for 'int', 'double', and 'MPI_' ./test.sh check-int.sh $src_dir mv -f check-int.??? $output_dir @@ -136,6 +134,10 @@ ./test.sh basic.sh $src_dir -co: $co -mo: $mo -ro: $ro -eo: -bigint ./renametest.sh basic $output_dir/basic--enable-bigint +co="--enable-mixedint --enable-debug" +./test.sh basic.sh $src_dir -co: $co -mo: $mo +./renametest.sh basic $output_dir/basic--enable-mixedint + co="--enable-debug --with-print-errors" ./test.sh basic.sh $src_dir -co: $co -mo: $mo -ro: $ro -rt -valgrind ./renametest.sh basic $output_dir/basic--valgrind1 diff -Nru hypre-2.16.0/AUTOTEST/machine-vs-pro.bat hypre-2.18.2/AUTOTEST/machine-vs-pro.bat --- hypre-2.16.0/AUTOTEST/machine-vs-pro.bat 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/machine-vs-pro.bat 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ @echo off +rem Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +rem HYPRE Project Developers. See the top-level COPYRIGHT file for details. +rem +rem SPDX-License-Identifier: (Apache-2.0 OR MIT) + setlocal rem This script can be run from anywhere, but must live in the same directory diff -Nru hypre-2.16.0/AUTOTEST/machine-vulcan.sh hypre-2.18.2/AUTOTEST/machine-vulcan.sh --- hypre-2.16.0/AUTOTEST/machine-vulcan.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/machine-vulcan.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -#!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. -# -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - -testname=`basename $0 .sh` - -# Echo usage information -case $1 in - -h|-help) - cat <&2 -done diff -Nru hypre-2.16.0/AUTOTEST/make.sh hypre-2.18.2/AUTOTEST/make.sh --- hypre-2.16.0/AUTOTEST/make.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/make.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` diff -Nru hypre-2.16.0/AUTOTEST/README.txt hypre-2.18.2/AUTOTEST/README.txt --- hypre-2.16.0/AUTOTEST/README.txt 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/README.txt 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + This directory contains scripts for running various tests on the hypre library. The scripts augment the 'runtest.sh' runtime tests in 'test/TEST_*'. diff -Nru hypre-2.16.0/AUTOTEST/renametest.sh hypre-2.18.2/AUTOTEST/renametest.sh --- hypre-2.16.0/AUTOTEST/renametest.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/renametest.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) # Echo usage information case $1 in diff -Nru hypre-2.16.0/AUTOTEST/run.sh hypre-2.18.2/AUTOTEST/run.sh --- hypre-2.16.0/AUTOTEST/run.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/run.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) testname=`basename $0 .sh` tests="" diff -Nru hypre-2.16.0/AUTOTEST/test.sh hypre-2.18.2/AUTOTEST/test.sh --- hypre-2.16.0/AUTOTEST/test.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/AUTOTEST/test.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) while [ "$*" ] do diff -Nru hypre-2.16.0/CHANGELOG hypre-2.18.2/CHANGELOG --- hypre-2.16.0/CHANGELOG 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/CHANGELOG 2019-10-28 22:30:04.000000000 +0000 @@ -1,19 +1,46 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= -# This file chronicles user-level changes to hypre, beginning with the most -# recent release. -#============================================================================= +# This file chronicles user-level changes, beginning with the most recent. +# ============================================================================= + +Version 2.18.2 released 2019/10/28 + +- Fixed mixedint bugs. + +#==================================== + +Version 2.18.1 released 2019/10/15 + +- Various bug fixes. + +#==================================== + +Version 2.18.0 released 2019/09/27 + +- Ported BoomerAMG setup to run on GPUs. Only a subset of setup phase features + are currently available. + +- Updated CMake to support more of the features available in configure/make. + +- Added RecomputeResidual options to several hybrid solvers. + +- Various bug fixes. + +#==================================== + +Version 2.17.0 released 2019/07/10 + +- Changed open source license to dual MIT/Apache-2.0 + +- Removed FEI_mv/ml subdirectory and several FEI header files + +- Various bug fixes. + +#==================================== Version 2.16.0 released 2019/03/20 @@ -31,12 +58,16 @@ - Various bug fixes. +#==================================== + Version 2.15.1 released 2018/10/19 - Added hypre version functions: HYPRE_Version(), HYPRE_VersionNumber() - Various bug fixes. +#==================================== + Version 2.15.0 released 2018/09/21 - Added new system interface routines to reduce copies and improve threading: @@ -53,6 +84,8 @@ - Various bug fixes. +#==================================== + Version 2.14.0 released 2018/03/16 - New GPU release uses CUDA or OpenMP4.5. AMG setup phase is not yet ported. @@ -63,6 +96,8 @@ - Various bug fixes. +#==================================== + Version 2.13.0 released 2017/10/20 - Added new multigrid reduction (MGR) solver @@ -81,6 +116,8 @@ - Fixed Windows Visual Studio compile (version 2017) +#==================================== + Version 2.12.1 released 2017/09/29 - Added support for single and quad precision floating point numbers @@ -89,12 +126,16 @@ - Various bug fixes +#==================================== + Version 2.12.0 released 2017/05/02 - Added GPU support to hypre. The Struct and SStruct code can use CUDA, RAJA, or KOKKOS. The ParCSR code uses CUDA. The BoomerAMG setup phase is not yet ported to the GPU. This release uses unified memory. +#==================================== + Version 2.11.2 released 2017/03/13 - Changed the defaults in hypre to HMIS with ext+i(4) interpolation @@ -105,6 +146,8 @@ - Various bug fixes +#==================================== + Version 2.11.1 released 2016/06/09 - Fixed one more bug related to SStructSetSharedPart and SetNeighborPart @@ -122,6 +165,8 @@ - Updated the AME and LOBPCG interfaces to work correctly with both absolute and relative tolerances. +#==================================== + Version 2.11.0 released 2016/03/28 - Added a new function hypre_BoomerAMGSetKeepTranspose, which will store the @@ -154,6 +199,8 @@ - Removed Babel from the release +#==================================== + Version 2.10.1 released 2015/09/11 - Fixed various bugs in AMG and the IJ interface. @@ -167,6 +214,8 @@ for the nonGalerkin version, with HYPRE_BoomerAMGSetNonGalerkinTol and HYPRE_BommerAMGSetLevelNonGalerkinTol +#==================================== + Version 2.10.0b released 2015/01/22 - Added new interpolation that allows the incorporation of near null-space diff -Nru hypre-2.16.0/COPYING.LESSER hypre-2.18.2/COPYING.LESSER --- hypre-2.16.0/COPYING.LESSER 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/COPYING.LESSER 1970-01-01 00:00:00.000000000 +0000 @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff -Nru hypre-2.16.0/COPYRIGHT hypre-2.18.2/COPYRIGHT --- hypre-2.16.0/COPYRIGHT 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/COPYRIGHT 2019-10-28 22:30:04.000000000 +0000 @@ -1,35 +1,40 @@ -COPYRIGHT +Intellectual Property Notice +---------------------------- -The following copyright applies to each file in the HYPRE distribution, unless -otherwise stated in the file: +HYPRE is licensed under the Apache License, Version 2.0 (see LICENSE-APACHE or +http://www.apache.org/licenses/LICENSE-2.0) or the MIT license (see LICENSE-MIT +or http://opensource.org/licenses/MIT), at your option. -Copyright (c) 2008, Lawrence Livermore National Security, LLC. -Produced at the Lawrence Livermore National Laboratory under -Contract No. DE-AC52-07NA27344 with the DOE. +Copyrights and patents in the HYPRE project are retained by contributors. +No copyright assignment is required to contribute to HYPRE. -This file is part of HYPRE. +HYPRE's original open source license was LGPL-2.1. Consent from contributors +was received and documented before relicensing to Apache-2.0/MIT. -LICENSE +SPDX usage +---------- -HYPRE is free software; you can redistribute it and/or modify it under the -terms of the GNU Lesser General Public License (as published by the Free -Software Foundation) version 2.1 dated February 1999. +Individual files contain SPDX tags instead of the full license text. +This enables machine processing of license information based on the SPDX +License Identifiers that are available here: https://spdx.org/licenses/ -HYPRE is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the IMPLIED WARRANTY OF MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the terms and conditions of the GNU Lesser -General Public License for more details. +Files that are dual-licensed as Apache-2.0 OR MIT contain the following +text in the license header: -You should have received a copy of the GNU Lesser General Public License along -with this library (file COPYING.LESSER); if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + SPDX-License-Identifier: (Apache-2.0 OR MIT) -CONTACT INFORMATION +External Software +----------------- -The HYPRE team can be contacted at hypre-support@llnl.gov. The software is -released under UCRL_CODE_222953. Please see http://www.llnl.gov/CASC/hypre for -more information and source code availability. +External software in hypre is covered by various permissive licenses. A summary +listing follows. See the license included with the software for full details. + +Directory: src/blas +License: University of Tennessee + +Directory: src/lapack +License: University of Tennessee diff -Nru hypre-2.16.0/debian/changelog hypre-2.18.2/debian/changelog --- hypre-2.16.0/debian/changelog 2019-07-26 16:15:05.000000000 +0000 +++ hypre-2.18.2/debian/changelog 2019-11-04 17:27:52.000000000 +0000 @@ -1,3 +1,42 @@ +hypre (2.18.2-1) unstable; urgency=medium + + * Team upload. + * New upstream release. + + -- Drew Parsons Tue, 05 Nov 2019 02:27:52 +0900 + +hypre (2.18.1-1) experimental; urgency=medium + + * Team upload. + * New upstream release. + * Standards-Version: 4.4.1 + * Provide library binary package as libhypre without the soname + version embedded in the package name. Enforce version dependency + through strict shlibs dependency. This is to workaround lack of + ABI backwards compatibility and keep minor version updates being + delayed in the NEW queue. See README.Debian. + + -- Drew Parsons Sat, 26 Oct 2019 12:36:52 +0800 + +hypre (2.18.0-1exp1) experimental; urgency=medium + + * Team upload. + * New upstream release. + + -- Drew Parsons Mon, 30 Sep 2019 10:51:22 +0800 + +hypre (2.17.0-1exp1) experimental; urgency=medium + + * Team upload. + * New upstream release. + - removed FEI_mv/ml subdirectory and several FEI header files + - now dual licensed as Apache-2.0 OR MIT, at your option, + instead of LGPL-2.1. + - applies debian patch bootstrap-path.patch + * use pkg-config to configure location of blas and lapack libraries + + -- Drew Parsons Sat, 24 Aug 2019 10:24:00 +0800 + hypre (2.16.0-4) unstable; urgency=medium * Team upload. diff -Nru hypre-2.16.0/debian/control hypre-2.18.2/debian/control --- hypre-2.16.0/debian/control 2019-07-26 16:15:05.000000000 +0000 +++ hypre-2.18.2/debian/control 2019-11-04 17:27:52.000000000 +0000 @@ -3,7 +3,7 @@ Priority: optional Maintainer: Debian Science Maintainers Uploaders: "Adam C. Powell, IV" -Standards-Version: 4.4.0 +Standards-Version: 4.4.1 Build-Depends: autoconf, automake, @@ -25,7 +25,7 @@ Architecture: any Section: libdevel Depends: - libhypre-2.16.0 (= ${binary:Version}), + libhypre (= ${binary:Version}), libopenblas-dev | libatlas-base-dev | libblas-dev | libblas.so, libopenblas-dev | libatlas-base-dev | liblapack-dev | liblapack.so, libsuperlu-dev, @@ -43,7 +43,7 @@ - libHYPRE_core.so - libHYPRE_FEI.so -Package: libhypre-2.16.0 +Package: libhypre Architecture: any Multi-Arch: same Section: libs diff -Nru hypre-2.16.0/debian/copyright hypre-2.18.2/debian/copyright --- hypre-2.16.0/debian/copyright 2019-07-26 16:15:05.000000000 +0000 +++ hypre-2.18.2/debian/copyright 2019-11-04 17:27:52.000000000 +0000 @@ -1,46 +1,108 @@ -This package was debianized by Adam C. Powell, IV on -August 27, 2003. - -It was downloaded from -http://computation.llnl.gov/projects/hypre-scalable-linear-solvers-multigrid-methods/software - -The copyright notice itself is given in the upstream source COPYRIGHT -file, which is reproduced below. The GNU Lesser General Public License version -2.1 mentioned therein is in the upstream source COPYING.LESSER file, and is -also in /usr/share/common-licenses/LGPL-2.1 on Debian systems. - ------------------------------------------------------------------------------- - -COPYRIGHT - -The following copyright applies to each file in the HYPRE distribution, unless -otherwise stated in the file: - -Copyright (c) 2008, Lawrence Livermore National Security, LLC. -Produced at the Lawrence Livermore National Laboratory under -Contract No. DE-AC52-07NA27344 with the DOE. - -This file is part of HYPRE. - - -LICENSE - -HYPRE is free software; you can redistribute it and/or modify it under the -terms of the GNU Lesser General Public License (as published by the Free -Software Foundation) version 2.1 dated February 1999. - -HYPRE is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the IMPLIED WARRANTY OF MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the terms and conditions of the GNU Lesser -General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along -with this library (file COPYING.LESSER); if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - -CONTACT INFORMATION - -The HYPRE team can be contacted at hypre-support@llnl.gov. The software is -released under UCRL_CODE_222953. Please see http://www.llnl.gov/CASC/hypre for -more information and source code availability. +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: HYPRE +Source: http://www.llnl.gov/casc/hypre/ + +Files: * +Copyright: 1998-2019 Lawrence Livermore National Security, LLC + and other HYPRE Project Developers +License: Apache-2.0-OR-MIT + HYPRE is licensed under the Apache License, Version 2.0 (see + LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) or the + MIT license (see LICENSE-MIT or http://opensource.org/licenses/MIT), + at your option. + . + The Apache 2.0 license is available to read at + /usr/share/common-licenses/Apache-2.0. The MIT licence is given + below. + . + Copyrights and patents in the HYPRE project are retained by + contributors. No copyright assignment is required to contribute to + HYPRE. + . + HYPRE's original open source license was LGPL-2.1. Consent from + contributors was received and documented before relicensing to + Apache-2.0/MIT. +Comment: + Dual Apache/MIT licensing began from v2.17.0. + . + This work was produced under the auspices of the U.S. Department of + Energy by Lawrence Livermore National Laboratory under Contract + DE-AC52-07NA27344. + . + This work was prepared as an account of work sponsored by an agency + of the United States Government. Neither the United States Government + nor Lawrence Livermore National Security, LLC, nor any of their + employees makes any warranty, expressed or implied, or assumes any + legal liability or responsibility for the accuracy, completeness, or + usefulness of any information, apparatus, product, or process + disclosed, or represents that its use would not infringe privately + owned rights. + . + Reference herein to any specific commercial product, process, or + service by trade name, trademark, manufacturer, or otherwise does not + necessarily constitute or imply its endorsement, recommendation, or + favoring by the United States Government or Lawrence Livermore + National Security, LLC. + . + The views and opinions of authors expressed herein do not necessarily + state or reflect those of the United States Government or Lawrence + Livermore National Security, LLC, and shall not be used for + advertising or product endorsement purposes. + +Files: src/blas/* src/lapack/* +Copyright: 1992-2008 The University of Tennessee. All rights reserved. +License: BSD-3-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + . + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer listed + in this license in the documentation and/or other materials + provided with the distribution. + . + - Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Files: debian/* +Copyright: 2003 Adam C. Powell, IV + 2016-2019 Drew Parsons +License: LGPL-2.1 + License text is found at /usr/share/common-licenses/LGPL-2.1 + +License: MIT + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + . + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. diff -Nru hypre-2.16.0/debian/libhypre.lintian-overrides hypre-2.18.2/debian/libhypre.lintian-overrides --- hypre-2.16.0/debian/libhypre.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/debian/libhypre.lintian-overrides 2019-11-04 17:27:52.000000000 +0000 @@ -0,0 +1 @@ +libhypre: package-name-doesnt-match-sonames libHYPRE-* libHYPRE-FEI-* libHYPRE-core-* diff -Nru hypre-2.16.0/debian/libhypre.shlibs.in hypre-2.18.2/debian/libhypre.shlibs.in --- hypre-2.16.0/debian/libhypre.shlibs.in 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/debian/libhypre.shlibs.in 2019-11-04 17:27:52.000000000 +0000 @@ -0,0 +1,3 @@ +libHYPRE __HYPRE_VERSION__ libhypre (>= __HYPRE_VERSION__), libhypre (<< __HYPRE_VERSION_NEXT__) +libHYPRE_FEI __HYPRE_VERSION__ libhypre (>= __HYPRE_VERSION__), libhypre (<< __HYPRE_VERSION_NEXT__) +libHYPRE_core __HYPRE_VERSION__ libhypre (>= __HYPRE_VERSION__), libhypre (<< __HYPRE_VERSION_NEXT__) diff -Nru hypre-2.16.0/debian/patches/blas.patch hypre-2.18.2/debian/patches/blas.patch --- hypre-2.16.0/debian/patches/blas.patch 2019-07-26 16:15:05.000000000 +0000 +++ hypre-2.18.2/debian/patches/blas.patch 2019-11-04 17:27:52.000000000 +0000 @@ -1,8 +1,6 @@ -Index: hypre/src/config/hypre_blas_macros.m4 -=================================================================== ---- hypre.orig/src/config/hypre_blas_macros.m4 -+++ hypre/src/config/hypre_blas_macros.m4 -@@ -77,8 +77,8 @@ AC_DEFUN([AC_HYPRE_FIND_BLAS], +--- a/src/config/hypre_blas_macros.m4 ++++ b/src/config/hypre_blas_macros.m4 +@@ -67,8 +67,8 @@ #*************************************************************** # Set search paths for BLAS library #*************************************************************** @@ -13,7 +11,7 @@ #*************************************************************** # Check for function dgemm in BLAS_LIB_NAMES -@@ -123,10 +123,14 @@ AC_DEFUN([AC_HYPRE_FIND_BLAS], +@@ -113,10 +113,14 @@ #*************************************************************** if test "$BLASLIBS" != "null" -a "$BLASLIBS" != "internal"; then BLASLIBS="-l$BLASLIBS" diff -Nru hypre-2.16.0/debian/patches/bootstrap-path.patch hypre-2.18.2/debian/patches/bootstrap-path.patch --- hypre-2.16.0/debian/patches/bootstrap-path.patch 2019-07-26 16:15:05.000000000 +0000 +++ hypre-2.18.2/debian/patches/bootstrap-path.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ ---- a/src/config/bootstrap -+++ b/src/config/bootstrap -@@ -43,4 +43,4 @@ - mv CMakeLists.txt.tmp CMakeLists.txt - - # Update release information in documentation --(cd docs; update-release.sh) -+(cd docs; ./update-release.sh) diff -Nru hypre-2.16.0/debian/patches/complex.patch hypre-2.18.2/debian/patches/complex.patch --- hypre-2.16.0/debian/patches/complex.patch 2019-07-26 16:15:05.000000000 +0000 +++ hypre-2.18.2/debian/patches/complex.patch 2019-11-04 17:27:52.000000000 +0000 @@ -25,7 +25,7 @@ --- a/src/config/configure.in +++ b/src/config/configure.in -@@ -1780,6 +1780,12 @@ +@@ -1852,6 +1852,12 @@ HYPRE_LIBINSTALL="${libdir}" HYPRE_INCINSTALL="${includedir}/hypre" diff -Nru hypre-2.16.0/debian/patches/configure.patch hypre-2.18.2/debian/patches/configure.patch --- hypre-2.16.0/debian/patches/configure.patch 2019-07-26 16:15:05.000000000 +0000 +++ hypre-2.18.2/debian/patches/configure.patch 2019-11-04 17:27:52.000000000 +0000 @@ -1,6 +1,6 @@ --- a/src/config/configure.in +++ b/src/config/configure.in -@@ -83,7 +83,7 @@ +@@ -71,7 +71,7 @@ dnl * Change default prefix from /usr/local to ./hypre dnl * Note that $ expansion of shell variables doesn't work with this AC macro. @@ -9,7 +9,7 @@ dnl ********************************************************************* dnl * Initialize some variables -@@ -174,19 +174,18 @@ +@@ -166,19 +166,18 @@ dnl ********************************************************************* dnl * Determine BUILD, HOST, and TARGET types dnl ********************************************************************* @@ -34,7 +34,7 @@ fi dnl ********************************************************************* -@@ -1779,7 +1778,7 @@ +@@ -1851,7 +1850,7 @@ dnl ********************************************************************* HYPRE_INSTALLDIR="${prefix}" HYPRE_LIBINSTALL="${libdir}" diff -Nru hypre-2.16.0/debian/patches/lapack.patch hypre-2.18.2/debian/patches/lapack.patch --- hypre-2.16.0/debian/patches/lapack.patch 2019-07-26 16:15:05.000000000 +0000 +++ hypre-2.18.2/debian/patches/lapack.patch 2019-11-04 17:27:52.000000000 +0000 @@ -1,8 +1,6 @@ -Index: hypre/src/FEI_mv/femli/Makefile -=================================================================== ---- hypre.orig/src/FEI_mv/femli/Makefile -+++ hypre/src/FEI_mv/femli/Makefile -@@ -37,6 +37,7 @@ MLI_INCLUDES = \ +--- a/src/FEI_mv/femli/Makefile ++++ b/src/FEI_mv/femli/Makefile +@@ -29,6 +29,7 @@ C_COMPILE_FLAGS =\ -DMLI_SUPERLU\ diff -Nru hypre-2.16.0/debian/patches/pilut_blas_mangle.patch hypre-2.18.2/debian/patches/pilut_blas_mangle.patch --- hypre-2.16.0/debian/patches/pilut_blas_mangle.patch 2019-07-26 16:15:05.000000000 +0000 +++ hypre-2.18.2/debian/patches/pilut_blas_mangle.patch 2019-11-04 17:27:52.000000000 +0000 @@ -1,10 +1,8 @@ -Index: hypre/src/distributed_ls/pilut/macros.h -=================================================================== ---- hypre.orig/src/distributed_ls/pilut/macros.h -+++ hypre/src/distributed_ls/pilut/macros.h -@@ -18,6 +18,7 @@ +--- a/src/distributed_ls/pilut/macros.h ++++ b/src/distributed_ls/pilut/macros.h +@@ -10,6 +10,7 @@ - #include "../../utilities/general.h" + #include "../../utilities/hypre_general.h" #include "../../utilities/fortran.h" +#include "../../blas/_hypre_blas.h" diff -Nru hypre-2.16.0/debian/patches/series hypre-2.18.2/debian/patches/series --- hypre-2.16.0/debian/patches/series 2019-07-26 16:15:05.000000000 +0000 +++ hypre-2.18.2/debian/patches/series 2019-11-04 17:27:52.000000000 +0000 @@ -7,4 +7,3 @@ test.patch lapack.patch superlu_libs.patch -bootstrap-path.patch diff -Nru hypre-2.16.0/debian/patches/shlibs-interlink-libHYPRE.so.patch hypre-2.18.2/debian/patches/shlibs-interlink-libHYPRE.so.patch --- hypre-2.16.0/debian/patches/shlibs-interlink-libHYPRE.so.patch 2019-07-26 16:15:05.000000000 +0000 +++ hypre-2.18.2/debian/patches/shlibs-interlink-libHYPRE.so.patch 2019-11-04 17:27:52.000000000 +0000 @@ -10,7 +10,7 @@ --- a/src/lib/Makefile +++ b/src/lib/Makefile -@@ -34,9 +34,7 @@ +@@ -27,9 +27,7 @@ BLASFILES = ${HYPRE_SRC_TOP_DIR}/blas/*.o LAPACKFILES = ${HYPRE_SRC_TOP_DIR}/lapack/*.o @@ -21,7 +21,7 @@ $(IJMVFILES)\ $(EUCLIDFILES)\ $(PARASAILSFILES)\ -@@ -57,8 +55,23 @@ +@@ -50,8 +48,21 @@ $(BLASFILES)\ $(LAPACKFILES) @@ -39,14 +39,12 @@ +LIBS_HYPRE = libHYPRE_core.so libHYPRE_FEI.so + SONAME = libHYPRE-${HYPRE_RELEASE_VERSION}${HYPRE_LIB_SUFFIX} --SOLIBS = ${MPILIBDIRS} ${MPILIBS} ${LAPACKLIBDIRS} ${LAPACKLIBS}\ -+SOLIBS = ${MPILIBDIRS} ${MPILIBS}\ -+ ${DSUPERLU_LIBS}\ -+ ${LAPACKLIBDIRS} ${LAPACKLIBS}\ +-SOLIBS = ${DSUPERLU_LIBS} ${MPILIBDIRS} ${MPILIBS} ${LAPACKLIBDIRS} ${LAPACKLIBS}\ ++SOLIBS = ${DSUPERLU_LIBS} ${MPILIBDIRS} ${MPILIBS} ${DSUPERLU_LIBS} ${LAPACKLIBDIRS} ${LAPACKLIBS}\ ${BLASLIBDIRS} ${BLASLIBS} ${LIBS} ${FLIBS} -@@ -69,7 +82,7 @@ +@@ -62,7 +73,7 @@ all: libHYPRE${HYPRE_LIB_SUFFIX} cp -fR libHYPRE* ${HYPRE_BUILD_DIR}/lib @@ -55,7 +53,7 @@ cp -fR libHYPRE* ${HYPRE_LIB_INSTALL} clean: -@@ -82,6 +95,16 @@ +@@ -75,6 +86,16 @@ # Rules ################################################################## @@ -72,7 +70,7 @@ libHYPRE.a: ${FILES_HYPRE} @echo "Building libHYPRE ... " rm -f $@ -@@ -104,7 +127,7 @@ +@@ -97,7 +118,7 @@ ${AR} $@ $(UTILITIESFILES) $(BLASFILES) $(LAPACKFILES) ${RANLIB} $@ diff -Nru hypre-2.16.0/debian/patches/superlu_libs.patch hypre-2.18.2/debian/patches/superlu_libs.patch --- hypre-2.16.0/debian/patches/superlu_libs.patch 2019-07-26 16:15:05.000000000 +0000 +++ hypre-2.18.2/debian/patches/superlu_libs.patch 2019-11-04 17:27:52.000000000 +0000 @@ -1,8 +1,6 @@ -Index: hypre/src/parcsr_ls/Makefile -=================================================================== ---- hypre.orig/src/parcsr_ls/Makefile -+++ hypre/src/parcsr_ls/Makefile -@@ -12,6 +12,8 @@ +--- a/src/parcsr_ls/Makefile ++++ b/src/parcsr_ls/Makefile +@@ -5,6 +5,8 @@ include ../config/Makefile.config @@ -11,11 +9,9 @@ ## Euclid specific macros taken from distributed_ls/Euclid CINCLUDES = ${INCLUDES} ${MPIINCLUDE} -Index: hypre/src/FEI_mv/femli/Makefile -=================================================================== ---- hypre.orig/src/FEI_mv/femli/Makefile -+++ hypre/src/FEI_mv/femli/Makefile -@@ -13,6 +13,8 @@ +--- a/src/FEI_mv/femli/Makefile ++++ b/src/FEI_mv/femli/Makefile +@@ -5,6 +5,8 @@ include ../../config/Makefile.config diff -Nru hypre-2.16.0/debian/patches/test.patch hypre-2.18.2/debian/patches/test.patch --- hypre-2.16.0/debian/patches/test.patch 2019-07-26 16:15:05.000000000 +0000 +++ hypre-2.18.2/debian/patches/test.patch 2019-11-04 17:27:52.000000000 +0000 @@ -1,14 +1,12 @@ -Index: hypre/src/test/runtest.sh -=================================================================== ---- hypre.orig/src/test/runtest.sh -+++ hypre/src/test/runtest.sh +--- a/src/test/runtest.sh ++++ b/src/test/runtest.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash - - # global variables - BatchMode=0 -@@ -76,8 +76,8 @@ function MpirunString + # Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + # HYPRE Project Developers. See the top-level COPYRIGHT file for details. + # +@@ -81,8 +81,8 @@ up*) CPUS_PER_NODE=8 POE_NUM_PROCS=$2 @@ -19,7 +17,7 @@ shift shift MY_ARGS="$*" -@@ -114,7 +114,7 @@ function MpirunString +@@ -119,7 +119,7 @@ # determine the "number of nodes" desired by dividing the "number of processes" # by the "number of CPU's per node" which can't be determined dynamically (real # ugly hack) @@ -28,7 +26,7 @@ { NUM_PROCS=1 NUM_NODES=1 -@@ -146,8 +146,8 @@ function CalcNodes +@@ -151,8 +151,8 @@ do case $1 in -n*) NUM_PROCS=$2 @@ -39,7 +37,7 @@ return $NUM_NODES ;; *) shift -@@ -158,7 +158,7 @@ function CalcNodes +@@ -163,7 +163,7 @@ } # extract the "number of processes/task" @@ -48,7 +46,7 @@ { while [ "$1" ] do -@@ -174,7 +174,7 @@ function CalcProcs +@@ -179,7 +179,7 @@ # check the path to the executable if the executable exists; save the name to # ExecFileNames @@ -57,7 +55,7 @@ { while [ "$1" ] do -@@ -203,7 +203,7 @@ function CheckPath +@@ -208,7 +208,7 @@ # # on ubgl, as of 8/2006, only allowable number of nodes are 32, 128 and # multiples of 512 @@ -66,7 +64,7 @@ { CalcNodes "$@" NumNodes=$? -@@ -236,7 +236,7 @@ function PsubCmdStub +@@ -241,7 +241,7 @@ } # read job file line by line saving arguments @@ -75,7 +73,7 @@ { StartDir=$1 WorkingDir=$2 -@@ -245,7 +245,7 @@ function ExecuteJobs +@@ -250,7 +250,7 @@ BatchFlag=0 # #BATCH option detected flag BatchCount=0 # different numbering for #Batch option PrevPid=0 @@ -84,7 +82,7 @@ ## ## move to specified directory cd $WorkingDir -@@ -260,12 +260,12 @@ function ExecuteJobs +@@ -265,12 +265,12 @@ "#END"*) BatchFlag=0 chmod +x $BatchFile @@ -101,7 +99,7 @@ do sleep $JobCheckInterval done -@@ -293,35 +293,35 @@ EOF +@@ -298,35 +298,35 @@ fi MpirunString $RunCmd # construct "RunString" case $HOST in @@ -147,7 +145,7 @@ do sleep $JobCheckInterval done -@@ -330,7 +330,7 @@ EOF +@@ -335,7 +335,7 @@ BatchFile=$InputFile.batch.$BatchCount BatchCount=BatchCount+1 cat > $BatchFile <<- EOF @@ -156,7 +154,7 @@ ${RunString} EOF else -@@ -344,7 +344,7 @@ EOF +@@ -349,7 +349,7 @@ ;; *) @@ -165,7 +163,7 @@ if [ "$NOTBLANK" ] ; then echo "Found something unexpected in $WorkingDir/$InputFile.jobs" echo "--> $InputLine" -@@ -373,12 +373,12 @@ function ExecuteTest +@@ -378,12 +378,12 @@ } # report errors from PURIFY and/or INSURE if run @@ -180,7 +178,7 @@ cd $WorkingDir if [ "$BatchMode" -eq 0 ] ; then if [ -f purify.log ] ; then -@@ -418,8 +418,8 @@ function CleanUp +@@ -423,8 +423,8 @@ fi } @@ -191,7 +189,7 @@ { rm -f ~/insure.log* -@@ -479,15 +479,15 @@ do +@@ -484,15 +484,15 @@ ;; -D) shift @@ -211,7 +209,7 @@ TestDirNames="$TestDirNames $DirPart" case $DirPart in TEST_examples) -@@ -550,7 +550,7 @@ do +@@ -555,7 +555,7 @@ for errfile in $( find $dir -name "*.err" ) do if (egrep -f runtest.filters $errfile > /dev/null) ; then @@ -220,31 +218,25 @@ echo "This file contains the original copy of $errfile before filtering" > $original cat $errfile >> $original mv $errfile $errfile.tmp -Index: hypre/src/test/checktest.sh -=================================================================== ---- hypre.orig/src/test/checktest.sh -+++ hypre/src/test/checktest.sh +--- a/src/test/checktest.sh ++++ b/src/test/checktest.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash - #BHEADER********************************************************************** - # Copyright (c) 2008, Lawrence Livermore National Security, LLC. - # Produced at the Lawrence Livermore National Laboratory. -Index: hypre/src/test/cleantest.sh -=================================================================== ---- hypre.orig/src/test/cleantest.sh -+++ hypre/src/test/cleantest.sh + # Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + # HYPRE Project Developers. See the top-level COPYRIGHT file for details. + # +--- a/src/test/cleantest.sh ++++ b/src/test/cleantest.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash - #BHEADER********************************************************************** - # Copyright (c) 2008, Lawrence Livermore National Security, LLC. - # Produced at the Lawrence Livermore National Laboratory. -Index: hypre/src/test/Makefile -=================================================================== ---- hypre.orig/src/test/Makefile -+++ hypre/src/test/Makefile -@@ -56,7 +56,7 @@ else + # Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + # HYPRE Project Developers. See the top-level COPYRIGHT file for details. + # +--- a/src/test/Makefile ++++ b/src/test/Makefile +@@ -49,7 +49,7 @@ endif LFLAGS =\ diff -Nru hypre-2.16.0/debian/README.Debian hypre-2.18.2/debian/README.Debian --- hypre-2.16.0/debian/README.Debian 2019-07-26 16:15:05.000000000 +0000 +++ hypre-2.18.2/debian/README.Debian 2019-11-04 17:27:52.000000000 +0000 @@ -19,3 +19,30 @@ libHYPRE.so is provided as a "dummy" library which is dynamically linked to libHYPRE_core.so and libHYPRE_FEI.so. + + +Library version, soname and package name +======================================== + +HYPRE does not provide ABI backwards compatibility. The ABI might +change, even between patch version updates (Z in X.Y.Z). + +This makes it inconvenient to follow the usual Debian practice of +creating a library binary package libhypre-X.Y containing the +library for a given ABI soname. The package would have to pass through +the NEW queue as a new package each time, even for a minor patch update. + +For this reason, starting with 2.18.1, the library binary package is +provided as libhypre without the soname version embedded in the name. +Version dependency is enforced via a strict shlibs patch version +dependency in the shlibs file, + libHYPRE_core __HYPRE_VERSION__ libhypre (>= __HYPRE_VERSION__), libhypre (<< __HYPRE_VERSION_NEXT__) + +This practice of strict shlibs dependency is not normally done since +it impedes transition of packages into testing: all dependent packages +need to be rebuilt against the new library version and transition at +the same time. For hypre this is expected to be less of an +inconvenience than the inconvenience of traversing the NEW queue with +each version update. There are only 2* dependent packages: + petsc (*and slepc) + sundials diff -Nru hypre-2.16.0/debian/rules hypre-2.18.2/debian/rules --- hypre-2.16.0/debian/rules 2019-07-26 16:15:05.000000000 +0000 +++ hypre-2.18.2/debian/rules 2019-11-04 17:27:52.000000000 +0000 @@ -6,7 +6,12 @@ DEB_NOEPOCH_VERSION := $(shell echo $(DEB_VERSION) | cut -d: -f2-) DEB_UPSTREAM_VERSION := $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//') -export HYPRE_SOVERSION=$(DEB_UPSTREAM_VERSION) +HYPRE_UPSTREAM_VERSION=$(DEB_UPSTREAM_VERSION) +HYPRE_X_Y_VERSION=$(shell echo $(HYPRE_UPSTREAM_VERSION) | sed "s/^\(.*\)\.\([^.]*\)$$/\1/") +HYPRE_Z_VERSION=$(shell echo $(HYPRE_UPSTREAM_VERSION) | sed "s/^\(.*\)\.\([^.]*\)$$/\2/") +HYPRE_NEXT_VERSION=$(HYPRE_X_Y_VERSION).$(shell echo $$(( $(HYPRE_Z_VERSION) + 1 )) ) + +export HYPRE_SOVERSION=$(HYPRE_UPSTREAM_VERSION) export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic -O3 export DEB_CXXFLAGS_MAINT_APPEND = -Wall -pedantic -O3 @@ -28,13 +33,15 @@ --with-fei --with-mli \ --with-superlu --with-superlu-include=/usr/include/superlu --with-superlu-lib="-lsuperlu" \ --with-dsuperlu --with-dsuperlu-include=/usr/include/superlu-dist --with-dsuperlu-lib="-lsuperlu_dist" \ - --with-blas --with-blas-lib="-lblas" \ - --with-lapack-libs="lapack" --with-lapack-lib-dirs="/usr/lib/lapack" --with-fmangle-lapack="one-underscore" \ + --with-blas=yes --with-blas-lib="$(shell pkg-config --libs blas)" \ + --with-lapack=yes \ + --with-lapack-lib="$(shell pkg-config --libs lapack)" \ + --with-fmangle-lapack="one-underscore" \ --with-MPI-include=$(shell pkg-config --cflags-only-I mpi | awk '{print $$1}' | sed "s/^-I//") \ --with-MPI-libs="$(shell pkg-config --libs-only-l mpi | sed 's/-l//g')" \ --with-MPI-lib-dirs="$(shell pkg-config --libs-only-L mpi | sed 's/-L//g')" \ --with-MPI-flags="$(shell pkg-config --libs-only-other mpi)" \ - --with-extra-flags="($shell pkg-config --cflags-only-other mpi)" \ + --with-extra-flags="$(shell pkg-config --cflags-only-other mpi)" \ --prefix=$(CURDIR)/debian/tmp/usr # To get petsc support when indexTypes.integerSize == 64 @@ -70,6 +77,10 @@ export OMPI_MCA_orte_rsh_agent=/bin/false +override_dh_clean: + dh_clean + rm -f debian/libhypre.shlibs + override_dh_auto_clean: echo "Running clean" rm -rf $(CURDIR)/debian/tmp @@ -147,10 +158,13 @@ # the versioned so files in a libhypre-dev.install file # Easier to just override instead override_dh_install: - dh_install -p libhypre-$(HYPRE_SOVERSION) usr/lib/*/*${HYPRE_SOVERSION}.so + dh_install -p libhypre usr/lib/*/*${HYPRE_SOVERSION}.so dh_install -p libhypre-dev --exclude=${HYPRE_SOVERSION} usr/lib/*/* dh_install -p libhypre-dev usr/include/hypre +override_dh_makeshlibs: + sed "s/__HYPRE_VERSION__/$(HYPRE_SOVERSION)/g; s/__HYPRE_VERSION_NEXT__/$(HYPRE_NEXT_VERSION)/g" debian/libhypre.shlibs.in > debian/libhypre.shlibs + dh_makeshlibs # run examples (add -W, -no-as-needed on Unbuntu for ex5f) # echo "Building examples" diff -Nru hypre-2.16.0/INSTALL.md hypre-2.18.2/INSTALL.md --- hypre-2.16.0/INSTALL.md 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/INSTALL.md 2019-10-28 22:30:04.000000000 +0000 @@ -1,13 +1,9 @@ - + HYPRE Installation Information for Unix-based systems ===================================================== @@ -86,3 +82,12 @@ type `c` then `q`. - Windows VS: Change options, then click on 'Configure' then 'Generate'. + + +ABI Compatibility +================= + +The hypre team currently does nothing to ensure application binary interface +(ABI) compatibility. As a result, all releases (major, minor, or patch) should +be treated as incompatible. + diff -Nru hypre-2.16.0/LICENSE-APACHE hypre-2.18.2/LICENSE-APACHE --- hypre-2.16.0/LICENSE-APACHE 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/LICENSE-APACHE 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff -Nru hypre-2.16.0/LICENSE-MIT hypre-2.18.2/LICENSE-MIT --- hypre-2.16.0/LICENSE-MIT 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/LICENSE-MIT 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,20 @@ +Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +HYPRE Project Developers. See the top-level COPYRIGHT file for details. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff -Nru hypre-2.16.0/NOTICE hypre-2.18.2/NOTICE --- hypre-2.16.0/NOTICE 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/NOTICE 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,20 @@ +This work was produced under the auspices of the U.S. Department of Energy by +Lawrence Livermore National Laboratory under Contract DE-AC52-07NA27344. + +This work was prepared as an account of work sponsored by an agency of +the United States Government. Neither the United States Government nor +Lawrence Livermore National Security, LLC, nor any of their employees +makes any warranty, expressed or implied, or assumes any legal liability +or responsibility for the accuracy, completeness, or usefulness of any +information, apparatus, product, or process disclosed, or represents that +its use would not infringe privately owned rights. + +Reference herein to any specific commercial product, process, or service +by trade name, trademark, manufacturer, or otherwise does not necessarily +constitute or imply its endorsement, recommendation, or favoring by the +United States Government or Lawrence Livermore National Security, LLC. + +The views and opinions of authors expressed herein do not necessarily +state or reflect those of the United States Government or Lawrence +Livermore National Security, LLC, and shall not be used for advertising +or product endorsement purposes. diff -Nru hypre-2.16.0/README.md hypre-2.18.2/README.md --- hypre-2.16.0/README.md 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/README.md 2019-10-28 22:30:04.000000000 +0000 @@ -1,34 +1,39 @@ - -![](src/docs/hypre-wwords.png) + +![](src/docs/hypre-wwords.png) -HYPRE - http://www.llnl.gov/casc/hypre/ -HYPRE is a library of high performance preconditioners and solvers featuring -multigrid methods for the solution of large, sparse linear systems of equations -on massively parallel computers. +[HYPRE](http://www.llnl.gov/casc/hypre/) is a library of high performance +preconditioners and solvers featuring multigrid methods for the solution of +large, sparse linear systems of equations on massively parallel computers. -Documentation can be found at https://hypre.readthedocs.io/en/latest/. +Documentation can be found [here](https://hypre.readthedocs.io/en/latest/). To install HYPRE, please see either the documentation or the file [INSTALL.md](./INSTALL.md). An overview of the HYPRE release history can be found in the file [CHANGELOG](./CHANGELOG). -We appreciate feedback from users of this package. Please submit comments, -suggestions, and issue reports to hypre-support@llnl.gov. +We appreciate feedback from users. Please submit comments, suggestions, and +issue reports to hypre-support@llnl.gov. + + +License +---------------- + +HYPRE is distributed under the terms of both the MIT license and the Apache +License (Version 2.0). Users may choose either license, at their option. + +All new contributions must be made under both the MIT and Apache-2.0 licenses. + +See [LICENSE-MIT](./LICENSE-MIT), [LICENSE-APACHE](./LICENSE-APACHE), +[COPYRIGHT](./COPYRIGHT), and [NOTICE](./NOTICE) for details. -Legal stuff (copyright, disclaimer, licensing restrictions, etc.) can be found -in the file [COPYRIGHT](./COPYRIGHT). +SPDX-License-Identifier: (Apache-2.0 OR MIT) -HYPRE is free software; you can redistribute it and/or modify it under the -terms of the GNU Lesser General Public License (as published by the Free -Software Foundation) version 2.1 dated February 1999. +LLNL-CODE-778117 diff -Nru hypre-2.16.0/src/blas/CMakeLists.txt hypre-2.18.2/src/blas/CMakeLists.txt --- hypre-2.16.0/src/blas/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/blas/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,37 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(SRCS + dasum.c + daxpy.c + dcopy.c + ddot.c + dgemm.c + dgemv.c + dger.c + dnrm2.c + drot.c + dscal.c + dswap.c + dsymm.c + dsymv.c + dsyr2.c + dsyr2k.c + dsyrk.c + dtrmm.c + dtrmv.c + dtrsm.c + dtrsv.c + f2c.c + idamax.c + lsame.c + xerbla.c +) + +convert_filenames_to_full_paths(SRCS) + +set(HYPRE_SOURCES ${HYPRE_SOURCES} ${SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/blas/COPYING hypre-2.18.2/src/blas/COPYING --- hypre-2.16.0/src/blas/COPYING 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/blas/COPYING 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,36 @@ +Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + +$COPYRIGHT$ + +Additional copyrights may follow + +$HEADER$ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +- Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer listed + in this license in the documentation and/or other materials + provided with the distribution. + +- Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff -Nru hypre-2.16.0/src/blas/dasum.c hypre-2.18.2/src/blas/dasum.c --- hypre-2.16.0/src/blas/dasum.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/dasum.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/daxpy.c hypre-2.18.2/src/blas/daxpy.c --- hypre-2.16.0/src/blas/daxpy.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/daxpy.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/dcopy.c hypre-2.18.2/src/blas/dcopy.c --- hypre-2.16.0/src/blas/dcopy.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/dcopy.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/ddot.c hypre-2.18.2/src/blas/ddot.c --- hypre-2.16.0/src/blas/ddot.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/ddot.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/dgemm.c hypre-2.18.2/src/blas/dgemm.c --- hypre-2.16.0/src/blas/dgemm.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/dgemm.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/dgemv.c hypre-2.18.2/src/blas/dgemv.c --- hypre-2.16.0/src/blas/dgemv.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/dgemv.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/dger.c hypre-2.18.2/src/blas/dger.c --- hypre-2.16.0/src/blas/dger.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/dger.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/dnrm2.c hypre-2.18.2/src/blas/dnrm2.c --- hypre-2.16.0/src/blas/dnrm2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/dnrm2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/drot.c hypre-2.18.2/src/blas/drot.c --- hypre-2.16.0/src/blas/drot.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/drot.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/dscal.c hypre-2.18.2/src/blas/dscal.c --- hypre-2.16.0/src/blas/dscal.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/dscal.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/dswap.c hypre-2.18.2/src/blas/dswap.c --- hypre-2.16.0/src/blas/dswap.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/dswap.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/dsymm.c hypre-2.18.2/src/blas/dsymm.c --- hypre-2.16.0/src/blas/dsymm.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/dsymm.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/dsymv.c hypre-2.18.2/src/blas/dsymv.c --- hypre-2.16.0/src/blas/dsymv.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/dsymv.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/dsyr2.c hypre-2.18.2/src/blas/dsyr2.c --- hypre-2.16.0/src/blas/dsyr2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/dsyr2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/dsyr2k.c hypre-2.18.2/src/blas/dsyr2k.c --- hypre-2.16.0/src/blas/dsyr2k.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/dsyr2k.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/dsyrk.c hypre-2.18.2/src/blas/dsyrk.c --- hypre-2.16.0/src/blas/dsyrk.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/dsyrk.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/dtrmm.c hypre-2.18.2/src/blas/dtrmm.c --- hypre-2.16.0/src/blas/dtrmm.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/dtrmm.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/dtrmv.c hypre-2.18.2/src/blas/dtrmv.c --- hypre-2.16.0/src/blas/dtrmv.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/dtrmv.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/dtrsm.c hypre-2.18.2/src/blas/dtrsm.c --- hypre-2.16.0/src/blas/dtrsm.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/dtrsm.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/dtrsv.c hypre-2.18.2/src/blas/dtrsv.c --- hypre-2.16.0/src/blas/dtrsv.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/dtrsv.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/f2c.c hypre-2.18.2/src/blas/f2c.c --- hypre-2.16.0/src/blas/f2c.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/f2c.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus #define REGISTER #else diff -Nru hypre-2.16.0/src/blas/f2c.h hypre-2.18.2/src/blas/f2c.h --- hypre-2.16.0/src/blas/f2c.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/f2c.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* f2c.h -- Standard Fortran to C header file */ diff -Nru hypre-2.16.0/src/blas/_hypre_blas.h hypre-2.18.2/src/blas/_hypre_blas.h --- hypre-2.16.0/src/blas/_hypre_blas.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/_hypre_blas.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/blas/hypre_blas.h hypre-2.18.2/src/blas/hypre_blas.h --- hypre-2.16.0/src/blas/hypre_blas.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/hypre_blas.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /***** DO NOT use this file outside of the BLAS directory *****/ diff -Nru hypre-2.16.0/src/blas/idamax.c hypre-2.18.2/src/blas/idamax.c --- hypre-2.16.0/src/blas/idamax.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/idamax.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/lsame.c hypre-2.18.2/src/blas/lsame.c --- hypre-2.16.0/src/blas/lsame.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/lsame.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/blas/Makefile hypre-2.18.2/src/blas/Makefile --- hypre-2.16.0/src/blas/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) ### Internal BLAS routines may be compiled in this sub-directory ### Generally, the Makefile in the utilities subdirectory controls diff -Nru hypre-2.16.0/src/blas/README hypre-2.18.2/src/blas/README --- hypre-2.16.0/src/blas/README 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/README 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) HYPRE BLAS README file @@ -17,6 +10,8 @@ new BLAS or LAPACK routine, copy the file to the appropriate directory, then do the following: +- Add the University of Tennessee copyright statement to the top of the file + - Add C include guards at the beginning and end of the file to allow for C++ compilation - Change the 'blaswrap.h' include file to either 'hypre_blas.h' or 'hypre_lapack.h' diff -Nru hypre-2.16.0/src/blas/xerbla.c hypre-2.18.2/src/blas/xerbla.c --- hypre-2.16.0/src/blas/xerbla.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/blas/xerbla.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/CMakeLists.txt hypre-2.18.2/src/CMakeLists.txt --- hypre-2.16.0/src/CMakeLists.txt 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -1,9 +1,18 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + cmake_minimum_required (VERSION 2.8.8) +if (POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif (POLICY CMP0074) + project (hypre) # The version number. -set (HYPRE_VERSION 2.16.0) -set (HYPRE_DATE 2019/03/20) +set (HYPRE_VERSION 2.18.2) +set (HYPRE_DATE 2019/10/28) set (HYPRE_TIME 00:00:00) set (HYPRE_BUGS hypre-support@llnl.gov) set (HYPRE_SRCDIR "${PROJECT_SOURCE_DIR}") @@ -12,6 +21,10 @@ message(FATAL_ERROR "In-place build not allowed! Please use a separate build directory. See the Users Manual or INSTALL file for details.") endif () +# Set cmake module path +set(CMAKE_MODULE_PATH ${hypre_SOURCE_DIR}/config/cmake) +include(hypre_CMakeUtilities) + # Set default installation directory, but provide a means for users to change set (HYPRE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/hypre" CACHE PATH "Installation directory for HYPRE") @@ -23,49 +36,112 @@ set (CMAKE_BUILD_TYPE "${HYPRE_BUILD_TYPE}" CACHE INTERNAL "" FORCE) # Configuration options -option(HYPRE_SHARED "Build a shared library" OFF) -option(HYPRE_BIGINT "Use long long int for HYPRE_Int" OFF) -option(HYPRE_SINGLE "Use float for HYPRE_Real" OFF) -option(HYPRE_LONG_DOUBLE "Use long double for HYPRE_Real" OFF) -option(HYPRE_SEQUENTIAL "Compile without MPI" OFF) -option(HYPRE_TIMING "Use HYPRE timing routines" OFF) -option(HYPRE_USING_HYPRE_BLAS "Use internal BLAS library" ON) -option(HYPRE_USING_HYPRE_LAPACK "Use internal LAPACK library" ON) -option(HYPRE_USING_PERSISTENT_COMM "Use persistent communication" OFF) -option(HYPRE_NO_GLOBAL_PARTITION "Use assumed partition" ON) -option(HYPRE_PRINT_ERRORS "Print HYPRE errors" OFF) -option(HYPRE_USING_OPENMP "Use OpenMP" OFF) -option(HYPRE_HOPSCOTCH "Use hopscotch hashing with OpenMP" OFF) -option(HAVE_DSUPERLU "required if using SuperLU_dist" OFF) -option(HYPRE_USING_FEI "Use FEI" ON) -option(HYPRE_USING_CALIPER "Use Caliper" OFF) # TODO: Finish this cmake feature +option(HYPRE_ENABLE_SHARED "Build a shared library" OFF) +option(HYPRE_ENABLE_BIGINT "Use long long int for HYPRE_Int" OFF) +option(HYPRE_ENABLE_MIXEDINT "Use long long int for HYPRE_BigInt, int for HYPRE_INT" OFF) +option(HYPRE_ENABLE_SINGLE "Use float for HYPRE_Real" OFF) +option(HYPRE_ENABLE_LONG_DOUBLE "Use long double for HYPRE_Real" OFF) +option(HYPRE_ENABLE_COMPLEX "Use complex values" OFF) +option(HYPRE_ENABLE_HYPRE_BLAS "Use internal BLAS library" ON) +option(HYPRE_ENABLE_HYPRE_LAPACK "Use internal LAPACK library" ON) +option(HYPRE_ENABLE_PERSISTENT_COMM "Use persistent communication" OFF) +option(HYPRE_ENABLE_GLOBAL_PARTITION "Use global partitioning" OFF) +option(HYPRE_ENABLE_FEI "Use FEI" OFF) # TODO: Add this cmake feature +option(HYPRE_WITH_MPI "Compile with MPI" ON) +option(HYPRE_WITH_OPENMP "Use OpenMP" OFF) +option(HYPRE_WITH_HOPSCOTCH "Use hopscotch hashing with OpenMP" OFF) +option(HYPRE_WITH_DSUPERLU "Use TPL SuperLU_Dist" OFF) +option(HYPRE_WITH_CALIPER "Use Caliper" OFF) # TODO: Finish this cmake feature +option(HYPRE_PRINT_ERRORS "Print HYPRE errors" OFF) +option(HYPRE_TIMING "Use HYPRE timing routines" OFF) +option(HYPRE_BUILD_EXAMPLES "Build examples" OFF) +option(HYPRE_BUILD_TESTS "Build tests" OFF) + +option(TPL_DSUPERLU_LIBRARIES "List of absolute paths to SuperLU_Dist link libraries [].") +option(TPL_DSUPERLU_INCLUDE_DIRS "List of absolute paths to SuperLU_Dist include directories [].") + +# Set config name values +if (HYPRE_ENABLE_SHARED) + set(HYPRE_SHARED ON CACHE BOOL "" FORCE) +endif() + +if (HYPRE_ENABLE_BIGINT) + set(HYPRE_BIGINT ON CACHE BOOL "" FORCE) +endif() + +if (HYPRE_ENABLE_MIXEDINT) + set(HYPRE_MIXEDINT ON CACHE BOOL "" FORCE) +endif() + +if (HYPRE_ENABLE_SINGLE) + set(HYPRE_SINGLE ON CACHE BOOL "" FORCE) +endif() + +if (HYPRE_ENABLE_LONG_DOUBLE) + set(HYPRE_LONG_DOUBLE ON CACHE BOOL "" FORCE) +endif() + +if (HYPRE_ENABLE_COMPLEX) + set(HYPRE_COMPLEX ON CACHE BOOL "" FORCE) +endif() + +if (HYPRE_ENABLE_HYPRE_BLAS) + set(HYPRE_USING_HYPRE_BLAS ON CACHE BOOL "" FORCE) +endif() + +if (HYPRE_ENABLE_HYPRE_LAPACK) + set(HYPRE_USING_HYPRE_LAPACK ON CACHE BOOL "" FORCE) +endif() + +if (HYPRE_ENABLE_PERSISTENT_COMM) + set(HYPRE_USING_PERSISTENT_COMM ON CACHE BOOL "" FORCE) +endif() + +if (HYPRE_ENABLE_GLOBAL_PARTITION) + set(HYPRE_NO_GLOBAL_PARTITION OFF CACHE BOOL "" FORCE) +elseif() + set(HYPRE_NO_GLOBAL_PARTITION ON CACHE BOOL "" FORCE) +endif() + +if (HYPRE_WITH_MPI) + set(HYPRE_SEQUENTIAL OFF CACHE BOOL "" FORCE) +elseif() + set(HYPRE_SEQUENTIAL ON CACHE BOOL "" FORCE) +endif() + +if (HYPRE_WITH_OPENMP) + set (HYPRE_USING_OPENMP ON CACHE BOOL "" FORCE) +endif() + +if (HYPRE_WITH_HOPSCOTCH) + set (HYPRE_HOPSCOTCH ON CACHE BOOL "" FORCE) +endif() + +if (HYPRE_WITH_DSUPERLU) + set (HYPRE_USING_DSUPERLU ON CACHE BOOL "" FORCE) + set (HYPRE_USING_HYPRE_BLAS OFF CACHE BOOL "" FORCE) + set (HYPRE_USING_HYPRE_LAPACK OFF CACHE BOOL "" FORCE) +endif() + +if (HYPRE_ENABLE_FEI) + set (HYPRE_USING_FEI ON CACHE BOOL "" FORCE) + message(WARNING "CMake support for FEI is not complete!") +endif() + +if (HYPRE_WITH_CALIPER) + set (HYPRE_USING_CALIPER ON CACHE BOOL "" FORCE) +endif() -if (HYPRE_SHARED) +if (HYPRE_SHARED OR HYPRE_BIGINT OR HYPRE_SINGLE OR HYPRE_LONG_DOUBLE) # FEI doesn't currently compile with shared set (HYPRE_USING_FEI OFF CACHE BOOL "" FORCE) endif () -if (HYPRE_BIGINT) - set (HYPRE_USING_FEI OFF CACHE BOOL "" FORCE) -endif () - -if (HYPRE_SINGLE) - set (HYPRE_USING_FEI OFF CACHE BOOL "" FORCE) -endif () - -if (HYPRE_LONG_DOUBLE) - set (HYPRE_USING_FEI OFF CACHE BOOL "" FORCE) -endif () - if (HYPRE_SEQUENTIAL) set (HYPRE_NO_GLOBAL_PARTITION OFF CACHE BOOL "" FORCE) + set (HYPRE_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) endif () -# --with-examples Build example codes. -# --with-fei Use internal FEI routines. -# --with-superlu Use internal SuperLU routines. -# --with-mli Use MLI - # Headers and sources set (HYPRE_HEADERS "") set (HYPRE_SOURCES "") @@ -77,670 +153,65 @@ HYPRE.h ) -# Headers and sources: blas -list (APPEND HYPRE_SOURCES - blas/dasum.c - blas/daxpy.c - blas/dcopy.c - blas/ddot.c - blas/dgemm.c - blas/dgemv.c - blas/dger.c - blas/dnrm2.c - blas/drot.c - blas/dscal.c - blas/dswap.c - blas/dsymm.c - blas/dsymv.c - blas/dsyr2.c - blas/dsyr2k.c - blas/dsyrk.c - blas/dtrmm.c - blas/dtrmv.c - blas/dtrsm.c - blas/dtrsv.c - blas/f2c.c - blas/idamax.c - blas/lsame.c - blas/xerbla.c -) - -# Headers and sources: lapack -list (APPEND HYPRE_SOURCES - lapack/dbdsqr.c - lapack/dgebd2.c - lapack/dgebrd.c - lapack/dgelq2.c - lapack/dgelqf.c - lapack/dgels.c - lapack/dgeqr2.c - lapack/dgeqrf.c - lapack/dgesvd.c - lapack/dgetrf.c - lapack/dgetri.c - lapack/dgetrs.c - lapack/dgetf2.c - lapack/dlabad.c - lapack/dlabrd.c - lapack/dlacpy.c - lapack/dlae2.c - lapack/dlaev2.c - lapack/dlamch.c - lapack/dlange.c - lapack/dlanst.c - lapack/dlansy.c - lapack/dlapy2.c - lapack/dlarfb.c - lapack/dlarf.c - lapack/dlarfg.c - lapack/dlarft.c - lapack/dlartg.c - lapack/dlas2.c - lapack/dlascl.c - lapack/dlaset.c - lapack/dlasq1.c - lapack/dlasq2.c - lapack/dlasq3.c - lapack/dlasq4.c - lapack/dlasq5.c - lapack/dlasq6.c - lapack/dlasr.c - lapack/dlasrt.c - lapack/dlassq.c - lapack/dlaswp.c - lapack/dlasv2.c - lapack/dlatrd.c - lapack/dorg2l.c - lapack/dorg2r.c - lapack/dorgbr.c - lapack/dorgl2.c - lapack/dorglq.c - lapack/dorgql.c - lapack/dorgqr.c - lapack/dorgtr.c - lapack/dorm2r.c - lapack/dormbr.c - lapack/dorml2.c - lapack/dormlq.c - lapack/dormqr.c - lapack/dpotf2.c - lapack/dpotrf.c - lapack/dpotrs.c - lapack/dsteqr.c - lapack/dsterf.c - lapack/dsyev.c - lapack/dsygs2.c - lapack/dsygst.c - lapack/dsygv.c - lapack/dsytd2.c - lapack/dsytrd.c - lapack/dtrti2.c - lapack/dtrtri.c - lapack/ieeeck.c - lapack/ilaenv.c - lapack/lsame.c - lapack/xerbla.c -) - -# Headers and sources: utilities -list (APPEND HYPRE_HEADERS - utilities/HYPRE_utilities.h - utilities/_hypre_utilities.h - utilities/hypre_hopscotch_hash.h - utilities/HYPRE_error_f.h - utilities/fortran.h - utilities/fortran_matrix.h -) -list (APPEND HYPRE_SOURCES - utilities/HYPRE_version.c - utilities/amg_linklist.c - utilities/binsearch.c - utilities/exchange_data.c - utilities/F90_HYPRE_error.c - utilities/fortran_matrix.c - utilities/hypre_ap.c - utilities/hypre_complex.c - utilities/hypre_error.c - utilities/hypre_general.c - utilities/hypre_hopscotch_hash.c - utilities/hypre_memory.c - utilities/hypre_merge_sort.c - utilities/hypre_mpi_comm_f2c.c - utilities/hypre_prefix_sum.c - utilities/hypre_printf.c - utilities/hypre_qsort.c - utilities/mpistubs.c - utilities/qsplit.c - utilities/random.c - utilities/threading.c - utilities/timer.c - utilities/timing.c -) - -# Headers and sources: multivector -list (APPEND HYPRE_HEADERS - multivector/csr_matmultivec.h - multivector/interpreter.h - multivector/multivector.h - multivector/par_csr_matmultivec.h - multivector/par_csr_pmvcomm.h - multivector/par_multivector.h - multivector/seq_multivector.h - multivector/temp_multivector.h -) -list (APPEND HYPRE_SOURCES - multivector/multivector.c - multivector/temp_multivector.c -) - -# Headers and sources: krylov -list (APPEND HYPRE_HEADERS - krylov/HYPRE_krylov.h - krylov/HYPRE_lobpcg.h - krylov/HYPRE_MatvecFunctions.h - krylov/krylov.h - krylov/lobpcg.h -) -list (APPEND HYPRE_SOURCES - krylov/bicgstab.c - krylov/cgnr.c - krylov/cogmres.c - krylov/gmres.c - krylov/flexgmres.c - krylov/lgmres.c - krylov/HYPRE_bicgstab.c - krylov/HYPRE_cgnr.c - krylov/HYPRE_gmres.c - krylov/HYPRE_cogmres.c - krylov/HYPRE_lgmres.c - krylov/HYPRE_flexgmres.c - krylov/HYPRE_pcg.c - krylov/pcg.c - krylov/HYPRE_lobpcg.c - krylov/lobpcg.c -) - -# Headers and sources: seq_mv -list (APPEND HYPRE_HEADERS - seq_mv/HYPRE_seq_mv.h - seq_mv/seq_mv.h -) -list (APPEND HYPRE_SOURCES - seq_mv/csr_matop.c - seq_mv/csr_matrix.c - seq_mv/csr_matvec.c - seq_mv/genpart.c - seq_mv/HYPRE_csr_matrix.c - seq_mv/HYPRE_mapped_matrix.c - seq_mv/HYPRE_multiblock_matrix.c - seq_mv/HYPRE_vector.c - seq_mv/mapped_matrix.c - seq_mv/multiblock_matrix.c - seq_mv/vector.c -) - -# Headers and sources: parcsr_mv -list (APPEND HYPRE_HEADERS - parcsr_mv/HYPRE_parcsr_mv.h - parcsr_mv/_hypre_parcsr_mv.h -) -list (APPEND HYPRE_SOURCES - parcsr_mv/communicationT.c - parcsr_mv/F90_HYPRE_parcsr_matrix.c - parcsr_mv/F90_HYPRE_parcsr_vector.c - parcsr_mv/F90_parcsr_matrix.c - parcsr_mv/F90_par_vector.c - parcsr_mv/HYPRE_parcsr_matrix.c - parcsr_mv/HYPRE_parcsr_vector.c - parcsr_mv/new_commpkg.c - parcsr_mv/numbers.c - parcsr_mv/par_csr_aat.c - parcsr_mv/par_csr_assumed_part.c - parcsr_mv/par_csr_bool_matop.c - parcsr_mv/par_csr_bool_matrix.c - parcsr_mv/par_csr_communication.c - parcsr_mv/par_csr_matop.c - parcsr_mv/par_csr_matrix.c - parcsr_mv/par_csr_matop_marked.c - parcsr_mv/par_csr_matvec.c - parcsr_mv/par_vector.c - parcsr_mv/par_make_system.c -) +# This is a list of TPLs that are used by all targets +set(TPL_LIBRARIES "") -# Headers and sources: parcsr_block_mv -list (APPEND HYPRE_HEADERS - parcsr_block_mv/par_csr_block_matrix.h - parcsr_block_mv/csr_block_matrix.h -) -list (APPEND HYPRE_SOURCES - parcsr_block_mv/csr_block_matrix.c - parcsr_block_mv/csr_block_matvec.c - parcsr_block_mv/par_csr_block_matrix.c - parcsr_block_mv/par_csr_block_matvec.c - parcsr_block_mv/par_csr_block_comm.c - parcsr_block_mv/par_csr_block_rap.c - parcsr_block_mv/par_csr_block_rap_communication.c - parcsr_block_mv/par_csr_block_interp.c - parcsr_block_mv/par_csr_block_relax.c - parcsr_block_mv/par_block_nodal_systems.c -) +# This is a list of linker flags to be used with TPLs for all targets +set(TPL_LINKER_FLAGS "") -# Headers and sources: distributed_matrix -list (APPEND HYPRE_HEADERS - distributed_matrix/distributed_matrix.h -) -list (APPEND HYPRE_SOURCES - distributed_matrix/distributed_matrix.c - distributed_matrix/HYPRE_distributed_matrix.c - distributed_matrix/distributed_matrix_ISIS.c - distributed_matrix/distributed_matrix_PETSc.c - distributed_matrix/distributed_matrix_parcsr.c -) - -# Headers and sources: IJ_mv -list (APPEND HYPRE_HEADERS - IJ_mv/HYPRE_IJ_mv.h - IJ_mv/_hypre_IJ_mv.h -) -list (APPEND HYPRE_SOURCES - IJ_mv/aux_parcsr_matrix.c - IJ_mv/aux_par_vector.c - IJ_mv/F90_HYPRE_IJMatrix.c - IJ_mv/F90_HYPRE_IJVector.c - IJ_mv/F90_IJMatrix.c - IJ_mv/HYPRE_IJMatrix.c - IJ_mv/HYPRE_IJVector.c - IJ_mv/IJ_assumed_part.c - IJ_mv/IJMatrix.c - IJ_mv/IJMatrix_parcsr.c - IJ_mv/IJVector.c - IJ_mv/IJVector_parcsr.c -) - -# Headers and sources: matrix_matrix -list (APPEND HYPRE_HEADERS - matrix_matrix/HYPRE_matrix_matrix_protos.h -) -list (APPEND HYPRE_SOURCES - matrix_matrix/HYPRE_ConvertParCSRMatrixToDistributedMatrix.c - matrix_matrix/HYPRE_ConvertPETScMatrixToDistributedMatrix.c -) - -# Headers and sources: distributed_ls/pilut -list (APPEND HYPRE_HEADERS - distributed_ls/pilut/HYPRE_DistributedMatrixPilutSolver_protos.h - distributed_ls/pilut/HYPRE_DistributedMatrixPilutSolver_types.h -) -list (APPEND HYPRE_SOURCES - distributed_ls/pilut/comm.c - distributed_ls/pilut/debug.c - distributed_ls/pilut/distributed_qsort.c - distributed_ls/pilut/distributed_qsort_si.c - distributed_ls/pilut/HYPRE_DistributedMatrixPilutSolver.c - distributed_ls/pilut/ilut.c - distributed_ls/pilut/parilut.c - distributed_ls/pilut/parutil.c - distributed_ls/pilut/pblas1.c - distributed_ls/pilut/serilut.c - distributed_ls/pilut/trifactor.c - distributed_ls/pilut/util.c -) - -# Headers and sources: distributed_ls/ParaSails -list (APPEND HYPRE_SOURCES - distributed_ls/ParaSails/ConjGrad.c - distributed_ls/ParaSails/DiagScale.c - distributed_ls/ParaSails/FGmres.c - distributed_ls/ParaSails/Hash.c - distributed_ls/ParaSails/hypre_ParaSails.c - distributed_ls/ParaSails/LoadBal.c - distributed_ls/ParaSails/Matrix.c - distributed_ls/ParaSails/Mem.c - distributed_ls/ParaSails/Numbering.c - distributed_ls/ParaSails/OrderStat.c - distributed_ls/ParaSails/ParaSails.c - distributed_ls/ParaSails/PrunedRows.c - distributed_ls/ParaSails/RowPatt.c - distributed_ls/ParaSails/StoredRows.c -) - -# Headers and sources: distributed_ls/Euclid -list (APPEND HYPRE_SOURCES - distributed_ls/Euclid/blas_dh.c - distributed_ls/Euclid/Euclid_apply.c - distributed_ls/Euclid/Euclid_dh.c - distributed_ls/Euclid/ExternalRows_dh.c - distributed_ls/Euclid/Factor_dh.c - distributed_ls/Euclid/getRow_dh.c - distributed_ls/Euclid/globalObjects.c - distributed_ls/Euclid/Hash_dh.c - distributed_ls/Euclid/Hash_i_dh.c - distributed_ls/Euclid/ilu_mpi_bj.c - distributed_ls/Euclid/ilu_mpi_pilu.c - distributed_ls/Euclid/ilu_seq.c - distributed_ls/Euclid/io_dh.c - distributed_ls/Euclid/krylov_dh.c - distributed_ls/Euclid/Mat_dh.c - distributed_ls/Euclid/mat_dh_private.c - distributed_ls/Euclid/MatGenFD.c - distributed_ls/Euclid/Mem_dh.c - distributed_ls/Euclid/Numbering_dh.c - distributed_ls/Euclid/Parser_dh.c - distributed_ls/Euclid/shellSort_dh.c - distributed_ls/Euclid/sig_dh.c - distributed_ls/Euclid/SortedList_dh.c - distributed_ls/Euclid/SortedSet_dh.c - distributed_ls/Euclid/SubdomainGraph_dh.c - distributed_ls/Euclid/TimeLog_dh.c - distributed_ls/Euclid/Timer_dh.c - distributed_ls/Euclid/Vec_dh.c -) +# Headers and sources: blas +if (HYPRE_USING_HYPRE_BLAS) + add_subdirectory(blas) +else() + # Find system blas + find_package(BLAS REQUIRED) + list(APPEND TPL_LIBRARIES ${BLAS_LIBRARIES}) + set(CMAKE_C_FLAGS "-DUSE_VENDOR_BLAS ${CMAKE_C_FLAGS}") +endif() -# Headers and sources: parcsr_ls -list (APPEND HYPRE_HEADERS - parcsr_ls/HYPRE_parcsr_ls.h - parcsr_ls/_hypre_parcsr_ls.h -) -list (APPEND HYPRE_SOURCES - parcsr_ls/amg_hybrid.c - parcsr_ls/aux_interp.c - parcsr_ls/F90_hypre_laplace.c - parcsr_ls/F90_HYPRE_parcsr_amg.c - parcsr_ls/F90_HYPRE_parcsr_bicgstab.c - parcsr_ls/F90_HYPRE_parcsr_block.c - parcsr_ls/F90_HYPRE_parcsr_cgnr.c - parcsr_ls/F90_HYPRE_parcsr_Euclid.c - parcsr_ls/F90_HYPRE_parcsr_gmres.c - parcsr_ls/F90_HYPRE_parcsr_cogmres.c - parcsr_ls/F90_HYPRE_parcsr_flexgmres.c - parcsr_ls/F90_HYPRE_parcsr_lgmres.c - parcsr_ls/F90_HYPRE_parcsr_hybrid.c - parcsr_ls/F90_HYPRE_parcsr_int.c - parcsr_ls/F90_HYPRE_parcsr_ParaSails.c - parcsr_ls/F90_HYPRE_parcsr_pcg.c - parcsr_ls/F90_HYPRE_parcsr_pilut.c - parcsr_ls/F90_HYPRE_parcsr_schwarz.c - parcsr_ls/F90_HYPRE_ams.c - parcsr_ls/gen_redcs_mat.c - parcsr_ls/HYPRE_parcsr_amg.c - parcsr_ls/HYPRE_parcsr_bicgstab.c - parcsr_ls/HYPRE_parcsr_block.c - parcsr_ls/HYPRE_parcsr_cgnr.c - parcsr_ls/HYPRE_parcsr_Euclid.c - parcsr_ls/HYPRE_parcsr_gmres.c - parcsr_ls/HYPRE_parcsr_cogmres.c - parcsr_ls/HYPRE_parcsr_flexgmres.c - parcsr_ls/HYPRE_parcsr_lgmres.c - parcsr_ls/HYPRE_parcsr_hybrid.c - parcsr_ls/HYPRE_parcsr_int.c - parcsr_ls/HYPRE_parcsr_mgr.c - parcsr_ls/HYPRE_parcsr_ParaSails.c - parcsr_ls/HYPRE_parcsr_pcg.c - parcsr_ls/HYPRE_parcsr_pilut.c - parcsr_ls/HYPRE_parcsr_schwarz.c - parcsr_ls/HYPRE_ams.c - parcsr_ls/HYPRE_ads.c - parcsr_ls/HYPRE_ame.c - parcsr_ls/par_amg.c - parcsr_ls/par_amg_setup.c - parcsr_ls/par_amg_solve.c - parcsr_ls/par_amg_solveT.c - parcsr_ls/par_cg_relax_wt.c - parcsr_ls/par_coarsen.c - parcsr_ls/par_cgc_coarsen.c - parcsr_ls/par_cheby.c - parcsr_ls/par_coarse_parms.c - parcsr_ls/par_coordinates.c - parcsr_ls/par_cr.c - parcsr_ls/par_cycle.c - parcsr_ls/par_add_cycle.c - parcsr_ls/par_difconv.c - parcsr_ls/par_gsmg.c - parcsr_ls/par_indepset.c - parcsr_ls/par_interp.c - parcsr_ls/par_jacobi_interp.c - parcsr_ls/par_multi_interp.c - parcsr_ls/par_laplace_27pt.c - parcsr_ls/par_laplace_9pt.c - parcsr_ls/par_laplace.c - parcsr_ls/par_lr_interp.c - parcsr_ls/par_mgr.c - parcsr_ls/par_mgr_setup.c - parcsr_ls/par_mgr_solve.c - parcsr_ls/par_nongalerkin.c - parcsr_ls/par_nodal_systems.c - parcsr_ls/par_rap.c - parcsr_ls/par_rap_communication.c - parcsr_ls/par_rotate_7pt.c - parcsr_ls/par_vardifconv.c - parcsr_ls/par_vardifconv_rs.c - parcsr_ls/par_relax.c - parcsr_ls/par_relax_more.c - parcsr_ls/par_relax_interface.c - parcsr_ls/par_scaled_matnorm.c - parcsr_ls/par_schwarz.c - parcsr_ls/par_stats.c - parcsr_ls/par_strength.c - parcsr_ls/par_sv_interp.c - parcsr_ls/par_sv_interp_ln.c - parcsr_ls/partial.c - parcsr_ls/pcg_par.c - parcsr_ls/schwarz.c - parcsr_ls/block_tridiag.c - parcsr_ls/ams.c - parcsr_ls/ads.c - parcsr_ls/ame.c - parcsr_ls/par_restr.c - parcsr_ls/par_lr_restr.c -) +# Headers and sources: lapack +if (HYPRE_USING_HYPRE_LAPACK) + add_subdirectory(lapack) +else() + # Find system lapack + find_package(LAPACK REQUIRED) + list(APPEND TPL_LIBRARIES ${LAPACK_LIBRARIES}) +endif() + +# Find DSUPERLU, if requested +if (HYPRE_USING_DSUPERLU) + if (NOT TPL_DSUPERLU_LIBRARIES) + message(FATAL_ERROR "TPL_DSUPERLU_LIBRARIES option should be set for SuperLU_Dist support.") + endif() + + if (NOT TPL_DSUPERLU_INCLUDE_DIRS) + message(FATAL_ERROR "TPL_DSUPERLU_INCLUDE_DIRS option be set for SuperLU_Dist support.") + endif() + foreach(dir ${TPL_DSUPERLU_INCLUDE_DIRS}) + if (NOT EXISTS ${dir}) + message(FATAL_ERROR "SuperLU_Dist include directory not found: ${dir}") + endif() + set(CMAKE_C_FLAGS "-I${dir} ${CMAKE_C_FLAGS}") + endforeach() + message("-- Enabled support for using DSUPERLU.") + set(DSUPERLU_FOUND TRUE) + list(APPEND TPL_LIBRARIES ${TPL_DSUPERLU_LIBRARIES} stdc++) +endif() -# Headers and sources: struct_mv -list (APPEND HYPRE_HEADERS - struct_mv/HYPRE_struct_mv.h - struct_mv/_hypre_struct_mv.h -) -list (APPEND HYPRE_SOURCES - struct_mv/assumed_part.c - struct_mv/box_algebra.c - struct_mv/box_boundary.c - struct_mv/box.c - struct_mv/box_manager.c - struct_mv/communication_info.c - struct_mv/computation.c - struct_mv/F90_HYPRE_struct_grid.c - struct_mv/F90_HYPRE_struct_matrix.c - struct_mv/F90_HYPRE_struct_stencil.c - struct_mv/F90_HYPRE_struct_vector.c - struct_mv/HYPRE_struct_grid.c - struct_mv/HYPRE_struct_matrix.c - struct_mv/HYPRE_struct_stencil.c - struct_mv/HYPRE_struct_vector.c - struct_mv/project.c - struct_mv/struct_axpy.c - struct_mv/struct_communication.c - struct_mv/struct_copy.c - struct_mv/struct_grid.c - struct_mv/struct_innerprod.c - struct_mv/struct_io.c - struct_mv/struct_matrix.c - struct_mv/struct_matrix_mask.c - struct_mv/struct_matvec.c - struct_mv/struct_scale.c - struct_mv/struct_stencil.c - struct_mv/struct_vector.c -) +if (TPL_DSUPERLU_INCLUDE_DIRS) + include_directories(${TPL_DSUPERLU_INCLUDE_DIRS}) +endif () -# Headers and sources: struct_ls -list (APPEND HYPRE_HEADERS - struct_ls/HYPRE_struct_ls.h - struct_ls/_hypre_struct_ls.h -) -list (APPEND HYPRE_SOURCES - struct_ls/coarsen.c - struct_ls/cyclic_reduction.c - struct_ls/F90_HYPRE_struct_bicgstab.c - struct_ls/F90_HYPRE_struct_cycred.c - struct_ls/F90_HYPRE_struct_gmres.c - struct_ls/F90_HYPRE_struct_hybrid.c - struct_ls/F90_HYPRE_struct_int.c - struct_ls/F90_HYPRE_struct_jacobi.c - struct_ls/F90_HYPRE_struct_pcg.c - struct_ls/F90_HYPRE_struct_pfmg.c - struct_ls/F90_HYPRE_struct_smg.c - struct_ls/F90_HYPRE_struct_sparse_msg.c - struct_ls/general.c - struct_ls/hybrid.c - struct_ls/HYPRE_struct_bicgstab.c - struct_ls/HYPRE_struct_cycred.c - struct_ls/HYPRE_struct_hybrid.c - struct_ls/HYPRE_struct_int.c - struct_ls/HYPRE_struct_jacobi.c - struct_ls/HYPRE_struct_pfmg.c - struct_ls/HYPRE_struct_smg.c - struct_ls/HYPRE_struct_sparse_msg.c - struct_ls/HYPRE_struct_pcg.c - struct_ls/HYPRE_struct_gmres.c - struct_ls/HYPRE_struct_flexgmres.c - struct_ls/HYPRE_struct_lgmres.c - struct_ls/jacobi.c - struct_ls/pcg_struct.c - struct_ls/pfmg2_setup_rap.c - struct_ls/pfmg3_setup_rap.c - struct_ls/pfmg.c - struct_ls/pfmg_relax.c - struct_ls/pfmg_setup.c - struct_ls/pfmg_setup_interp.c - struct_ls/pfmg_setup_rap5.c - struct_ls/pfmg_setup_rap7.c - struct_ls/pfmg_setup_rap.c - struct_ls/pfmg_solve.c - struct_ls/point_relax.c - struct_ls/red_black_constantcoef_gs.c - struct_ls/red_black_gs.c - struct_ls/semi.c - struct_ls/semi_interp.c - struct_ls/semi_restrict.c - struct_ls/semi_setup_rap.c - struct_ls/smg2_setup_rap.c - struct_ls/smg3_setup_rap.c - struct_ls/smg_axpy.c - struct_ls/smg.c - struct_ls/smg_relax.c - struct_ls/smg_residual.c - struct_ls/smg_setup.c - struct_ls/smg_setup_interp.c - struct_ls/smg_setup_rap.c - struct_ls/smg_setup_restrict.c - struct_ls/smg_solve.c - struct_ls/sparse_msg2_setup_rap.c - struct_ls/sparse_msg3_setup_rap.c - struct_ls/sparse_msg.c - struct_ls/sparse_msg_filter.c - struct_ls/sparse_msg_interp.c - struct_ls/sparse_msg_restrict.c - struct_ls/sparse_msg_setup.c - struct_ls/sparse_msg_setup_rap.c - struct_ls/sparse_msg_solve.c -) +if(DSUPERLU_FOUND) + set(HYPRE_USING_DSUPERLU TRUE) +endif() -# Headers and sources: sstruct_mv -list (APPEND HYPRE_HEADERS - sstruct_mv/HYPRE_sstruct_mv.h - sstruct_mv/_hypre_sstruct_mv.h -) -list (APPEND HYPRE_SOURCES - sstruct_mv/F90_HYPRE_sstruct_graph.c - sstruct_mv/F90_HYPRE_sstruct_grid.c - sstruct_mv/F90_HYPRE_sstruct_matrix.c - sstruct_mv/F90_HYPRE_sstruct_stencil.c - sstruct_mv/F90_HYPRE_sstruct_vector.c - sstruct_mv/HYPRE_sstruct_graph.c - sstruct_mv/HYPRE_sstruct_grid.c - sstruct_mv/HYPRE_sstruct_matrix.c - sstruct_mv/HYPRE_sstruct_stencil.c - sstruct_mv/HYPRE_sstruct_vector.c - sstruct_mv/sstruct_axpy.c - sstruct_mv/sstruct_copy.c - sstruct_mv/sstruct_graph.c - sstruct_mv/sstruct_grid.c - sstruct_mv/sstruct_innerprod.c - sstruct_mv/sstruct_matrix.c - sstruct_mv/sstruct_matvec.c - sstruct_mv/sstruct_scale.c - sstruct_mv/sstruct_stencil.c - sstruct_mv/sstruct_vector.c -) -# Headers and sources: sstruct_ls -list (APPEND HYPRE_HEADERS - sstruct_ls/HYPRE_sstruct_ls.h - sstruct_ls/_hypre_sstruct_ls.h -) -list (APPEND HYPRE_SOURCES - sstruct_ls/F90_HYPRE_sstruct_bicgstab.c - sstruct_ls/F90_HYPRE_sstruct_gmres.c - sstruct_ls/F90_HYPRE_sstruct_flexgmres.c - sstruct_ls/F90_HYPRE_sstruct_lgmres.c - sstruct_ls/F90_HYPRE_sstruct_InterFAC.c - sstruct_ls/F90_HYPRE_sstruct_int.c - sstruct_ls/F90_HYPRE_sstruct_maxwell.c - sstruct_ls/F90_HYPRE_sstruct_pcg.c - sstruct_ls/F90_HYPRE_sstruct_split.c - sstruct_ls/F90_HYPRE_sstruct_sys_pfmg.c - sstruct_ls/HYPRE_sstruct_bicgstab.c - sstruct_ls/HYPRE_sstruct_gmres.c - sstruct_ls/HYPRE_sstruct_flexgmres.c - sstruct_ls/HYPRE_sstruct_lgmres.c - sstruct_ls/HYPRE_sstruct_InterFAC.c - sstruct_ls/HYPRE_sstruct_int.c - sstruct_ls/HYPRE_sstruct_maxwell.c - sstruct_ls/HYPRE_sstruct_pcg.c - sstruct_ls/HYPRE_sstruct_split.c - sstruct_ls/HYPRE_sstruct_sys_pfmg.c - sstruct_ls/fac.c - sstruct_ls/fac_amr_rap.c - sstruct_ls/fac_amr_fcoarsen.c - sstruct_ls/fac_amr_zero_data.c - sstruct_ls/fac_cf_coarsen.c - sstruct_ls/fac_cfstencil_box.c - sstruct_ls/fac_CFInterfaceExtents.c - sstruct_ls/fac_interp2.c - sstruct_ls/fac_relax.c - sstruct_ls/fac_restrict2.c - sstruct_ls/fac_setup2.c - sstruct_ls/fac_solve3.c - sstruct_ls/fac_zero_cdata.c - sstruct_ls/fac_zero_stencilcoef.c - sstruct_ls/hypre_bsearch.c - sstruct_ls/krylov.c - sstruct_ls/krylov_sstruct.c - sstruct_ls/eliminate_rowscols.c - sstruct_ls/maxwell_grad.c - sstruct_ls/maxwell_physbdy.c - sstruct_ls/maxwell_PNedelec.c - sstruct_ls/maxwell_PNedelec_bdy.c - sstruct_ls/maxwell_semi_interp.c - sstruct_ls/maxwell_TV.c - sstruct_ls/maxwell_TV_setup.c - sstruct_ls/maxwell_zeroBC.c - sstruct_ls/hypre_MaxwellSolve.c - sstruct_ls/hypre_MaxwellSolve2.c - sstruct_ls/nd1_amge_interpolation.c - sstruct_ls/node_relax.c - sstruct_ls/sstruct_amr_intercommunication.c - sstruct_ls/sstruct_owninfo.c - sstruct_ls/sstruct_recvinfo.c - sstruct_ls/sstruct_sendinfo.c - sstruct_ls/sstruct_sharedDOFComm.c - sstruct_ls/sys_pfmg.c - sstruct_ls/sys_pfmg_relax.c - sstruct_ls/sys_pfmg_setup.c - sstruct_ls/sys_pfmg_setup_interp.c - sstruct_ls/sys_pfmg_setup_rap.c - sstruct_ls/sys_pfmg_solve.c - sstruct_ls/sys_semi_interp.c - sstruct_ls/sys_semi_restrict.c -) +# Headers and sources: remaining subdirectories +set(HYPRE_DIRS utilities multivector krylov seq_mv parcsr_mv parcsr_block_mv distributed_matrix IJ_mv matrix_matrix distributed_ls parcsr_ls struct_mv struct_ls sstruct_mv sstruct_ls) +foreach(DIR IN LISTS HYPRE_DIRS) + add_subdirectory(${DIR}) +endforeach() # Configure a header file to pass CMake settings to the source code configure_file ( @@ -753,23 +224,12 @@ include_directories(${hypre_SOURCE_DIR}) include_directories(blas) include_directories(lapack) -include_directories(utilities) -include_directories(multivector) -include_directories(krylov) -include_directories(seq_mv) -include_directories(parcsr_mv) -include_directories(parcsr_block_mv) -include_directories(distributed_matrix) -include_directories(IJ_mv) -include_directories(matrix_matrix) -include_directories(distributed_ls) +# Add remaining subdirectories +foreach(DIR IN LISTS HYPRE_DIRS) + include_directories(${DIR}) +endforeach() include_directories(distributed_ls/Euclid) include_directories(distributed_ls/ParaSails) -include_directories(parcsr_ls) -include_directories(struct_mv) -include_directories(struct_ls) -include_directories(sstruct_mv) -include_directories(sstruct_ls) # Set library build type if (HYPRE_SHARED) @@ -784,10 +244,7 @@ if ((MPI_C_FOUND) AND (NOT CMAKE_C_COMPILER STREQUAL MPI_C_COMPILER)) include_directories (${MPI_C_INCLUDE_PATH}) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_C_COMPILE_FLAGS}") - endif () - if ((MPI_CXX_FOUND) AND (NOT CMAKE_CXX_COMPILER STREQUAL MPI_CXX_COMPILER)) - include_directories (${MPI_CXX_INCLUDE_PATH}) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MPI_CXX_COMPILE_FLAGS}") + list(APPEND TPL_LIBRARIES ${MPI_C_LIBRARIES}) endif () endif (NOT HYPRE_SEQUENTIAL) @@ -796,17 +253,9 @@ find_package (OpenMP) if (OPENMP_FOUND) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") endif (OPENMP_FOUND) endif (HYPRE_USING_OPENMP) -# Turn optimization off for this file -if (MSVC) - set_source_files_properties (lapack/dlamch.c PROPERTIES COMPILE_FLAGS /Od) -else () - set_source_files_properties (lapack/dlamch.c PROPERTIES COMPILE_FLAGS -O0) -endif () - if (MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS) # Use the C++ compiler to compile these files to get around lack of C99 support @@ -834,22 +283,23 @@ add_subdirectory(FEI_mv) endif () -add_library (HYPRE ${HYPRE_SOURCES} ${FEI_LIBS}) +# Build the examples directory, if requested +if (HYPRE_BUILD_EXAMPLES) + add_subdirectory(examples) +endif() + +# Build the test directory, if requested +if (HYPRE_BUILD_TESTS) + add_subdirectory(test) +endif() + +# Cleanup the TPL list +list(REMOVE_DUPLICATES TPL_LIBRARIES) + +add_library (HYPRE ${HYPRE_SOURCES} ${HYPRE_HEADERS} ${FEI_LIBS}) + +target_link_libraries(HYPRE PUBLIC ${TPL_LIBRARIES}) install (TARGETS HYPRE DESTINATION lib) install (FILES ${HYPRE_HEADERS} DESTINATION include) -# add_subdirectory (test EXCLUDE_FROM_ALL) - -# # does this system provide the log and exp functions? -# include (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) -# -# check_function_exists (log HAVE_LOG) -# check_function_exists (exp HAVE_EXP) - -# # add the MathFunctions library? -# if (USE_MYMATH) -# include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions") -# add_subdirectory (MathFunctions) -# set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions) -# endif (USE_MYMATH) diff -Nru hypre-2.16.0/src/config/bootstrap hypre-2.18.2/src/config/bootstrap --- hypre-2.16.0/src/config/bootstrap 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/config/bootstrap 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) if [ -f "configure.in" ]; then echo "File configure.in already exists!" @@ -43,4 +36,4 @@ mv CMakeLists.txt.tmp CMakeLists.txt # Update release information in documentation -(cd docs; update-release.sh) +(cd docs; ./update-release.sh) diff -Nru hypre-2.16.0/src/config/cmake/hypre_CMakeUtilities.cmake hypre-2.18.2/src/config/cmake/hypre_CMakeUtilities.cmake --- hypre-2.16.0/src/config/cmake/hypre_CMakeUtilities.cmake 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/config/cmake/hypre_CMakeUtilities.cmake 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,32 @@ +# A handy function to add the current source directory to a local +# filename. To be used for creating a list of sources. +function(convert_filenames_to_full_paths NAMES) + unset(tmp_names) + foreach(name ${${NAMES}}) + list(APPEND tmp_names ${CMAKE_CURRENT_SOURCE_DIR}/${name}) + endforeach() + set(${NAMES} ${tmp_names} PARENT_SCOPE) +endfunction() + +# A function to add each executable in the list to the build with the +# correct flags, includes, and linkage. +function(add_hypre_executables EXE_SRCS) + # Add one executable per cpp file + foreach(SRC_FILE IN LISTS ${EXE_SRCS}) + get_filename_component(SRC_FILENAME ${SRC_FILE} NAME) + + string(REPLACE ".c" "" EXE_NAME ${SRC_FILENAME}) + # Actually add the exe + add_executable(${EXE_NAME} ${SRC_FILE}) + # Link libraries + set (HYPRE_LIBS "HYPRE") + + # Link libraries for Unix systems + if (UNIX) + list (APPEND HYPRE_LIBS m) + endif (UNIX) + + # Append the additional libraries and options + target_link_libraries(${EXE_NAME} PRIVATE "${HYPRE_LIBS}") + endforeach(SRC_FILE) +endfunction() diff -Nru hypre-2.16.0/src/config/configure.in hypre-2.18.2/src/config/configure.in --- hypre-2.16.0/src/config/configure.in 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/config/configure.in 2019-10-28 22:30:04.000000000 +0000 @@ -1,20 +1,13 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ +dnl Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +dnl HYPRE Project Developers. See the top-level COPYRIGHT file for details. +dnl +dnl SPDX-License-Identifier: (Apache-2.0 OR MIT) dnl ********************************************************************* dnl * File Name: configure.in dnl * dnl * This file is read when autoconf is run and the configure script is -dnl * generated. +dnl * generated. dnl * Configure.in is structured as follows: dnl * initialization information dnl * determine the current architecture @@ -23,14 +16,14 @@ dnl * For the given the architecture, an optimal compiler is dnl * found (if not specified by the user). If the architecture is dnl * unknown or none of the preferred compilers are available then -dnl * default compilers are found. +dnl * default compilers are found. dnl * -dnl * For each chosen compiler, the appropriate flags are set for +dnl * For each chosen compiler, the appropriate flags are set for dnl * optimization, debugging, MPI and pthreading (as required) and the dnl * C preprocessor is checked. -dnl * +dnl * dnl * Finally, library flags are added and AC_SUBST is used to export -dnl * all necessary macro values. +dnl * all necessary macro values. dnl ********************************************************************* dnl ********************************************************************* @@ -55,8 +48,8 @@ dnl ********************************************************************* m4_define([M4_HYPRE_NAME], [hypre]) -m4_define([M4_HYPRE_VERSION], [2.16.0]) -m4_define([M4_HYPRE_DATE], [2019/03/20]) +m4_define([M4_HYPRE_VERSION], [2.18.2]) +m4_define([M4_HYPRE_DATE], [2019/10/28]) m4_define([M4_HYPRE_TIME], [00:00:00]) m4_define([M4_HYPRE_BUGS], [hypre-support@llnl.gov]) m4_define([M4_HYPRE_SRCDIR], [`pwd`]) @@ -69,13 +62,8 @@ AC_REVISION($Id$) AC_INIT(M4_HYPRE_NAME, M4_HYPRE_VERSION) AC_CONFIG_HEADERS([HYPRE_config.h:config/HYPRE_config.h.in]) -AC_COPYRIGHT([Copyright (c) 2008, Lawrence Livermore National Security, LLC. -Produced at the Lawrence Livermore National Laboratory. -This file is part of HYPRE. See file COPYRIGHT for details. - -HYPRE is free software; you can redistribute it and/or modify it under the -terms of the GNU Lesser General Public License (as published by the Free -Software Foundation) version 2.1 dated February 1999.]) +AC_COPYRIGHT([Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +HYPRE Project Developers. See the top-level COPYRIGHT file for details.]) AC_CONFIG_AUX_DIR(config) AC_CONFIG_SRCDIR([HYPRE.h]) @@ -132,7 +120,6 @@ hypre_user_chose_mpi=no hypre_user_chose_blas=no hypre_user_chose_lapack=no -hypre_user_chose_fei=no hypre_user_chose_cuda=no hypre_user_chose_raja=no hypre_user_chose_kokkos=no @@ -147,7 +134,7 @@ hypre_using_superlu=no hypre_using_dsuperlu=no -hypre_using_fei=yes +hypre_using_fei=no hypre_using_mli=no hypre_using_openmp=no @@ -156,6 +143,12 @@ hypre_using_cuda=no hypre_using_gpu=no hypre_using_um=no +hypre_gpu_mpi=no +hypre_using_cuda_streams=no +hypre_using_nvtx=no +hypre_using_cusparse=yes +hypre_using_cublas=no +hypre_using_curand=yes hypre_using_caliper=no hypre_user_gave_caliper_lib=no @@ -163,6 +156,8 @@ hypre_found_cuda=no +hypre_using_node_aware_mpi=no + dnl ********************************************************************* dnl * Initialize flag-check variables dnl ********************************************************************* @@ -322,7 +317,7 @@ AC_ARG_ENABLE(hopscotch, AS_HELP_STRING([--enable-hopscotch], - [Uses hopscotch hashing if configured with OpenMP and + [Uses hopscotch hashing if configured with OpenMP and atomic capability available(default is NO).]), [case "${enableval}" in yes) hypre_using_hopscotch=yes ;; @@ -379,6 +374,72 @@ [hypre_using_um=no] ) +AC_ARG_ENABLE(cuda-streams, +AS_HELP_STRING([--enable-cuda-streams], + [Use CUDA streams (default is YES).]), +[case "${enableval}" in + yes) hypre_using_cuda_streams=yes ;; + no) hypre_using_cuda_streams=no ;; + *) hypre_using_cuda_streams=yes ;; + esac], +[hypre_using_cuda_streams=yes] +) + +AC_ARG_ENABLE(nvtx, +AS_HELP_STRING([--enable-nvtx], + [Use NVTX (default is NO).]), +[case "${enableval}" in + yes) hypre_using_nvtx=yes ;; + no) hypre_using_nvtx=no ;; + *) hypre_using_nvtx=no ;; + esac], +[hypre_using_nvtx=no] +) + +AC_ARG_ENABLE(cusparse, +AS_HELP_STRING([--enable-cusparse], + [Use cuSPARSE (default is YES).]), +[case "${enableval}" in + yes) hypre_using_cusparse=yes ;; + no) hypre_using_cusparse=no ;; + *) hypre_using_cusparse=yes ;; + esac], +[hypre_using_cusparse=yes] +) + +AC_ARG_ENABLE(cublas, +AS_HELP_STRING([--enable-cublas], + [Use cuBLAS (default is NO).]), +[case "${enableval}" in + yes) hypre_using_cublas=yes ;; + no) hypre_using_cublas=no ;; + *) hypre_using_cublas=no ;; + esac], +[hypre_using_cublas=no] +) + +AC_ARG_ENABLE(curand, +AS_HELP_STRING([--enable-curand], + [Use cuRAND (default is YES).]), +[case "${enableval}" in + yes) hypre_using_curand=yes ;; + no) hypre_using_curand=no ;; + *) hypre_using_curand=yes ;; + esac], +[hypre_using_curand=yes] +) + +AC_ARG_ENABLE(gpu-aware-mpi, +AS_HELP_STRING([--enable-gpu-aware-mpi], + [Use GPU memory aware MPI]), +[case "${enableval}" in + yes) hypre_gpu_mpi=yes ;; + no) hypre_gpu_mpi=no ;; + *) AC_MSG_ERROR([Bad value ${enableval} for --enable-gpu-aware-mpi]) ;; + esac], +[hypre_gpu_mpi=no] +) + dnl * The AC_DEFINE is below, after hypre_using_mpi is completely set dnl * Need to change to a new approach that always defines variable to some value @@ -446,13 +507,13 @@ dnl ********************************************************************* dnl * Set default AR value if not defined by the user dnl ********************************************************************* -if test "x$AR" = "x" +if test "x$AR" = "x" then AR="ar -rcu" fi dnl ********************************************************************* -dnl * If the user has specified a c, c++, or fortran compiler on the +dnl * If the user has specified a c, c++, or fortran compiler on the dnl * command line, that compiler will be used. No checks are done dnl * to assure this compiler is present or working. Additionally, dnl * if the user indicated any MPI include, library, or directory @@ -569,7 +630,7 @@ CXXFLAGS="-g --strict --lint --display_error_number" CXXFLAGS="$CXXFLAGS --diag_suppress 381,450,1023,1024" fi - + AC_CHECK_PROGS(CXX, [g++ gcc icpc icc pgCC pgcc xlC xlc KCC kcc], [""]) if test "x$CXX" = "x" then @@ -594,7 +655,7 @@ AC_ARG_WITH(MPI-include, AS_HELP_STRING([--with-MPI-include=DIR], [User specifies that mpi.h is in DIR. The options - --with-MPI-include --with-MPI-libs and + --with-MPI-include --with-MPI-libs and --with-MPI-lib-dirs must be used together.]), [for mpi_dir in $withval; do MPIINCLUDE="$MPIINCLUDE -I$mpi_dir" @@ -606,7 +667,7 @@ AC_ARG_WITH(MPI-libs, AS_HELP_STRING([--with-MPI-libs=LIBS], [LIBS is space-separated list (enclosed in quotes) of library - names needed for MPI, e.g. "nsl socket mpi". The options + names needed for MPI, e.g. "nsl socket mpi". The options --with-MPI-include --with-MPI-libs and --with-MPI-lib-dirs must be used together.]), [for mpi_lib in $withval; do @@ -630,7 +691,7 @@ AC_ARG_WITH(MPI-flags, AS_HELP_STRING([--with-MPI-flags=FLAGS], - [FLAGS is a space separated list (enclosed in quotes) of + [FLAGS is a space separated list (enclosed in quotes) of whatever flags other than -l and -L are needed to link with MPI libraries-- Does not de-activate autosearch for other MPI information. May be used with the other three @@ -644,6 +705,27 @@ [MPIFLAGS=""] ) +dnl ***** Node Aware MPI +AC_ARG_WITH(node-aware-mpi, +AS_HELP_STRING([--with-node-aware-mpi], + [Use Node Aware MPI (default is NO).]), +[case "$withval" in + yes) hypre_using_node_aware_mpi=yes;; + no) hypre_using_node_aware_mpi=no ;; + *) hypre_using_node_aware_mpi=no ;; + esac], +[hypre_using_node_aware_mpi=no] +) + +AC_ARG_WITH(node-aware-mpi-include, +AS_HELP_STRING([--with-node-aware-mpi-include=DIR], + [User specifies that nap_comm.hpp is in DIR.]), +[for nap_dir in $withval; do + HYPRE_NAP_INCLUDE="$HYPRE_NAP_INCLUDE -I$nap_dir" + done; + hypre_using_node_aware_mpi=yes] +) + dnl ***** BLAS AC_ARG_WITH(blas-lib, @@ -676,8 +758,8 @@ AC_ARG_WITH(blas-lib-dirs, AS_HELP_STRING([--with-blas-lib-dirs=DIRS], - [DIRS is space-separated list (enclosed in quotes) of - directories containing the libraries specified by + [DIRS is space-separated list (enclosed in quotes) of + directories containing the libraries specified by --with-blas-libs, e.g "usr/lib /usr/local/blas/lib". The options --with-blas-libs and --with-blas-lib-dirs must be used together.]), @@ -720,8 +802,8 @@ AC_ARG_WITH(lapack-lib-dirs, AS_HELP_STRING([--with-lapack-lib-dirs=DIRS], - [DIRS is space-separated list (enclosed in quotes) of - directories containing the libraries specified by + [DIRS is space-separated list (enclosed in quotes) of + directories containing the libraries specified by --with-lapack-libs, e.g "usr/lib /usr/local/lapack/lib". The options --with-lapack-libs and --with-lapack-lib-dirs must be used together.]), @@ -729,7 +811,7 @@ LAPACKLIBDIRS="-L$lapack_lib_dir $LAPACKLIBDIRS" done; hypre_user_chose_lapack=yes - hypre_lapack_lib_dir_old_style=yes] + hypre_lapack_lib_dir_old_style=yes] ) dnl * Define a generic macro to set hypre_fmangle based on withval @@ -778,7 +860,7 @@ AC_DEFINE_UNQUOTED(HYPRE_FMANGLE_BLAS, [$hypre_fmangle_blas], [BLAS mangling]) dnl * Define a generic macro to set hypre_fmangle_blaslapack based on withval -dnl * This could use the same variable for blas, but it is redefined here for the +dnl * This could use the same variable for blas, but it is redefined here for the dnl * rare case that blas/ lapack manglings could be different AC_DEFUN([AC_HYPRE_SET_FMANGLE_LAPACK], [ @@ -800,14 +882,6 @@ ) AC_DEFINE_UNQUOTED(HYPRE_FMANGLE_LAPACK, [$hypre_fmangle_lapack], [LAPACK mangling]) -AC_ARG_WITH(fei-inc-dir, -AS_HELP_STRING([--with-fei-inc-dir=DIR], - [DIR is the directory containing the FEI distribution.]), -[HYPRE_FEI_BASE_DIR="$withval"; - hypre_using_fei=yes; - hypre_user_chose_fei=yes] -) - AC_ARG_WITH(print-errors, AS_HELP_STRING([--with-print-errors], [Print HYPRE errors.]), @@ -890,7 +964,7 @@ ) AS_IF([test "x$with_dsuperlu" = "xyes"], - [AC_DEFINE(HAVE_DSUPERLU, 1, [Have external DSuperLU library.])], + [AC_DEFINE(HYPRE_USING_DSUPERLU, 1, [Have external DSuperLU library.])], []) AC_ARG_WITH(dsuperlu-include, @@ -912,13 +986,11 @@ dnl ***** FEI -AC_ARG_WITH(fei, -AS_HELP_STRING([--with-fei], - [Use internal FEI routines.]), -[case "${withval}" in - no) hypre_using_fei=no ;; - *) hypre_using_fei=yes ;; - esac] +AC_ARG_WITH(fei-inc-dir, +AS_HELP_STRING([--with-fei-inc-dir=DIR], + [DIR is the directory containing the FEI distribution.]), +[HYPRE_FEI_BASE_DIR="$withval"; + hypre_using_fei=yes] ) dnl ***** MLI @@ -938,7 +1010,7 @@ AS_HELP_STRING([--with-MPI], [DEFAULT: Compile with MPI. Selecting --without-MPI may affect which compiler is chosen.]), -[case "$withval" in +[case "$withval" in no) hypre_using_mpi=no ;; *) hypre_using_mpi=yes ;; esac] @@ -986,7 +1058,7 @@ AC_ARG_WITH(raja-include, AS_HELP_STRING([--with-raja-include=DIR], [User specifies that RAJA/*.h is in DIR. The options - --with-raja-include --with-raja-libs and + --with-raja-include --with-raja-libs and --with-raja-lib-dirs must be used together.]), [for raja_dir in $withval; do HYPRE_RAJA_INCLUDE="-I$raja_dir $HYPRE_RAJA_INCLUDE" @@ -1017,8 +1089,8 @@ AC_ARG_WITH(raja-lib-dirs, AS_HELP_STRING([--with-raja-lib-dirs=DIRS], - [DIRS is space-separated list (enclosed in quotes) of - directories containing the libraries specified by + [DIRS is space-separated list (enclosed in quotes) of + directories containing the libraries specified by --with-raja-libs, e.g "usr/lib /usr/local/lib". The options --with-raja-libs and --raja-blas-lib-dirs must be used together.]), @@ -1030,8 +1102,8 @@ AC_ARG_WITH(kokkos-lib-dirs, AS_HELP_STRING([--with-kokkos-lib-dirs=DIRS], - [DIRS is space-separated list (enclosed in quotes) of - directories containing the libraries and + [DIRS is space-separated list (enclosed in quotes) of + directories containing the libraries and Makefile.kokkos is assumed to be in DIRS/../ . The options --with-kokkos-libs and --with-kokkos-dirs must be used together.]), @@ -1045,12 +1117,12 @@ AS_HELP_STRING([--with-kokkos-include=DIR], [User specifies that KOKKOS headers is in DIR. The options --with-kokkos-include --with-kokkos-libs and - --with-kokkos-dirs must be used together.]), + --with-kokkos-dirs must be used together.]), [for kokkos_dir in $withval; do HYPRE_KOKKOS_INCLUDE="-I$kokkos_dir $HYPRE_KOKKOS_INCLUDE" done; hypre_user_chose_kokkos=yes] -) +) AC_ARG_WITH(kokkos-lib, AS_HELP_STRING([--with-kokkos-lib=LIBS], @@ -1105,7 +1177,7 @@ ) dnl ********************************************************************* -dnl * Select compilers if not already defined by command line options +dnl * Select compilers if not already defined by command line options dnl ********************************************************************* if test "$hypre_user_chose_ccompilers" = "no" then @@ -1203,7 +1275,7 @@ fi dnl ********************************************************************* -dnl * Check for general programs +dnl * Check for general programs dnl ********************************************************************* AC_PROG_MAKE_SET AC_PROG_RANLIB @@ -1212,7 +1284,7 @@ dnl AC_PROG_LN_S dnl ********************************************************************* -dnl * Check for compiler related programs +dnl * Check for compiler related programs dnl * Most of these AC_PROG_ macros check to see if the compilers works. dnl ********************************************************************* if test "$hypre_using_c" = "yes" @@ -1265,6 +1337,11 @@ dnl fi fi +if test "$hypre_using_node_aware_mpi" = "yes" +then + AC_DEFINE(HYPRE_USING_NODE_AWARE_MPI, 1) +fi + dnl ********************************************************************* dnl * Define appropriate variables if user set blas to either essl or dxml dnl ********************************************************************* @@ -1284,7 +1361,7 @@ fi dnl ********************************************************************* -dnl * Find BLAS library if not already set by the user +dnl * Find BLAS library if not already set by the user dnl * If user specified --without-blas or a system one cannot be found, dnl * default to internal HYPRE routines dnl ********************************************************************* @@ -1327,7 +1404,7 @@ fi dnl ********************************************************************* -dnl * Find LAPACK library if not already set by the user +dnl * Find LAPACK library if not already set by the user dnl * If user specified --without-lapack or a system one cannot be found, dnl * default to internal HYPRE routines dnl ********************************************************************* @@ -1375,10 +1452,6 @@ AC_DEFINE(HAVE_MLI, 1, [Using MLI.]) fi fi - if test "$hypre_user_chose_fei" = "no" - then - HYPRE_FEI_BASE_DIR="$HYPRE_SRCDIR/FEI_mv/fei-base" - fi AC_CHECK_LIB(stdc++, __gxx_personality_v0, LIBS="$LIBS -lstdc++") else HYPRE_FEI_SRC_DIR= @@ -1404,7 +1477,7 @@ fi dnl ********************************************************************* -dnl * Set debug/optimization flags +dnl * Set debug/optimization flags dnl ********************************************************************* if test "$hypre_using_debug" = "yes" then @@ -1488,9 +1561,9 @@ then AC_MSG_ERROR([*********** Unspecified BLASLIBDIRS error: ****************************** --with-blas-libs set without setting corresponding --with-blas-lib-dirs. - Please specify directory paths to preferred blas libraries. - Otherwise use --with-blas to search for library on the system. - See "configure --help" for usage details. + Please specify directory paths to preferred blas libraries. + Otherwise use --with-blas to search for library on the system. + See "configure --help" for usage details. ********************************************************************],[9]) fi if test "$hypre_blas_lib_old_style" = "no" -a "$hypre_blas_lib_dir_old_style" = "yes"; @@ -1498,8 +1571,8 @@ AC_MSG_ERROR([*********** Unspecified BLASLIB error: ********************************** --with-blas-lib-dirs set without setting corresponding --with-blas-libs. Please specify base names of preferred blas libraries in the provided dir paths. - Otherwise use --with-blas to search for library on the system. - See "configure --help" for usage details. + Otherwise use --with-blas to search for library on the system. + See "configure --help" for usage details. ********************************************************************],[9]) fi dnl AC_HYPRE_CHECK_USER_BLASLIBS @@ -1511,9 +1584,9 @@ then AC_MSG_ERROR([*********** Unspecified LAPACKLIBDIRS error: ****************************** --with-lapack-libs set without setting corresponding --with-lapack-lib-dirs. - Please specify directory paths to preferred lapack libraries. - Otherwise use --with-lapack to search for library on the system. - See "configure --help" for usage details. + Please specify directory paths to preferred lapack libraries. + Otherwise use --with-lapack to search for library on the system. + See "configure --help" for usage details. ********************************************************************],[9]) fi if test "$hypre_lapack_lib_old_style" = "no" -a "$hypre_lapack_lib_dir_old_style" = "yes"; @@ -1521,8 +1594,8 @@ AC_MSG_ERROR([*********** Unspecified LAPACKLIB error: ********************************** --with-lapack-lib-dirs set without setting corresponding --with-lapack-libs. Please specify base names of preferred lapack libraries in the provided dir paths. - Otherwise use --with-lapack to search for library on the system. - See "configure --help" for usage details. + Otherwise use --with-lapack to search for library on the system. + See "configure --help" for usage details. ********************************************************************],[9]) fi dnl AC_HYPRE_CHECK_USER_LAPACKLIBS @@ -1537,7 +1610,7 @@ if test "$hypre_user_gave_caliper_inc" != "yes" then AC_MSG_WARN([*******************************************************]) - AC_MSG_WARN([Configuring with --with-caliper=yes without providing]) + AC_MSG_WARN([Configuring with --with-caliper=yes without providing]) AC_MSG_WARN([--with-caliper-include=.]) AC_MSG_WARN([Using default user include path.]) AC_MSG_WARN([NOTE: Caliper annotations may not work.]) @@ -1581,12 +1654,12 @@ if test "$hypre_using_cuda" != "yes" then if [test "$CXX" = "mpixlC" || test "$CXX" = "xlC_r"] - then + then CXXFLAGS="${CXXFLAGS} -+ -std=c++11" fi fi - dnl let CC be CXX + dnl let CC be CXX CC=${CXX} LINK_CC=${LINK_CXX} CFLAGS=${CXXFLAGS} @@ -1603,12 +1676,12 @@ if test "$hypre_using_cuda" != "yes" then if [test "$CXX" = "mpixlC" || test "$CXX" = "xlC_r"] - then + then CXXFLAGS="${CXXFLAGS} -+ -std=c++11" fi fi - dnl let CC be CXX + dnl let CC be CXX CC=${CXX} LINK_CC=${LINK_CXX} CFLAGS=${CXXFLAGS} @@ -1619,11 +1692,29 @@ dnl ********************************************************************* if test "$hypre_user_chose_cuda" = "yes" then - dnl to delete - AC_DEFINE(HYPRE_USING_GPU, 1, [GPU being used]) - AC_DEFINE(HYPRE_USING_CUDA, 1, [CUDA being used]) - AC_DEFINE(USE_NVTX, 1, [NVTX being used]) + + AC_DEFINE(HYPRE_USING_CUSPARSE, 1, [cuSPARSE being used]) + + if test "$hypre_using_nvtx" = "yes" + then + AC_DEFINE(HYPRE_USING_NVTX, 1, [NVTX being used]) + fi + + if test "$hypre_using_cusparse" = "yes" + then + AC_DEFINE(HYPRE_USING_CUSPARSE, 1, [CUSPARSE being used]) + fi + + if test "$hypre_using_cublas" = "yes" + then + AC_DEFINE(HYPRE_USING_CUBLAS, 1, [CUBLAS being used]) + fi + + if test "$hypre_using_curand" = "yes" + then + AC_DEFINE(HYPRE_USING_CURAND, 1, [CURAND being used]) + fi dnl let CC/CXX and LINK be CUCC and let host compiler be CXX AC_CHECK_PROGS(CUCC, nvcc) @@ -1642,11 +1733,34 @@ HYPRE_CUDA_GENCODE="-gencode arch=compute_${HYPRE_CUDA_SM},\"code=sm_${HYPRE_CUDA_SM}\"" CUFLAGS+="-O2 -ccbin=$NVCCBIN ${HYPRE_CUDA_GENCODE} -expt-extended-lambda -dc -std=c++11 -Xcompiler -Wno-deprecated-register --x cu" + if test "$hypre_using_debug" = "yes" + then + CUFLAGS="-g ${CUFLAGS}" + fi CXXFLAGS="${CUFLAGS} -Xcompiler \"${CXXFLAGS}\"" CFLAGS=${CXXFLAGS} LDFLAGS="-ccbin=$NVCCBIN ${HYPRE_CUDA_GENCODE} -Xcompiler \"${LDFLAGS}\"" HYPRE_CUDA_INCL="-I${HYPRE_CUDA_PATH}/include" - HYPRE_CUDA_LIBS="-L${HYPRE_CUDA_PATH}/lib64 -lcusparse -lcudart -lcublas -lnvToolsExt" + HYPRE_CUDA_LIBS="-L${HYPRE_CUDA_PATH}/lib64 -lcudart" + if test "$hypre_using_nvtx" = "yes" + then + HYPRE_CUDA_LIBS+=" -lnvToolsExt" + fi + + if test "$hypre_using_cusparse" = "yes" + then + HYPRE_CUDA_LIBS+=" -lcusparse" + fi + + if test "$hypre_using_cublas" = "yes" + then + HYPRE_CUDA_LIBS+=" -lcublas" + fi + + if test "$hypre_using_curand" = "yes" + then + HYPRE_CUDA_LIBS+=" -lcurand" + fi fi dnl ********************************************************************* @@ -1658,7 +1772,7 @@ if test "$hypre_user_chose_cuda" = "yes" then AC_MSG_NOTICE([***********************************************************]) - AC_MSG_NOTICE([Configuring with --with-cuda=yes without unified memory.]) + AC_MSG_NOTICE([Configuring with --with-cuda=yes without unified memory.]) AC_MSG_NOTICE([It only works for struct interface.]) AC_MSG_NOTICE([Use --enable-unified-memory to compile with unified memory.]) AC_MSG_NOTICE([***********************************************************]) @@ -1666,7 +1780,7 @@ if test "$hypre_using_device_openmp" = "yes" then AC_MSG_NOTICE([***********************************************************]) - AC_MSG_NOTICE([Configuring with --with-device-openmp=yes without unified memory.]) + AC_MSG_NOTICE([Configuring with --with-device-openmp=yes without unified memory.]) AC_MSG_NOTICE([It only works for struct interface.]) AC_MSG_NOTICE([Use --enable-unified-memory to compile with unified memory.]) AC_MSG_NOTICE([***********************************************************]) @@ -1683,15 +1797,21 @@ if test "$hypre_using_device_openmp" = "yes" then - AC_DEFINE(USE_NVTX, 1, [NVTX being used]) + AC_DEFINE(HYPRE_USING_CUSPARSE, 1, [cuSPARSE being used]) + + if test "$hypre_using_nvtx" = "yes" + then + AC_DEFINE(HYPRE_USING_NVTX, 1, [NVTX being used]) + fi AC_DEFINE(HYPRE_USING_DEVICE_OPENMP, 1, [Enable OpenMP (>=4.5) device directives]) AC_DEFINE(HYPRE_DEVICE_OPENMP_ALLOC, 1, [Enable device OpenMP target alloc version]) + dnl AC_DEFINE(HYPRE_DEVICE_OPENMP_MAPPED, 1, [Enable device OpenMP target mapped version]) AC_CHECK_PROGS(CUCC, nvcc) - CFLAGS="${CFLAGS} -DHYPRE_USING_CUSPARSE -DHYPRE_USING_OPENMP_OFFLOAD" - CXXFLAGS="${CXXFLAGS} -DHYPRE_USING_CUSPARSE -DHYPRE_USING_OPENMP_OFFLOAD" + CFLAGS="${CFLAGS}" + CXXFLAGS="${CXXFLAGS}" if [test "$CC" = "clang-gpu" || test "$CC" = "mpiclang-gpu"] then @@ -1703,12 +1823,21 @@ fi if test "$hypre_using_debug" = "yes" then - CFLAGS+=" -DHYPRE_OMP45_DEBUG" - CXXFLAGS+=" -DHYPRE_OMP45_DEBUG" + AC_DEFINE(HYPRE_DEVICE_OPENMP_CHECK, 1, [Strictly checking OpenMP offload directives]) fi HYPRE_CUDA_INCL="-I${HYPRE_CUDA_PATH}/include" - HYPRE_CUDA_LIBS="-L${HYPRE_CUDA_PATH}/lib64 -lcusparse -lcudart -lcublas -lnvToolsExt" + HYPRE_CUDA_LIBS="-L${HYPRE_CUDA_PATH}/lib64 -lcusparse -lcudart -lcurand" + if test "$hypre_using_nvtx" = "yes" + then + HYPRE_CUDA_LIBS+=" -lnvToolsExt" + fi + + dnl let CC be CXX + CC=${CXX} + LINK_CC=${LINK_CXX} + CXXFLAGS="-x c++ ${CXXFLAGS}" + CFLAGS=${CXXFLAGS} fi dnl ********************************************************************* @@ -1759,6 +1888,11 @@ BUILD_CXX_SHARED="${CXX} ${SHARED_BUILD_FLAG}" fi +if test "x$hypre_using_cuda_streams" = "xyes" +then + AC_DEFINE([HYPRE_USING_CUDA_STREAMS],1,[HYPRE WITH CUDA STREAMS]) +fi + dnl ********************************************************************* dnl * Set memory env dnl ********************************************************************* @@ -1774,6 +1908,11 @@ fi fi +if test "$hypre_gpu_mpi" = "yes" +then + AC_DEFINE([HYPRE_WITH_GPU_AWARE_MPI],1,[HYPRE WITH GPU AWARE MPI]) +fi + dnl ********************************************************************* dnl * Set installation directories dnl ********************************************************************* @@ -1788,7 +1927,7 @@ dnl ********************************************************************* dnl * AC_SUBST performs the variable substitutions so they may be used in -dnl * the Makefile.in files. Some macros call AC_SUBST for some of these +dnl * the Makefile.in files. Some macros call AC_SUBST for some of these dnl * variables, but it does no damage to call it again. dnl ********************************************************************* @@ -1862,6 +2001,11 @@ AC_SUBST(HYPRE_PILUT_FILES) dnl ********************************************************************* +dnl * Node_Aware_MPI +dnl ********************************************************************* +AC_SUBST(HYPRE_NAP_INCLUDE) + +dnl ********************************************************************* dnl * FEI-related files, libraries and directories dnl ********************************************************************* AC_SUBST(HYPRE_FEI_SRC_DIR) @@ -1894,7 +2038,7 @@ AC_SUBST(HYPRE_KOKKOS_INCLUDE) AC_SUBST(HYPRE_KOKKOS_LIB) AC_SUBST(KOKKOS_LIBS) -AC_SUBST(HYPRE_KOKKOS_INC_FILE) +AC_SUBST(HYPRE_KOKKOS_INC_FILE) dnl ********************************************************************* dnl * CUDA stuff @@ -1928,7 +2072,7 @@ AC_SUBST(RANLIB) dnl ********************************************************************* -dnl * Define the files to be configured and made +dnl * Define the files to be configured and made dnl ********************************************************************* AC_CONFIG_FILES([config/Makefile.config]) diff -Nru hypre-2.16.0/src/config/hypre_blas_macros.m4 hypre-2.18.2/src/config/hypre_blas_macros.m4 --- hypre-2.16.0/src/config/hypre_blas_macros.m4 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/config/hypre_blas_macros.m4 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,7 @@ -dnl #*BHEADER******************************************************************** -dnl # Copyright (c) 2008, Lawrence Livermore National Security, LLC. -dnl # Produced at the Lawrence Livermore National Laboratory. -dnl # This file is part of HYPRE. See file COPYRIGHT for details. -dnl # -dnl # HYPRE is free software; you can redistribute it and/or modify it under the -dnl # terms of the GNU Lesser General Public License (as published by the Free -dnl # Software Foundation) version 2.1 dated February 1999. -dnl # -dnl # $Revision$ -dnl #EHEADER********************************************************************* - - - +dnl Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +dnl HYPRE Project Developers. See the top-level COPYRIGHT file for details. +dnl +dnl SPDX-License-Identifier: (Apache-2.0 OR MIT) dnl @synopsis AC_HYPRE_FIND_BLAS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) dnl diff -Nru hypre-2.16.0/src/config/HYPRE_config.h.cmake.in hypre-2.18.2/src/config/HYPRE_config.h.cmake.in --- hypre-2.16.0/src/config/HYPRE_config.h.cmake.in 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/config/HYPRE_config.h.cmake.in 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #define HYPRE_RELEASE_NAME "@CMAKE_PROJECT_NAME@" #define HYPRE_RELEASE_VERSION "@HYPRE_VERSION@" @@ -34,6 +29,12 @@ /* Define to be the max dimension size (must be at least 3) */ #define HYPRE_MAXDIM 3 +/* Use persistent communication */ +#cmakedefine HYPRE_USING_PERSISTENT_COMM + +/* Use hopscotch hashing */ +#cmakedefine HYPRE_HOPSCOTCH + /* Compile without MPI */ #cmakedefine HYPRE_SEQUENTIAL @@ -58,6 +59,12 @@ /* Use Caliper instrumentation */ #cmakedefine HYPRE_USING_CALIPER +/* Use SuperLU_Dist */ +#cmakedefine HYPRE_USING_DSUPERLU + +/* Use SuperLU */ +#cmakedefine HAVE_SUPERLU + /* #undef HYPRE_HAVE_MPI */ /* #undef HYPRE_HAVE_MPI_COMM_F2C */ diff -Nru hypre-2.16.0/src/config/HYPRE_config.h.in hypre-2.18.2/src/config/HYPRE_config.h.in --- hypre-2.16.0/src/config/HYPRE_config.h.in 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/config/HYPRE_config.h.in 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* config/HYPRE_config.h.in. Generated from configure.in by autoheader. */ @@ -73,6 +67,9 @@ /* 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 @@ -131,6 +128,9 @@ /* Define to 1 if using OpenMP on device [target mapped version] */ #undef HYPRE_DEVICE_OPENMP_MAPPED +/* Define to 1 if strictly checking OpenMP offload directives */ +#undef HYPRE_DEVICE_OPENMP_CHECK + /* Define to 1 if executing on host/device with RAJA */ #undef HYPRE_USING_RAJA @@ -138,12 +138,22 @@ #undef HYPRE_USING_KOKKOS /* Define to 1 if using NVIDIA Tools Extension (NVTX) */ -#undef USE_NVTX +#undef HYPRE_USING_NVTX -/* FIXME: replace this with USING_CUDA */ -#undef HYPRE_USING_GPU +/* Define to 1 if using cuSPARSE */ +#undef HYPRE_USING_CUSPARSE +/* Define to 1 if using cuBLAS */ +#undef HYPRE_USING_CUBLAS +/* Define to 1 if using cuRAND */ +#undef HYPRE_USING_CURAND + +/* 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 @@ -174,8 +184,7 @@ #undef HAVE_SUPERLU /* Define to 1 if using DSuperLU */ -#undef HAVE_DSUPERLU +#undef HYPRE_USING_DSUPERLU /* Define to 1 if using MLI */ #undef HAVE_MLI - diff -Nru hypre-2.16.0/src/config/hypre_lapack_macros.m4 hypre-2.18.2/src/config/hypre_lapack_macros.m4 --- hypre-2.16.0/src/config/hypre_lapack_macros.m4 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/config/hypre_lapack_macros.m4 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,7 @@ -dnl #BHEADER********************************************************************** -dnl # Copyright (c) 2008, Lawrence Livermore National Security, LLC. -dnl # Produced at the Lawrence Livermore National Laboratory. -dnl # This file is part of HYPRE. See file COPYRIGHT for details. -dnl # -dnl # HYPRE is free software; you can redistribute it and/or modify it under the -dnl # terms of the GNU Lesser General Public License (as published by the Free -dnl # Software Foundation) version 2.1 dated February 1999. -dnl # -dnl # $Revision$ -dnl #EHEADER********************************************************************** - - - +dnl Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +dnl HYPRE Project Developers. See the top-level COPYRIGHT file for details. +dnl +dnl SPDX-License-Identifier: (Apache-2.0 OR MIT) dnl @synopsis AC_HYPRE_FIND_LAPACK([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) dnl diff -Nru hypre-2.16.0/src/config/hypre_macros_misc.m4 hypre-2.18.2/src/config/hypre_macros_misc.m4 --- hypre-2.16.0/src/config/hypre_macros_misc.m4 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/config/hypre_macros_misc.m4 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,7 @@ -dnl #BHEADER********************************************************************** -dnl # Copyright (c) 2008, Lawrence Livermore National Security, LLC. -dnl # Produced at the Lawrence Livermore National Laboratory. -dnl # This file is part of HYPRE. See file COPYRIGHT for details. -dnl # -dnl # HYPRE is free software; you can redistribute it and/or modify it under the -dnl # terms of the GNU Lesser General Public License (as published by the Free -dnl # Software Foundation) version 2.1 dated February 1999. -dnl # -dnl # $Revision$ -dnl #EHEADER********************************************************************** +dnl Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +dnl HYPRE Project Developers. See the top-level COPYRIGHT file for details. +dnl +dnl SPDX-License-Identifier: (Apache-2.0 OR MIT) dnl ********************************************************************** dnl * AC_HYPRE_CHECK_MPI diff -Nru hypre-2.16.0/src/config/Makefile.config.in hypre-2.18.2/src/config/Makefile.config.in --- hypre-2.16.0/src/config/Makefile.config.in 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/config/Makefile.config.in 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) ############################################################################### ## All configurable variables are defined in the file named Makefile.config.in @@ -92,7 +85,7 @@ LIBS = @LIBS@ @CALIPER_LIBS@ @HYPRE_CUDA_LIBS@ @RAJA_LIBS@ @KOKKOS_LIBS@ FLIBS = @FLIBS@ -INCLUDES = @CALIPER_INCLUDE@ @HYPRE_RAJA_INCLUDE@ @HYPRE_KOKKOS_INCLUDE@ @HYPRE_CUDA_INCL@ +INCLUDES = @CALIPER_INCLUDE@ @HYPRE_RAJA_INCLUDE@ @HYPRE_KOKKOS_INCLUDE@ @HYPRE_CUDA_INCL@ @HYPRE_NAP_INCLUDE@ ################################################################## ## LAPACK Library Flags @@ -115,9 +108,13 @@ MPIFLAGS = @MPIFLAGS@ ################################################################## +## Node Aware MPI options +################################################################## +HYPRE_NAP_INCLUDE = @HYPRE_NAP_INCLUDE@ + +################################################################## ## CUDA options ################################################################## -HYPRE_NVCC_MAKEFILE = @HYPRE_NVCC_MAKEFILE@ HYPRE_CUDA_INCL = @HYPRE_CUDA_INCL@ HYPRE_CUDA_LIBS = @HYPRE_CUDA_LIBS@ @@ -166,6 +163,7 @@ ################################################################## ## kokkos options ################################################################## +HYPRE_KOKKOS_SRC_DIR = @HYPRE_KOKKOS_SRC_DIR@ HYPRE_KOKKOS_LIB_DIR = @HYPRE_KOKKOS_LIB_DIR@ HYPRE_KOKKOS_INCLUDE = @HYPRE_KOKKOS_INCLUDE@ HYPRE_KOKKOS_LIB = @HYPRE_KOKKOS_LIB@ diff -Nru hypre-2.16.0/src/config/Makefile.config.saved hypre-2.18.2/src/config/Makefile.config.saved --- hypre-2.16.0/src/config/Makefile.config.saved 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/config/Makefile.config.saved 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) ############################################################################### ## All configurable variables are defined in the file named Makefile.config.in diff -Nru hypre-2.16.0/src/config/windows.sh hypre-2.18.2/src/config/windows.sh --- hypre-2.16.0/src/config/windows.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/config/windows.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + # Small modifications to several hypre Makefiles needed to allow the use of the # Visual Studio CL.exe compiler on Windows. Note that this script should be run diff -Nru hypre-2.16.0/src/configure hypre-2.18.2/src/configure --- hypre-2.16.0/src/configure 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/configure 2019-10-28 22:30:04.000000000 +0000 @@ -1,7 +1,7 @@ #! /bin/sh # From configure.in Id. # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for hypre 2.16.0. +# Generated by GNU Autoconf 2.69 for hypre 2.18.2. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -10,13 +10,8 @@ # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. -# -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## @@ -586,8 +581,8 @@ # Identity of this package. PACKAGE_NAME='hypre' PACKAGE_TARNAME='hypre' -PACKAGE_VERSION='2.16.0' -PACKAGE_STRING='hypre 2.16.0' +PACKAGE_VERSION='2.18.2' +PACKAGE_STRING='hypre 2.18.2' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -660,6 +655,7 @@ HYPRE_FEI_SUBDIRS HYPRE_FEI_BASE_DIR HYPRE_FEI_SRC_DIR +HYPRE_NAP_INCLUDE HYPRE_PILUT_FILES HYPRE_PARASAILS_FILES HYPRE_EUCLID_FILES @@ -778,6 +774,12 @@ enable_global_partition enable_fortran enable_unified_memory +enable_cuda_streams +enable_nvtx +enable_cusparse +enable_cublas +enable_curand +enable_gpu_aware_mpi with_LD with_LDFLAGS with_extra_CFLAGS @@ -791,6 +793,8 @@ with_MPI_libs with_MPI_lib_dirs with_MPI_flags +with_node_aware_mpi +with_node_aware_mpi_include with_blas_lib with_blas_libs with_blas_lib_dirs @@ -800,7 +804,6 @@ with_fmangle with_fmangle_blas with_fmangle_lapack -with_fei_inc_dir with_print_errors with_timing with_openmp @@ -811,7 +814,7 @@ with_dsuperlu with_dsuperlu_include with_dsuperlu_lib -with_fei +with_fei_inc_dir with_mli with_MPI with_cuda @@ -1385,7 +1388,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures hypre 2.16.0 to adapt to many kinds of systems. +\`configure' configures hypre 2.18.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1450,7 +1453,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of hypre 2.16.0:";; + short | recursive ) echo "Configuration of hypre 2.18.2:";; esac cat <<\_ACEOF @@ -1478,6 +1481,12 @@ --enable-fortran Require a working Fortran compiler (default is YES). --enable-unified-memory Use unified memory for allocating the memory (default is NO). + --enable-cuda-streams Use CUDA streams (default is YES). + --enable-nvtx Use NVTX (default is NO). + --enable-cusparse Use cuSPARSE (default is YES). + --enable-cublas Use cuBLAS (default is NO). + --enable-curand Use cuRAND (default is YES). + --enable-gpu-aware-mpi Use GPU memory aware MPI Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1530,6 +1539,9 @@ autosearch for other MPI information. May be used with the other three MPI options or alone in conjunction with the automatic MPI search. + --with-node-aware-mpi Use Node Aware MPI (default is NO). + --with-node-aware-mpi-include=DIR + User specifies that nap_comm.hpp is in DIR. --with-blas-lib=LIBS LIBS is space-separated linkable list (enclosed in quotes) of libraries needed for BLAS. OK to use -L and -l flags in the list @@ -1566,8 +1578,6 @@ Name mangling for BLAS. See --with-fmangle. --with-fmangle-lapack=FMANGLE Name mangling for LAPACK. See --with-fmangle. - --with-fei-inc-dir=DIR DIR is the directory containing the FEI - distribution. --with-print-errors Print HYPRE errors. --with-timing Use HYPRE timing routines. --with-openmp Use OpenMP. This may affect which compiler is @@ -1587,7 +1597,8 @@ LIBS is space-separated linkable list (enclosed in quotes) of libraries needed for DSuperLU. OK to use -L and -l flags in the list - --with-fei Use internal FEI routines. + --with-fei-inc-dir=DIR DIR is the directory containing the FEI + distribution. --with-mli Use MLI --with-MPI DEFAULT: Compile with MPI. Selecting --without-MPI may affect which compiler is chosen. @@ -1719,20 +1730,15 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -hypre configure 2.16.0 +hypre configure 2.18.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. -Copyright (c) 2008, Lawrence Livermore National Security, LLC. -Produced at the Lawrence Livermore National Laboratory. -This file is part of HYPRE. See file COPYRIGHT for details. - -HYPRE is free software; you can redistribute it and/or modify it under the -terms of the GNU Lesser General Public License (as published by the Free -Software Foundation) version 2.1 dated February 1999. +Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +HYPRE Project Developers. See the top-level COPYRIGHT file for details. _ACEOF exit fi @@ -2176,7 +2182,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by hypre $as_me 2.16.0, which was +It was created by hypre $as_me 2.18.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2562,8 +2568,8 @@ HYPRE_NAME="hypre" -HYPRE_VERSION="2.16.0" -HYPRE_DATE="2019/03/20" +HYPRE_VERSION="2.18.2" +HYPRE_DATE="2019/10/28" HYPRE_TIME="00:00:00" HYPRE_BUGS="hypre-support@llnl.gov" HYPRE_SRCDIR="`pwd`" @@ -2614,7 +2620,6 @@ hypre_user_chose_mpi=no hypre_user_chose_blas=no hypre_user_chose_lapack=no -hypre_user_chose_fei=no hypre_user_chose_cuda=no hypre_user_chose_raja=no hypre_user_chose_kokkos=no @@ -2629,7 +2634,7 @@ hypre_using_superlu=no hypre_using_dsuperlu=no -hypre_using_fei=yes +hypre_using_fei=no hypre_using_mli=no hypre_using_openmp=no @@ -2638,6 +2643,12 @@ hypre_using_cuda=no hypre_using_gpu=no hypre_using_um=no +hypre_gpu_mpi=no +hypre_using_cuda_streams=no +hypre_using_nvtx=no +hypre_using_cusparse=yes +hypre_using_cublas=no +hypre_using_curand=yes hypre_using_caliper=no hypre_user_gave_caliper_lib=no @@ -2645,6 +2656,8 @@ hypre_found_cuda=no +hypre_using_node_aware_mpi=no + hypre_blas_lib_old_style=no hypre_blas_lib_dir_old_style=no hypre_lapack_lib_old_style=no @@ -2956,6 +2969,84 @@ fi +# Check whether --enable-cuda-streams was given. +if test "${enable_cuda_streams+set}" = set; then : + enableval=$enable_cuda_streams; case "${enableval}" in + yes) hypre_using_cuda_streams=yes ;; + no) hypre_using_cuda_streams=no ;; + *) hypre_using_cuda_streams=yes ;; + esac +else + hypre_using_cuda_streams=yes + +fi + + +# Check whether --enable-nvtx was given. +if test "${enable_nvtx+set}" = set; then : + enableval=$enable_nvtx; case "${enableval}" in + yes) hypre_using_nvtx=yes ;; + no) hypre_using_nvtx=no ;; + *) hypre_using_nvtx=no ;; + esac +else + hypre_using_nvtx=no + +fi + + +# Check whether --enable-cusparse was given. +if test "${enable_cusparse+set}" = set; then : + enableval=$enable_cusparse; case "${enableval}" in + yes) hypre_using_cusparse=yes ;; + no) hypre_using_cusparse=no ;; + *) hypre_using_cusparse=yes ;; + esac +else + hypre_using_cusparse=yes + +fi + + +# Check whether --enable-cublas was given. +if test "${enable_cublas+set}" = set; then : + enableval=$enable_cublas; case "${enableval}" in + yes) hypre_using_cublas=yes ;; + no) hypre_using_cublas=no ;; + *) hypre_using_cublas=no ;; + esac +else + hypre_using_cublas=no + +fi + + +# Check whether --enable-curand was given. +if test "${enable_curand+set}" = set; then : + enableval=$enable_curand; case "${enableval}" in + yes) hypre_using_curand=yes ;; + no) hypre_using_curand=no ;; + *) hypre_using_curand=yes ;; + esac +else + hypre_using_curand=yes + +fi + + +# Check whether --enable-gpu-aware-mpi was given. +if test "${enable_gpu_aware_mpi+set}" = set; then : + enableval=$enable_gpu_aware_mpi; case "${enableval}" in + yes) hypre_gpu_mpi=yes ;; + no) hypre_gpu_mpi=no ;; + *) as_fn_error $? "Bad value ${enableval} for --enable-gpu-aware-mpi" "$LINENO" 5 ;; + esac +else + hypre_gpu_mpi=no + +fi + + if test "x$CC" = "x" then @@ -3331,6 +3422,31 @@ +# Check whether --with-node-aware-mpi was given. +if test "${with_node_aware_mpi+set}" = set; then : + withval=$with_node_aware_mpi; case "$withval" in + yes) hypre_using_node_aware_mpi=yes;; + no) hypre_using_node_aware_mpi=no ;; + *) hypre_using_node_aware_mpi=no ;; + esac +else + hypre_using_node_aware_mpi=no + +fi + + + +# Check whether --with-node-aware-mpi-include was given. +if test "${with_node_aware_mpi_include+set}" = set; then : + withval=$with_node_aware_mpi_include; for nap_dir in $withval; do + HYPRE_NAP_INCLUDE="$HYPRE_NAP_INCLUDE -I$nap_dir" + done; + hypre_using_node_aware_mpi=yes + +fi + + + # Check whether --with-blas-lib was given. if test "${with_blas_lib+set}" = set; then : @@ -3478,16 +3594,6 @@ -# Check whether --with-fei-inc-dir was given. -if test "${with_fei_inc_dir+set}" = set; then : - withval=$with_fei_inc_dir; HYPRE_FEI_BASE_DIR="$withval"; - hypre_using_fei=yes; - hypre_user_chose_fei=yes - -fi - - - # Check whether --with-print-errors was given. if test "${with_print_errors+set}" = set; then : withval=$with_print_errors; if test "$withval" = "yes" @@ -3591,7 +3697,7 @@ if test "x$with_dsuperlu" = "xyes"; then : -$as_echo "#define HAVE_DSUPERLU 1" >>confdefs.h +$as_echo "#define HYPRE_USING_DSUPERLU 1" >>confdefs.h fi @@ -3617,12 +3723,10 @@ -# Check whether --with-fei was given. -if test "${with_fei+set}" = set; then : - withval=$with_fei; case "${withval}" in - no) hypre_using_fei=no ;; - *) hypre_using_fei=yes ;; - esac +# Check whether --with-fei-inc-dir was given. +if test "${with_fei_inc_dir+set}" = set; then : + withval=$with_fei_inc_dir; HYPRE_FEI_BASE_DIR="$withval"; + hypre_using_fei=yes fi @@ -7131,6 +7235,12 @@ fi +if test "$hypre_using_node_aware_mpi" = "yes" +then + $as_echo "#define HYPRE_USING_NODE_AWARE_MPI 1" >>confdefs.h + +fi + if test "$hypre_user_chose_blas" = "yes" then for blas_lib in $BLASLIBS; do @@ -7556,10 +7666,6 @@ fi fi - if test "$hypre_user_chose_fei" = "no" - then - HYPRE_FEI_BASE_DIR="$HYPRE_SRCDIR/FEI_mv/fei-base" - fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __gxx_personality_v0 in -lstdc++" >&5 $as_echo_n "checking for __gxx_personality_v0 in -lstdc++... " >&6; } if ${ac_cv_lib_stdcpp___gxx_personality_v0+:} false; then : @@ -8251,15 +8357,40 @@ if test "$hypre_user_chose_cuda" = "yes" then -$as_echo "#define HYPRE_USING_GPU 1" >>confdefs.h +$as_echo "#define HYPRE_USING_CUDA 1" >>confdefs.h -$as_echo "#define HYPRE_USING_CUDA 1" >>confdefs.h +$as_echo "#define HYPRE_USING_CUSPARSE 1" >>confdefs.h + + + if test "$hypre_using_nvtx" = "yes" + then + +$as_echo "#define HYPRE_USING_NVTX 1" >>confdefs.h + + fi + + if test "$hypre_using_cusparse" = "yes" + then +$as_echo "#define HYPRE_USING_CUSPARSE 1" >>confdefs.h -$as_echo "#define USE_NVTX 1" >>confdefs.h + fi + + if test "$hypre_using_cublas" = "yes" + then +$as_echo "#define HYPRE_USING_CUBLAS 1" >>confdefs.h + + fi + + if test "$hypre_using_curand" = "yes" + then + +$as_echo "#define HYPRE_USING_CURAND 1" >>confdefs.h + + fi for ac_prog in nvcc do @@ -8317,11 +8448,34 @@ HYPRE_CUDA_GENCODE="-gencode arch=compute_${HYPRE_CUDA_SM},\"code=sm_${HYPRE_CUDA_SM}\"" CUFLAGS+="-O2 -ccbin=$NVCCBIN ${HYPRE_CUDA_GENCODE} -expt-extended-lambda -dc -std=c++11 -Xcompiler -Wno-deprecated-register --x cu" + if test "$hypre_using_debug" = "yes" + then + CUFLAGS="-g ${CUFLAGS}" + fi CXXFLAGS="${CUFLAGS} -Xcompiler \"${CXXFLAGS}\"" CFLAGS=${CXXFLAGS} LDFLAGS="-ccbin=$NVCCBIN ${HYPRE_CUDA_GENCODE} -Xcompiler \"${LDFLAGS}\"" HYPRE_CUDA_INCL="-I${HYPRE_CUDA_PATH}/include" - HYPRE_CUDA_LIBS="-L${HYPRE_CUDA_PATH}/lib64 -lcusparse -lcudart -lcublas -lnvToolsExt" + HYPRE_CUDA_LIBS="-L${HYPRE_CUDA_PATH}/lib64 -lcudart" + if test "$hypre_using_nvtx" = "yes" + then + HYPRE_CUDA_LIBS+=" -lnvToolsExt" + fi + + if test "$hypre_using_cusparse" = "yes" + then + HYPRE_CUDA_LIBS+=" -lcusparse" + fi + + if test "$hypre_using_cublas" = "yes" + then + HYPRE_CUDA_LIBS+=" -lcublas" + fi + + if test "$hypre_using_curand" = "yes" + then + HYPRE_CUDA_LIBS+=" -lcurand" + fi fi if test "$hypre_using_um" != "yes" @@ -8364,15 +8518,23 @@ if test "$hypre_using_device_openmp" = "yes" then -$as_echo "#define USE_NVTX 1" >>confdefs.h +$as_echo "#define HYPRE_USING_CUSPARSE 1" >>confdefs.h + if test "$hypre_using_nvtx" = "yes" + then + +$as_echo "#define HYPRE_USING_NVTX 1" >>confdefs.h + + fi + $as_echo "#define HYPRE_USING_DEVICE_OPENMP 1" >>confdefs.h $as_echo "#define HYPRE_DEVICE_OPENMP_ALLOC 1" >>confdefs.h + for ac_prog in nvcc do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -8416,8 +8578,8 @@ done - CFLAGS="${CFLAGS} -DHYPRE_USING_CUSPARSE -DHYPRE_USING_OPENMP_OFFLOAD" - CXXFLAGS="${CXXFLAGS} -DHYPRE_USING_CUSPARSE -DHYPRE_USING_OPENMP_OFFLOAD" + CFLAGS="${CFLAGS}" + CXXFLAGS="${CXXFLAGS}" if test "$CC" = "clang-gpu" || test "$CC" = "mpiclang-gpu" then @@ -8429,12 +8591,22 @@ fi if test "$hypre_using_debug" = "yes" then - CFLAGS+=" -DHYPRE_OMP45_DEBUG" - CXXFLAGS+=" -DHYPRE_OMP45_DEBUG" + +$as_echo "#define HYPRE_DEVICE_OPENMP_CHECK 1" >>confdefs.h + fi HYPRE_CUDA_INCL="-I${HYPRE_CUDA_PATH}/include" - HYPRE_CUDA_LIBS="-L${HYPRE_CUDA_PATH}/lib64 -lcusparse -lcudart -lcublas -lnvToolsExt" + HYPRE_CUDA_LIBS="-L${HYPRE_CUDA_PATH}/lib64 -lcusparse -lcudart -lcurand" + if test "$hypre_using_nvtx" = "yes" + then + HYPRE_CUDA_LIBS+=" -lnvToolsExt" + fi + + CC=${CXX} + LINK_CC=${LINK_CXX} + CXXFLAGS="-x c++ ${CXXFLAGS}" + CFLAGS=${CXXFLAGS} fi if test "$hypre_using_shared" = "yes" @@ -8480,6 +8652,13 @@ BUILD_CXX_SHARED="${CXX} ${SHARED_BUILD_FLAG}" fi +if test "x$hypre_using_cuda_streams" = "xyes" +then + +$as_echo "#define HYPRE_USING_CUDA_STREAMS 1" >>confdefs.h + +fi + if test "x$hypre_using_um" = "xyes" then @@ -8498,6 +8677,13 @@ fi fi +if test "$hypre_gpu_mpi" = "yes" +then + +$as_echo "#define HYPRE_WITH_GPU_AWARE_MPI 1" >>confdefs.h + +fi + HYPRE_INSTALLDIR="${prefix}" HYPRE_LIBINSTALL="${libdir}" HYPRE_INCINSTALL="${includedir}" @@ -8698,6 +8884,8 @@ + + ac_config_files="$ac_config_files config/Makefile.config" @@ -9207,7 +9395,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by hypre $as_me 2.16.0, which was +This file was extended by hypre $as_me 2.18.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -9269,7 +9457,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -hypre config.status 2.16.0 +hypre config.status 2.18.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru hypre-2.16.0/src/distributed_ls/CMakeLists.txt hypre-2.18.2/src/distributed_ls/CMakeLists.txt --- hypre-2.16.0/src/distributed_ls/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,16 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(HDRS "") +set(SRCS "") + +add_subdirectory(Euclid) +add_subdirectory(ParaSails) +add_subdirectory(pilut) + +set(HYPRE_HEADERS ${HYPRE_HEADERS} ${HDRS} PARENT_SCOPE) +set(HYPRE_SOURCES ${HYPRE_SOURCES} ${SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/blas_dh.c hypre-2.18.2/src/distributed_ls/Euclid/blas_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/blas_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/blas_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "blas_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/blas_dh.h hypre-2.18.2/src/distributed_ls/Euclid/blas_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/blas_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/blas_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef THREADED_BLAS_DH #define THREADED_BLAS_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/CMakeLists.txt hypre-2.18.2/src/distributed_ls/Euclid/CMakeLists.txt --- hypre-2.16.0/src/distributed_ls/Euclid/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,41 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(EUCLID_SRCS + blas_dh.c + Euclid_apply.c + Euclid_dh.c + ExternalRows_dh.c + Factor_dh.c + getRow_dh.c + globalObjects.c + Hash_dh.c + Hash_i_dh.c + ilu_mpi_bj.c + ilu_mpi_pilu.c + ilu_seq.c + io_dh.c + krylov_dh.c + Mat_dh.c + mat_dh_private.c + MatGenFD.c + Mem_dh.c + Numbering_dh.c + Parser_dh.c + shellSort_dh.c + sig_dh.c + SortedList_dh.c + SortedSet_dh.c + SubdomainGraph_dh.c + TimeLog_dh.c + Timer_dh.c + Vec_dh.c +) + +convert_filenames_to_full_paths(EUCLID_SRCS) + +set(SRCS ${SRCS} ${EUCLID_SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/driver.c hypre-2.18.2/src/distributed_ls/Euclid/driver.c --- hypre-2.16.0/src/distributed_ls/Euclid/driver.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/driver.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2953 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - -/*-------------------------------------------------------------------------- - * Test driver for unstructured matrix interface (IJ_matrix interface). - * Do `driver -help' for usage info. - * This driver started from the driver for parcsr_linear_solvers, and it - * works by first building a parcsr matrix as before and then "copying" - * that matrix row-by-row into the IJMatrix interface. AJC 7/99. - *--------------------------------------------------------------------------*/ -#include -#include -#include - -#include "_hypre_utilities.h" -#include "HYPRE.h" -#include "HYPRE_parcsr_mv.h" - -#include "HYPRE_IJ_mv.h" -#include "HYPRE_parcsr_ls.h" -#include "krylov.h" - -HYPRE_Int BuildParFromFile (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); -HYPRE_Int BuildParLaplacian (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); -HYPRE_Int BuildParDifConv (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); -HYPRE_Int BuildParFromOneFile (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); -HYPRE_Int BuildFuncsFromFiles (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix A , HYPRE_Int **dof_func_ptr ); -HYPRE_Int BuildFuncsFromOneFile (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix A , HYPRE_Int **dof_func_ptr ); -HYPRE_Int BuildRhsParFromOneFile (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_Int *partitioning , HYPRE_ParVector *b_ptr ); -HYPRE_Int BuildParLaplacian9pt (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); -HYPRE_Int BuildParLaplacian27pt (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); - -#define SECOND_TIME 0 - -HYPRE_Int -main( HYPRE_Int argc, - char *argv[] ) -{ - HYPRE_Int arg_index; - HYPRE_Int print_usage; - HYPRE_Int sparsity_known = 0; - HYPRE_Int build_matrix_type; - HYPRE_Int build_matrix_arg_index; - HYPRE_Int build_rhs_type; - HYPRE_Int build_rhs_arg_index; - HYPRE_Int build_src_type; - HYPRE_Int build_src_arg_index; - HYPRE_Int build_funcs_type; - HYPRE_Int build_funcs_arg_index; - HYPRE_Int solver_id; - HYPRE_Int ioutdat; - HYPRE_Int debug_flag; - HYPRE_Int ierr = 0; - HYPRE_Int i,j,k; - HYPRE_Int indx, rest, tms; - HYPRE_Int max_levels = 25; - HYPRE_Int num_iterations; - HYPRE_Real norm; - HYPRE_Real final_res_norm; - void *object; - - HYPRE_IJMatrix ij_A; - HYPRE_IJVector ij_b; - HYPRE_IJVector ij_x; - - HYPRE_ParCSRMatrix parcsr_A; - HYPRE_ParVector b; - HYPRE_ParVector x; - - HYPRE_Solver amg_solver; - HYPRE_Solver pcg_solver; - HYPRE_Solver pcg_precond, pcg_precond_gotten; - - HYPRE_Int num_procs, myid; - HYPRE_Int local_row; - HYPRE_Int *row_sizes; - HYPRE_Int *diag_sizes; - HYPRE_Int *offdiag_sizes; - HYPRE_Int *rows; - HYPRE_Int size; - HYPRE_Int *ncols; - HYPRE_Int *col_inds; - HYPRE_Int *dof_func; - HYPRE_Int num_functions = 1; - - HYPRE_Int time_index; - MPI_Comm comm = hypre_MPI_COMM_WORLD; - HYPRE_Int M, N; - HYPRE_Int first_local_row, last_local_row, local_num_rows; - HYPRE_Int first_local_col, last_local_col, local_num_cols; - HYPRE_Int local_num_vars; - HYPRE_Int variant, overlap, domain_type; - HYPRE_Real schwarz_rlx_weight; - HYPRE_Real *values, val; - - const HYPRE_Real dt_inf = 1.e40; - HYPRE_Real dt = dt_inf; - - /* parameters for BoomerAMG */ - HYPRE_Real strong_threshold; - HYPRE_Real trunc_factor; - HYPRE_Int cycle_type; - HYPRE_Int coarsen_type = 6; - HYPRE_Int hybrid = 1; - HYPRE_Int measure_type = 0; - HYPRE_Int *num_grid_sweeps; - HYPRE_Int *grid_relax_type; - HYPRE_Int **grid_relax_points; - HYPRE_Int smooth_lev; - HYPRE_Int smooth_rlx = 8; - HYPRE_Int *smooth_option; - HYPRE_Int relax_default; - HYPRE_Int smooth_num_sweep = 1; - HYPRE_Int num_sweep = 1; - HYPRE_Real *relax_weight; - HYPRE_Real tol = 1.e-6, pc_tol = 0.; - HYPRE_Real max_row_sum = 1.; - - /* parameters for ParaSAILS */ - HYPRE_Real sai_threshold = 0.1; - HYPRE_Real sai_filter = 0.1; - - /* parameters for PILUT */ - HYPRE_Real drop_tol = -1; - HYPRE_Int nonzeros_to_keep = -1; - - /* parameters for GMRES */ - HYPRE_Int k_dim; - - /*----------------------------------------------------------- - * Initialize some stuff - *-----------------------------------------------------------*/ - - /* Initialize MPI */ - hypre_MPI_Init(&argc, &argv); - - hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); - hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); - - /*----------------------------------------------------------- - * Set defaults - *-----------------------------------------------------------*/ - - build_matrix_type = 2; - build_matrix_arg_index = argc; - build_rhs_type = 2; - build_rhs_arg_index = argc; - build_src_type = -1; - build_src_arg_index = argc; - build_funcs_type = 0; - build_funcs_arg_index = argc; - relax_default = 3; - debug_flag = 0; - - solver_id = 0; - - ioutdat = 3; - - /*----------------------------------------------------------- - * Parse command line - *-----------------------------------------------------------*/ - - print_usage = 0; - arg_index = 1; - smooth_option = hypre_CTAlloc(HYPRE_Int, max_levels, HYPRE_MEMORY_HOST); - for (i=0; i < max_levels; i++) - { - smooth_option[i] = -1; - } - - while ( (arg_index < argc) && (!print_usage) ) - { - if ( strcmp(argv[arg_index], "-fromijfile") == 0 ) - { - arg_index++; - build_matrix_type = -1; - build_matrix_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-fromparcsrfile") == 0 ) - { - arg_index++; - build_matrix_type = 0; - build_matrix_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-fromonecsrfile") == 0 ) - { - arg_index++; - build_matrix_type = 1; - build_matrix_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-laplacian") == 0 ) - { - arg_index++; - build_matrix_type = 2; - build_matrix_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-9pt") == 0 ) - { - arg_index++; - build_matrix_type = 3; - build_matrix_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-27pt") == 0 ) - { - arg_index++; - build_matrix_type = 4; - build_matrix_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-difconv") == 0 ) - { - arg_index++; - build_matrix_type = 5; - build_matrix_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-funcsfromonefile") == 0 ) - { - arg_index++; - build_funcs_type = 1; - build_funcs_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-funcsfromfile") == 0 ) - { - arg_index++; - build_funcs_type = 2; - build_funcs_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-exact_size") == 0 ) - { - arg_index++; - sparsity_known = 1; - } - else if ( strcmp(argv[arg_index], "-storage_low") == 0 ) - { - arg_index++; - sparsity_known = 2; - } - else if ( strcmp(argv[arg_index], "-concrete_parcsr") == 0 ) - { - arg_index++; - build_matrix_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-solver") == 0 ) - { - arg_index++; - solver_id = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-rhsfromfile") == 0 ) - { - arg_index++; - build_rhs_type = 0; - build_rhs_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-rhsfromonefile") == 0 ) - { - arg_index++; - build_rhs_type = 1; - build_rhs_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-rhsisone") == 0 ) - { - arg_index++; - build_rhs_type = 2; - build_rhs_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-rhsrand") == 0 ) - { - arg_index++; - build_rhs_type = 3; - build_rhs_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-xisone") == 0 ) - { - arg_index++; - build_rhs_type = 4; - build_rhs_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-rhszero") == 0 ) - { - arg_index++; - build_rhs_type = 5; - build_rhs_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-srcfromfile") == 0 ) - { - arg_index++; - build_src_type = 0; - build_rhs_type = -1; - build_src_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-srcfromonefile") == 0 ) - { - arg_index++; - build_src_type = 1; - build_rhs_type = -1; - build_src_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-srcisone") == 0 ) - { - arg_index++; - build_src_type = 2; - build_rhs_type = -1; - build_src_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-srcrand") == 0 ) - { - arg_index++; - build_src_type = 3; - build_rhs_type = -1; - build_src_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-srczero") == 0 ) - { - arg_index++; - build_src_type = 4; - build_rhs_type = -1; - build_src_arg_index = arg_index; - } - else if ( strcmp(argv[arg_index], "-cljp") == 0 ) - { - arg_index++; - coarsen_type = 0; - } - else if ( strcmp(argv[arg_index], "-ruge") == 0 ) - { - arg_index++; - coarsen_type = 1; - } - else if ( strcmp(argv[arg_index], "-ruge2b") == 0 ) - { - arg_index++; - coarsen_type = 2; - } - else if ( strcmp(argv[arg_index], "-ruge3") == 0 ) - { - arg_index++; - coarsen_type = 3; - } - else if ( strcmp(argv[arg_index], "-ruge3c") == 0 ) - { - arg_index++; - coarsen_type = 4; - } - else if ( strcmp(argv[arg_index], "-rugerlx") == 0 ) - { - arg_index++; - coarsen_type = 5; - } - else if ( strcmp(argv[arg_index], "-falgout") == 0 ) - { - arg_index++; - coarsen_type = 6; - } - else if ( strcmp(argv[arg_index], "-nohybrid") == 0 ) - { - arg_index++; - hybrid = -1; - } - else if ( strcmp(argv[arg_index], "-gm") == 0 ) - { - arg_index++; - measure_type = 1; - } - else if ( strcmp(argv[arg_index], "-rlx") == 0 ) - { - arg_index++; - relax_default = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-smooth") == 0 ) - { - arg_index++; - smooth_lev = atoi(argv[arg_index++]); - smooth_rlx = atoi(argv[arg_index++]); - for (i=0; i < smooth_lev; i++) - smooth_option[i] = smooth_rlx; - } - else if ( strcmp(argv[arg_index], "-mxl") == 0 ) - { - arg_index++; - max_levels = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-dbg") == 0 ) - { - arg_index++; - debug_flag = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-nf") == 0 ) - { - arg_index++; - num_functions = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-ns") == 0 ) - { - arg_index++; - num_sweep = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-sns") == 0 ) - { - arg_index++; - smooth_num_sweep = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-dt") == 0 ) - { - arg_index++; - dt = atof(argv[arg_index++]); - build_rhs_type = -1; - if ( build_src_type == -1 ) build_src_type = 2; - } - else if ( strcmp(argv[arg_index], "-help") == 0 ) - { - print_usage = 1; - } - else - { - arg_index++; - } - } - - /* for CGNR preconditioned with Boomeramg, only relaxation scheme 2 is - implemented, i.e. Jacobi relaxation with Matvec */ - if (solver_id == 5) relax_default = 2; - - if (solver_id == 8 || solver_id == 18) - { - max_levels = 1; - } - - /* defaults for BoomerAMG */ - if (solver_id == 0 || solver_id == 1 || solver_id == 3 || solver_id == 5 - || solver_id == 9) - { - strong_threshold = 0.25; - trunc_factor = 0.; - cycle_type = 1; - - num_grid_sweeps = hypre_CTAlloc(HYPRE_Int, 4, HYPRE_MEMORY_HOST); - grid_relax_type = hypre_CTAlloc(HYPRE_Int, 4, HYPRE_MEMORY_HOST); - grid_relax_points = hypre_CTAlloc(HYPRE_Int *, 4, HYPRE_MEMORY_HOST); - relax_weight = hypre_CTAlloc(HYPRE_Real, max_levels, HYPRE_MEMORY_HOST); - - for (i=0; i < max_levels; i++) - relax_weight[i] = 1.; - - if (coarsen_type == 5) - { - /* fine grid */ - num_grid_sweeps[0] = 3; - grid_relax_type[0] = relax_default; - grid_relax_points[0] = hypre_CTAlloc(HYPRE_Int, 3, HYPRE_MEMORY_HOST); - grid_relax_points[0][0] = -2; - grid_relax_points[0][1] = -1; - grid_relax_points[0][2] = 1; - - /* down cycle */ - num_grid_sweeps[1] = 4; - grid_relax_type[1] = relax_default; - grid_relax_points[1] = hypre_CTAlloc(HYPRE_Int, 4, HYPRE_MEMORY_HOST); - grid_relax_points[1][0] = -1; - grid_relax_points[1][1] = 1; - grid_relax_points[1][2] = -2; - grid_relax_points[1][3] = -2; - - /* up cycle */ - num_grid_sweeps[2] = 4; - grid_relax_type[2] = relax_default; - grid_relax_points[2] = hypre_CTAlloc(HYPRE_Int, 4, HYPRE_MEMORY_HOST); - grid_relax_points[2][0] = -2; - grid_relax_points[2][1] = -2; - grid_relax_points[2][2] = 1; - grid_relax_points[2][3] = -1; - } - else - { - /* fine grid */ - num_grid_sweeps[0] = 2*num_sweep; - grid_relax_type[0] = relax_default; - grid_relax_points[0] = hypre_CTAlloc(HYPRE_Int, 2*num_sweep, HYPRE_MEMORY_HOST); - for (i=0; i<2*num_sweep; i+=2) - { - grid_relax_points[0][i] = 1; - grid_relax_points[0][i+1] = -1; - } - - /* down cycle */ - num_grid_sweeps[1] = 2*num_sweep; - grid_relax_type[1] = relax_default; - grid_relax_points[1] = hypre_CTAlloc(HYPRE_Int, 2*num_sweep, HYPRE_MEMORY_HOST); - for (i=0; i<2*num_sweep; i+=2) - { - grid_relax_points[1][i] = 1; - grid_relax_points[1][i+1] = -1; - } - - /* up cycle */ - num_grid_sweeps[2] = 2*num_sweep; - grid_relax_type[2] = relax_default; - grid_relax_points[2] = hypre_CTAlloc(HYPRE_Int, 2*num_sweep, HYPRE_MEMORY_HOST); - for (i=0; i<2*num_sweep; i+=2) - { - grid_relax_points[2][i] = -1; - grid_relax_points[2][i+1] = 1; - } - } - - /* coarsest grid */ - num_grid_sweeps[3] = 1; - grid_relax_type[3] = 9; - grid_relax_points[3] = hypre_CTAlloc(HYPRE_Int, 1, HYPRE_MEMORY_HOST); - grid_relax_points[3][0] = 0; - } - - /* defaults for Schwarz */ - - variant = 0; /* multiplicative */ - overlap = 1; /* 1 layer overlap */ - domain_type = 2; /* through agglomeration */ - schwarz_rlx_weight = 1.; - - /* defaults for GMRES */ - - k_dim = 5; - - arg_index = 0; - while (arg_index < argc) - { - if ( strcmp(argv[arg_index], "-k") == 0 ) - { - arg_index++; - k_dim = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-w") == 0 ) - { - arg_index++; - if (solver_id == 0 || solver_id == 1 || solver_id == 3 - || solver_id == 5 ) - { - relax_weight[0] = atof(argv[arg_index++]); - for (i=1; i < max_levels; i++) - relax_weight[i] = relax_weight[0]; - } - } - else if ( strcmp(argv[arg_index], "-sw") == 0 ) - { - arg_index++; - schwarz_rlx_weight = atof(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-th") == 0 ) - { - arg_index++; - strong_threshold = atof(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-tol") == 0 ) - { - arg_index++; - tol = atof(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-mxrs") == 0 ) - { - arg_index++; - max_row_sum = atof(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-sai_th") == 0 ) - { - arg_index++; - sai_threshold = atof(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-sai_filt") == 0 ) - { - arg_index++; - sai_filter = atof(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-drop_tol") == 0 ) - { - arg_index++; - drop_tol = atof(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-nonzeros_to_keep") == 0 ) - { - arg_index++; - nonzeros_to_keep = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-tr") == 0 ) - { - arg_index++; - trunc_factor = atof(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-iout") == 0 ) - { - arg_index++; - ioutdat = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-var") == 0 ) - { - arg_index++; - variant = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-ov") == 0 ) - { - arg_index++; - overlap = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-dom") == 0 ) - { - arg_index++; - domain_type = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-mu") == 0 ) - { - arg_index++; - cycle_type = atoi(argv[arg_index++]); - } - else - { - arg_index++; - } - } - - /*----------------------------------------------------------- - * Print usage info - *-----------------------------------------------------------*/ - - if ( (print_usage) && (myid == 0) ) - { - hypre_printf("\n"); - hypre_printf("Usage: %s []\n", argv[0]); - hypre_printf("\n"); - hypre_printf(" -fromijfile : "); - hypre_printf("matrix read in IJ format from distributed files\n"); - hypre_printf(" -fromparcsrfile : "); - hypre_printf("matrix read in ParCSR format from distributed files\n"); - hypre_printf(" -fromonecsrfile : "); - hypre_printf("matrix read in CSR format from a file on one processor\n"); - hypre_printf("\n"); - hypre_printf(" -laplacian [] : build 5pt 2D laplacian problem (default) \n"); - hypre_printf(" -9pt [] : build 9pt 2D laplacian problem\n"); - hypre_printf(" -27pt [] : build 27pt 3D laplacian problem\n"); - hypre_printf(" -difconv [] : build convection-diffusion problem\n"); - hypre_printf(" -n : total problem size \n"); - hypre_printf(" -P : processor topology\n"); - hypre_printf(" -c : diffusion coefficients\n"); - hypre_printf(" -a : convection coefficients\n"); - hypre_printf("\n"); - hypre_printf(" -exact_size : inserts immediately into ParCSR structure\n"); - hypre_printf(" -storage_low : allocates not enough storage for aux struct\n"); - hypre_printf(" -concrete_parcsr : use parcsr matrix type as concrete type\n"); - hypre_printf("\n"); - hypre_printf(" -rhsfromfile : rhs read in IJ form from distributed files\n"); - hypre_printf(" -rhsfromonefile : rhs read from a file one one processor\n"); - hypre_printf(" -rhsrand : rhs is random vector\n"); - hypre_printf(" -rhsisone : rhs is vector with unit components (default)\n"); - hypre_printf(" -xisone : solution of all ones\n"); - hypre_printf(" -rhszero : rhs is zero vector\n"); - hypre_printf("\n"); - hypre_printf(" -dt : specify finite backward Euler time step\n"); - hypre_printf(" : -rhsfromfile, -rhsfromonefile, -rhsrand,\n"); - hypre_printf(" : -rhsrand, or -xisone will be ignored\n"); - hypre_printf(" -srcfromfile : backward Euler source read in IJ form from distributed files\n"); - hypre_printf(" -srcfromonefile : "); - hypre_printf("backward Euler source read from a file on one processor\n"); - hypre_printf(" -srcrand : "); - hypre_printf("backward Euler source is random vector with components in range 0 - 1\n"); - hypre_printf(" -srcisone : "); - hypre_printf("backward Euler source is vector with unit components (default)\n"); - hypre_printf(" -srczero : "); - hypre_printf("backward Euler source is zero-vector\n"); - hypre_printf("\n"); - hypre_printf(" -solver : solver ID\n"); - hypre_printf(" 0=AMG 1=AMG-PCG \n"); - hypre_printf(" 2=DS-PCG 3=AMG-GMRES \n"); - hypre_printf(" 4=DS-GMRES 5=AMG-CGNR \n"); - hypre_printf(" 6=DS-CGNR 7=PILUT-GMRES \n"); - hypre_printf(" 8=ParaSails-PCG 9=AMG-BiCGSTAB \n"); - hypre_printf(" 10=DS-BiCGSTAB 11=PILUT-BiCGSTAB \n"); - hypre_printf(" 12=Schwarz-PCG 18=ParaSails-GMRES\n"); - hypre_printf(" 43=Euclid-PCG 44=Euclid-GMRES \n"); - hypre_printf(" 45=Euclid-BICGSTAB\n"); - hypre_printf("\n"); - hypre_printf(" -cljp : CLJP coarsening \n"); - hypre_printf(" -ruge : Ruge coarsening (local)\n"); - hypre_printf(" -ruge3 : third pass on boundary\n"); - hypre_printf(" -ruge3c : third pass on boundary, keep c-points\n"); - hypre_printf(" -ruge2b : 2nd pass is global\n"); - hypre_printf(" -rugerlx : relaxes special points\n"); - hypre_printf(" -falgout : local ruge followed by LJP\n"); - hypre_printf(" -nohybrid : no switch in coarsening\n"); - hypre_printf(" -gm : use global measures\n"); - hypre_printf("\n"); - hypre_printf(" -rlx : relaxation type\n"); - hypre_printf(" 0=Weighted Jacobi \n"); - hypre_printf(" 1=Gauss-Seidel (very slow!) \n"); - hypre_printf(" 3=Hybrid Jacobi/Gauss-Seidel \n"); - hypre_printf(" -ns : Use sweeps on each level\n"); - hypre_printf(" (default C/F down, F/C up, F/C fine\n"); - hypre_printf("\n"); - hypre_printf(" -mu : set AMG cycles (1=V, 2=W, etc.)\n"); - hypre_printf(" -th : set AMG threshold Theta = val \n"); - hypre_printf(" -tr : set AMG interpolation truncation factor = val \n"); - hypre_printf(" -mxrs : set AMG maximum row sum threshold for dependency weakening \n"); - hypre_printf(" -nf : set number of functions for systems AMG\n"); - - hypre_printf(" -w : set Jacobi relax weight = val\n"); - hypre_printf(" -k : dimension Krylov space for GMRES\n"); - hypre_printf(" -mxl : maximum number of levels (AMG, ParaSAILS)\n"); - hypre_printf(" -tol : set solver convergence tolerance = val\n"); - hypre_printf("\n"); - hypre_printf(" -sai_th : set ParaSAILS threshold = val \n"); - hypre_printf(" -sai_filt : set ParaSAILS filter = val \n"); - hypre_printf("\n"); - hypre_printf(" -drop_tol : set threshold for dropping in PILUT\n"); - hypre_printf(" -nonzeros_to_keep : number of nonzeros in each row to keep\n"); - hypre_printf("\n"); - hypre_printf(" -iout : set output flag\n"); - hypre_printf(" 0=no output 1=matrix stats\n"); - hypre_printf(" 2=cycle stats 3=matrix & cycle stats\n"); - hypre_printf("\n"); - hypre_printf(" -dbg : set debug flag\n"); - hypre_printf(" 0=no debugging\n 1=internal timing\n 2=interpolation truncation\n 3=more detailed timing in coarsening routine\n"); - exit(1); - } - - /*----------------------------------------------------------- - * Print driver parameters - *-----------------------------------------------------------*/ - - if (myid == 0) - { - hypre_printf("Running with these driver parameters:\n"); - hypre_printf(" solver ID = %d\n\n", solver_id); - } - - /*----------------------------------------------------------- - * Set up matrix - *-----------------------------------------------------------*/ - - if ( myid == 0 && dt != dt_inf) - { - hypre_printf(" Backward Euler time step with dt = %e\n", dt); - hypre_printf(" Dirichlet 0 BCs are implicit in the spatial operator\n"); - } - - if ( build_matrix_type == -1 ) - { - HYPRE_IJMatrixRead( argv[build_matrix_arg_index], comm, - HYPRE_PARCSR, &ij_A ); - } - else if ( build_matrix_type == 0 ) - { - BuildParFromFile(argc, argv, build_matrix_arg_index, &parcsr_A); - } - else if ( build_matrix_type == 1 ) - { - BuildParFromOneFile(argc, argv, build_matrix_arg_index, &parcsr_A); - } - else if ( build_matrix_type == 2 ) - { - BuildParLaplacian(argc, argv, build_matrix_arg_index, &parcsr_A); - } - else if ( build_matrix_type == 3 ) - { - BuildParLaplacian9pt(argc, argv, build_matrix_arg_index, &parcsr_A); - } - else if ( build_matrix_type == 4 ) - { - BuildParLaplacian27pt(argc, argv, build_matrix_arg_index, &parcsr_A); - } - else if ( build_matrix_type == 5 ) - { - BuildParDifConv(argc, argv, build_matrix_arg_index, &parcsr_A); - } - else - { - hypre_printf("You have asked for an unsupported problem with\n"); - hypre_printf("build_matrix_type = %d.\n", build_matrix_type); - return(-1); - } - - time_index = hypre_InitializeTiming("Spatial operator"); - hypre_BeginTiming(time_index); - - if (build_matrix_type < 2) - { - ierr += HYPRE_IJMatrixGetObject( ij_A, &object); - parcsr_A = (HYPRE_ParCSRMatrix) object; - - ierr = HYPRE_ParCSRMatrixGetLocalRange( parcsr_A, - &first_local_row, &last_local_row , - &first_local_col, &last_local_col ); - - local_num_rows = last_local_row - first_local_row + 1; - local_num_cols = last_local_col - first_local_col + 1; - - ierr = HYPRE_IJMatrixInitialize( ij_A ); - - } - else - { - - /*----------------------------------------------------------- - * Copy the parcsr matrix into the IJMatrix through interface calls - *-----------------------------------------------------------*/ - - ierr = HYPRE_ParCSRMatrixGetLocalRange( parcsr_A, - &first_local_row, &last_local_row , - &first_local_col, &last_local_col ); - - local_num_rows = last_local_row - first_local_row + 1; - local_num_cols = last_local_col - first_local_col + 1; - - ierr += HYPRE_ParCSRMatrixGetDims( parcsr_A, &M, &N ); - - ierr += HYPRE_IJMatrixCreate( comm, first_local_row, last_local_row, - first_local_col, last_local_col, - &ij_A ); - - ierr += HYPRE_IJMatrixSetObjectType( ij_A, HYPRE_PARCSR ); - - -/* the following shows how to build an IJMatrix if one has only an - estimate for the row sizes */ - if (sparsity_known == 1) - { -/* build IJMatrix using exact row_sizes for diag and offdiag */ - - diag_sizes = hypre_CTAlloc(HYPRE_Int, local_num_rows, HYPRE_MEMORY_HOST); - offdiag_sizes = hypre_CTAlloc(HYPRE_Int, local_num_rows, HYPRE_MEMORY_HOST); - local_row = 0; - for (i=first_local_row; i<= last_local_row; i++) - { - ierr += HYPRE_ParCSRMatrixGetRow( parcsr_A, i, &size, - &col_inds, &values ); - - for (j=0; j < size; j++) - { - if (col_inds[j] < first_local_row || col_inds[j] > last_local_row) - offdiag_sizes[local_row]++; - else - diag_sizes[local_row]++; - } - local_row++; - ierr += HYPRE_ParCSRMatrixRestoreRow( parcsr_A, i, &size, - &col_inds, &values ); - } - ierr += HYPRE_IJMatrixSetDiagOffdSizes( ij_A, - (const HYPRE_Int *) diag_sizes, - (const HYPRE_Int *) offdiag_sizes ); - hypre_TFree(diag_sizes, HYPRE_MEMORY_HOST); - hypre_TFree(offdiag_sizes, HYPRE_MEMORY_HOST); - - ierr = HYPRE_IJMatrixInitialize( ij_A ); - - for (i=first_local_row; i<= last_local_row; i++) - { - ierr += HYPRE_ParCSRMatrixGetRow( parcsr_A, i, &size, - &col_inds, &values ); - - ierr += HYPRE_IJMatrixSetValues( ij_A, 1, &size, &i, - (const HYPRE_Int *) col_inds, - (const HYPRE_Real *) values ); - - ierr += HYPRE_ParCSRMatrixRestoreRow( parcsr_A, i, &size, - &col_inds, &values ); - } - } - else - { - row_sizes = hypre_CTAlloc(HYPRE_Int, local_num_rows, HYPRE_MEMORY_HOST); - - size = 5; /* this is in general too low, and supposed to test - the capability of the reallocation of the interface */ - - if (sparsity_known == 0) /* tries a more accurate estimate of the - storage */ - { - if (build_matrix_type == 2) size = 7; - if (build_matrix_type == 3) size = 9; - if (build_matrix_type == 4) size = 27; - } - - for (i=0; i < local_num_rows; i++) - row_sizes[i] = size; - - ierr = HYPRE_IJMatrixSetRowSizes ( ij_A, (const HYPRE_Int *) row_sizes ); - - hypre_TFree(row_sizes, HYPRE_MEMORY_HOST); - - ierr = HYPRE_IJMatrixInitialize( ij_A ); - - /* Loop through all locally stored rows and insert them into ij_matrix */ - for (i=first_local_row; i<= last_local_row; i++) - { - ierr += HYPRE_ParCSRMatrixGetRow( parcsr_A, i, &size, - &col_inds, &values ); - - ierr += HYPRE_IJMatrixSetValues( ij_A, 1, &size, &i, - (const HYPRE_Int *) col_inds, - (const HYPRE_Real *) values ); - - ierr += HYPRE_ParCSRMatrixRestoreRow( parcsr_A, i, &size, - &col_inds, &values ); - } - } - - ierr += HYPRE_IJMatrixAssemble( ij_A ); - - } - - hypre_EndTiming(time_index); - hypre_PrintTiming("IJ Matrix Setup", hypre_MPI_COMM_WORLD); - hypre_FinalizeTiming(time_index); - hypre_ClearTiming(); - - if (ierr) - { - hypre_printf("Error in driver building IJMatrix from parcsr matrix. \n"); - return(-1); - } - - /* This is to emphasize that one can IJMatrixAddToValues after an - IJMatrixRead or an IJMatrixAssemble. After an IJMatrixRead, - assembly is unnecessary if the sparsity pattern of the matrix is - not changed somehow. If one has not used IJMatrixRead, one has - the opportunity to IJMatrixAddTo before a IJMatrixAssemble. */ - - ncols = hypre_CTAlloc(HYPRE_Int, last_local_row - first_local_row + 1, HYPRE_MEMORY_HOST); - rows = hypre_CTAlloc(HYPRE_Int, last_local_row - first_local_row + 1, HYPRE_MEMORY_HOST); - col_inds = hypre_CTAlloc(HYPRE_Int, last_local_row - first_local_row + 1, HYPRE_MEMORY_HOST); - values = hypre_CTAlloc(HYPRE_Real, last_local_row - first_local_row + 1, HYPRE_MEMORY_HOST); - - if (dt < dt_inf) - val = 1./dt; - else - val = 0.; /* Use zero to avoid unintentional loss of significance */ - - for (i = first_local_row; i <= last_local_row; i++) - { - j = i - first_local_row; - rows[j] = i; - ncols[j] = 1; - col_inds[j] = i; - values[j] = val; - } - - ierr += HYPRE_IJMatrixAddToValues( ij_A, - local_num_rows, - ncols, rows, - (const HYPRE_Int *) col_inds, - (const HYPRE_Real *) values ); - - hypre_TFree(values, HYPRE_MEMORY_HOST); - hypre_TFree(col_inds, HYPRE_MEMORY_HOST); - hypre_TFree(rows, HYPRE_MEMORY_HOST); - hypre_TFree(ncols, HYPRE_MEMORY_HOST); - - /* If sparsity pattern is not changed since last IJMatrixAssemble call, - this should be a no-op */ - - ierr += HYPRE_IJMatrixAssemble( ij_A ); - - /*----------------------------------------------------------- - * Fetch the resulting underlying matrix out - *-----------------------------------------------------------*/ - - if (build_matrix_type > 1) - ierr += HYPRE_ParCSRMatrixDestroy(parcsr_A); - - ierr += HYPRE_IJMatrixGetObject( ij_A, &object); - parcsr_A = (HYPRE_ParCSRMatrix) object; - - /*----------------------------------------------------------- - * Set up the RHS and initial guess - *-----------------------------------------------------------*/ - - time_index = hypre_InitializeTiming("RHS and Initial Guess"); - hypre_BeginTiming(time_index); - - if ( build_rhs_type == 0 ) - { - if (myid == 0) - { - hypre_printf(" RHS vector read from file %s\n", argv[build_rhs_arg_index]); - hypre_printf(" Initial guess is 0\n"); - } - -/* RHS */ - ierr = HYPRE_IJVectorRead( argv[build_rhs_arg_index], hypre_MPI_COMM_WORLD, - HYPRE_PARCSR, &ij_b ); - ierr = HYPRE_IJVectorGetObject( ij_b, &object ); - b = (HYPRE_ParVector) object; - -/* Initial guess */ - HYPRE_IJVectorCreate(hypre_MPI_COMM_WORLD, first_local_col, last_local_col, &ij_x); - HYPRE_IJVectorSetObjectType(ij_x, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(ij_x); - - values = hypre_CTAlloc(HYPRE_Real, local_num_cols, HYPRE_MEMORY_HOST); - for (i = 0; i < local_num_cols; i++) - values[i] = 0.; - HYPRE_IJVectorSetValues(ij_x, local_num_cols, NULL, values); - hypre_TFree(values, HYPRE_MEMORY_HOST); - - ierr = HYPRE_IJVectorGetObject( ij_x, &object ); - x = (HYPRE_ParVector) object; - } - else if ( build_rhs_type == 1 ) - { - hypre_printf("build_rhs_type == 1 not currently implemented\n"); - return(-1); - -#if 0 -/* RHS */ - BuildRhsParFromOneFile(argc, argv, build_rhs_arg_index, part_b, &b); -#endif - } - else if ( build_rhs_type == 2 ) - { - if (myid == 0) - { - hypre_printf(" RHS vector has unit components\n"); - hypre_printf(" Initial guess is 0\n"); - } - -/* RHS */ - HYPRE_IJVectorCreate(hypre_MPI_COMM_WORLD, first_local_row, last_local_row, &ij_b); - HYPRE_IJVectorSetObjectType(ij_b, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(ij_b); - - values = hypre_CTAlloc(HYPRE_Real, local_num_rows, HYPRE_MEMORY_HOST); - for (i = 0; i < local_num_rows; i++) - values[i] = 1.; - HYPRE_IJVectorSetValues(ij_b, local_num_rows, NULL, values); - hypre_TFree(values, HYPRE_MEMORY_HOST); - - ierr = HYPRE_IJVectorGetObject( ij_b, &object ); - b = (HYPRE_ParVector) object; - -/* Initial guess */ - HYPRE_IJVectorCreate(hypre_MPI_COMM_WORLD, first_local_col, last_local_col, &ij_x); - HYPRE_IJVectorSetObjectType(ij_x, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(ij_x); - - values = hypre_CTAlloc(HYPRE_Real, local_num_cols, HYPRE_MEMORY_HOST); - for (i = 0; i < local_num_cols; i++) - values[i] = 0.; - HYPRE_IJVectorSetValues(ij_x, local_num_cols, NULL, values); - hypre_TFree(values, HYPRE_MEMORY_HOST); - - ierr = HYPRE_IJVectorGetObject( ij_x, &object ); - x = (HYPRE_ParVector) object; - } - else if ( build_rhs_type == 3 ) - { - if (myid == 0) - { - hypre_printf(" RHS vector has random components and unit 2-norm\n"); - hypre_printf(" Initial guess is 0\n"); - } - -/* RHS */ - HYPRE_IJVectorCreate(hypre_MPI_COMM_WORLD, first_local_row, last_local_row, &ij_b); - HYPRE_IJVectorSetObjectType(ij_b, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(ij_b); - ierr = HYPRE_IJVectorGetObject( ij_b, &object ); - b = (HYPRE_ParVector) object; - -/* For purposes of this test, HYPRE_ParVector functions are used, but these are - not necessary. For a clean use of the interface, the user "should" - modify components of ij_x by using functions HYPRE_IJVectorSetValues or - HYPRE_IJVectorAddToValues */ - - HYPRE_ParVectorSetRandomValues(b, 22775); - HYPRE_ParVectorInnerProd(b,b,&norm); - norm = 1./sqrt(norm); - ierr = HYPRE_ParVectorScale(norm, b); - -/* Initial guess */ - HYPRE_IJVectorCreate(hypre_MPI_COMM_WORLD, first_local_col, last_local_col, &ij_x); - HYPRE_IJVectorSetObjectType(ij_x, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(ij_x); - - values = hypre_CTAlloc(HYPRE_Real, local_num_cols, HYPRE_MEMORY_HOST); - for (i = 0; i < local_num_cols; i++) - values[i] = 0.; - HYPRE_IJVectorSetValues(ij_x, local_num_cols, NULL, values); - hypre_TFree(values, HYPRE_MEMORY_HOST); - - ierr = HYPRE_IJVectorGetObject( ij_x, &object ); - x = (HYPRE_ParVector) object; - } - else if ( build_rhs_type == 4 ) - { - if (myid == 0) - { - hypre_printf(" RHS vector set for solution with unit components\n"); - hypre_printf(" Initial guess is 0\n"); - } - -/* Temporary use of solution vector */ - HYPRE_IJVectorCreate(hypre_MPI_COMM_WORLD, first_local_col, last_local_col, &ij_x); - HYPRE_IJVectorSetObjectType(ij_x, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(ij_x); - - values = hypre_CTAlloc(HYPRE_Real, local_num_cols, HYPRE_MEMORY_HOST); - for (i = 0; i < local_num_cols; i++) - values[i] = 1.; - HYPRE_IJVectorSetValues(ij_x, local_num_cols, NULL, values); - hypre_TFree(values, HYPRE_MEMORY_HOST); - - ierr = HYPRE_IJVectorGetObject( ij_x, &object ); - x = (HYPRE_ParVector) object; - -/* RHS */ - HYPRE_IJVectorCreate(hypre_MPI_COMM_WORLD, first_local_row, last_local_row, &ij_b); - HYPRE_IJVectorSetObjectType(ij_b, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(ij_b); - ierr = HYPRE_IJVectorGetObject( ij_b, &object ); - b = (HYPRE_ParVector) object; - - HYPRE_ParCSRMatrixMatvec(1.,parcsr_A,x,0.,b); - -/* Initial guess */ - values = hypre_CTAlloc(HYPRE_Real, local_num_cols, HYPRE_MEMORY_HOST); - for (i = 0; i < local_num_cols; i++) - values[i] = 0.; - HYPRE_IJVectorSetValues(ij_x, local_num_cols, NULL, values); - hypre_TFree(values, HYPRE_MEMORY_HOST); - } - else if ( build_rhs_type == 5 ) - { - if (myid == 0) - { - hypre_printf(" RHS vector is 0\n"); - hypre_printf(" Initial guess has unit components\n"); - } - -/* RHS */ - HYPRE_IJVectorCreate(hypre_MPI_COMM_WORLD, first_local_row, last_local_row, &ij_b); - HYPRE_IJVectorSetObjectType(ij_b, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(ij_b); - - values = hypre_CTAlloc(HYPRE_Real, local_num_rows, HYPRE_MEMORY_HOST); - for (i = 0; i < local_num_rows; i++) - values[i] = 0.; - HYPRE_IJVectorSetValues(ij_b, local_num_rows, NULL, values); - hypre_TFree(values, HYPRE_MEMORY_HOST); - - ierr = HYPRE_IJVectorGetObject( ij_b, &object ); - b = (HYPRE_ParVector) object; - -/* Initial guess */ - HYPRE_IJVectorCreate(hypre_MPI_COMM_WORLD, first_local_col, last_local_col, &ij_x); - HYPRE_IJVectorSetObjectType(ij_x, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(ij_x); - - values = hypre_CTAlloc(HYPRE_Real, local_num_cols, HYPRE_MEMORY_HOST); - for (i = 0; i < local_num_cols; i++) - values[i] = 1.; - HYPRE_IJVectorSetValues(ij_x, local_num_cols, NULL, values); - hypre_TFree(values, HYPRE_MEMORY_HOST); - - ierr = HYPRE_IJVectorGetObject( ij_x, &object ); - x = (HYPRE_ParVector) object; - } - - if ( build_src_type == 0 ) - { -#if 0 -/* RHS */ - BuildRhsParFromFile(argc, argv, build_src_arg_index, &b); -#endif - - if (myid == 0) - { - hypre_printf(" Source vector read from file %s\n", argv[build_src_arg_index]); - hypre_printf(" Initial unknown vector in evolution is 0\n"); - } - - ierr = HYPRE_IJVectorRead( argv[build_src_arg_index], hypre_MPI_COMM_WORLD, - HYPRE_PARCSR, &ij_b ); - - ierr = HYPRE_IJVectorGetObject( ij_b, &object ); - b = (HYPRE_ParVector) object; - -/* Initial unknown vector */ - HYPRE_IJVectorCreate(hypre_MPI_COMM_WORLD, first_local_col, last_local_col, &ij_x); - HYPRE_IJVectorSetObjectType(ij_x, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(ij_x); - - values = hypre_CTAlloc(HYPRE_Real, local_num_cols, HYPRE_MEMORY_HOST); - for (i = 0; i < local_num_cols; i++) - values[i] = 0.; - HYPRE_IJVectorSetValues(ij_x, local_num_cols, NULL, values); - hypre_TFree(values, HYPRE_MEMORY_HOST); - - ierr = HYPRE_IJVectorGetObject( ij_x, &object ); - x = (HYPRE_ParVector) object; - } - else if ( build_src_type == 1 ) - { - hypre_printf("build_src_type == 1 not currently implemented\n"); - return(-1); - -#if 0 - BuildRhsParFromOneFile(argc, argv, build_src_arg_index, part_b, &b); -#endif - } - else if ( build_src_type == 2 ) - { - if (myid == 0) - { - hypre_printf(" Source vector has unit components\n"); - hypre_printf(" Initial unknown vector is 0\n"); - } - -/* RHS */ - HYPRE_IJVectorCreate(hypre_MPI_COMM_WORLD, first_local_row, last_local_row, &ij_b); - HYPRE_IJVectorSetObjectType(ij_b, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(ij_b); - - values = hypre_CTAlloc(HYPRE_Real, local_num_rows, HYPRE_MEMORY_HOST); - for (i = 0; i < local_num_rows; i++) - values[i] = 1.; - HYPRE_IJVectorSetValues(ij_b, local_num_rows, NULL, values); - hypre_TFree(values, HYPRE_MEMORY_HOST); - - ierr = HYPRE_IJVectorGetObject( ij_b, &object ); - b = (HYPRE_ParVector) object; - -/* Initial guess */ - HYPRE_IJVectorCreate(hypre_MPI_COMM_WORLD, first_local_col, last_local_col, &ij_x); - HYPRE_IJVectorSetObjectType(ij_x, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(ij_x); - -/* For backward Euler the previous backward Euler iterate (assumed - 0 here) is usually used as the initial guess */ - values = hypre_CTAlloc(HYPRE_Real, local_num_cols, HYPRE_MEMORY_HOST); - for (i = 0; i < local_num_cols; i++) - values[i] = 0.; - HYPRE_IJVectorSetValues(ij_x, local_num_cols, NULL, values); - hypre_TFree(values, HYPRE_MEMORY_HOST); - - ierr = HYPRE_IJVectorGetObject( ij_x, &object ); - x = (HYPRE_ParVector) object; - } - else if ( build_src_type == 3 ) - { - if (myid == 0) - { - hypre_printf(" Source vector has random components in range 0 - 1\n"); - hypre_printf(" Initial unknown vector is 0\n"); - } - -/* RHS */ - HYPRE_IJVectorCreate(hypre_MPI_COMM_WORLD, first_local_row, last_local_row, &ij_b); - HYPRE_IJVectorSetObjectType(ij_b, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(ij_b); - values = hypre_CTAlloc(HYPRE_Real, local_num_rows, HYPRE_MEMORY_HOST); - - hypre_SeedRand(myid); - for (i = 0; i < local_num_rows; i++) - values[i] = hypre_Rand(); - - HYPRE_IJVectorSetValues(ij_b, local_num_rows, NULL, values); - hypre_TFree(values, HYPRE_MEMORY_HOST); - - ierr = HYPRE_IJVectorGetObject( ij_b, &object ); - b = (HYPRE_ParVector) object; - -/* Initial guess */ - HYPRE_IJVectorCreate(hypre_MPI_COMM_WORLD, first_local_col, last_local_col, &ij_x); - HYPRE_IJVectorSetObjectType(ij_x, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(ij_x); - -/* For backward Euler the previous backward Euler iterate (assumed - 0 here) is usually used as the initial guess */ - values = hypre_CTAlloc(HYPRE_Real, local_num_cols, HYPRE_MEMORY_HOST); - for (i = 0; i < local_num_cols; i++) - values[i] = 0.; - HYPRE_IJVectorSetValues(ij_x, local_num_cols, NULL, values); - hypre_TFree(values, HYPRE_MEMORY_HOST); - - ierr = HYPRE_IJVectorGetObject( ij_x, &object ); - x = (HYPRE_ParVector) object; - } - else if ( build_src_type == 4 ) - { - if (myid == 0) - { - hypre_printf(" Source vector is 0 \n"); - hypre_printf(" Initial unknown vector has random components in range 0 - 1\n"); - } - -/* RHS */ - HYPRE_IJVectorCreate(hypre_MPI_COMM_WORLD, first_local_row, last_local_row, &ij_b); - HYPRE_IJVectorSetObjectType(ij_b, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(ij_b); - - values = hypre_CTAlloc(HYPRE_Real, local_num_rows, HYPRE_MEMORY_HOST); - hypre_SeedRand(myid); - for (i = 0; i < local_num_rows; i++) - values[i] = hypre_Rand()/dt; - HYPRE_IJVectorSetValues(ij_b, local_num_rows, NULL, values); - hypre_TFree(values, HYPRE_MEMORY_HOST); - - ierr = HYPRE_IJVectorGetObject( ij_b, &object ); - b = (HYPRE_ParVector) object; - -/* Initial guess */ - HYPRE_IJVectorCreate(hypre_MPI_COMM_WORLD, first_local_col, last_local_col, &ij_x); - HYPRE_IJVectorSetObjectType(ij_x, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(ij_x); - -/* For backward Euler the previous backward Euler iterate (assumed - random in 0 - 1 here) is usually used as the initial guess */ - values = hypre_CTAlloc(HYPRE_Real, local_num_cols, HYPRE_MEMORY_HOST); - hypre_SeedRand(myid); - for (i = 0; i < local_num_cols; i++) - values[i] = hypre_Rand(); - HYPRE_IJVectorSetValues(ij_x, local_num_cols, NULL, values); - hypre_TFree(values, HYPRE_MEMORY_HOST); - - ierr = HYPRE_IJVectorGetObject( ij_x, &object ); - x = (HYPRE_ParVector) object; - } - - hypre_EndTiming(time_index); - hypre_PrintTiming("IJ Vector Setup", hypre_MPI_COMM_WORLD); - hypre_FinalizeTiming(time_index); - hypre_ClearTiming(); - - HYPRE_IJMatrixPrint(ij_A, "driver.out.A"); - HYPRE_IJVectorPrint(ij_x, "driver.out.x0"); - - if (num_functions > 1) - { - dof_func = NULL; - if (build_funcs_type == 1) - { - BuildFuncsFromOneFile(argc, argv, build_funcs_arg_index, parcsr_A, &dof_func); - } - else if (build_funcs_type == 2) - { - BuildFuncsFromFiles(argc, argv, build_funcs_arg_index, parcsr_A, &dof_func); - } - else - { - local_num_vars = local_num_rows; - dof_func = hypre_CTAlloc(HYPRE_Int, local_num_vars, HYPRE_MEMORY_HOST); - if (myid == 0) - hypre_printf (" Number of unknown functions = %d \n", num_functions); - rest = first_local_row-((first_local_row/num_functions)*num_functions); - indx = num_functions-rest; - if (rest == 0) indx = 0; - k = num_functions - 1; - for (j = indx-1; j > -1; j--) - dof_func[j] = k--; - tms = local_num_vars/num_functions; - if (tms*num_functions+indx > local_num_vars) tms--; - for (j=0; j < tms; j++) - { - for (k=0; k < num_functions; k++) - dof_func[indx++] = k; - } - k = 0; - while (indx < local_num_vars) - dof_func[indx++] = k++; - } - } - - /*----------------------------------------------------------- - * Solve the system using AMG - *-----------------------------------------------------------*/ - - if (solver_id == 0) - { - if (myid == 0) hypre_printf("Solver: AMG\n"); - time_index = hypre_InitializeTiming("BoomerAMG Setup"); - hypre_BeginTiming(time_index); - - HYPRE_BoomerAMGCreate(&amg_solver); - HYPRE_BoomerAMGSetCoarsenType(amg_solver, (hybrid*coarsen_type)); - HYPRE_BoomerAMGSetMeasureType(amg_solver, measure_type); - HYPRE_BoomerAMGSetTol(amg_solver, tol); - HYPRE_BoomerAMGSetStrongThreshold(amg_solver, strong_threshold); - HYPRE_BoomerAMGSetTruncFactor(amg_solver, trunc_factor); -/* note: log is written to standard output, not to file */ - HYPRE_BoomerAMGSetLogging(amg_solver, ioutdat, "driver.out.log"); - HYPRE_BoomerAMGSetCycleType(amg_solver, cycle_type); - HYPRE_BoomerAMGSetNumGridSweeps(amg_solver, num_grid_sweeps); - HYPRE_BoomerAMGSetGridRelaxType(amg_solver, grid_relax_type); - HYPRE_BoomerAMGSetRelaxWeight(amg_solver, relax_weight); - HYPRE_BoomerAMGSetSmoothOption(amg_solver, smooth_option); - HYPRE_BoomerAMGSetSmoothNumSweep(amg_solver, smooth_num_sweep); - HYPRE_BoomerAMGSetGridRelaxPoints(amg_solver, grid_relax_points); - HYPRE_BoomerAMGSetMaxLevels(amg_solver, max_levels); - HYPRE_BoomerAMGSetMaxRowSum(amg_solver, max_row_sum); - HYPRE_BoomerAMGSetDebugFlag(amg_solver, debug_flag); - HYPRE_BoomerAMGSetVariant(amg_solver, variant); - HYPRE_BoomerAMGSetOverlap(amg_solver, overlap); - HYPRE_BoomerAMGSetDomainType(amg_solver, domain_type); - HYPRE_BoomerAMGSetSchwarzRlxWeight(amg_solver, schwarz_rlx_weight); - HYPRE_BoomerAMGSetNumFunctions(amg_solver, num_functions); - if (num_functions > 1) - HYPRE_BoomerAMGSetDofFunc(amg_solver, dof_func); - - HYPRE_BoomerAMGSetup(amg_solver, parcsr_A, b, x); - - hypre_EndTiming(time_index); - hypre_PrintTiming("Setup phase times", hypre_MPI_COMM_WORLD); - hypre_FinalizeTiming(time_index); - hypre_ClearTiming(); - - time_index = hypre_InitializeTiming("BoomerAMG Solve"); - hypre_BeginTiming(time_index); - - HYPRE_BoomerAMGSolve(amg_solver, parcsr_A, b, x); - - hypre_EndTiming(time_index); - hypre_PrintTiming("Solve phase times", hypre_MPI_COMM_WORLD); - hypre_FinalizeTiming(time_index); - hypre_ClearTiming(); - -#if SECOND_TIME - /* run a second time to check for memory leaks */ - HYPRE_ParVectorSetRandomValues(x, 775); - HYPRE_BoomerAMGSetup(amg_solver, parcsr_A, b, x); - HYPRE_BoomerAMGSolve(amg_solver, parcsr_A, b, x); -#endif - - HYPRE_BoomerAMGDestroy(amg_solver); - } - - /*----------------------------------------------------------- - * Solve the system using PCG - *-----------------------------------------------------------*/ - - if (solver_id == 1 || solver_id == 2 || solver_id == 8 || - solver_id == 12 || solver_id == 43) - { - time_index = hypre_InitializeTiming("PCG Setup"); - hypre_BeginTiming(time_index); - - HYPRE_ParCSRPCGCreate(hypre_MPI_COMM_WORLD, &pcg_solver); - HYPRE_PCGSetMaxIter(pcg_solver, 500); - HYPRE_PCGSetTol(pcg_solver, tol); - HYPRE_PCGSetTwoNorm(pcg_solver, 1); - HYPRE_PCGSetRelChange(pcg_solver, 0); - HYPRE_PCGSetLogging(pcg_solver, 1); - - if (solver_id == 1) - { - /* use BoomerAMG as preconditioner */ - ioutdat = 1; - if (myid == 0) hypre_printf("Solver: AMG-PCG\n"); - HYPRE_BoomerAMGCreate(&pcg_precond); - HYPRE_BoomerAMGSetTol(pcg_precond, pc_tol); - HYPRE_BoomerAMGSetCoarsenType(pcg_precond, (hybrid*coarsen_type)); - HYPRE_BoomerAMGSetMeasureType(pcg_precond, measure_type); - HYPRE_BoomerAMGSetStrongThreshold(pcg_precond, strong_threshold); - HYPRE_BoomerAMGSetTruncFactor(pcg_precond, trunc_factor); - HYPRE_BoomerAMGSetLogging(pcg_precond, ioutdat, "driver.out.log"); - HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); - HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); - HYPRE_BoomerAMGSetNumGridSweeps(pcg_precond, num_grid_sweeps); - HYPRE_BoomerAMGSetGridRelaxType(pcg_precond, grid_relax_type); - HYPRE_BoomerAMGSetRelaxWeight(pcg_precond, relax_weight); - HYPRE_BoomerAMGSetSmoothOption(pcg_precond, smooth_option); - HYPRE_BoomerAMGSetSmoothNumSweep(pcg_precond, smooth_num_sweep); - HYPRE_BoomerAMGSetGridRelaxPoints(pcg_precond, grid_relax_points); - HYPRE_BoomerAMGSetMaxLevels(pcg_precond, max_levels); - HYPRE_BoomerAMGSetMaxRowSum(pcg_precond, max_row_sum); - HYPRE_BoomerAMGSetNumFunctions(pcg_precond, num_functions); - HYPRE_BoomerAMGSetVariant(pcg_precond, variant); - HYPRE_BoomerAMGSetOverlap(pcg_precond, overlap); - HYPRE_BoomerAMGSetDomainType(pcg_precond, domain_type); - HYPRE_BoomerAMGSetSchwarzRlxWeight(pcg_precond, schwarz_rlx_weight); - if (num_functions > 1) - HYPRE_BoomerAMGSetDofFunc(pcg_precond, dof_func); - HYPRE_PCGSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSolve, - (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSetup, - pcg_precond); - } - else if (solver_id == 2) - { - - /* use diagonal scaling as preconditioner */ - if (myid == 0) hypre_printf("Solver: DS-PCG\n"); - pcg_precond = NULL; - - HYPRE_PCGSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSRDiagScale, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSRDiagScaleSetup, - pcg_precond); - hypre_TFree(smooth_option, HYPRE_MEMORY_HOST); - } - else if (solver_id == 8) - { - /* use ParaSails preconditioner */ - if (myid == 0) hypre_printf("Solver: ParaSails-PCG\n"); - - HYPRE_ParaSailsCreate(hypre_MPI_COMM_WORLD, &pcg_precond); - HYPRE_ParaSailsSetParams(pcg_precond, sai_threshold, max_levels); - HYPRE_ParaSailsSetFilter(pcg_precond, sai_filter); - HYPRE_ParaSailsSetLogging(pcg_precond, ioutdat); - - HYPRE_PCGSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_ParaSailsSolve, - (HYPRE_PtrToSolverFcn) HYPRE_ParaSailsSetup, - pcg_precond); - hypre_TFree(smooth_option, HYPRE_MEMORY_HOST); - } - else if (solver_id == 12) - { - /* use ParaSails preconditioner */ - if (myid == 0) hypre_printf("Solver: Schwarz-PCG\n"); - - HYPRE_SchwarzCreate(&pcg_precond); - HYPRE_SchwarzSetVariant(pcg_precond, variant); - HYPRE_SchwarzSetOverlap(pcg_precond, overlap); - HYPRE_SchwarzSetDomainType(pcg_precond, domain_type); - HYPRE_SchwarzSetRelaxWeight(pcg_precond, schwarz_rlx_weight); - - HYPRE_PCGSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_SchwarzSolve, - (HYPRE_PtrToSolverFcn) HYPRE_SchwarzSetup, - pcg_precond); - hypre_TFree(smooth_option, HYPRE_MEMORY_HOST); - } - else if (solver_id == 43) - { - /* use Euclid preconditioning */ - if (myid == 0) hypre_printf("Solver: Euclid-PCG\n"); - - HYPRE_ParCSREuclidCreate(hypre_MPI_COMM_WORLD, &pcg_precond); - - /* note: There are three three methods of setting run-time - parameters for Euclid: (see HYPRE_parcsr_ls.h); here - we'll use what I think is simplest: let Euclid internally - parse the command line. - */ - HYPRE_ParCSREuclidSetParams(pcg_precond, argc, argv); - - HYPRE_PCGSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSREuclidSolve, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSREuclidSetup, - pcg_precond); - hypre_TFree(smooth_option, HYPRE_MEMORY_HOST); - } - - HYPRE_PCGGetPrecond(pcg_solver, &pcg_precond_gotten); - if (pcg_precond_gotten != pcg_precond) - { - hypre_printf("HYPRE_ParCSRPCGGetPrecond got bad precond\n"); - return(-1); - } - else - if (myid == 0) - hypre_printf("HYPRE_ParCSRPCGGetPrecond got good precond\n"); - HYPRE_PCGSetup(pcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)b, (HYPRE_Vector)x); - - hypre_EndTiming(time_index); - hypre_PrintTiming("Setup phase times", hypre_MPI_COMM_WORLD); - hypre_FinalizeTiming(time_index); - hypre_ClearTiming(); - - time_index = hypre_InitializeTiming("PCG Solve"); - hypre_BeginTiming(time_index); - - HYPRE_PCGSolve(pcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)b, (HYPRE_Vector)x); - - hypre_EndTiming(time_index); - hypre_PrintTiming("Solve phase times", hypre_MPI_COMM_WORLD); - hypre_FinalizeTiming(time_index); - hypre_ClearTiming(); - - HYPRE_PCGGetNumIterations(pcg_solver, &num_iterations); - HYPRE_PCGGetFinalRelativeResidualNorm(pcg_solver, &final_res_norm); - -#if SECOND_TIME - /* run a second time to check for memory leaks */ - HYPRE_ParVectorSetRandomValues(x, 775); - HYPRE_PCGSetup(pcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)b, (HYPRE_Vector)x); - HYPRE_PCGSolve(pcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)b, (HYPRE_Vector)x); -#endif - - HYPRE_ParCSRPCGDestroy(pcg_solver); - - if (solver_id == 1) - { - HYPRE_BoomerAMGDestroy(pcg_precond); - } - else if (solver_id == 8) - { - HYPRE_ParaSailsDestroy(pcg_precond); - } - else if (solver_id == 12) - { - HYPRE_SchwarzDestroy(pcg_precond); - } - else if (solver_id == 43) - { - HYPRE_ParCSREuclidPrintParams(pcg_precond); - HYPRE_ParCSREuclidDestroy(pcg_precond); - } - - if (myid == 0) - { - hypre_printf("\n"); - hypre_printf("Iterations = %d\n", num_iterations); - hypre_printf("Final Relative Residual Norm = %e\n", final_res_norm); - hypre_printf("\n"); - } - - } - - /*----------------------------------------------------------- - * Solve the system using GMRES - *-----------------------------------------------------------*/ - - if (solver_id == 3 || solver_id == 4 || solver_id == 7 - || solver_id == 18 || solver_id == 44) - { - time_index = hypre_InitializeTiming("GMRES Setup"); - hypre_BeginTiming(time_index); - - HYPRE_ParCSRGMRESCreate(hypre_MPI_COMM_WORLD, &pcg_solver); - HYPRE_GMRESSetKDim(pcg_solver, k_dim); - HYPRE_GMRESSetMaxIter(pcg_solver, 1000); - HYPRE_GMRESSetTol(pcg_solver, tol); - HYPRE_GMRESSetLogging(pcg_solver, 1); - - if (solver_id == 3) - { - /* use BoomerAMG as preconditioner */ - if (myid == 0) hypre_printf("Solver: AMG-GMRES\n"); - - HYPRE_BoomerAMGCreate(&pcg_precond); - HYPRE_BoomerAMGSetTol(pcg_precond, pc_tol); - HYPRE_BoomerAMGSetCoarsenType(pcg_precond, (hybrid*coarsen_type)); - HYPRE_BoomerAMGSetMeasureType(pcg_precond, measure_type); - HYPRE_BoomerAMGSetStrongThreshold(pcg_precond, strong_threshold); - HYPRE_BoomerAMGSetTruncFactor(pcg_precond, trunc_factor); - HYPRE_BoomerAMGSetLogging(pcg_precond, ioutdat, "driver.out.log"); - HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); - HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); - HYPRE_BoomerAMGSetNumGridSweeps(pcg_precond, num_grid_sweeps); - HYPRE_BoomerAMGSetGridRelaxType(pcg_precond, grid_relax_type); - HYPRE_BoomerAMGSetRelaxWeight(pcg_precond, relax_weight); - HYPRE_BoomerAMGSetSmoothOption(pcg_precond, smooth_option); - HYPRE_BoomerAMGSetSmoothNumSweep(pcg_precond, smooth_num_sweep); - HYPRE_BoomerAMGSetGridRelaxPoints(pcg_precond, grid_relax_points); - HYPRE_BoomerAMGSetMaxLevels(pcg_precond, max_levels); - HYPRE_BoomerAMGSetMaxRowSum(pcg_precond, max_row_sum); - HYPRE_BoomerAMGSetNumFunctions(pcg_precond, num_functions); - HYPRE_BoomerAMGSetVariant(pcg_precond, variant); - HYPRE_BoomerAMGSetOverlap(pcg_precond, overlap); - HYPRE_BoomerAMGSetDomainType(pcg_precond, domain_type); - if (num_functions > 1) - HYPRE_BoomerAMGSetDofFunc(pcg_precond, dof_func); - HYPRE_GMRESSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSolve, - (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSetup, - pcg_precond); - } - else if (solver_id == 4) - { - /* use diagonal scaling as preconditioner */ - if (myid == 0) hypre_printf("Solver: DS-GMRES\n"); - pcg_precond = NULL; - - HYPRE_GMRESSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSRDiagScale, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSRDiagScaleSetup, - pcg_precond); - hypre_TFree(smooth_option, HYPRE_MEMORY_HOST); - } - else if (solver_id == 7) - { - /* use PILUT as preconditioner */ - if (myid == 0) hypre_printf("Solver: PILUT-GMRES\n"); - - ierr = HYPRE_ParCSRPilutCreate( hypre_MPI_COMM_WORLD, &pcg_precond ); - if (ierr) { - hypre_printf("Error in ParPilutCreate\n"); - } - - HYPRE_GMRESSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSRPilutSolve, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSRPilutSetup, - pcg_precond); - hypre_TFree(smooth_option, HYPRE_MEMORY_HOST); - - if (drop_tol >= 0 ) - HYPRE_ParCSRPilutSetDropTolerance( pcg_precond, - drop_tol ); - - if (nonzeros_to_keep >= 0 ) - HYPRE_ParCSRPilutSetFactorRowSize( pcg_precond, - nonzeros_to_keep ); - } - else if (solver_id == 18) - { - /* use ParaSails preconditioner */ - if (myid == 0) hypre_printf("Solver: ParaSails-GMRES\n"); - - HYPRE_ParaSailsCreate(hypre_MPI_COMM_WORLD, &pcg_precond); - HYPRE_ParaSailsSetParams(pcg_precond, sai_threshold, max_levels); - HYPRE_ParaSailsSetFilter(pcg_precond, sai_filter); - HYPRE_ParaSailsSetLogging(pcg_precond, ioutdat); - HYPRE_ParaSailsSetSym(pcg_precond, 0); - - HYPRE_GMRESSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_ParaSailsSolve, - (HYPRE_PtrToSolverFcn) HYPRE_ParaSailsSetup, - pcg_precond); - hypre_TFree(smooth_option, HYPRE_MEMORY_HOST); - } - else if (solver_id == 44) - { - /* use Euclid preconditioning */ - if (myid == 0) hypre_printf("Solver: Euclid-GMRES\n"); - - HYPRE_ParCSREuclidCreate(hypre_MPI_COMM_WORLD, &pcg_precond); - - /* note: There are three three methods of setting run-time - parameters for Euclid: (see HYPRE_parcsr_ls.h); here - we'll use what I think is simplest: let Euclid internally - parse the command line. - */ - HYPRE_ParCSREuclidSetParams(pcg_precond, argc, argv); - - HYPRE_GMRESSetPrecond (pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSREuclidSolve, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSREuclidSetup, - pcg_precond); - hypre_TFree(smooth_option, HYPRE_MEMORY_HOST); - } - - HYPRE_GMRESGetPrecond(pcg_solver, &pcg_precond_gotten); - if (pcg_precond_gotten != pcg_precond) - { - hypre_printf("HYPRE_GMRESGetPrecond got bad precond\n"); - return(-1); - } - else - if (myid == 0) - hypre_printf("HYPRE_GMRESGetPrecond got good precond\n"); - HYPRE_GMRESSetup - (pcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)b, (HYPRE_Vector)x); - - hypre_EndTiming(time_index); - hypre_PrintTiming("Setup phase times", hypre_MPI_COMM_WORLD); - hypre_FinalizeTiming(time_index); - hypre_ClearTiming(); - - time_index = hypre_InitializeTiming("GMRES Solve"); - hypre_BeginTiming(time_index); - - HYPRE_GMRESSolve - (pcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)b, (HYPRE_Vector)x); - - hypre_EndTiming(time_index); - hypre_PrintTiming("Solve phase times", hypre_MPI_COMM_WORLD); - hypre_FinalizeTiming(time_index); - hypre_ClearTiming(); - - HYPRE_GMRESGetNumIterations(pcg_solver, &num_iterations); - HYPRE_GMRESGetFinalRelativeResidualNorm(pcg_solver,&final_res_norm); -#if SECOND_TIME - /* run a second time to check for memory leaks */ - HYPRE_ParVectorSetRandomValues(x, 775); - HYPRE_GMRESSetup(pcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)b, (HYPRE_Vector)x); - HYPRE_GMRESSolve(pcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)b, (HYPRE_Vector)x); -#endif - - HYPRE_ParCSRGMRESDestroy(pcg_solver); - - if (solver_id == 3) - { - HYPRE_BoomerAMGDestroy(pcg_precond); - } - - if (solver_id == 7) - { - HYPRE_ParCSRPilutDestroy(pcg_precond); - } - else if (solver_id == 18) - { - HYPRE_ParaSailsDestroy(pcg_precond); - } - else if (solver_id == 44) - { - HYPRE_ParCSREuclidPrintParams(pcg_precond); - HYPRE_ParCSREuclidDestroy(pcg_precond); - } - - if (myid == 0) - { - hypre_printf("\n"); - hypre_printf("GMRES Iterations = %d\n", num_iterations); - hypre_printf("Final GMRES Relative Residual Norm = %e\n", final_res_norm); - hypre_printf("\n"); - } - } - /*----------------------------------------------------------- - * Solve the system using BiCGSTAB - *-----------------------------------------------------------*/ - - if (solver_id == 9 || solver_id == 10 || solver_id == 11 || solver_id == 45) - { - time_index = hypre_InitializeTiming("BiCGSTAB Setup"); - hypre_BeginTiming(time_index); - - HYPRE_ParCSRBiCGSTABCreate(hypre_MPI_COMM_WORLD, &pcg_solver); - HYPRE_BiCGSTABSetMaxIter(pcg_solver, 1000); - HYPRE_BiCGSTABSetTol(pcg_solver, tol); - HYPRE_BiCGSTABSetLogging(pcg_solver, 1); - - if (solver_id == 9) - { - /* use BoomerAMG as preconditioner */ - if (myid == 0) hypre_printf("Solver: AMG-BiCGSTAB\n"); - - HYPRE_BoomerAMGCreate(&pcg_precond); - HYPRE_BoomerAMGSetTol(pcg_precond, pc_tol); - HYPRE_BoomerAMGSetCoarsenType(pcg_precond, (hybrid*coarsen_type)); - HYPRE_BoomerAMGSetMeasureType(pcg_precond, measure_type); - HYPRE_BoomerAMGSetStrongThreshold(pcg_precond, strong_threshold); - HYPRE_BoomerAMGSetTruncFactor(pcg_precond, trunc_factor); - HYPRE_BoomerAMGSetLogging(pcg_precond, ioutdat, "driver.out.log"); - HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); - HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); - HYPRE_BoomerAMGSetNumGridSweeps(pcg_precond, num_grid_sweeps); - HYPRE_BoomerAMGSetGridRelaxType(pcg_precond, grid_relax_type); - HYPRE_BoomerAMGSetRelaxWeight(pcg_precond, relax_weight); - HYPRE_BoomerAMGSetSmoothOption(pcg_precond, smooth_option); - HYPRE_BoomerAMGSetSmoothNumSweep(pcg_precond, smooth_num_sweep); - HYPRE_BoomerAMGSetGridRelaxPoints(pcg_precond, grid_relax_points); - HYPRE_BoomerAMGSetMaxLevels(pcg_precond, max_levels); - HYPRE_BoomerAMGSetMaxRowSum(pcg_precond, max_row_sum); - HYPRE_BoomerAMGSetNumFunctions(pcg_precond, num_functions); - HYPRE_BoomerAMGSetVariant(pcg_precond, variant); - HYPRE_BoomerAMGSetOverlap(pcg_precond, overlap); - HYPRE_BoomerAMGSetDomainType(pcg_precond, domain_type); - if (num_functions > 1) - HYPRE_BoomerAMGSetDofFunc(pcg_precond, dof_func); - HYPRE_BiCGSTABSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSolve, - (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSetup, - pcg_precond); - } - else if (solver_id == 10) - { - /* use diagonal scaling as preconditioner */ - if (myid == 0) hypre_printf("Solver: DS-BiCGSTAB\n"); - pcg_precond = NULL; - - HYPRE_BiCGSTABSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSRDiagScale, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSRDiagScaleSetup, - pcg_precond); - hypre_TFree(smooth_option, HYPRE_MEMORY_HOST); - } - else if (solver_id == 11) - { - /* use PILUT as preconditioner */ - if (myid == 0) hypre_printf("Solver: PILUT-BiCGSTAB\n"); - - ierr = HYPRE_ParCSRPilutCreate( hypre_MPI_COMM_WORLD, &pcg_precond ); - if (ierr) { - hypre_printf("Error in ParPilutCreate\n"); - } - - HYPRE_BiCGSTABSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSRPilutSolve, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSRPilutSetup, - pcg_precond); - hypre_TFree(smooth_option, HYPRE_MEMORY_HOST); - - if (drop_tol >= 0 ) - HYPRE_ParCSRPilutSetDropTolerance( pcg_precond, - drop_tol ); - - if (nonzeros_to_keep >= 0 ) - HYPRE_ParCSRPilutSetFactorRowSize( pcg_precond, - nonzeros_to_keep ); - } - else if (solver_id == 45) - { - /* use Euclid preconditioning */ - if (myid == 0) hypre_printf("Solver: Euclid-BICGSTAB\n"); - - HYPRE_ParCSREuclidCreate(hypre_MPI_COMM_WORLD, &pcg_precond); - - /* note: There are three three methods of setting run-time - parameters for Euclid: (see HYPRE_parcsr_ls.h); here - we'll use what I think is simplest: let Euclid internally - parse the command line. - */ - HYPRE_ParCSREuclidSetParams(pcg_precond, argc, argv); - - HYPRE_BiCGSTABSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSREuclidSolve, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSREuclidSetup, - pcg_precond); - hypre_TFree(smooth_option, HYPRE_MEMORY_HOST); - } - - HYPRE_BiCGSTABSetup(pcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)b, (HYPRE_Vector)x); - - hypre_EndTiming(time_index); - hypre_PrintTiming("Setup phase times", hypre_MPI_COMM_WORLD); - hypre_FinalizeTiming(time_index); - hypre_ClearTiming(); - - time_index = hypre_InitializeTiming("BiCGSTAB Solve"); - hypre_BeginTiming(time_index); - - HYPRE_BiCGSTABSolve(pcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)b, (HYPRE_Vector)x); - - hypre_EndTiming(time_index); - hypre_PrintTiming("Solve phase times", hypre_MPI_COMM_WORLD); - hypre_FinalizeTiming(time_index); - hypre_ClearTiming(); - - HYPRE_BiCGSTABGetNumIterations(pcg_solver, &num_iterations); - HYPRE_BiCGSTABGetFinalRelativeResidualNorm(pcg_solver,&final_res_norm); -#if SECOND_TIME - /* run a second time to check for memory leaks */ - HYPRE_ParVectorSetRandomValues(x, 775); - HYPRE_BiCGSTABSetup(pcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)b, (HYPRE_Vector)x); - HYPRE_BiCGSTABSolve(pcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)b, (HYPRE_Vector)x); -#endif - - HYPRE_ParCSRBiCGSTABDestroy(pcg_solver); - - if (solver_id == 9) - { - HYPRE_BoomerAMGDestroy(pcg_precond); - } - - if (solver_id == 11) - { - HYPRE_ParCSRPilutDestroy(pcg_precond); - } - else if (solver_id == 45) - { - HYPRE_ParCSREuclidPrintParams(pcg_precond); - HYPRE_ParCSREuclidDestroy(pcg_precond); - } - - if (myid == 0) - { - hypre_printf("\n"); - hypre_printf("BiCGSTAB Iterations = %d\n", num_iterations); - hypre_printf("Final BiCGSTAB Relative Residual Norm = %e\n", final_res_norm); - hypre_printf("\n"); - } - } - /*----------------------------------------------------------- - * Solve the system using CGNR - *-----------------------------------------------------------*/ - - if (solver_id == 5 || solver_id == 6) - { - time_index = hypre_InitializeTiming("CGNR Setup"); - hypre_BeginTiming(time_index); - - HYPRE_ParCSRCGNRCreate(hypre_MPI_COMM_WORLD, &pcg_solver); - HYPRE_CGNRSetMaxIter(pcg_solver, 1000); - HYPRE_CGNRSetTol(pcg_solver, tol); - HYPRE_CGNRSetLogging(pcg_solver, 1); - - if (solver_id == 5) - { - /* use BoomerAMG as preconditioner */ - if (myid == 0) hypre_printf("Solver: AMG-CGNR\n"); - - HYPRE_BoomerAMGCreate(&pcg_precond); - HYPRE_BoomerAMGSetTol(pcg_precond, pc_tol); - HYPRE_BoomerAMGSetCoarsenType(pcg_precond, (hybrid*coarsen_type)); - HYPRE_BoomerAMGSetMeasureType(pcg_precond, measure_type); - HYPRE_BoomerAMGSetStrongThreshold(pcg_precond, strong_threshold); - HYPRE_BoomerAMGSetTruncFactor(pcg_precond, trunc_factor); - HYPRE_BoomerAMGSetLogging(pcg_precond, ioutdat, "driver.out.log"); - HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); - HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); - HYPRE_BoomerAMGSetNumGridSweeps(pcg_precond, num_grid_sweeps); - HYPRE_BoomerAMGSetGridRelaxType(pcg_precond, grid_relax_type); - HYPRE_BoomerAMGSetRelaxWeight(pcg_precond, relax_weight); - HYPRE_BoomerAMGSetSmoothOption(pcg_precond, smooth_option); - HYPRE_BoomerAMGSetSmoothNumSweep(pcg_precond, smooth_num_sweep); - HYPRE_BoomerAMGSetGridRelaxPoints(pcg_precond, grid_relax_points); - HYPRE_BoomerAMGSetMaxLevels(pcg_precond, max_levels); - HYPRE_BoomerAMGSetMaxRowSum(pcg_precond, max_row_sum); - HYPRE_BoomerAMGSetNumFunctions(pcg_precond, num_functions); - HYPRE_BoomerAMGSetVariant(pcg_precond, variant); - HYPRE_BoomerAMGSetOverlap(pcg_precond, overlap); - HYPRE_BoomerAMGSetDomainType(pcg_precond, domain_type); - if (num_functions > 1) - HYPRE_BoomerAMGSetDofFunc(pcg_precond, dof_func); - HYPRE_CGNRSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSolve, - (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSolveT, - (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSetup, - pcg_precond); - } - else if (solver_id == 6) - { - /* use diagonal scaling as preconditioner */ - if (myid == 0) hypre_printf("Solver: DS-CGNR\n"); - pcg_precond = NULL; - - HYPRE_CGNRSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSRDiagScale, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSRDiagScale, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSRDiagScaleSetup, - pcg_precond); - hypre_TFree(smooth_option, HYPRE_MEMORY_HOST); - } - - HYPRE_CGNRGetPrecond(pcg_solver, &pcg_precond_gotten); - if (pcg_precond_gotten != pcg_precond) - { - hypre_printf("HYPRE_ParCSRCGNRGetPrecond got bad precond\n"); - return(-1); - } - else - if (myid == 0) - hypre_printf("HYPRE_ParCSRCGNRGetPrecond got good precond\n"); - HYPRE_CGNRSetup(pcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)b, (HYPRE_Vector)x); - - hypre_EndTiming(time_index); - hypre_PrintTiming("Setup phase times", hypre_MPI_COMM_WORLD); - hypre_FinalizeTiming(time_index); - hypre_ClearTiming(); - - time_index = hypre_InitializeTiming("CGNR Solve"); - hypre_BeginTiming(time_index); - - HYPRE_CGNRSolve(pcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)b, (HYPRE_Vector)x); - - hypre_EndTiming(time_index); - hypre_PrintTiming("Solve phase times", hypre_MPI_COMM_WORLD); - hypre_FinalizeTiming(time_index); - hypre_ClearTiming(); - - HYPRE_CGNRGetNumIterations(pcg_solver, &num_iterations); - HYPRE_CGNRGetFinalRelativeResidualNorm(pcg_solver,&final_res_norm); - -#if SECOND_TIME - /* run a second time to check for memory leaks */ - HYPRE_ParVectorSetRandomValues(x, 775); - HYPRE_CGNRSetup(pcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)b, (HYPRE_Vector)x); - HYPRE_CGNRSolve(pcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)b, (HYPRE_Vector)x); -#endif - - HYPRE_ParCSRCGNRDestroy(pcg_solver); - - if (solver_id == 5) - { - HYPRE_BoomerAMGDestroy(pcg_precond); - } - if (myid == 0) - { - hypre_printf("\n"); - hypre_printf("Iterations = %d\n", num_iterations); - hypre_printf("Final Relative Residual Norm = %e\n", final_res_norm); - hypre_printf("\n"); - } - } - - /*----------------------------------------------------------- - * Print the solution and other info - *-----------------------------------------------------------*/ - - HYPRE_IJVectorGetObjectType(ij_b, &j); - HYPRE_IJVectorPrint(ij_b, "driver.out.b"); - HYPRE_IJVectorPrint(ij_x, "driver.out.x"); - - /*----------------------------------------------------------- - * Finalize things - *-----------------------------------------------------------*/ - - HYPRE_IJMatrixDestroy(ij_A); - HYPRE_IJVectorDestroy(ij_b); - HYPRE_IJVectorDestroy(ij_x); - - hypre_MPI_Finalize(); - - return (0); -} - -/*---------------------------------------------------------------------- - * Build matrix from file. Expects three files on each processor. - * filename.D.n contains the diagonal part, filename.O.n contains - * the offdiagonal part and filename.INFO.n contains global row - * and column numbers, number of columns of offdiagonal matrix - * and the mapping of offdiagonal column numbers to global column numbers. - * Parameters given in command line. - *----------------------------------------------------------------------*/ - -HYPRE_Int -BuildParFromFile( HYPRE_Int argc, - char *argv[], - HYPRE_Int arg_index, - HYPRE_ParCSRMatrix *A_ptr ) -{ - char *filename; - - HYPRE_ParCSRMatrix A; - - HYPRE_Int myid; - - /*----------------------------------------------------------- - * Initialize some stuff - *-----------------------------------------------------------*/ - - hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); - - /*----------------------------------------------------------- - * Parse command line - *-----------------------------------------------------------*/ - - if (arg_index < argc) - { - filename = argv[arg_index]; - } - else - { - hypre_printf("Error: No filename specified \n"); - exit(1); - } - - /*----------------------------------------------------------- - * Print driver parameters - *-----------------------------------------------------------*/ - - if (myid == 0) - { - hypre_printf(" FromFile: %s\n", filename); - } - - /*----------------------------------------------------------- - * Generate the matrix - *-----------------------------------------------------------*/ - - HYPRE_ParCSRMatrixRead(hypre_MPI_COMM_WORLD, filename,&A); - - *A_ptr = A; - - return (0); -} - -/*---------------------------------------------------------------------- - * Build standard 7-point laplacian in 3D with grid and anisotropy. - * Parameters given in command line. - *----------------------------------------------------------------------*/ - -HYPRE_Int -BuildParLaplacian( HYPRE_Int argc, - char *argv[], - HYPRE_Int arg_index, - HYPRE_ParCSRMatrix *A_ptr ) -{ - HYPRE_Int nx, ny, nz; - HYPRE_Int P, Q, R; - HYPRE_Real cx, cy, cz; - - HYPRE_ParCSRMatrix A; - - HYPRE_Int num_procs, myid; - HYPRE_Int p, q, r; - HYPRE_Real *values; - - /*----------------------------------------------------------- - * Initialize some stuff - *-----------------------------------------------------------*/ - - hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); - hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); - - /*----------------------------------------------------------- - * Set defaults - *-----------------------------------------------------------*/ - - nx = 10; - ny = 10; - nz = 10; - - P = 1; - Q = num_procs; - R = 1; - - cx = 1.; - cy = 1.; - cz = 1.; - - /*----------------------------------------------------------- - * Parse command line - *-----------------------------------------------------------*/ - arg_index = 0; - while (arg_index < argc) - { - if ( strcmp(argv[arg_index], "-n") == 0 ) - { - arg_index++; - nx = atoi(argv[arg_index++]); - ny = atoi(argv[arg_index++]); - nz = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-P") == 0 ) - { - arg_index++; - P = atoi(argv[arg_index++]); - Q = atoi(argv[arg_index++]); - R = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-c") == 0 ) - { - arg_index++; - cx = atof(argv[arg_index++]); - cy = atof(argv[arg_index++]); - cz = atof(argv[arg_index++]); - } - else - { - arg_index++; - } - } - - /*----------------------------------------------------------- - * Check a few things - *-----------------------------------------------------------*/ - - if ((P*Q*R) != num_procs) - { - hypre_printf("Error: Invalid number of processors or processor topology \n"); - exit(1); - } - - /*----------------------------------------------------------- - * Print driver parameters - *-----------------------------------------------------------*/ - - if (myid == 0) - { - hypre_printf(" Laplacian:\n"); - hypre_printf(" (nx, ny, nz) = (%d, %d, %d)\n", nx, ny, nz); - hypre_printf(" (Px, Py, Pz) = (%d, %d, %d)\n", P, Q, R); - hypre_printf(" (cx, cy, cz) = (%f, %f, %f)\n\n", cx, cy, cz); - } - - /*----------------------------------------------------------- - * Set up the grid structure - *-----------------------------------------------------------*/ - - /* compute p,q,r from P,Q,R and myid */ - p = myid % P; - q = (( myid - p)/P) % Q; - r = ( myid - p - P*q)/( P*Q ); - - /*----------------------------------------------------------- - * Generate the matrix - *-----------------------------------------------------------*/ - - values = hypre_CTAlloc(HYPRE_Real, 4, HYPRE_MEMORY_HOST); - - values[1] = -cx; - values[2] = -cy; - values[3] = -cz; - - values[0] = 0.; - if (nx > 1) - { - values[0] += 2.0*cx; - } - if (ny > 1) - { - values[0] += 2.0*cy; - } - if (nz > 1) - { - values[0] += 2.0*cz; - } - - A = (HYPRE_ParCSRMatrix) GenerateLaplacian(hypre_MPI_COMM_WORLD, - nx, ny, nz, P, Q, R, p, q, r, values); - - hypre_TFree(values, HYPRE_MEMORY_HOST); - - *A_ptr = A; - - return (0); -} - -/*---------------------------------------------------------------------- - * Build standard 7-point convection-diffusion operator - * Parameters given in command line. - * Operator: - * - * -cx Dxx - cy Dyy - cz Dzz + ax Dx + ay Dy + az Dz = f - * - *----------------------------------------------------------------------*/ - -HYPRE_Int -BuildParDifConv( HYPRE_Int argc, - char *argv[], - HYPRE_Int arg_index, - HYPRE_ParCSRMatrix *A_ptr ) -{ - HYPRE_Int nx, ny, nz; - HYPRE_Int P, Q, R; - HYPRE_Real cx, cy, cz; - HYPRE_Real ax, ay, az; - HYPRE_Real hinx,hiny,hinz; - - HYPRE_ParCSRMatrix A; - - HYPRE_Int num_procs, myid; - HYPRE_Int p, q, r; - HYPRE_Real *values; - - /*----------------------------------------------------------- - * Initialize some stuff - *-----------------------------------------------------------*/ - - hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); - hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); - - /*----------------------------------------------------------- - * Set defaults - *-----------------------------------------------------------*/ - - nx = 10; - ny = 10; - nz = 10; - - hinx = 1./(nx+1); - hiny = 1./(ny+1); - hinz = 1./(nz+1); - - P = 1; - Q = num_procs; - R = 1; - - cx = 1.; - cy = 1.; - cz = 1.; - - ax = 1.; - ay = 1.; - az = 1.; - - /*----------------------------------------------------------- - * Parse command line - *-----------------------------------------------------------*/ - arg_index = 0; - while (arg_index < argc) - { - if ( strcmp(argv[arg_index], "-n") == 0 ) - { - arg_index++; - nx = atoi(argv[arg_index++]); - ny = atoi(argv[arg_index++]); - nz = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-P") == 0 ) - { - arg_index++; - P = atoi(argv[arg_index++]); - Q = atoi(argv[arg_index++]); - R = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-c") == 0 ) - { - arg_index++; - cx = atof(argv[arg_index++]); - cy = atof(argv[arg_index++]); - cz = atof(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-a") == 0 ) - { - arg_index++; - ax = atof(argv[arg_index++]); - ay = atof(argv[arg_index++]); - az = atof(argv[arg_index++]); - } - else - { - arg_index++; - } - } - - /*----------------------------------------------------------- - * Check a few things - *-----------------------------------------------------------*/ - - if ((P*Q*R) != num_procs) - { - hypre_printf("Error: Invalid number of processors or processor topology \n"); - exit(1); - } - - /*----------------------------------------------------------- - * Print driver parameters - *-----------------------------------------------------------*/ - - if (myid == 0) - { - hypre_printf(" Convection-Diffusion: \n"); - hypre_printf(" -cx Dxx - cy Dyy - cz Dzz + ax Dx + ay Dy + az Dz = f\n"); - hypre_printf(" (nx, ny, nz) = (%d, %d, %d)\n", nx, ny, nz); - hypre_printf(" (Px, Py, Pz) = (%d, %d, %d)\n", P, Q, R); - hypre_printf(" (cx, cy, cz) = (%f, %f, %f)\n", cx, cy, cz); - hypre_printf(" (ax, ay, az) = (%f, %f, %f)\n\n", ax, ay, az); - } - - /*----------------------------------------------------------- - * Set up the grid structure - *-----------------------------------------------------------*/ - - /* compute p,q,r from P,Q,R and myid */ - p = myid % P; - q = (( myid - p)/P) % Q; - r = ( myid - p - P*q)/( P*Q ); - - /*----------------------------------------------------------- - * Generate the matrix - *-----------------------------------------------------------*/ - - values = hypre_CTAlloc(HYPRE_Real, 7, HYPRE_MEMORY_HOST); - - values[1] = -cx/(hinx*hinx); - values[2] = -cy/(hiny*hiny); - values[3] = -cz/(hinz*hinz); - values[4] = -cx/(hinx*hinx) + ax/hinx; - values[5] = -cy/(hiny*hiny) + ay/hiny; - values[6] = -cz/(hinz*hinz) + az/hinz; - - values[0] = 0.; - if (nx > 1) - { - values[0] += 2.0*cx/(hinx*hinx) - 1.*ax/hinx; - } - if (ny > 1) - { - values[0] += 2.0*cy/(hiny*hiny) - 1.*ay/hiny; - } - if (nz > 1) - { - values[0] += 2.0*cz/(hinz*hinz) - 1.*az/hinz; - } - - A = (HYPRE_ParCSRMatrix) GenerateDifConv(hypre_MPI_COMM_WORLD, - nx, ny, nz, P, Q, R, p, q, r, values); - - hypre_TFree(values, HYPRE_MEMORY_HOST); - - *A_ptr = A; - - return (0); -} - -/*---------------------------------------------------------------------- - * Build matrix from one file on Proc. 0. Expects matrix to be in - * CSR format. Distributes matrix across processors giving each about - * the same number of rows. - * Parameters given in command line. - *----------------------------------------------------------------------*/ - -HYPRE_Int -BuildParFromOneFile( HYPRE_Int argc, - char *argv[], - HYPRE_Int arg_index, - HYPRE_ParCSRMatrix *A_ptr ) -{ - char *filename; - - HYPRE_ParCSRMatrix A; - HYPRE_CSRMatrix A_CSR = NULL; - - HYPRE_Int myid; - - /*----------------------------------------------------------- - * Initialize some stuff - *-----------------------------------------------------------*/ - - hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); - - /*----------------------------------------------------------- - * Parse command line - *-----------------------------------------------------------*/ - - if (arg_index < argc) - { - filename = argv[arg_index]; - } - else - { - hypre_printf("Error: No filename specified \n"); - exit(1); - } - - /*----------------------------------------------------------- - * Print driver parameters - *-----------------------------------------------------------*/ - - if (myid == 0) - { - hypre_printf(" FromFile: %s\n", filename); - - /*----------------------------------------------------------- - * Generate the matrix - *-----------------------------------------------------------*/ - - A_CSR = HYPRE_CSRMatrixRead(filename); - } - HYPRE_CSRMatrixToParCSRMatrix(hypre_MPI_COMM_WORLD, A_CSR, NULL, NULL, &A); - - *A_ptr = A; - - if (myid == 0) HYPRE_CSRMatrixDestroy(A_CSR); - - return (0); -} - -/*---------------------------------------------------------------------- - * Build Function array from files on different processors - *----------------------------------------------------------------------*/ - -HYPRE_Int -BuildFuncsFromFiles( HYPRE_Int argc, - char *argv[], - HYPRE_Int arg_index, - HYPRE_ParCSRMatrix parcsr_A, - HYPRE_Int **dof_func_ptr ) -{ -/*---------------------------------------------------------------------- - * Build Function array from files on different processors - *----------------------------------------------------------------------*/ - - hypre_printf (" Feature is not implemented yet!\n"); - return(0); - -} - - -HYPRE_Int -BuildFuncsFromOneFile( HYPRE_Int argc, - char *argv[], - HYPRE_Int arg_index, - HYPRE_ParCSRMatrix parcsr_A, - HYPRE_Int **dof_func_ptr ) -{ - char *filename; - - HYPRE_Int myid, num_procs; - HYPRE_Int *partitioning; - HYPRE_Int *dof_func; - HYPRE_Int *dof_func_local; - HYPRE_Int i, j; - HYPRE_Int local_size, global_size; - hypre_MPI_Request *requests; - hypre_MPI_Status *status, status0; - MPI_Comm comm; - - /*----------------------------------------------------------- - * Initialize some stuff - *-----------------------------------------------------------*/ - - comm = hypre_MPI_COMM_WORLD; - hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); - hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); - - /*----------------------------------------------------------- - * Parse command line - *-----------------------------------------------------------*/ - - if (arg_index < argc) - { - filename = argv[arg_index]; - } - else - { - hypre_printf("Error: No filename specified \n"); - exit(1); - } - - /*----------------------------------------------------------- - * Print driver parameters - *-----------------------------------------------------------*/ - - if (myid == 0) - { - FILE *fp; - hypre_printf(" Funcs FromFile: %s\n", filename); - - /*----------------------------------------------------------- - * read in the data - *-----------------------------------------------------------*/ - fp = fopen(filename, "r"); - - hypre_fscanf(fp, "%d", &global_size); - dof_func = hypre_CTAlloc(HYPRE_Int, global_size, HYPRE_MEMORY_HOST); - - for (j = 0; j < global_size; j++) - { - hypre_fscanf(fp, "%d", &dof_func[j]); - } - - fclose(fp); - - } - HYPRE_ParCSRMatrixGetRowPartitioning(parcsr_A, &partitioning); - local_size = partitioning[myid+1]-partitioning[myid]; - dof_func_local = hypre_CTAlloc(HYPRE_Int, local_size, HYPRE_MEMORY_HOST); - - if (myid == 0) - { - requests = hypre_CTAlloc(hypre_MPI_Request, num_procs-1, HYPRE_MEMORY_HOST); - status = hypre_CTAlloc(hypre_MPI_Status, num_procs-1, HYPRE_MEMORY_HOST); - j = 0; - for (i=1; i < num_procs; i++) - hypre_MPI_Isend(&dof_func[partitioning[i]], - partitioning[i+1]-partitioning[i], - HYPRE_MPI_INT, i, 0, comm, &requests[j++]); - for (i=0; i < local_size; i++) - dof_func_local[i] = dof_func[i]; - hypre_MPI_Waitall(num_procs-1,requests, status); - hypre_TFree(requests, HYPRE_MEMORY_HOST); - hypre_TFree(status, HYPRE_MEMORY_HOST); - } - else - { - hypre_MPI_Recv(dof_func_local,local_size,HYPRE_MPI_INT,0,0,comm,&status0); - } - - *dof_func_ptr = dof_func_local; - - if (myid == 0) hypre_TFree(dof_func, HYPRE_MEMORY_HOST); - - return (0); -} - -/*---------------------------------------------------------------------- - * Build Rhs from one file on Proc. 0. Distributes vector across processors - * giving each about using the distribution of the matrix A. - *----------------------------------------------------------------------*/ - -HYPRE_Int -BuildRhsParFromOneFile( HYPRE_Int argc, - char *argv[], - HYPRE_Int arg_index, - HYPRE_Int *partitioning, - HYPRE_ParVector *b_ptr ) -{ - char *filename; - - HYPRE_ParVector b; - HYPRE_Vector b_CSR; - - HYPRE_Int myid; - - /*----------------------------------------------------------- - * Initialize some stuff - *-----------------------------------------------------------*/ - - hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); - - /*----------------------------------------------------------- - * Parse command line - *-----------------------------------------------------------*/ - - if (arg_index < argc) - { - filename = argv[arg_index]; - } - else - { - hypre_printf("Error: No filename specified \n"); - exit(1); - } - - /*----------------------------------------------------------- - * Print driver parameters - *-----------------------------------------------------------*/ - - if (myid == 0) - { - hypre_printf(" Rhs FromFile: %s\n", filename); - - /*----------------------------------------------------------- - * Generate the matrix - *-----------------------------------------------------------*/ - - b_CSR = HYPRE_VectorRead(filename); - } - HYPRE_VectorToParVector(hypre_MPI_COMM_WORLD, b_CSR, partitioning,&b); - - *b_ptr = b; - - HYPRE_VectorDestroy(b_CSR); - - return (0); -} - -/*---------------------------------------------------------------------- - * Build standard 9-point laplacian in 2D with grid and anisotropy. - * Parameters given in command line. - *----------------------------------------------------------------------*/ - -HYPRE_Int -BuildParLaplacian9pt( HYPRE_Int argc, - char *argv[], - HYPRE_Int arg_index, - HYPRE_ParCSRMatrix *A_ptr ) -{ - HYPRE_Int nx, ny; - HYPRE_Int P, Q; - - HYPRE_ParCSRMatrix A; - - HYPRE_Int num_procs, myid; - HYPRE_Int p, q; - HYPRE_Real *values; - - /*----------------------------------------------------------- - * Initialize some stuff - *-----------------------------------------------------------*/ - - hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); - hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); - - /*----------------------------------------------------------- - * Set defaults - *-----------------------------------------------------------*/ - - nx = 10; - ny = 10; - - P = 1; - Q = num_procs; - - /*----------------------------------------------------------- - * Parse command line - *-----------------------------------------------------------*/ - arg_index = 0; - while (arg_index < argc) - { - if ( strcmp(argv[arg_index], "-n") == 0 ) - { - arg_index++; - nx = atoi(argv[arg_index++]); - ny = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-P") == 0 ) - { - arg_index++; - P = atoi(argv[arg_index++]); - Q = atoi(argv[arg_index++]); - } - else - { - arg_index++; - } - } - - /*----------------------------------------------------------- - * Check a few things - *-----------------------------------------------------------*/ - - if ((P*Q) != num_procs) - { - hypre_printf("Error: Invalid number of processors or processor topology \n"); - exit(1); - } - - /*----------------------------------------------------------- - * Print driver parameters - *-----------------------------------------------------------*/ - - if (myid == 0) - { - hypre_printf(" Laplacian 9pt:\n"); - hypre_printf(" (nx, ny) = (%d, %d)\n", nx, ny); - hypre_printf(" (Px, Py) = (%d, %d)\n\n", P, Q); - } - - /*----------------------------------------------------------- - * Set up the grid structure - *-----------------------------------------------------------*/ - - /* compute p,q from P,Q and myid */ - p = myid % P; - q = ( myid - p)/P; - - /*----------------------------------------------------------- - * Generate the matrix - *-----------------------------------------------------------*/ - - values = hypre_CTAlloc(HYPRE_Real, 2, HYPRE_MEMORY_HOST); - - values[1] = -1.; - - values[0] = 0.; - if (nx > 1) - { - values[0] += 2.0; - } - if (ny > 1) - { - values[0] += 2.0; - } - if (nx > 1 && ny > 1) - { - values[0] += 4.0; - } - - A = (HYPRE_ParCSRMatrix) GenerateLaplacian9pt(hypre_MPI_COMM_WORLD, - nx, ny, P, Q, p, q, values); - - hypre_TFree(values, HYPRE_MEMORY_HOST); - - *A_ptr = A; - - return (0); -} -/*---------------------------------------------------------------------- - * Build 27-point laplacian in 3D, - * Parameters given in command line. - *----------------------------------------------------------------------*/ - -HYPRE_Int -BuildParLaplacian27pt( HYPRE_Int argc, - char *argv[], - HYPRE_Int arg_index, - HYPRE_ParCSRMatrix *A_ptr ) -{ - HYPRE_Int nx, ny, nz; - HYPRE_Int P, Q, R; - - HYPRE_ParCSRMatrix A; - - HYPRE_Int num_procs, myid; - HYPRE_Int p, q, r; - HYPRE_Real *values; - - /*----------------------------------------------------------- - * Initialize some stuff - *-----------------------------------------------------------*/ - - hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); - hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); - - /*----------------------------------------------------------- - * Set defaults - *-----------------------------------------------------------*/ - - nx = 10; - ny = 10; - nz = 10; - - P = 1; - Q = num_procs; - R = 1; - - /*----------------------------------------------------------- - * Parse command line - *-----------------------------------------------------------*/ - arg_index = 0; - while (arg_index < argc) - { - if ( strcmp(argv[arg_index], "-n") == 0 ) - { - arg_index++; - nx = atoi(argv[arg_index++]); - ny = atoi(argv[arg_index++]); - nz = atoi(argv[arg_index++]); - } - else if ( strcmp(argv[arg_index], "-P") == 0 ) - { - arg_index++; - P = atoi(argv[arg_index++]); - Q = atoi(argv[arg_index++]); - R = atoi(argv[arg_index++]); - } - else - { - arg_index++; - } - } - - /*----------------------------------------------------------- - * Check a few things - *-----------------------------------------------------------*/ - - if ((P*Q*R) != num_procs) - { - hypre_printf("Error: Invalid number of processors or processor topology \n"); - exit(1); - } - - /*----------------------------------------------------------- - * Print driver parameters - *-----------------------------------------------------------*/ - - if (myid == 0) - { - hypre_printf(" Laplacian_27pt:\n"); - hypre_printf(" (nx, ny, nz) = (%d, %d, %d)\n", nx, ny, nz); - hypre_printf(" (Px, Py, Pz) = (%d, %d, %d)\n\n", P, Q, R); - } - - /*----------------------------------------------------------- - * Set up the grid structure - *-----------------------------------------------------------*/ - - /* compute p,q,r from P,Q,R and myid */ - p = myid % P; - q = (( myid - p)/P) % Q; - r = ( myid - p - P*q)/( P*Q ); - - /*----------------------------------------------------------- - * Generate the matrix - *-----------------------------------------------------------*/ - - values = hypre_CTAlloc(HYPRE_Real, 2, HYPRE_MEMORY_HOST); - - values[0] = 26.0; - if (nx == 1 || ny == 1 || nz == 1) - values[0] = 8.0; - if (nx*ny == 1 || nx*nz == 1 || ny*nz == 1) - values[0] = 2.0; - values[1] = -1.; - - A = (HYPRE_ParCSRMatrix) GenerateLaplacian27pt(hypre_MPI_COMM_WORLD, - nx, ny, nz, P, Q, R, p, q, r, values); - - hypre_TFree(values, HYPRE_MEMORY_HOST); - - *A_ptr = A; - - return (0); -} diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Euclid_apply.c hypre-2.18.2/src/distributed_ls/Euclid/Euclid_apply.c --- hypre-2.16.0/src/distributed_ls/Euclid/Euclid_apply.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Euclid_apply.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "Euclid_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/euclid_common.h hypre-2.18.2/src/distributed_ls/Euclid/euclid_common.h --- hypre-2.16.0/src/distributed_ls/Euclid/euclid_common.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/euclid_common.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef COMMON_DH #define COMMON_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/euclid_config.h hypre-2.18.2/src/distributed_ls/Euclid/euclid_config.h --- hypre-2.16.0/src/distributed_ls/Euclid/euclid_config.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/euclid_config.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef EUCLID_CONF_DH #define EUCLID_CONF_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Euclid_dh.c hypre-2.18.2/src/distributed_ls/Euclid/Euclid_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/Euclid_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Euclid_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "Euclid_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Euclid_dh.h hypre-2.18.2/src/distributed_ls/Euclid/Euclid_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/Euclid_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Euclid_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef EUCLID_MPI_INTERFACE_DH #define EUCLID_MPI_INTERFACE_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/ExternalRows_dh.c hypre-2.18.2/src/distributed_ls/Euclid/ExternalRows_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/ExternalRows_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/ExternalRows_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "ExternalRows_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/ExternalRows_dh.h hypre-2.18.2/src/distributed_ls/Euclid/ExternalRows_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/ExternalRows_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/ExternalRows_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* for internal use */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Factor_dh.c hypre-2.18.2/src/distributed_ls/Euclid/Factor_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/Factor_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Factor_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "Factor_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Factor_dh.h hypre-2.18.2/src/distributed_ls/Euclid/Factor_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/Factor_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Factor_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef FACTOR_DH #define FACTOR_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/getRow_dh.c hypre-2.18.2/src/distributed_ls/Euclid/getRow_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/getRow_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/getRow_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "getRow_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/getRow_dh.h hypre-2.18.2/src/distributed_ls/Euclid/getRow_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/getRow_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/getRow_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef GET_ROW_DH #define GET_ROW_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/globalObjects.c hypre-2.18.2/src/distributed_ls/Euclid/globalObjects.c --- hypre-2.16.0/src/distributed_ls/Euclid/globalObjects.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/globalObjects.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/guards_dh.h hypre-2.18.2/src/distributed_ls/Euclid/guards_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/guards_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/guards_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef GUARDS_DH #define GUARDS_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Hash_dh.c hypre-2.18.2/src/distributed_ls/Euclid/Hash_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/Hash_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Hash_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "Hash_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Hash_dh.h hypre-2.18.2/src/distributed_ls/Euclid/Hash_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/Hash_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Hash_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef HASH_D_DH #define HASH_D_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Hash_i_dh.c hypre-2.18.2/src/distributed_ls/Euclid/Hash_i_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/Hash_i_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Hash_i_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "Hash_i_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Hash_i_dh.h hypre-2.18.2/src/distributed_ls/Euclid/Hash_i_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/Hash_i_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Hash_i_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* This is similar to the Hash_i_dh class (woe, for a lack of templates); this this class is for hashing data diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/headers hypre-2.18.2/src/distributed_ls/Euclid/headers --- hypre-2.16.0/src/distributed_ls/Euclid/headers 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/headers 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) INTERNAL_HEADER=_hypre_Euclid.h diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/_hypre_Euclid.h hypre-2.18.2/src/distributed_ls/Euclid/_hypre_Euclid.h --- hypre-2.16.0/src/distributed_ls/Euclid/_hypre_Euclid.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/_hypre_Euclid.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_EUCLID_HEADER #define hypre_EUCLID_HEADER @@ -32,18 +27,6 @@ extern "C" { #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef EUCLID_CONF_DH #define EUCLID_CONF_DH @@ -163,18 +146,6 @@ */ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef MACROS_DH #define MACROS_DH @@ -359,18 +330,6 @@ #endif #endif /* #ifndef MACROS_DH */ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef COMMON_DH #define COMMON_DH @@ -523,18 +482,6 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - /* for internal use */ #ifndef EXTERNAL_ROWS_DH_H @@ -598,18 +545,6 @@ }; #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef FACTOR_DH #define FACTOR_DH @@ -697,18 +632,6 @@ /* prints local matrix to logfile, if open */ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef VEC_DH_H #define VEC_DH_H @@ -744,18 +667,6 @@ extern void Vec_dhPrint(Vec_dh v, SubdomainGraph_dh sg, char *filename); extern void Vec_dhPrintBIN(Vec_dh v, SubdomainGraph_dh sg, char *filename); #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef MATGENFD_DH_DH #define MATGENFD_DH_DH @@ -887,18 +798,6 @@ extern HYPRE_Real box_2(HYPRE_Real coeff, HYPRE_Real x, HYPRE_Real y, HYPRE_Real z); #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef MAT_DH_DH #define MAT_DH_DH @@ -1044,18 +943,6 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef SUBDOMAIN_GRAPH_DH #define SUBDOMAIN_GRAPH_DH @@ -1167,18 +1054,6 @@ extern void SubdomainGraph_dhPrintStats(SubdomainGraph_dh sg, FILE *fp); #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - /* Euclid employs a global object: @@ -1201,18 +1076,6 @@ extern void TimeLog_dhPrint(TimeLog_dh t, FILE *fp, bool allPrint); #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef SORTED_SET_DH #define SORTED_SET_DH @@ -1231,18 +1094,6 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef MEM_DH_DH #define MEM_DH_DH @@ -1263,18 +1114,6 @@ */ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef SUPPORT_DH #define SUPPORT_DH @@ -1290,18 +1129,6 @@ */ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef NUMBERING_DH_H #define NUMBERING_DH_H @@ -1345,18 +1172,6 @@ HYPRE_Int *global_in, HYPRE_Int *local_out); #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - /* This is similar to the Hash_i_dh class (woe, for a lack of templates); this this class is for hashing data consisting of single, non-negative integers. @@ -1393,18 +1208,6 @@ */ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef TIMER_DH_H #define TIMER_DH_H @@ -1485,18 +1288,6 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef PARSER_DH_DH #define PARSER_DH_DH @@ -1560,18 +1351,6 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef SORTEDLIST_DH_H #define SORTEDLIST_DH_H @@ -1650,18 +1429,6 @@ extern void SortedList_dhUpdateVal(SortedList_dh sList, SRecord *sr); #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef HASH_D_DH #define HASH_D_DH @@ -1717,18 +1484,6 @@ } #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef MAT_DH_PRIVATE #define MAT_DH_PRIVATE @@ -1846,18 +1601,6 @@ extern void make_symmetric_private(HYPRE_Int m, HYPRE_Int **rp, HYPRE_Int **cval, HYPRE_Real **aval); #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef GET_ROW_DH #define GET_ROW_DH @@ -1877,18 +1620,6 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef ILU_MPI_DH #define ILU_MPI_DH @@ -1923,18 +1654,6 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef EUCLID_MPI_INTERFACE_DH #define EUCLID_MPI_INTERFACE_DH @@ -2087,18 +1806,6 @@ }; #endif /* #ifndef EUCLID_MPI_INTERFACE_DH */ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef THREADED_KRYLOV_H #define THREADED_KRYLOV_H @@ -2111,18 +1818,6 @@ HYPRE_Int *itsOUT); #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - /* Note: this module contains functionality for reading/writing Euclid's binary io format, and opening and closing files. @@ -2167,18 +1862,6 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef THREADED_BLAS_DH #define THREADED_BLAS_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/ilu_dh.h hypre-2.18.2/src/distributed_ls/Euclid/ilu_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/ilu_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/ilu_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef ILU_MPI_DH #define ILU_MPI_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/ilu_mpi_bj.c hypre-2.18.2/src/distributed_ls/Euclid/ilu_mpi_bj.c --- hypre-2.16.0/src/distributed_ls/Euclid/ilu_mpi_bj.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/ilu_mpi_bj.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/ilu_mpi_pilu.c hypre-2.18.2/src/distributed_ls/Euclid/ilu_mpi_pilu.c --- hypre-2.16.0/src/distributed_ls/Euclid/ilu_mpi_pilu.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/ilu_mpi_pilu.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "Euclid_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/ilu_seq.c hypre-2.18.2/src/distributed_ls/Euclid/ilu_seq.c --- hypre-2.16.0/src/distributed_ls/Euclid/ilu_seq.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/ilu_seq.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/io_dh.c hypre-2.18.2/src/distributed_ls/Euclid/io_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/io_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/io_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "io_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/io_dh.h hypre-2.18.2/src/distributed_ls/Euclid/io_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/io_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/io_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* Note: this module contains functionality for reading/writing diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/krylov_dh.c hypre-2.18.2/src/distributed_ls/Euclid/krylov_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/krylov_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/krylov_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "Euclid_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/krylov_dh.h hypre-2.18.2/src/distributed_ls/Euclid/krylov_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/krylov_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/krylov_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef THREADED_KRYLOV_H #define THREADED_KRYLOV_H diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/macros_dh.h hypre-2.18.2/src/distributed_ls/Euclid/macros_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/macros_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/macros_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef MACROS_DH #define MACROS_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Makefile hypre-2.18.2/src/distributed_ls/Euclid/Makefile --- hypre-2.16.0/src/distributed_ls/Euclid/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../../config/Makefile.config diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Mat_dh.c hypre-2.18.2/src/distributed_ls/Euclid/Mat_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/Mat_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Mat_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "Mat_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Mat_dh.h hypre-2.18.2/src/distributed_ls/Euclid/Mat_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/Mat_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Mat_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef MAT_DH_DH #define MAT_DH_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/mat_dh_private.c hypre-2.18.2/src/distributed_ls/Euclid/mat_dh_private.c --- hypre-2.16.0/src/distributed_ls/Euclid/mat_dh_private.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/mat_dh_private.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "mat_dh_private.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/mat_dh_private.h hypre-2.18.2/src/distributed_ls/Euclid/mat_dh_private.h --- hypre-2.16.0/src/distributed_ls/Euclid/mat_dh_private.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/mat_dh_private.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef MAT_DH_PRIVATE #define MAT_DH_PRIVATE diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/MatGenFD.c hypre-2.18.2/src/distributed_ls/Euclid/MatGenFD.c --- hypre-2.16.0/src/distributed_ls/Euclid/MatGenFD.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/MatGenFD.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "MatGenFD.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/MatGenFD.h hypre-2.18.2/src/distributed_ls/Euclid/MatGenFD.h --- hypre-2.16.0/src/distributed_ls/Euclid/MatGenFD.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/MatGenFD.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef MATGENFD_DH_DH #define MATGENFD_DH_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Mem_dh.c hypre-2.18.2/src/distributed_ls/Euclid/Mem_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/Mem_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Mem_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "Parser_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Mem_dh.h hypre-2.18.2/src/distributed_ls/Euclid/Mem_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/Mem_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Mem_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef MEM_DH_DH #define MEM_DH_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Numbering_dh.c hypre-2.18.2/src/distributed_ls/Euclid/Numbering_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/Numbering_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Numbering_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "Numbering_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Numbering_dh.h hypre-2.18.2/src/distributed_ls/Euclid/Numbering_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/Numbering_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Numbering_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef NUMBERING_DH_H #define NUMBERING_DH_H diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Parser_dh.c hypre-2.18.2/src/distributed_ls/Euclid/Parser_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/Parser_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Parser_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "Parser_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Parser_dh.h hypre-2.18.2/src/distributed_ls/Euclid/Parser_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/Parser_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Parser_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef PARSER_DH_DH #define PARSER_DH_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/README.hypre hypre-2.18.2/src/distributed_ls/Euclid/README.hypre --- hypre-2.16.0/src/distributed_ls/Euclid/README.hypre 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/README.hypre 2019-10-28 22:30:04.000000000 +0000 @@ -1,20 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) driver.c is the same as linear_solvers/test/IJ_linear_evolvers.c, but with added "-solver " switches for Euclid: diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/shellSort_dh.c hypre-2.18.2/src/distributed_ls/Euclid/shellSort_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/shellSort_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/shellSort_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/shellSort_dh.h hypre-2.18.2/src/distributed_ls/Euclid/shellSort_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/shellSort_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/shellSort_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef SUPPORT_DH #define SUPPORT_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/sig_dh.c hypre-2.18.2/src/distributed_ls/Euclid/sig_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/sig_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/sig_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "sig_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/sig_dh.h hypre-2.18.2/src/distributed_ls/Euclid/sig_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/sig_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/sig_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef MY_SIG_DH #define MY_SIG_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/SortedList_dh.c hypre-2.18.2/src/distributed_ls/Euclid/SortedList_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/SortedList_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/SortedList_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "SortedList_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/SortedList_dh.h hypre-2.18.2/src/distributed_ls/Euclid/SortedList_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/SortedList_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/SortedList_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef SORTEDLIST_DH_H #define SORTEDLIST_DH_H diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/SortedSet_dh.c hypre-2.18.2/src/distributed_ls/Euclid/SortedSet_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/SortedSet_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/SortedSet_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "SortedSet_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/SortedSet_dh.h hypre-2.18.2/src/distributed_ls/Euclid/SortedSet_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/SortedSet_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/SortedSet_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef SORTED_SET_DH #define SORTED_SET_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/SubdomainGraph_dh.c hypre-2.18.2/src/distributed_ls/Euclid/SubdomainGraph_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/SubdomainGraph_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/SubdomainGraph_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "SubdomainGraph_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/SubdomainGraph_dh.h hypre-2.18.2/src/distributed_ls/Euclid/SubdomainGraph_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/SubdomainGraph_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/SubdomainGraph_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef SUBDOMAIN_GRAPH_DH #define SUBDOMAIN_GRAPH_DH diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/test/euclid.sh hypre-2.18.2/src/distributed_ls/Euclid/test/euclid.sh --- hypre-2.16.0/src/distributed_ls/Euclid/test/euclid.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/test/euclid.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -#!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. -# -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - - - - -#notes: -# this script should be called by: IJ_linear_solvers.sh per: -# ../distributed_ls/Euclid/test/euclid.sh -# -# HYPRE_ARCH and MPIRUN are initialized by caller. - -#=========================================================================== -# goto Euclid's test directory -#=========================================================================== - -CALLING_DIR=`pwd` -EUCLID_TEST_DIR=${CALLING_DIR}/../distributed_ls/Euclid/test -cd $EUCLID_TEST_DIR - -#================================================================= -# single cpu tests -#================================================================= - -rm -rf *.out* *temp *database - -# -#read options from "database" (the default configuration filename) -# -cp input/level.3 ./database -$MPIRUN -np 1 $DRIVER -solver 43 -laplacian -printTestData eu.temp -diff eu.temp output/test3.out >&2 -rm -f database eu.temp - -# -#specify a different configuration filename, and read options therefrom -# -cp input/level.3 . -$MPIRUN -np 1 $DRIVER -solver 43 -laplacian -db_filename level.3 -printTestData eu.temp -diff eu.temp output/test3.out >&2 -rm -f level.3 eu.temp - -# -#ensure command line options override options in the configuration file -# -cp input/level.3 ./database -$MPIRUN -np 1 $DRIVER -solver 43 -laplacian -printTestData eu.temp -diff eu.temp output/test2.out >&2 -rm -f database eu.temp - - -#================================================================= -# mulitple cpu tests -#================================================================= - -rm -rf *.out* *temp *database diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/test/input/level.2 hypre-2.18.2/src/distributed_ls/Euclid/test/input/level.2 --- hypre-2.16.0/src/distributed_ls/Euclid/test/input/level.2 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/test/input/level.2 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ --level 2 diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/test/input/level.3 hypre-2.18.2/src/distributed_ls/Euclid/test/input/level.3 --- hypre-2.16.0/src/distributed_ls/Euclid/test/input/level.3 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/test/input/level.3 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ --level 3 diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/TimeLog_dh.c hypre-2.18.2/src/distributed_ls/Euclid/TimeLog_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/TimeLog_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/TimeLog_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "TimeLog_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/TimeLog_dh.h hypre-2.18.2/src/distributed_ls/Euclid/TimeLog_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/TimeLog_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/TimeLog_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* Euclid employs a global object: diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Timer_dh.c hypre-2.18.2/src/distributed_ls/Euclid/Timer_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/Timer_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Timer_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_Euclid.h" /* #include "Timer_dh.h" */ diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Timer_dh.h hypre-2.18.2/src/distributed_ls/Euclid/Timer_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/Timer_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Timer_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef TIMER_DH_H #define TIMER_DH_H diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Vec_dh.c hypre-2.18.2/src/distributed_ls/Euclid/Vec_dh.c --- hypre-2.16.0/src/distributed_ls/Euclid/Vec_dh.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Vec_dh.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include "_hypre_Euclid.h" diff -Nru hypre-2.16.0/src/distributed_ls/Euclid/Vec_dh.h hypre-2.18.2/src/distributed_ls/Euclid/Vec_dh.h --- hypre-2.16.0/src/distributed_ls/Euclid/Vec_dh.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Euclid/Vec_dh.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef VEC_DH_H #define VEC_DH_H diff -Nru hypre-2.16.0/src/distributed_ls/Makefile hypre-2.18.2/src/distributed_ls/Makefile --- hypre-2.16.0/src/distributed_ls/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/CMakeLists.txt hypre-2.18.2/src/distributed_ls/ParaSails/CMakeLists.txt --- hypre-2.16.0/src/distributed_ls/ParaSails/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,27 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(PARASAILS_SRCS + ConjGrad.c + DiagScale.c + FGmres.c + Hash.c + hypre_ParaSails.c + LoadBal.c + Matrix.c + Mem.c + Numbering.c + OrderStat.c + ParaSails.c + PrunedRows.c + RowPatt.c + StoredRows.c +) + +convert_filenames_to_full_paths(PARASAILS_SRCS) + +set(SRCS ${SRCS} ${PARASAILS_SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/Common.h hypre-2.18.2/src/distributed_ls/ParaSails/Common.h --- hypre-2.16.0/src/distributed_ls/ParaSails/Common.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/Common.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/ConjGrad.c hypre-2.18.2/src/distributed_ls/ParaSails/ConjGrad.c --- hypre-2.16.0/src/distributed_ls/ParaSails/ConjGrad.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/ConjGrad.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/ConjGrad.h hypre-2.18.2/src/distributed_ls/ParaSails/ConjGrad.h --- hypre-2.16.0/src/distributed_ls/ParaSails/ConjGrad.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/ConjGrad.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/convert.c hypre-2.18.2/src/distributed_ls/ParaSails/convert.c --- hypre-2.16.0/src/distributed_ls/ParaSails/convert.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/convert.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include /* Convert - conversion routines from triangular formats */ diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/DiagScale.c hypre-2.18.2/src/distributed_ls/ParaSails/DiagScale.c --- hypre-2.16.0/src/distributed_ls/ParaSails/DiagScale.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/DiagScale.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/DiagScale.h hypre-2.18.2/src/distributed_ls/ParaSails/DiagScale.h --- hypre-2.16.0/src/distributed_ls/ParaSails/DiagScale.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/DiagScale.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/driver.c hypre-2.18.2/src/distributed_ls/ParaSails/driver.c --- hypre-2.16.0/src/distributed_ls/ParaSails/driver.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/driver.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,250 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#include -#include -#include "Common.h" -#include "Matrix.h" -#include "ParaSails.h" -#include "ConjGrad.h" - -/* - * Usage: driver symmetric num_runs matrixfile [rhsfile] - * - * If num_runs == 1, then hard-coded parameters will be used; else the - * user will be prompted for parameters (except on the final run). - * - * To simulate diagonal preconditioning, use a large value of thresh, - * e.g., thresh > 10. - */ - -HYPRE_Int main(HYPRE_Int argc, char *argv[]) -{ - HYPRE_Int mype, npes; - HYPRE_Int symmetric; - HYPRE_Int num_runs; - Matrix *A; - ParaSails *ps; - FILE *file; - HYPRE_Int n, beg_row, end_row; - HYPRE_Real time0, time1; - HYPRE_Real setup_time, solve_time; - HYPRE_Real max_setup_time, max_solve_time; - HYPRE_Real cost; - - HYPRE_Real *x, *b; - HYPRE_Int i, niter; - HYPRE_Real thresh; - HYPRE_Real threshg; - HYPRE_Int nlevels; - HYPRE_Real filter; - HYPRE_Real loadbal; - - hypre_MPI_Init(&argc, &argv); - hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &mype); - hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &npes); - - /* Read number of rows in matrix */ - symmetric = atoi(argv[1]); - num_runs = atoi(argv[2]); - - file = fopen(argv[3], "r"); - assert(file != NULL); -#ifdef EMSOLVE - hypre_fscanf(file, "%*d %d\n", &n); -#else - hypre_fscanf(file, "%d\n", &n); -#endif - fclose(file); - assert(n >= npes); - - beg_row = (HYPRE_Int) ((HYPRE_Real)(mype*n) / npes) + 1; /* assumes 1-based */ - end_row = (HYPRE_Int) ((HYPRE_Real)((mype+1)* n) / npes); - - if (mype == 0) - assert(beg_row == 1); - if (mype == npes-1) - assert(end_row == n); - -#ifdef EMSOLVE - beg_row--; - end_row--; -#endif - - x = hypre_TAlloc(HYPRE_Real, (end_row-beg_row+1) , HYPRE_MEMORY_HOST); - b = hypre_TAlloc(HYPRE_Real, (end_row-beg_row+1) , HYPRE_MEMORY_HOST); - - A = MatrixCreate(hypre_MPI_COMM_WORLD, beg_row, end_row); - - MatrixRead(A, argv[3]); - if (mype == 0) - hypre_printf("%s\n", argv[3]); - - /* MatrixPrint(A, "A"); */ - - /* Right-hand side */ - if (argc > 4) - { - RhsRead(b, A, argv[4]); - if (mype == 0) - hypre_printf("Using rhs from %s\n", argv[4]); - } - else - { - for (i=0; i= -1) - { - /* Initial guess */ - for (i=0; iloadbal_beta = loadbal; - -#if PARASAILS_EXT_PATTERN - ParaSailsSetupPatternExt(ps, A, threshg, thresh, nlevels); -#else - ParaSailsSetupPattern(ps, A, thresh, nlevels); -#endif - - time1 = hypre_MPI_Wtime(); - setup_time = time1-time0; - - cost = ParaSailsStatsPattern(ps, A); - if (cost > 5.e11) - { - hypre_printf("Aborting setup and solve due to high cost.\n"); - goto cleanup; - } - - hypre_MPI_Barrier(hypre_MPI_COMM_WORLD); - time0 = hypre_MPI_Wtime(); - - err = ParaSailsSetupValues(ps, A, filter); - if (err != 0) - { - hypre_printf("ParaSailsSetupValues returned error.\n"); - goto cleanup; - } - - time1 = hypre_MPI_Wtime(); - setup_time += (time1-time0); - - ParaSailsStatsValues(ps, A); - - if (!strncmp(argv[3], "testpsmat", 8)) - MatrixPrint(ps->M, "M"); - -#if 0 - if (mype == 0) - hypre_printf("SETTING UP VALUES AGAIN WITH FILTERED PATTERN\n"); - ps->loadbal_beta = 0; - ParaSailsSetupValues(ps, A, 0.0); -#endif - - /***************** - * Solution phase - *****************/ - - niter = 3000; - if (MatrixNnz(ps->M) == n) /* if diagonal preconditioner */ - niter = 5000; - - hypre_MPI_Barrier(hypre_MPI_COMM_WORLD); - time0 = hypre_MPI_Wtime(); - - if (symmetric == 1) - PCG_ParaSails(A, ps, b, x, 1.e-8, niter); - else - FGMRES_ParaSails(A, ps, b, x, 50, 1.e-8, niter); - - time1 = hypre_MPI_Wtime(); - solve_time = time1-time0; - - hypre_MPI_Reduce(&setup_time, &max_setup_time, 1, hypre_MPI_REAL, hypre_MPI_MAX, 0, - hypre_MPI_COMM_WORLD); - hypre_MPI_Reduce(&solve_time, &max_solve_time, 1, hypre_MPI_REAL, hypre_MPI_MAX, 0, - hypre_MPI_COMM_WORLD); - - if (mype == 0) - { - hypre_printf("**********************************************\n"); - hypre_printf("*** Setup Solve Total\n"); - hypre_printf("III %8.1f %8.1f %8.1f\n", max_setup_time, max_solve_time, - max_setup_time+max_solve_time); - hypre_printf("**********************************************\n"); - } - -cleanup: - ParaSailsDestroy(ps); - - num_runs--; - } - - free(x); - free(b); - - MatrixDestroy(A); - hypre_MPI_Finalize(); - - return 0; -} diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/FGmres.c hypre-2.18.2/src/distributed_ls/ParaSails/FGmres.c --- hypre-2.16.0/src/distributed_ls/ParaSails/FGmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/FGmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/Hash.c hypre-2.18.2/src/distributed_ls/ParaSails/Hash.c --- hypre-2.16.0/src/distributed_ls/ParaSails/Hash.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/Hash.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/Hash.h hypre-2.18.2/src/distributed_ls/ParaSails/Hash.h --- hypre-2.16.0/src/distributed_ls/ParaSails/Hash.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/Hash.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/hypre_ParaSails.c hypre-2.18.2/src/distributed_ls/ParaSails/hypre_ParaSails.c --- hypre-2.16.0/src/distributed_ls/ParaSails/hypre_ParaSails.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/hypre_ParaSails.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/hypre_ParaSails.h hypre-2.18.2/src/distributed_ls/ParaSails/hypre_ParaSails.h --- hypre-2.16.0/src/distributed_ls/ParaSails/hypre_ParaSails.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/hypre_ParaSails.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/lapdriver.c hypre-2.18.2/src/distributed_ls/ParaSails/lapdriver.c --- hypre-2.16.0/src/distributed_ls/ParaSails/lapdriver.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/lapdriver.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,336 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#include -#include -#include "Common.h" -#include "Matrix.h" -#include "ParaSails.h" -#include "ConjGrad.h" - -/* functions for instrumenting code */ -/* compile using - cc -bI:/usr/lpp/pmtoolkit/lib/pmsvcs.exp -o counter counter.c -lpmapi */ - -#include -#if 0 -#include "pmapi.h" - -#define ERROR_CODE -1 -#define OK_CODE 0 - -void hcinit(); -void hcreset(); /* will accumulate if not reset */ -void hcstart(); /* use start and stop to surround sections to instrument */ -void hcstop(); /* each stop will print a message */ -void hcfinish(); - -void hcinit() -{ - pm_info_t myinfo; - pm_prog_t prog; - HYPRE_Int rc; - HYPRE_Int filter = 0; - - prog.mode.w = 0; - - prog.events[0] = 15; /* floating point ops */ - prog.events[1] = 6; /* data cache misses */ - prog.events[2] = 1; /* cycles */ - prog.events[3] = 2; /* instr completed per cycle */ - - /* prog.mode.w |= PM_KERNEL; *//* count in kernel mode */ - prog.mode.w |= PM_USER; /* count in user mode */ - - prog.mode.w |= PM_PROCESS; - - if ( (rc = pm_init(filter, &myinfo)) != OK_CODE) { - pm_error("pm_init", rc); - exit(ERROR_CODE); - } - - prog.mode.b.count = 1; - - if ( (rc = pm_set_program_mygroup(&prog)) != OK_CODE) { - pm_error("pm_set_program_mygroup", rc); - exit(ERROR_CODE); - } -} - -void hcreset() -{ - HYPRE_Int rc; - - if ( (rc = pm_reset_data_mygroup()) != OK_CODE) - pm_error("pm_reset_data_mygroup", rc); -} - -void hcstart() -{ - HYPRE_Int rc; - - if ( (rc = pm_start_mygroup()) != OK_CODE) - pm_error("pm_start_mygroup", rc); -} - -void hcstop() -{ - pm_prog_t getprog; - pm_data_t mydata; - HYPRE_Int rc; - - if ( (rc = pm_stop_mygroup()) != OK_CODE) - pm_error("pm_stop_mygroup", rc); - - if ( (rc = pm_get_program_mygroup(&getprog)) != OK_CODE) - pm_error("pm_get_program_mygroup", rc); - - if ( (rc = pm_get_data_mygroup(&mydata)) != OK_CODE) - pm_error("pm_get_data_mygroup", rc); - - hypre_printf("--------------\n"); - hypre_printf("flops: %-8lld\n", mydata.accu[0]); - hypre_printf("dcmiss: %-8lld\n", mydata.accu[1]); - hypre_printf("cycles: %-8lld\n", mydata.accu[2]); - hypre_printf("instr: %-8lld\n", mydata.accu[3]); -} - -void hcfinish() -{ - HYPRE_Int rc; - - if ( (rc = pm_delete_program_mygroup()) != OK_CODE) - pm_error("pm_delete_program_mygroup", rc); -} -#endif - -HYPRE_Int rownum(const HYPRE_Int x, const HYPRE_Int y, const HYPRE_Int z, - const HYPRE_Int nx, const HYPRE_Int ny, const HYPRE_Int nz, HYPRE_Int P, HYPRE_Int Q) -{ - HYPRE_Int p, q, r; - HYPRE_Int lowerx, lowery, lowerz; - HYPRE_Int id, startrow; - - p = (x-1) / nx; - q = (y-1) / ny; - r = (z-1) / nz; - id = r*P*Q+q*P+p; - startrow = id*(nx*ny*nz) + 1; - lowerx = nx*p + 1; - lowery = ny*q + 1; - lowerz = nz*r + 1; - - return startrow + nx*ny*(z-lowerz) + nx*(y-lowery) + (x-lowerx); -} - -HYPRE_Int main(HYPRE_Int argc, char *argv[]) -{ - HYPRE_Int npes, mype; - - HYPRE_Int nx, ny, nz; - HYPRE_Int P, Q, R; - HYPRE_Real dx, dy, dz; - HYPRE_Int p, q, r; - HYPRE_Int lowerx, lowery, lowerz; - HYPRE_Int upperx, uppery, upperz; - HYPRE_Int x, y, z; - HYPRE_Int num_rows; - HYPRE_Int row; - HYPRE_Int inds[100], *inds_p; - HYPRE_Real coefs[100], *coefs_p; - HYPRE_Int beg_row, end_row; - HYPRE_Real time0, time1; - HYPRE_Real setup_time, solve_time; - HYPRE_Real max_setup_time, max_solve_time; - - HYPRE_Real *x0, *b; - HYPRE_Int i; - Matrix *A; - ParaSails *ps; - - hypre_MPI_Init(&argc, &argv); - - hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &mype); - hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &npes); - - if (argc > 9) - { - nx = atoi(argv[1]); - ny = atoi(argv[2]); - nz = atoi(argv[3]); - P = atoi(argv[4]); - Q = atoi(argv[5]); - R = atoi(argv[6]); - dx = atof(argv[7]); - dy = atof(argv[8]); - dz = atof(argv[9]); - } - else - { - hypre_printf("Usage: mpirun -np %d %s ,\n\n", - npes, argv[0]); - hypre_printf(" where nx X ny X nz is the problem size per processor;\n"); - hypre_printf(" P X Q X R is the processor topology;\n"); - hypre_printf(" dx, dy, dz are the diffusion coefficients.\n"); - - exit(1); - } - - assert(npes == P*Q*R); - - hypre_printf("XX side: %4d npes: %4d n: %10d\n", nx, npes, npes*nx*ny*nz); - - /* compute p,q,r from P,Q,R and mype */ - p = mype % P; - q = (( mype - p)/P) % Q; - r = ( mype - p - P*q)/( P*Q ); - - /* compute ilower and iupper from p,q,r and nx,ny,nz */ - /* 1-based */ - - lowerx = nx*p + 1; - upperx = nx*(p+1); - lowery = ny*q + 1; - uppery = ny*(q+1); - lowerz = nz*r + 1; - upperz = nz*(r+1); - - num_rows = P*Q*R*nx*ny*nz; - beg_row = mype*(nx*ny*nz)+1; - end_row = (mype+1)*(nx*ny*nz); - - x0 = hypre_TAlloc(HYPRE_Real, (end_row-beg_row+1) , HYPRE_MEMORY_HOST); - b = hypre_TAlloc(HYPRE_Real, (end_row-beg_row+1) , HYPRE_MEMORY_HOST); - - for (i=0; inumb->hash); -*/ - MatrixDestroy(A); - - free(x0); - free(b); - - hypre_MPI_Finalize(); -} diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/LoadBal.c hypre-2.18.2/src/distributed_ls/ParaSails/LoadBal.c --- hypre-2.16.0/src/distributed_ls/ParaSails/LoadBal.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/LoadBal.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/LoadBal.h hypre-2.18.2/src/distributed_ls/ParaSails/LoadBal.h --- hypre-2.16.0/src/distributed_ls/ParaSails/LoadBal.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/LoadBal.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/Makefile hypre-2.18.2/src/distributed_ls/ParaSails/Makefile --- hypre-2.16.0/src/distributed_ls/ParaSails/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../../config/Makefile.config diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/Matrix.c hypre-2.18.2/src/distributed_ls/ParaSails/Matrix.c --- hypre-2.16.0/src/distributed_ls/ParaSails/Matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/Matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/Matrix.h hypre-2.18.2/src/distributed_ls/ParaSails/Matrix.h --- hypre-2.16.0/src/distributed_ls/ParaSails/Matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/Matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/Mem.c hypre-2.18.2/src/distributed_ls/ParaSails/Mem.c --- hypre-2.16.0/src/distributed_ls/ParaSails/Mem.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/Mem.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/Mem.h hypre-2.18.2/src/distributed_ls/ParaSails/Mem.h --- hypre-2.16.0/src/distributed_ls/ParaSails/Mem.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/Mem.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/Numbering.c hypre-2.18.2/src/distributed_ls/ParaSails/Numbering.c --- hypre-2.16.0/src/distributed_ls/ParaSails/Numbering.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/Numbering.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/Numbering.h hypre-2.18.2/src/distributed_ls/ParaSails/Numbering.h --- hypre-2.16.0/src/distributed_ls/ParaSails/Numbering.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/Numbering.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/OrderStat.c hypre-2.18.2/src/distributed_ls/ParaSails/OrderStat.c --- hypre-2.16.0/src/distributed_ls/ParaSails/OrderStat.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/OrderStat.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/OrderStat.h hypre-2.18.2/src/distributed_ls/ParaSails/OrderStat.h --- hypre-2.16.0/src/distributed_ls/ParaSails/OrderStat.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/OrderStat.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/ParaSails.c hypre-2.18.2/src/distributed_ls/ParaSails/ParaSails.c --- hypre-2.16.0/src/distributed_ls/ParaSails/ParaSails.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/ParaSails.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/ParaSails.h hypre-2.18.2/src/distributed_ls/ParaSails/ParaSails.h --- hypre-2.16.0/src/distributed_ls/ParaSails/ParaSails.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/ParaSails.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/permute.c hypre-2.18.2/src/distributed_ls/ParaSails/permute.c --- hypre-2.16.0/src/distributed_ls/ParaSails/permute.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/permute.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include /* Permute - permute matrix */ diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/PrunedRows.c hypre-2.18.2/src/distributed_ls/ParaSails/PrunedRows.c --- hypre-2.16.0/src/distributed_ls/ParaSails/PrunedRows.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/PrunedRows.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/PrunedRows.h hypre-2.18.2/src/distributed_ls/ParaSails/PrunedRows.h --- hypre-2.16.0/src/distributed_ls/ParaSails/PrunedRows.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/PrunedRows.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/.psrc hypre-2.18.2/src/distributed_ls/ParaSails/.psrc --- hypre-2.16.0/src/distributed_ls/ParaSails/.psrc 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/.psrc 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -insure++.file_ignore Mem.c diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/RowPatt.c hypre-2.18.2/src/distributed_ls/ParaSails/RowPatt.c --- hypre-2.16.0/src/distributed_ls/ParaSails/RowPatt.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/RowPatt.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/RowPatt.h hypre-2.18.2/src/distributed_ls/ParaSails/RowPatt.h --- hypre-2.16.0/src/distributed_ls/ParaSails/RowPatt.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/RowPatt.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/StoredRows.c hypre-2.18.2/src/distributed_ls/ParaSails/StoredRows.c --- hypre-2.16.0/src/distributed_ls/ParaSails/StoredRows.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/StoredRows.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/ParaSails/StoredRows.h hypre-2.18.2/src/distributed_ls/ParaSails/StoredRows.h --- hypre-2.16.0/src/distributed_ls/ParaSails/StoredRows.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/ParaSails/StoredRows.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/pilut/CMakeLists.txt hypre-2.18.2/src/distributed_ls/pilut/CMakeLists.txt --- hypre-2.16.0/src/distributed_ls/pilut/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,31 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(PILUT_HDRS + HYPRE_DistributedMatrixPilutSolver_protos.h + HYPRE_DistributedMatrixPilutSolver_types.h +) + +set(PILUT_SRCS + comm.c + debug.c + distributed_qsort.c + distributed_qsort_si.c + HYPRE_DistributedMatrixPilutSolver.c + ilut.c + parilut.c + parutil.c + pblas1.c + serilut.c + trifactor.c + util.c +) + +convert_filenames_to_full_paths(PILUT_HDRS) +convert_filenames_to_full_paths(PILUT_SRCS) + +set(HDRS ${HDRS} ${PILUT_HDRS} PARENT_SCOPE) +set(SRCS ${SRCS} ${PILUT_SRCS} PARENT_SCOPE) + diff -Nru hypre-2.16.0/src/distributed_ls/pilut/comm.c hypre-2.18.2/src/distributed_ls/pilut/comm.c --- hypre-2.16.0/src/distributed_ls/pilut/comm.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/comm.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* * comm.c diff -Nru hypre-2.16.0/src/distributed_ls/pilut/const.h hypre-2.18.2/src/distributed_ls/pilut/const.h --- hypre-2.16.0/src/distributed_ls/pilut/const.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/const.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef CONST_H #define CONST_H diff -Nru hypre-2.16.0/src/distributed_ls/pilut/debug.c hypre-2.18.2/src/distributed_ls/pilut/debug.c --- hypre-2.16.0/src/distributed_ls/pilut/debug.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/debug.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* * debug.c diff -Nru hypre-2.16.0/src/distributed_ls/pilut/DistributedMatrixPilutSolver.h hypre-2.18.2/src/distributed_ls/pilut/DistributedMatrixPilutSolver.h --- hypre-2.16.0/src/distributed_ls/pilut/DistributedMatrixPilutSolver.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/DistributedMatrixPilutSolver.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,20 +1,15 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef _DISTRIBUTED_MATRIX_PILUT_SOLVER_HEADER #define _DISTRIBUTED_MATRIX_PILUT_SOLVER_HEADER #include "HYPRE_config.h" -#include "general.h" +#include "hypre_general.h" #include "_hypre_utilities.h" /* #ifdef HYPRE_DEBUG diff -Nru hypre-2.16.0/src/distributed_ls/pilut/distributed_qsort.c hypre-2.18.2/src/distributed_ls/pilut/distributed_qsort.c --- hypre-2.16.0/src/distributed_ls/pilut/distributed_qsort.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/distributed_qsort.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifdef __cplusplus #define REGISTER diff -Nru hypre-2.16.0/src/distributed_ls/pilut/distributed_qsort_si.c hypre-2.18.2/src/distributed_ls/pilut/distributed_qsort_si.c --- hypre-2.16.0/src/distributed_ls/pilut/distributed_qsort_si.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/distributed_qsort_si.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifdef __cplusplus #define REGISTER diff -Nru hypre-2.16.0/src/distributed_ls/pilut/HYPRE_DistributedMatrixPilutSolver.c hypre-2.18.2/src/distributed_ls/pilut/HYPRE_DistributedMatrixPilutSolver.c --- hypre-2.16.0/src/distributed_ls/pilut/HYPRE_DistributedMatrixPilutSolver.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/HYPRE_DistributedMatrixPilutSolver.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* Include headers for problem and solver data structure */ #include "./DistributedMatrixPilutSolver.h" diff -Nru hypre-2.16.0/src/distributed_ls/pilut/HYPRE_DistributedMatrixPilutSolver_protos.h hypre-2.18.2/src/distributed_ls/pilut/HYPRE_DistributedMatrixPilutSolver_protos.h --- hypre-2.16.0/src/distributed_ls/pilut/HYPRE_DistributedMatrixPilutSolver_protos.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/HYPRE_DistributedMatrixPilutSolver_protos.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,19 +1,10 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ - /* HYPRE_DistributedMatrixPilutSolver.c */ HYPRE_Int HYPRE_NewDistributedMatrixPilutSolver (MPI_Comm comm , HYPRE_DistributedMatrix matrix, HYPRE_DistributedMatrixPilutSolver *solver ); HYPRE_Int HYPRE_FreeDistributedMatrixPilutSolver (HYPRE_DistributedMatrixPilutSolver in_ptr ); diff -Nru hypre-2.16.0/src/distributed_ls/pilut/HYPRE_DistributedMatrixPilutSolver_types.h hypre-2.18.2/src/distributed_ls/pilut/HYPRE_DistributedMatrixPilutSolver_types.h --- hypre-2.16.0/src/distributed_ls/pilut/HYPRE_DistributedMatrixPilutSolver_types.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/HYPRE_DistributedMatrixPilutSolver_types.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,20 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_ls/pilut/ilu.h hypre-2.18.2/src/distributed_ls/pilut/ilu.h --- hypre-2.16.0/src/distributed_ls/pilut/ilu.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/ilu.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef ILU_H #define ILU_H diff -Nru hypre-2.16.0/src/distributed_ls/pilut/ilut.c hypre-2.18.2/src/distributed_ls/pilut/ilut.c --- hypre-2.16.0/src/distributed_ls/pilut/ilut.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/ilut.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* * ilut.c diff -Nru hypre-2.16.0/src/distributed_ls/pilut/internal_protos.h hypre-2.18.2/src/distributed_ls/pilut/internal_protos.h --- hypre-2.16.0/src/distributed_ls/pilut/internal_protos.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/internal_protos.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* HYPRE_DistributedMatrixPilutSolver.c */ HYPRE_Int HYPRE_NewDistributedMatrixPilutSolver( MPI_Comm comm , HYPRE_DistributedMatrix matrix , HYPRE_DistributedMatrixPilutSolver *new_solver ); diff -Nru hypre-2.16.0/src/distributed_ls/pilut/macros.h hypre-2.18.2/src/distributed_ls/pilut/macros.h --- hypre-2.16.0/src/distributed_ls/pilut/macros.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/macros.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,22 +1,14 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef MACROS_H #define MACROS_H -#include "../../utilities/general.h" +#include "../../utilities/hypre_general.h" #include "../../utilities/fortran.h" /* @@ -106,7 +98,7 @@ #endif /********************************************************************* -* Utility Macros +* Utility Macros **********************************************************************/ /* MPI and Cray native timers. Note MPI uses doubles while Cray uses longs */ #if MACHINE_IS_CRAY diff -Nru hypre-2.16.0/src/distributed_ls/pilut/Makefile hypre-2.18.2/src/distributed_ls/pilut/Makefile --- hypre-2.16.0/src/distributed_ls/pilut/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../../config/Makefile.config diff -Nru hypre-2.16.0/src/distributed_ls/pilut/parilut.c hypre-2.18.2/src/distributed_ls/pilut/parilut.c --- hypre-2.16.0/src/distributed_ls/pilut/parilut.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/parilut.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* * parilut.c diff -Nru hypre-2.16.0/src/distributed_ls/pilut/parutil.c hypre-2.18.2/src/distributed_ls/pilut/parutil.c --- hypre-2.16.0/src/distributed_ls/pilut/parutil.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/parutil.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* * parutil.c diff -Nru hypre-2.16.0/src/distributed_ls/pilut/pblas1.c hypre-2.18.2/src/distributed_ls/pilut/pblas1.c --- hypre-2.16.0/src/distributed_ls/pilut/pblas1.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/pblas1.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* * pblas1.c diff -Nru hypre-2.16.0/src/distributed_ls/pilut/serilut.c hypre-2.18.2/src/distributed_ls/pilut/serilut.c --- hypre-2.16.0/src/distributed_ls/pilut/serilut.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/serilut.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* * serilut.c diff -Nru hypre-2.16.0/src/distributed_ls/pilut/struct.h hypre-2.18.2/src/distributed_ls/pilut/struct.h --- hypre-2.16.0/src/distributed_ls/pilut/struct.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/struct.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef STRUCT_H #define STRUCT_H diff -Nru hypre-2.16.0/src/distributed_ls/pilut/trifactor.c hypre-2.18.2/src/distributed_ls/pilut/trifactor.c --- hypre-2.16.0/src/distributed_ls/pilut/trifactor.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/trifactor.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* * trifactor.c diff -Nru hypre-2.16.0/src/distributed_ls/pilut/util.c hypre-2.18.2/src/distributed_ls/pilut/util.c --- hypre-2.16.0/src/distributed_ls/pilut/util.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_ls/pilut/util.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* * util.c diff -Nru hypre-2.16.0/src/distributed_matrix/CMakeLists.txt hypre-2.18.2/src/distributed_matrix/CMakeLists.txt --- hypre-2.16.0/src/distributed_matrix/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/distributed_matrix/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,24 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(HDRS + distributed_matrix.h +) + +set(SRCS + distributed_matrix.c + distributed_matrix_ISIS.c + distributed_matrix_parcsr.c + distributed_matrix_PETSc.c + HYPRE_distributed_matrix.c +) + +convert_filenames_to_full_paths(HDRS) +convert_filenames_to_full_paths(SRCS) + +set(HYPRE_HEADERS ${HYPRE_HEADERS} ${HDRS} PARENT_SCOPE) +set(HYPRE_SOURCES ${HYPRE_SOURCES} ${SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/distributed_matrix/distributed_matrix.c hypre-2.18.2/src/distributed_matrix/distributed_matrix.c --- hypre-2.16.0/src/distributed_matrix/distributed_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_matrix/distributed_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_matrix/distributed_matrix.h hypre-2.18.2/src/distributed_matrix/distributed_matrix.h --- hypre-2.16.0/src/distributed_matrix/distributed_matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_matrix/distributed_matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_matrix/distributed_matrix_ISIS.c hypre-2.18.2/src/distributed_matrix/distributed_matrix_ISIS.c --- hypre-2.16.0/src/distributed_matrix/distributed_matrix_ISIS.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_matrix/distributed_matrix_ISIS.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* THIS IS A C++ FILE, since it needs to call ISIS++ with objects */ diff -Nru hypre-2.16.0/src/distributed_matrix/distributed_matrix_ISIS.cc hypre-2.18.2/src/distributed_matrix/distributed_matrix_ISIS.cc --- hypre-2.16.0/src/distributed_matrix/distributed_matrix_ISIS.cc 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_matrix/distributed_matrix_ISIS.cc 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* THIS IS A C++ FILE, since it needs to call ISIS++ with objects */ diff -Nru hypre-2.16.0/src/distributed_matrix/distributed_matrix_parcsr.c hypre-2.18.2/src/distributed_matrix/distributed_matrix_parcsr.c --- hypre-2.16.0/src/distributed_matrix/distributed_matrix_parcsr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_matrix/distributed_matrix_parcsr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_matrix/distributed_matrix_PETSc.c hypre-2.18.2/src/distributed_matrix/distributed_matrix_PETSc.c --- hypre-2.16.0/src/distributed_matrix/distributed_matrix_PETSc.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_matrix/distributed_matrix_PETSc.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_matrix/HYPRE_distributed_matrix.c hypre-2.18.2/src/distributed_matrix/HYPRE_distributed_matrix.c --- hypre-2.16.0/src/distributed_matrix/HYPRE_distributed_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_matrix/HYPRE_distributed_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_matrix/HYPRE_distributed_matrix_mv.h hypre-2.18.2/src/distributed_matrix/HYPRE_distributed_matrix_mv.h --- hypre-2.16.0/src/distributed_matrix/HYPRE_distributed_matrix_mv.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_matrix/HYPRE_distributed_matrix_mv.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/distributed_matrix/HYPRE_distributed_matrix_protos.h hypre-2.18.2/src/distributed_matrix/HYPRE_distributed_matrix_protos.h --- hypre-2.16.0/src/distributed_matrix/HYPRE_distributed_matrix_protos.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_matrix/HYPRE_distributed_matrix_protos.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,8 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "HYPRE_distributed_matrix_mv.h" diff -Nru hypre-2.16.0/src/distributed_matrix/HYPRE_distributed_matrix_types.h hypre-2.18.2/src/distributed_matrix/HYPRE_distributed_matrix_types.h --- hypre-2.16.0/src/distributed_matrix/HYPRE_distributed_matrix_types.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_matrix/HYPRE_distributed_matrix_types.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,8 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "HYPRE_distributed_matrix_mv.h" diff -Nru hypre-2.16.0/src/distributed_matrix/internal_protos.h hypre-2.18.2/src/distributed_matrix/internal_protos.h --- hypre-2.16.0/src/distributed_matrix/internal_protos.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_matrix/internal_protos.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* HYPRE_distributed_matrix.c */ HYPRE_Int HYPRE_DistributedMatrixCreate (MPI_Comm context, HYPRE_DistributedMatrix *matrix ); diff -Nru hypre-2.16.0/src/distributed_matrix/Makefile hypre-2.18.2/src/distributed_matrix/Makefile --- hypre-2.16.0/src/distributed_matrix/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/distributed_matrix/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config diff -Nru hypre-2.16.0/src/docs/copyright.txt hypre-2.18.2/src/docs/copyright.txt --- hypre-2.16.0/src/docs/copyright.txt 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/copyright.txt 2019-10-28 22:30:04.000000000 +0000 @@ -1,7 +1,4 @@ -Copyright (c) 2008, Lawrence Livermore National Security, LLC. -Produced at the Lawrence Livermore National Laboratory. -See file COPYRIGHT for details. +Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +HYPRE Project Developers. See the top-level COPYRIGHT file for details. -HYPRE is free software; you can redistribute it and/or modify it under the -terms of the GNU Lesser General Public License (as published by the Free -Software Foundation) version 2.1 dated February 1999. +SPDX-License-Identifier: (Apache-2.0 OR MIT) diff -Nru hypre-2.16.0/src/docs/hypre.bib hypre-2.18.2/src/docs/hypre.bib --- hypre-2.16.0/src/docs/hypre.bib 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/hypre.bib 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +% Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +% HYPRE Project Developers. See the top-level COPYRIGHT file for details. +% +% SPDX-License-Identifier: (Apache-2.0 OR MIT) + @techreport {GKarypis_VKumar_1998, author = "Karypis, G. and Kumar, V.", diff -Nru hypre-2.16.0/src/docs/Makefile hypre-2.18.2/src/docs/Makefile --- hypre-2.16.0/src/docs/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config diff -Nru hypre-2.16.0/src/docs/ref-manual/conf.doxygen hypre-2.18.2/src/docs/ref-manual/conf.doxygen --- hypre-2.16.0/src/docs/ref-manual/conf.doxygen 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/ref-manual/conf.doxygen 2019-10-28 22:30:04.000000000 +0000 @@ -31,7 +31,7 @@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 2.16.0 +PROJECT_NUMBER = 2.18.2 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff -Nru hypre-2.16.0/src/docs/ref-manual/Makefile hypre-2.18.2/src/docs/ref-manual/Makefile --- hypre-2.16.0/src/docs/ref-manual/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/ref-manual/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) PDFLATEX = pdflatex --interaction=nonstopmode diff -Nru hypre-2.16.0/src/docs/update-release.sh hypre-2.18.2/src/docs/update-release.sh --- hypre-2.16.0/src/docs/update-release.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/update-release.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + usrconf="usr-manual/conf.py" refconf="ref-manual/conf.doxygen" diff -Nru hypre-2.16.0/src/docs/usr-manual/ch-fei.rst hypre-2.18.2/src/docs/usr-manual/ch-fei.rst --- hypre-2.16.0/src/docs/usr-manual/ch-fei.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/ch-fei.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + .. _ch-FEI: diff -Nru hypre-2.16.0/src/docs/usr-manual/ch-ij.rst hypre-2.18.2/src/docs/usr-manual/ch-ij.rst --- hypre-2.16.0/src/docs/usr-manual/ch-ij.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/ch-ij.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + .. _ch-IJ: diff -Nru hypre-2.16.0/src/docs/usr-manual/ch-intro.rst hypre-2.18.2/src/docs/usr-manual/ch-intro.rst --- hypre-2.16.0/src/docs/usr-manual/ch-intro.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/ch-intro.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + .. _introduction: diff -Nru hypre-2.16.0/src/docs/usr-manual/ch-misc.rst hypre-2.18.2/src/docs/usr-manual/ch-misc.rst --- hypre-2.16.0/src/docs/usr-manual/ch-misc.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/ch-misc.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + .. _ch-General: diff -Nru hypre-2.16.0/src/docs/usr-manual/ch-references.rst hypre-2.18.2/src/docs/usr-manual/ch-references.rst --- hypre-2.16.0/src/docs/usr-manual/ch-references.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/ch-references.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + .. _references: diff -Nru hypre-2.16.0/src/docs/usr-manual/ch-solvers.rst hypre-2.18.2/src/docs/usr-manual/ch-solvers.rst --- hypre-2.16.0/src/docs/usr-manual/ch-solvers.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/ch-solvers.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + .. _ch-Solvers: diff -Nru hypre-2.16.0/src/docs/usr-manual/ch-sstruct.rst hypre-2.18.2/src/docs/usr-manual/ch-sstruct.rst --- hypre-2.16.0/src/docs/usr-manual/ch-sstruct.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/ch-sstruct.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + .. _ch-SStruct: diff -Nru hypre-2.16.0/src/docs/usr-manual/ch-struct.rst hypre-2.18.2/src/docs/usr-manual/ch-struct.rst --- hypre-2.16.0/src/docs/usr-manual/ch-struct.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/ch-struct.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + .. _ch-Struct: diff -Nru hypre-2.16.0/src/docs/usr-manual/conf.py hypre-2.18.2/src/docs/usr-manual/conf.py --- hypre-2.16.0/src/docs/usr-manual/conf.py 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/conf.py 2019-10-28 22:30:04.000000000 +0000 @@ -48,16 +48,16 @@ # General information about the project. project = u'hypre' -copyright = u'2017, Lawrence Livermore National Laboratory' +copyright = u'1998-2019 Lawrence Livermore National Security, LLC and other HYPRE Project Developers. See the top-level COPYRIGHT file for details.' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '2.16.0' +version = '2.18.2' # The full version, including alpha/beta/rc tags. -release = '2.16.0' +release = '2.18.2' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -65,7 +65,7 @@ # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -today = 'March 20, 2019' +today = 'October 28, 2019' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' diff -Nru hypre-2.16.0/src/docs/usr-manual/index.rst hypre-2.18.2/src/docs/usr-manual/index.rst --- hypre-2.16.0/src/docs/usr-manual/index.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/index.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + .. hypre documentation master file, created by sphinx-quickstart on Fri Nov 17 15:46:25 2017. You can adapt this file completely to your liking, but it should at least diff -Nru hypre-2.16.0/src/docs/usr-manual/solvers-ads.rst hypre-2.18.2/src/docs/usr-manual/solvers-ads.rst --- hypre-2.16.0/src/docs/usr-manual/solvers-ads.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/solvers-ads.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + .. _ADS: diff -Nru hypre-2.16.0/src/docs/usr-manual/solvers-ams.rst hypre-2.18.2/src/docs/usr-manual/solvers-ams.rst --- hypre-2.16.0/src/docs/usr-manual/solvers-ams.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/solvers-ams.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + .. _AMS: diff -Nru hypre-2.16.0/src/docs/usr-manual/solvers-boomeramg.rst hypre-2.18.2/src/docs/usr-manual/solvers-boomeramg.rst --- hypre-2.16.0/src/docs/usr-manual/solvers-boomeramg.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/solvers-boomeramg.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + BoomerAMG ============================================================================== diff -Nru hypre-2.16.0/src/docs/usr-manual/solvers-euclid.rst hypre-2.18.2/src/docs/usr-manual/solvers-euclid.rst --- hypre-2.16.0/src/docs/usr-manual/solvers-euclid.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/solvers-euclid.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + Euclid ============================================================================== diff -Nru hypre-2.16.0/src/docs/usr-manual/solvers-fac.rst hypre-2.18.2/src/docs/usr-manual/solvers-fac.rst --- hypre-2.16.0/src/docs/usr-manual/solvers-fac.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/solvers-fac.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + FAC ============================================================================== diff -Nru hypre-2.16.0/src/docs/usr-manual/solvers-fei.rst hypre-2.18.2/src/docs/usr-manual/solvers-fei.rst --- hypre-2.16.0/src/docs/usr-manual/solvers-fei.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/solvers-fei.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + .. _LSI_solvers: diff -Nru hypre-2.16.0/src/docs/usr-manual/solvers-hybrid.rst hypre-2.18.2/src/docs/usr-manual/solvers-hybrid.rst --- hypre-2.16.0/src/docs/usr-manual/solvers-hybrid.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/solvers-hybrid.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + Hybrid ============================================================================== diff -Nru hypre-2.16.0/src/docs/usr-manual/solvers-lobpcg.rst hypre-2.18.2/src/docs/usr-manual/solvers-lobpcg.rst --- hypre-2.16.0/src/docs/usr-manual/solvers-lobpcg.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/solvers-lobpcg.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + LOBPCG Eigensolver ============================================================================== diff -Nru hypre-2.16.0/src/docs/usr-manual/solvers-maxwell.rst hypre-2.18.2/src/docs/usr-manual/solvers-maxwell.rst --- hypre-2.16.0/src/docs/usr-manual/solvers-maxwell.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/solvers-maxwell.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + Maxwell ============================================================================== diff -Nru hypre-2.16.0/src/docs/usr-manual/solvers-mgr.rst hypre-2.18.2/src/docs/usr-manual/solvers-mgr.rst --- hypre-2.16.0/src/docs/usr-manual/solvers-mgr.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/solvers-mgr.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + Multigrid Reduction (MGR) ============================================================================== diff -Nru hypre-2.16.0/src/docs/usr-manual/solvers-mli.rst hypre-2.18.2/src/docs/usr-manual/solvers-mli.rst --- hypre-2.16.0/src/docs/usr-manual/solvers-mli.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/solvers-mli.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + The MLI Package ============================================================================== diff -Nru hypre-2.16.0/src/docs/usr-manual/solvers-parasails.rst hypre-2.18.2/src/docs/usr-manual/solvers-parasails.rst --- hypre-2.16.0/src/docs/usr-manual/solvers-parasails.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/solvers-parasails.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + ParaSails ============================================================================== diff -Nru hypre-2.16.0/src/docs/usr-manual/solvers-pilut.rst hypre-2.18.2/src/docs/usr-manual/solvers-pilut.rst --- hypre-2.16.0/src/docs/usr-manual/solvers-pilut.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/solvers-pilut.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + .. _PILUT: diff -Nru hypre-2.16.0/src/docs/usr-manual/solvers-smg-pfmg.rst hypre-2.18.2/src/docs/usr-manual/solvers-smg-pfmg.rst --- hypre-2.16.0/src/docs/usr-manual/solvers-smg-pfmg.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/solvers-smg-pfmg.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + SMG ============================================================================== diff -Nru hypre-2.16.0/src/docs/usr-manual/solvers-split.rst hypre-2.18.2/src/docs/usr-manual/solvers-split.rst --- hypre-2.16.0/src/docs/usr-manual/solvers-split.rst 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/docs/usr-manual/solvers-split.rst 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +.. Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + HYPRE Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + SplitSolve ============================================================================== diff -Nru hypre-2.16.0/src/examples/CMakeLists.txt hypre-2.18.2/src/examples/CMakeLists.txt --- hypre-2.16.0/src/examples/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/examples/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,40 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(EXAMPLE_SRCS + ex1.c + ex2.c + ex3.c + ex4.c + ex5.c + ex6.c + ex7.c + ex8.c + ex9.c + ex11.c + ex12.c + ex13.c + ex14.c + ex15.c + ex16.c + ex17.c + ex18.c +) + +if (HYPRE_BIGINT) + list(APPEND EXAMPLE_SRCS + ex5big.c + ex15big.c + ) +endif() + +if (HYPRE_COMPLEX) + list(APPEND EXAMPLE_SRCS + ex18comp.c + ) +endif() + +add_hypre_executables(EXAMPLE_SRCS) + diff -Nru hypre-2.16.0/src/examples/ex10.cxx hypre-2.18.2/src/examples/ex10.cxx --- hypre-2.16.0/src/examples/ex10.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex10.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 10 diff -Nru hypre-2.16.0/src/examples/ex11.c hypre-2.18.2/src/examples/ex11.c --- hypre-2.16.0/src/examples/ex11.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex11.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 11 diff -Nru hypre-2.16.0/src/examples/ex12.c hypre-2.18.2/src/examples/ex12.c --- hypre-2.16.0/src/examples/ex12.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex12.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 12 diff -Nru hypre-2.16.0/src/examples/ex12f.f hypre-2.18.2/src/examples/ex12f.f --- hypre-2.16.0/src/examples/ex12f.f 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex12f.f 2019-10-28 22:30:04.000000000 +0000 @@ -1,23 +1,28 @@ -c -c Example 12 -c -c Interface: Semi-Structured interface (SStruct) -c -c Compile with: make ex12f (may need to edit HYPRE_DIR in Makefile) -c -c Sample runs: mpirun -np 2 ex12f -c -c Description: The grid layout is the same as ex1, but with nodal -c unknowns. The solver is PCG preconditioned with either PFMG or -c BoomerAMG, set with 'precond_id' below. -c -c We recommend viewing the Struct examples before viewing this and -c the other SStruct examples. This is one of the simplest SStruct -c examples, used primarily to demonstrate how to set up -c non-cell-centered problems, and to demonstrate how easy it is to -c switch between structured solvers (PFMG) and solvers designed for -c more general settings (AMG). -c +! Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +! HYPRE Project Developers. See the top-level COPYRIGHT file for details. +! +! SPDX-License-Identifier: (Apache-2.0 OR MIT) + +! +! Example 12 +! +! Interface: Semi-Structured interface (SStruct) +! +! Compile with: make ex12f (may need to edit HYPRE_DIR in Makefile) +! +! Sample runs: mpirun -np 2 ex12f +! +! Description: The grid layout is the same as ex1, but with nodal +! unknowns. The solver is PCG preconditioned with either PFMG or +! BoomerAMG, set with 'precond_id' below. +! +! We recommend viewing the Struct examples before viewing this and +! the other SStruct examples. This is one of the simplest SStruct +! examples, used primarily to demonstrate how to set up +! non-cell-centered problems, and to demonstrate how easy it is to +! switch between structured solvers (PFMG) and solvers designed for +! more general settings (AMG). +! program ex12f @@ -51,7 +56,7 @@ double precision values(100), tol -c This comes from 'sstruct_mv/HYPRE_sstruct_mv.h' +! This comes from 'sstruct_mv/HYPRE_sstruct_mv.h' integer HYPRE_SSTRUCT_VARIABLE_NODE parameter( HYPRE_SSTRUCT_VARIABLE_NODE = 1 ) @@ -66,13 +71,13 @@ character*32 matfile -c We only have one part and one variable +! We only have one part and one variable nparts = 1 nvars = 1 part = 0 var = 0 -c Initialize MPI +! Initialize MPI call MPI_Init(ierr) call MPI_Comm_rank(MPI_COMM_WORLD, myid, ierr) call MPI_Comm_size(MPI_COMM_WORLD, num_procs, ierr) @@ -84,7 +89,7 @@ endif endif -c Set preconditioner id (PFMG = 1, BoomerAMG = 2) +! Set preconditioner id (PFMG = 1, BoomerAMG = 2) precond_id = 1 if (precond_id .eq. 1) then @@ -98,16 +103,16 @@ endif endif -c----------------------------------------------------------------------- -c 1. Set up the grid. Here we use only one part. Each processor -c describes the piece of the grid that it owns. -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! 1. Set up the grid. Here we use only one part. Each processor +! describes the piece of the grid that it owns. +!----------------------------------------------------------------------- -c Create an empty 2D grid object +! Create an empty 2D grid object call HYPRE_SStructGridCreate(MPI_COMM_WORLD, 2, nparts, grid, + ierr) -c Add boxes to the grid +! Add boxes to the grid if (myid .eq. 0) then ilower(1) = -3 ilower(2) = 1 @@ -124,23 +129,23 @@ + ierr) endif -c Set the variable type and number of variables on each part +! Set the variable type and number of variables on each part vartypes(1) = HYPRE_SSTRUCT_VARIABLE_NODE call HYPRE_SStructGridSetVariables(grid, part, nvars, vartypes, + ierr) -c This is a collective call finalizing the grid assembly +! This is a collective call finalizing the grid assembly call HYPRE_SStructGridAssemble(grid, ierr) -c----------------------------------------------------------------------- -c 2. Define the discretization stencil -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! 2. Define the discretization stencil +!----------------------------------------------------------------------- -c Create an empty 2D, 5-pt stencil object +! Create an empty 2D, 5-pt stencil object call HYPRE_SStructStencilCreate(2, 5, stencil, ierr) -c Define the geometry of the stencil. Each represents a relative -c offset (in the index space). +! Define the geometry of the stencil. Each represents a relative +! offset (in the index space). offsets(1,1) = 0 offsets(2,1) = 0 offsets(1,2) = -1 @@ -152,63 +157,63 @@ offsets(1,5) = 0 offsets(2,5) = 1 -c Assign numerical values to the offsets so that we can easily refer -c to them - the last argument indicates the variable for which we -c are assigning this stencil +! Assign numerical values to the offsets so that we can easily refer +! to them - the last argument indicates the variable for which we +! are assigning this stencil do ent = 1, 5 call HYPRE_SStructStencilSetEntry(stencil, + ent-1, offsets(1,ent), var, ierr) enddo -c----------------------------------------------------------------------- -c 3. Set up the Graph - this determines the non-zero structure of -c the matrix and allows non-stencil relationships between the parts -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! 3. Set up the Graph - this determines the non-zero structure of +! the matrix and allows non-stencil relationships between the parts +!----------------------------------------------------------------------- -c Create the graph object +! Create the graph object call HYPRE_SStructGraphCreate(MPI_COMM_WORLD, grid, graph, ierr) -c See MatrixSetObjectType below +! See MatrixSetObjectType below call HYPRE_SStructGraphSetObjectType(graph, object_type, ierr) -c Now we need to tell the graph which stencil to use for each -c variable on each part (we only have one variable and one part) +! Now we need to tell the graph which stencil to use for each +! variable on each part (we only have one variable and one part) call HYPRE_SStructGraphSetStencil(graph, part, var, stencil, ierr) -c Here we could establish connections between parts if we had more -c than one part using the graph. For example, we could use -c HYPRE_GraphAddEntries() routine or HYPRE_GridSetNeighborPart() +! Here we could establish connections between parts if we had more +! than one part using the graph. For example, we could use +! HYPRE_GraphAddEntries() routine or HYPRE_GridSetNeighborPart() -c Assemble the graph +! Assemble the graph call HYPRE_SStructGraphAssemble(graph, ierr) -c----------------------------------------------------------------------- -c 4. Set up a SStruct Matrix -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! 4. Set up a SStruct Matrix +!----------------------------------------------------------------------- -c Create an empty matrix object +! Create an empty matrix object call HYPRE_SStructMatrixCreate(MPI_COMM_WORLD, graph, A, ierr) -c Set the object type (by default HYPRE_SSTRUCT). This determines -c the data structure used to store the matrix. For PFMG we use -c HYPRE_STRUCT, and for BoomerAMG we use HYPRE_PARCSR (set above). +! Set the object type (by default HYPRE_SSTRUCT). This determines +! the data structure used to store the matrix. For PFMG we use +! HYPRE_STRUCT, and for BoomerAMG we use HYPRE_PARCSR (set above). call HYPRE_SStructMatrixSetObjectTyp(A, object_type, ierr) -c Get ready to set values +! Get ready to set values call HYPRE_SStructMatrixInitialize(A, ierr) -c Set the matrix coefficients. Each processor assigns coefficients -c for the boxes in the grid that it owns. Note that the -c coefficients associated with each stencil entry may vary from grid -c point to grid point if desired. Here, we first set the same -c stencil entries for each grid point. Then we make modifications -c to grid points near the boundary. Note that the ilower values are -c different from those used in ex1 because of the way nodal -c variables are referenced. Also note that some of the stencil -c values are set on both processor 0 and processor 1. See the User -c and Reference manuals for more details. +! Set the matrix coefficients. Each processor assigns coefficients +! for the boxes in the grid that it owns. Note that the +! coefficients associated with each stencil entry may vary from grid +! point to grid point if desired. Here, we first set the same +! stencil entries for each grid point. Then we make modifications +! to grid points near the boundary. Note that the ilower values are +! different from those used in ex1 because of the way nodal +! variables are referenced. Also note that some of the stencil +! values are set on both processor 0 and processor 1. See the User +! and Reference manuals for more details. -c Stencil entry labels correspond to the offsets defined above +! Stencil entry labels correspond to the offsets defined above do i = 1, 5 stencil_indices(i) = i-1 enddo @@ -219,14 +224,14 @@ ilower(2) = 0 iupper(1) = -1 iupper(2) = 2 -c 12 grid points, each with 5 stencil entries +! 12 grid points, each with 5 stencil entries nvalues = 60 else if (myid .eq. 1) then ilower(1) = -1 ilower(2) = 0 iupper(1) = 2 iupper(2) = 4 -c 12 grid points, each with 5 stencil entries +! 12 grid points, each with 5 stencil entries nvalues = 100 endif @@ -240,8 +245,8 @@ call HYPRE_SStructMatrixSetBoxValues(A, part, ilower, iupper, + var, nentries, stencil_indices, values, ierr) -c Set the coefficients reaching outside of the boundary to 0. Note -c that both ilower *and* iupper may be different from those in ex1. +! Set the coefficients reaching outside of the boundary to 0. Note +! that both ilower *and* iupper may be different from those in ex1. do i = 1, 5 values(i) = 0.0 @@ -249,7 +254,7 @@ if (myid .eq. 0) then -c values below our box +! values below our box ilower(1) = -4 ilower(2) = 0 iupper(1) = -1 @@ -257,7 +262,7 @@ stencil_indices(1) = 3 call HYPRE_SStructMatrixSetBoxValues(A, part, ilower, iupper, + var, 1, stencil_indices, values, ierr) -c values to the left of our box +! values to the left of our box ilower(1) = -4 ilower(2) = 0 iupper(1) = -4 @@ -265,7 +270,7 @@ stencil_indices(1) = 1 call HYPRE_SStructMatrixSetBoxValues(A, part, ilower, iupper, + var, 1, stencil_indices, values, ierr) -c values above our box +! values above our box ilower(1) = -4 ilower(2) = 2 iupper(1) = -2 @@ -276,7 +281,7 @@ else if (myid .eq. 1) then -c values below our box +! values below our box ilower(1) = -1 ilower(2) = 0 iupper(1) = 2 @@ -284,7 +289,7 @@ stencil_indices(1) = 3 call HYPRE_SStructMatrixSetBoxValues(A, part, ilower, iupper, + var, 1, stencil_indices, values, ierr) -c values to the right of our box +! values to the right of our box ilower(1) = 2 ilower(2) = 0 iupper(1) = 2 @@ -292,7 +297,7 @@ stencil_indices(1) = 2 call HYPRE_SStructMatrixSetBoxValues(A, part, ilower, iupper, + var, 1, stencil_indices, values, ierr) -c values above our box +! values above our box ilower(1) = -1 ilower(2) = 4 iupper(1) = 2 @@ -300,8 +305,8 @@ stencil_indices(1) = 4 call HYPRE_SStructMatrixSetBoxValues(A, part, ilower, iupper, + var, 1, stencil_indices, values, ierr) -c values to the left of our box -c (that do not border the other box on proc. 0) +! values to the left of our box +! (that do not border the other box on proc. 0) ilower(1) = -1 ilower(2) = 3 iupper(1) = -1 @@ -312,28 +317,28 @@ endif -c This is a collective call finalizing the matrix assembly +! This is a collective call finalizing the matrix assembly call HYPRE_SStructMatrixAssemble(A, ierr) -c matfile = 'ex12f.out' -c matfile(10:10) = char(0) -c call HYPRE_SStructMatrixPrint(matfile, A, 0, ierr) +! matfile = 'ex12f.out' +! matfile(10:10) = char(0) +! call HYPRE_SStructMatrixPrint(matfile, A, 0, ierr) -c Create an empty vector object +! Create an empty vector object call HYPRE_SStructVectorCreate(MPI_COMM_WORLD, grid, b, ierr) call HYPRE_SStructVectorCreate(MPI_COMM_WORLD, grid, x, ierr) -c As with the matrix, set the appropriate object type for the vectors +! As with the matrix, set the appropriate object type for the vectors call HYPRE_SStructVectorSetObjectTyp(b, object_type, ierr) call HYPRE_SStructVectorSetObjectTyp(x, object_type, ierr) -c Indicate that the vector coefficients are ready to be set +! Indicate that the vector coefficients are ready to be set call HYPRE_SStructVectorInitialize(b, ierr) call HYPRE_SStructVectorInitialize(x, ierr) -c Set the vector coefficients. Again, note that the ilower values -c are different from those used in ex1, and some of the values are -c set on both processors. +! Set the vector coefficients. Again, note that the ilower values +! are different from those used in ex1, and some of the values are +! set on both processors. if (myid .eq. 0) then @@ -373,98 +378,98 @@ endif -c This is a collective call finalizing the vector assembly +! This is a collective call finalizing the vector assembly call HYPRE_SStructVectorAssemble(b, ierr) call HYPRE_SStructVectorAssemble(x, ierr) -c----------------------------------------------------------------------- -c 6. Set up and use a solver (See the Reference Manual for -c descriptions of all of the options.) -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! 6. Set up and use a solver (See the Reference Manual for +! descriptions of all of the options.) +!----------------------------------------------------------------------- tol = 1.0E-6 if (precond_id .eq. 1) then -c PFMG +! PFMG -c Because we are using a struct solver, we need to get the object -c of the matrix and vectors to pass in to the struct solvers +! Because we are using a struct solver, we need to get the object +! of the matrix and vectors to pass in to the struct solvers call HYPRE_SStructMatrixGetObject(A, sA, ierr) call HYPRE_SStructVectorGetObject(b, sb, ierr) call HYPRE_SStructVectorGetObject(x, sx, ierr) -c Create an empty PCG Struct solver +! Create an empty PCG Struct solver call HYPRE_StructPCGCreate(MPI_COMM_WORLD, solver, ierr) -c Set PCG parameters +! Set PCG parameters call HYPRE_StructPCGSetTol(solver, tol, ierr) call HYPRE_StructPCGSetPrintLevel(solver, 2, ierr) call HYPRE_StructPCGSetMaxIter(solver, 50, ierr) -c Create the Struct PFMG solver for use as a preconditioner +! Create the Struct PFMG solver for use as a preconditioner call HYPRE_StructPFMGCreate(MPI_COMM_WORLD, precond, ierr) -c Set PFMG parameters +! Set PFMG parameters call HYPRE_StructPFMGSetMaxIter(precond, 1, ierr) call HYPRE_StructPFMGSetTol(precond, 0.0d0, ierr) call HYPRE_StructPFMGSetZeroGuess(precond, ierr) call HYPRE_StructPFMGSetNumPreRelax(precond, 2, ierr) call HYPRE_StructPFMGSetNumPostRelax(precond, 2, ierr) -c Non-Galerkin coarse grid (more efficient for this problem) +! Non-Galerkin coarse grid (more efficient for this problem) call HYPRE_StructPFMGSetRAPType(precond, 1, ierr) -c R/B Gauss-Seidel +! R/B Gauss-Seidel call HYPRE_StructPFMGSetRelaxType(precond, 2, ierr) -c Skip relaxation on some levels (more efficient for this problem) +! Skip relaxation on some levels (more efficient for this problem) call HYPRE_StructPFMGSetSkipRelax(precond, 1, ierr) -c Set preconditioner (PFMG = 1) and solve +! Set preconditioner (PFMG = 1) and solve call HYPRE_StructPCGSetPrecond(solver, 1, precond, ierr) call HYPRE_StructPCGSetup(solver, sA, sb, sx, ierr) call HYPRE_StructPCGSolve(solver, sA, sb, sx, ierr) -c Free memory +! Free memory call HYPRE_StructPCGDestroy(solver, ierr) call HYPRE_StructPFMGDestroy(precond, ierr) else if (precond_id .eq. 2) then -c BoomerAMG +! BoomerAMG -c Because we are using a struct solver, we need to get the object -c of the matrix and vectors to pass in to the struct solvers +! Because we are using a struct solver, we need to get the object +! of the matrix and vectors to pass in to the struct solvers call HYPRE_SStructMatrixGetObject(A, parA, ierr) call HYPRE_SStructVectorGetObject(b, parb, ierr) call HYPRE_SStructVectorGetObject(x, parx, ierr) -c Create an empty PCG Struct solver +! Create an empty PCG Struct solver call HYPRE_ParCSRPCGCreate(MPI_COMM_WORLD, solver, ierr) -c Set PCG parameters +! Set PCG parameters call HYPRE_ParCSRPCGSetTol(solver, tol, ierr) call HYPRE_ParCSRPCGSetPrintLevel(solver, 2, ierr) call HYPRE_ParCSRPCGSetMaxIter(solver, 50, ierr) -c Create the BoomerAMG solver for use as a preconditioner +! Create the BoomerAMG solver for use as a preconditioner call HYPRE_BoomerAMGCreate(precond, ierr) -c Set BoomerAMG parameters +! Set BoomerAMG parameters call HYPRE_BoomerAMGSetMaxIter(precond, 1, ierr) call HYPRE_BoomerAMGSetTol(precond, 0.0, ierr) -c Print amg solution info +! Print amg solution info call HYPRE_BoomerAMGSetPrintLevel(precond, 1, ierr) call HYPRE_BoomerAMGSetCoarsenType(precond, 6, ierr) call HYPRE_BoomerAMGSetOldDefault(precond, ierr) -c Sym G.S./Jacobi hybrid +! Sym G.S./Jacobi hybrid call HYPRE_BoomerAMGSetRelaxType(precond, 6, ierr) call HYPRE_BoomerAMGSetNumSweeps(precond, 1, ierr) -c Set preconditioner (BoomerAMG = 2) and solve +! Set preconditioner (BoomerAMG = 2) and solve call HYPRE_ParCSRPCGSetPrecond(solver, 2, precond, ierr) call HYPRE_ParCSRPCGSetup(solver, parA, parb, parx, ierr) call HYPRE_ParCSRPCGSolve(solver, parA, parb, parx, ierr) -c Free memory +! Free memory call HYPRE_ParCSRPCGDestroy(solver, ierr) call HYPRE_BoomerAMGDestroy(precond, ierr) endif -c Free memory +! Free memory call HYPRE_SStructGridDestroy(grid, ierr) call HYPRE_SStructStencilDestroy(stencil, ierr) call HYPRE_SStructGraphDestroy(graph, ierr) @@ -472,7 +477,7 @@ call HYPRE_SStructVectorDestroy(b, ierr) call HYPRE_SStructVectorDestroy(x, ierr) -c Finalize MPI +! Finalize MPI call MPI_Finalize(ierr) stop diff -Nru hypre-2.16.0/src/examples/ex13.c hypre-2.18.2/src/examples/ex13.c --- hypre-2.16.0/src/examples/ex13.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex13.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 13 diff -Nru hypre-2.16.0/src/examples/ex14.c hypre-2.18.2/src/examples/ex14.c --- hypre-2.16.0/src/examples/ex14.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex14.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 14 diff -Nru hypre-2.16.0/src/examples/ex15big.c hypre-2.18.2/src/examples/ex15big.c --- hypre-2.16.0/src/examples/ex15big.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex15big.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 15big diff -Nru hypre-2.16.0/src/examples/ex15.c hypre-2.18.2/src/examples/ex15.c --- hypre-2.16.0/src/examples/ex15.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex15.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 15 diff -Nru hypre-2.16.0/src/examples/ex16.c hypre-2.18.2/src/examples/ex16.c --- hypre-2.16.0/src/examples/ex16.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex16.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 16 diff -Nru hypre-2.16.0/src/examples/ex17.c hypre-2.18.2/src/examples/ex17.c --- hypre-2.16.0/src/examples/ex17.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex17.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 17 diff -Nru hypre-2.16.0/src/examples/ex18.c hypre-2.18.2/src/examples/ex18.c --- hypre-2.16.0/src/examples/ex18.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex18.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 18 diff -Nru hypre-2.16.0/src/examples/ex18comp.c hypre-2.18.2/src/examples/ex18comp.c --- hypre-2.16.0/src/examples/ex18comp.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex18comp.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 18comp diff -Nru hypre-2.16.0/src/examples/ex1.c hypre-2.18.2/src/examples/ex1.c --- hypre-2.16.0/src/examples/ex1.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex1.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 1 diff -Nru hypre-2.16.0/src/examples/ex2.c hypre-2.18.2/src/examples/ex2.c --- hypre-2.16.0/src/examples/ex2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 2 @@ -243,7 +250,7 @@ } } - /* For each box, set any coefficients that reach ouside of the + /* For each box, set any coefficients that reach outside of the boundary to 0 */ if (myid == 0) { diff -Nru hypre-2.16.0/src/examples/ex3.c hypre-2.18.2/src/examples/ex3.c --- hypre-2.16.0/src/examples/ex3.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex3.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 3 @@ -367,6 +374,7 @@ /* Clean up */ HYPRE_StructPCGDestroy(solver); + HYPRE_StructSMGDestroy(precond); } if (solver_id == 1) diff -Nru hypre-2.16.0/src/examples/ex4.c hypre-2.18.2/src/examples/ex4.c --- hypre-2.16.0/src/examples/ex4.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex4.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 4 diff -Nru hypre-2.16.0/src/examples/ex5big.c hypre-2.18.2/src/examples/ex5big.c --- hypre-2.16.0/src/examples/ex5big.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex5big.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 5big diff -Nru hypre-2.16.0/src/examples/ex5.c hypre-2.18.2/src/examples/ex5.c --- hypre-2.16.0/src/examples/ex5.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex5.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 5 diff -Nru hypre-2.16.0/src/examples/ex5f.f hypre-2.18.2/src/examples/ex5f.f --- hypre-2.16.0/src/examples/ex5f.f 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex5f.f 2019-10-28 22:30:04.000000000 +0000 @@ -1,30 +1,35 @@ -c -c Example 5 -c -c Interface: Linear-Algebraic (IJ), Fortran (77) version -c -c Compile with: make ex5f -c -c Sample run: mpirun -np 4 ex5f -c -c Description: This example solves the 2-D -c Laplacian problem with zero boundary conditions -c on an nxn grid. The number of unknowns is N=n^2. -c The standard 5-point stencil is used, and we solve -c for the interior nodes only. -c -c This example solves the same problem as Example 3. -c Available solvers are AMG, PCG, and PCG with AMG, -c and PCG with ParaSails -c -c -c Notes: for PCG, GMRES and BiCGStab, precond_id means: -c 0 - do not set up a preconditioner -c 1 - set up a ds preconditioner -c 2 - set up an amg preconditioner -c 3 - set up a pilut preconditioner -c 4 - set up a ParaSails preconditioner -c +! Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +! HYPRE Project Developers. See the top-level COPYRIGHT file for details. +! +! SPDX-License-Identifier: (Apache-2.0 OR MIT) + +! +! Example 5 +! +! Interface: Linear-Algebraic (IJ), Fortran (77) version +! +! Compile with: make ex5f +! +! Sample run: mpirun -np 4 ex5f +! +! Description: This example solves the 2-D +! Laplacian problem with zero boundary conditions +! on an nxn grid. The number of unknowns is N=n^2. +! The standard 5-point stencil is used, and we solve +! for the interior nodes only. +! +! This example solves the same problem as Example 3. +! Available solvers are AMG, PCG, and PCG with AMG, +! and PCG with ParaSails +! +! +! Notes: for PCG, GMRES and BiCGStab, precond_id means: +! 0 - do not set up a preconditioner +! 1 - set up a ds preconditioner +! 2 - set up an amg preconditioner +! 3 - set up a pilut preconditioner +! 4 - set up a ParaSails preconditioner +! program ex5f @@ -38,7 +43,7 @@ parameter (MAX_LOCAL_SIZE=123000) -c the following is from HYPRE.c +! the following is from HYPRE.c parameter (HYPRE_PARCSR=5555) integer ierr @@ -67,35 +72,35 @@ integer*8 solver integer*8 precond -c----------------------------------------------------------------------- -c Initialize MPI -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Initialize MPI +!----------------------------------------------------------------------- call MPI_INIT(ierr) call MPI_COMM_RANK(MPI_COMM_WORLD, myid, ierr) call MPI_COMM_SIZE(MPI_COMM_WORLD, num_procs, ierr) mpi_comm = MPI_COMM_WORLD -c Default problem parameters +! Default problem parameters n = 33 solver_id = 0 print_solution = 0 tol = 1.0d-7 -c The input section not implemented yet. +! The input section not implemented yet. -c Preliminaries: want at least one processor per row +! Preliminaries: want at least one processor per row if ( n*n .lt. num_procs ) then n = int(sqrt(real(num_procs))) + 1 endif -c ng = global no. rows, h = mesh size +! ng = global no. rows, h = mesh size ng = n*n h = 1.0d0/(n+1) h2 = h*h -c Each processor knows only of its own rows - the range is denoted by ilower -c and upper. Here we partition the rows. We account for the fact that -c N may not divide evenly by the number of processors. +! Each processor knows only of its own rows - the range is denoted by ilower +! and upper. Here we partition the rows. We account for the fact that +! N may not divide evenly by the number of processors. local_size = ng/num_procs extra = ng - local_size*num_procs @@ -106,85 +111,85 @@ iupper = iupper + min(myid+1, extra) iupper = iupper - 1 -c How many rows do I have? +! How many rows do I have? local_size = iupper - ilower + 1 -c Create the matrix. -c Note that this is a square matrix, so we indicate the row partition -c size twice (since number of rows = number of cols) +! Create the matrix. +! Note that this is a square matrix, so we indicate the row partition +! size twice (since number of rows = number of cols) call HYPRE_IJMatrixCreate(mpi_comm, ilower, 1 iupper, ilower, iupper, A, ierr) -c Choose a parallel csr format storage (see the User's Manual) +! Choose a parallel csr format storage (see the User's Manual) call HYPRE_IJMatrixSetObjectType(A, HYPRE_PARCSR, ierr) -c Initialize before setting coefficients +! Initialize before setting coefficients call HYPRE_IJMatrixInitialize(A, ierr) -c Now go through my local rows and set the matrix entries. -c Each row has at most 5 entries. For example, if n=3: -c -c A = [M -I 0; -I M -I; 0 -I M] -c M = [4 -1 0; -1 4 -1; 0 -1 4] -c -c Note that here we are setting one row at a time, though -c one could set all the rows together (see the User's Manual). +! Now go through my local rows and set the matrix entries. +! Each row has at most 5 entries. For example, if n=3: +! +! A = [M -I 0; -I M -I; 0 -I M] +! M = [4 -1 0; -1 4 -1; 0 -1 4] +! +! Note that here we are setting one row at a time, though +! one could set all the rows together (see the User's Manual). do i = ilower, iupper nnz = 1 -c The left identity block:position i-n +! The left identity block:position i-n if ( (i-n) .ge. 0 ) then cols(nnz) = i-n values(nnz) = -1.0d0 nnz = nnz + 1 endif -c The left -1: position i-1 +! The left -1: position i-1 if ( mod(i,n).ne.0 ) then cols(nnz) = i-1 values(nnz) = -1.0d0 nnz = nnz + 1 endif -c Set the diagonal: position i +! Set the diagonal: position i cols(nnz) = i values(nnz) = 4.0d0 nnz = nnz + 1 -c The right -1: position i+1 +! The right -1: position i+1 if ( mod((i+1),n) .ne. 0 ) then cols(nnz) = i+1 values(nnz) = -1.0d0 nnz = nnz + 1 endif -c The right identity block:position i+n +! The right identity block:position i+n if ( (i+n) .lt. ng ) then cols(nnz) = i+n values(nnz) = -1.0d0 nnz = nnz + 1 endif -c Set the values for row i +! Set the values for row i call HYPRE_IJMatrixSetValues( 1 A, 1, nnz-1, i, cols, values, ierr) enddo -c Assemble after setting the coefficients +! Assemble after setting the coefficients call HYPRE_IJMatrixAssemble(A, ierr) -c Get parcsr matrix object +! Get parcsr matrix object call HYPRE_IJMatrixGetObject(A, parcsr_A, ierr) -c Create the rhs and solution +! Create the rhs and solution call HYPRE_IJVectorCreate(mpi_comm, 1 ilower, iupper, b, ierr) call HYPRE_IJVectorSetObjectType(b, HYPRE_PARCSR, ierr) @@ -196,7 +201,7 @@ call HYPRE_IJVectorInitialize(x, ierr) -c Set the rhs values to h^2 and the solution to zero +! Set the rhs values to h^2 and the solution to zero do i = 1, local_size rhs_values(i) = h2 x_values(i) = 0.0 @@ -211,46 +216,46 @@ call HYPRE_IJVectorAssemble(b, ierr) call HYPRE_IJVectorAssemble(x, ierr) -c get the x and b objects +! get the x and b objects call HYPRE_IJVectorGetObject(b, par_b, ierr) call HYPRE_IJVectorGetObject(x, par_x, ierr) -c Choose a solver and solve the system +! Choose a solver and solve the system -c AMG +! AMG if ( solver_id .eq. 0 ) then -c Create solver +! Create solver call HYPRE_BoomerAMGCreate(solver, ierr) -c Set some parameters (See Reference Manual for more parameters) +! Set some parameters (See Reference Manual for more parameters) -c print solve info + parameters +! print solve info + parameters call HYPRE_BoomerAMGSetPrintLevel(solver, 3, ierr) -c old defaults, Falgout coarsening, mod. class. interpolation +! old defaults, Falgout coarsening, mod. class. interpolation call HYPRE_BoomerAMGSetOldDefault(solver, ierr) -c G-S/Jacobi hybrid relaxation +! G-S/Jacobi hybrid relaxation call HYPRE_BoomerAMGSetRelaxType(solver, 3, ierr) -c C/F relaxation +! C/F relaxation call HYPRE_BoomerAMGSetRelaxOrder(solver, 1, ierr) -c Sweeeps on each level +! Sweeeps on each level call HYPRE_BoomerAMGSetNumSweeps(solver, 1, ierr) -c maximum number of levels +! maximum number of levels call HYPRE_BoomerAMGSetMaxLevels(solver, 20, ierr) -c conv. tolerance +! conv. tolerance call HYPRE_BoomerAMGSetTol(solver, 1.0d-7, ierr) -c Now setup and solve! +! Now setup and solve! call HYPRE_BoomerAMGSetup( 1 solver, parcsr_A, par_b, par_x, ierr) call HYPRE_BoomerAMGSolve( 1 solver, parcsr_A, par_b, par_x, ierr) -c Run info - needed logging turned on +! Run info - needed logging turned on call HYPRE_BoomerAMGGetNumIterations(solver, num_iterations, 1 ierr) call HYPRE_BoomerAMGGetFinalReltvRes(solver, final_res_norm, @@ -265,38 +270,38 @@ print * endif -c Destroy solver +! Destroy solver call HYPRE_BoomerAMGDestroy(solver, ierr) -c PCG (with DS) +! PCG (with DS) elseif ( solver_id .eq. 50 ) then -c Create solver +! Create solver call HYPRE_ParCSRPCGCreate(MPI_COMM_WORLD, solver, ierr) -c Set some parameters (See Reference Manual for more parameters) +! Set some parameters (See Reference Manual for more parameters) call HYPRE_ParCSRPCGSetMaxIter(solver, 1000, ierr) call HYPRE_ParCSRPCGSetTol(solver, 1.0d-7, ierr) call HYPRE_ParCSRPCGSetTwoNorm(solver, 1, ierr) call HYPRE_ParCSRPCGSetPrintLevel(solver, 2, ierr) call HYPRE_ParCSRPCGSetLogging(solver, 1, ierr) -c set ds (diagonal scaling) as the pcg preconditioner +! set ds (diagonal scaling) as the pcg preconditioner precond_id = 1 call HYPRE_ParCSRPCGSetPrecond(solver, precond_id, 1 precond, ierr) -c Now setup and solve! +! Now setup and solve! call HYPRE_ParCSRPCGSetup(solver, parcsr_A, par_b, & par_x, ierr) call HYPRE_ParCSRPCGSolve(solver, parcsr_A, par_b, & par_x, ierr) -c Run info - needed logging turned on +! Run info - needed logging turned on call HYPRE_ParCSRPCGGetNumIterations(solver, num_iterations, & ierr) @@ -310,59 +315,59 @@ print * endif -c Destroy solver +! Destroy solver call HYPRE_ParCSRPCGDestroy(solver, ierr) -c PCG with AMG preconditioner +! PCG with AMG preconditioner elseif ( solver_id == 1 ) then -c Create solver +! Create solver call HYPRE_ParCSRPCGCreate(MPI_COMM_WORLD, solver, ierr) -c Set some parameters (See Reference Manual for more parameters) +! Set some parameters (See Reference Manual for more parameters) call HYPRE_ParCSRPCGSetMaxIter(solver, 1000, ierr) call HYPRE_ParCSRPCGSetTol(solver, 1.0d-7, ierr) call HYPRE_ParCSRPCGSetTwoNorm(solver, 1, ierr) call HYPRE_ParCSRPCGSetPrintLevel(solver, 2, ierr) call HYPRE_ParCSRPCGSetLogging(solver, 1, ierr) -c Now set up the AMG preconditioner and specify any parameters +! Now set up the AMG preconditioner and specify any parameters call HYPRE_BoomerAMGCreate(precond, ierr) -c Set some parameters (See Reference Manual for more parameters) +! Set some parameters (See Reference Manual for more parameters) -c print less solver info since a preconditioner +! print less solver info since a preconditioner call HYPRE_BoomerAMGSetPrintLevel(precond, 1, ierr); -c Falgout coarsening +! Falgout coarsening call HYPRE_BoomerAMGSetCoarsenType(precond, 6, ierr) -c old defaults +! old defaults call HYPRE_BoomerAMGSetOldDefault(precond, ierr) -c SYMMETRIC G-S/Jacobi hybrid relaxation +! SYMMETRIC G-S/Jacobi hybrid relaxation call HYPRE_BoomerAMGSetRelaxType(precond, 6, ierr) -c Sweeeps on each level +! Sweeeps on each level call HYPRE_BoomerAMGSetNumSweeps(precond, 1, ierr) -c conv. tolerance +! conv. tolerance call HYPRE_BoomerAMGSetTol(precond, 0.0d0, ierr) -c do only one iteration! +! do only one iteration! call HYPRE_BoomerAMGSetMaxIter(precond, 1, ierr) -c set amg as the pcg preconditioner +! set amg as the pcg preconditioner precond_id = 2 call HYPRE_ParCSRPCGSetPrecond(solver, precond_id, 1 precond, ierr) -c Now setup and solve! +! Now setup and solve! call HYPRE_ParCSRPCGSetup(solver, parcsr_A, par_b, 1 par_x, ierr) call HYPRE_ParCSRPCGSolve(solver, parcsr_A, par_b, 1 par_x, ierr) -c Run info - needed logging turned on +! Run info - needed logging turned on call HYPRE_ParCSRPCGGetNumIterations(solver, num_iterations, 1 ierr) @@ -376,45 +381,45 @@ print * endif -c Destroy precond and solver +! Destroy precond and solver call HYPRE_BoomerAMGDestroy(precond, ierr) call HYPRE_ParCSRPCGDestroy(solver, ierr) -c PCG with ParaSails +! PCG with ParaSails elseif ( solver_id .eq. 8 ) then -c Create solver +! Create solver call HYPRE_ParCSRPCGCreate(MPI_COMM_WORLD, solver, ierr) -c Set some parameters (See Reference Manual for more parameters) +! Set some parameters (See Reference Manual for more parameters) call HYPRE_ParCSRPCGSetMaxIter(solver, 1000, ierr) call HYPRE_ParCSRPCGSetTol(solver, 1.0d-7, ierr) call HYPRE_ParCSRPCGSetTwoNorm(solver, 1, ierr) call HYPRE_ParCSRPCGSetPrintLevel(solver, 2, ierr) call HYPRE_ParCSRPCGSetLogging(solver, 1, ierr) -c Now set up the Parasails preconditioner and specify any parameters +! Now set up the Parasails preconditioner and specify any parameters call HYPRE_ParaSailsCreate(MPI_COMM_WORLD, precond,ierr) call HYPRE_ParaSailsSetParams(precond, 0.1d0, 1, ierr) call HYPRE_ParaSailsSetFilter(precond, 0.05d0, ierr) call HYPRE_ParaSailsSetSym(precond, 1, ierr) call HYPRE_ParaSailsSetLogging(precond, 3, ierr) -c set parsails as the pcg preconditioner +! set parsails as the pcg preconditioner precond_id = 4 call HYPRE_ParCSRPCGSetPrecond(solver, precond_id, 1 precond, ierr) -c Now setup and solve! +! Now setup and solve! call HYPRE_ParCSRPCGSetup(solver, parcsr_A, par_b, 1 par_x, ierr) call HYPRE_ParCSRPCGSolve(solver, parcsr_A, par_b, 1 par_x, ierr) -c Run info - needed logging turned on +! Run info - needed logging turned on call HYPRE_ParCSRPCGGetNumIterations(solver, num_iterations, 1 ierr) @@ -428,7 +433,7 @@ print * endif -c Destroy precond and solver +! Destroy precond and solver call HYPRE_ParaSailsDestroy(precond, ierr) call HYPRE_ParCSRPCGDestroy(solver, ierr) @@ -442,19 +447,19 @@ -c Print the solution +! Print the solution if ( print_solution .ne. 0 ) then call HYPRE_IJVectorPrint(x, "ij.out.x", ierr) endif -c Clean up +! Clean up call HYPRE_IJMatrixDestroy(A, ierr) call HYPRE_IJVectorDestroy(b, ierr) call HYPRE_IJVectorDestroy(x, ierr) -c Finalize MPI +! Finalize MPI call MPI_Finalize(ierr) stop diff -Nru hypre-2.16.0/src/examples/ex6.c hypre-2.18.2/src/examples/ex6.c --- hypre-2.16.0/src/examples/ex6.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex6.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 6 diff -Nru hypre-2.16.0/src/examples/ex7.c hypre-2.18.2/src/examples/ex7.c --- hypre-2.16.0/src/examples/ex7.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex7.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 7 diff -Nru hypre-2.16.0/src/examples/ex8.c hypre-2.18.2/src/examples/ex8.c --- hypre-2.16.0/src/examples/ex8.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex8.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 8 diff -Nru hypre-2.16.0/src/examples/ex9.c hypre-2.18.2/src/examples/ex9.c --- hypre-2.16.0/src/examples/ex9.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/ex9.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /* Example 9 diff -Nru hypre-2.16.0/src/examples/Makefile hypre-2.18.2/src/examples/Makefile --- hypre-2.16.0/src/examples/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,10 +1,15 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ######################################################################## # Compiler and external dependences ######################################################################## CC = mpicc F77 = mpif77 CXX = mpicxx -F90 = mpif90 +F90 = mpifort HYPRE_DIR = ../hypre ######################################################################## @@ -54,7 +59,7 @@ ######################################################################## # List of all programs to be compiled ######################################################################## -ALLPROGS = ex1 ex2 ex3 ex4 ex5 ex5f ex6 ex7 ex8 ex9 ex10 ex11 ex12 ex12f \ +ALLPROGS = ex1 ex2 ex3 ex4 ex5 ex5f ex6 ex7 ex8 ex9 ex11 ex12 ex12f \ ex13 ex14 ex15 ex16 BIGINTPROGS = ex5big ex15big FORTRANPROGS = ex5f ex12f diff -Nru hypre-2.16.0/src/examples/vis/glvis-ex10.sh hypre-2.18.2/src/examples/vis/glvis-ex10.sh --- hypre-2.16.0/src/examples/vis/glvis-ex10.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/glvis-ex10.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ex=ex10 dir=`basename \`pwd\`` diff -Nru hypre-2.16.0/src/examples/vis/glvis-ex11.sh hypre-2.18.2/src/examples/vis/glvis-ex11.sh --- hypre-2.16.0/src/examples/vis/glvis-ex11.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/glvis-ex11.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ex=ex11 dir=`basename \`pwd\`` diff -Nru hypre-2.16.0/src/examples/vis/glvis-ex12.sh hypre-2.18.2/src/examples/vis/glvis-ex12.sh --- hypre-2.16.0/src/examples/vis/glvis-ex12.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/glvis-ex12.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ex=ex12 dir=`basename \`pwd\`` diff -Nru hypre-2.16.0/src/examples/vis/glvis-ex13.sh hypre-2.18.2/src/examples/vis/glvis-ex13.sh --- hypre-2.16.0/src/examples/vis/glvis-ex13.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/glvis-ex13.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ex=ex13 dir=`basename \`pwd\`` diff -Nru hypre-2.16.0/src/examples/vis/glvis-ex14.sh hypre-2.18.2/src/examples/vis/glvis-ex14.sh --- hypre-2.16.0/src/examples/vis/glvis-ex14.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/glvis-ex14.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ex=ex14 dir=`basename \`pwd\`` diff -Nru hypre-2.16.0/src/examples/vis/glvis-ex15.sh hypre-2.18.2/src/examples/vis/glvis-ex15.sh --- hypre-2.16.0/src/examples/vis/glvis-ex15.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/glvis-ex15.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ex=ex15 dir=`basename \`pwd\`` diff -Nru hypre-2.16.0/src/examples/vis/glvis-ex16.sh hypre-2.18.2/src/examples/vis/glvis-ex16.sh --- hypre-2.16.0/src/examples/vis/glvis-ex16.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/glvis-ex16.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ex=ex16 dir=`basename \`pwd\`` diff -Nru hypre-2.16.0/src/examples/vis/glvis-ex1.sh hypre-2.18.2/src/examples/vis/glvis-ex1.sh --- hypre-2.16.0/src/examples/vis/glvis-ex1.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/glvis-ex1.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ex=ex1 dir=`basename \`pwd\`` diff -Nru hypre-2.16.0/src/examples/vis/glvis-ex2.sh hypre-2.18.2/src/examples/vis/glvis-ex2.sh --- hypre-2.16.0/src/examples/vis/glvis-ex2.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/glvis-ex2.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ex=ex2 dir=`basename \`pwd\`` diff -Nru hypre-2.16.0/src/examples/vis/glvis-ex3.sh hypre-2.18.2/src/examples/vis/glvis-ex3.sh --- hypre-2.16.0/src/examples/vis/glvis-ex3.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/glvis-ex3.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ex=ex3 dir=`basename \`pwd\`` diff -Nru hypre-2.16.0/src/examples/vis/glvis-ex4.sh hypre-2.18.2/src/examples/vis/glvis-ex4.sh --- hypre-2.16.0/src/examples/vis/glvis-ex4.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/glvis-ex4.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ex=ex4 dir=`basename \`pwd\`` diff -Nru hypre-2.16.0/src/examples/vis/glvis-ex5.sh hypre-2.18.2/src/examples/vis/glvis-ex5.sh --- hypre-2.16.0/src/examples/vis/glvis-ex5.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/glvis-ex5.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ex=ex5 dir=`basename \`pwd\`` diff -Nru hypre-2.16.0/src/examples/vis/glvis-ex6.sh hypre-2.18.2/src/examples/vis/glvis-ex6.sh --- hypre-2.16.0/src/examples/vis/glvis-ex6.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/glvis-ex6.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ex=ex6 dir=`basename \`pwd\`` diff -Nru hypre-2.16.0/src/examples/vis/glvis-ex7.sh hypre-2.18.2/src/examples/vis/glvis-ex7.sh --- hypre-2.16.0/src/examples/vis/glvis-ex7.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/glvis-ex7.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ex=ex7 dir=`basename \`pwd\`` diff -Nru hypre-2.16.0/src/examples/vis/glvis-ex8.sh hypre-2.18.2/src/examples/vis/glvis-ex8.sh --- hypre-2.16.0/src/examples/vis/glvis-ex8.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/glvis-ex8.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ex=ex8 dir=`basename \`pwd\`` diff -Nru hypre-2.16.0/src/examples/vis/glvis-ex9.sh hypre-2.18.2/src/examples/vis/glvis-ex9.sh --- hypre-2.16.0/src/examples/vis/glvis-ex9.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/glvis-ex9.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ex=ex9 dir=`basename \`pwd\`` diff -Nru hypre-2.16.0/src/examples/vis/Makefile hypre-2.18.2/src/examples/vis/Makefile --- hypre-2.16.0/src/examples/vis/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,2 +1,7 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + clean: rm -f *mesh* *sol* *data* diff -Nru hypre-2.16.0/src/examples/vis/README hypre-2.18.2/src/examples/vis/README --- hypre-2.16.0/src/examples/vis/README 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/examples/vis/README 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + This directory contains scripts that use the GLVis visualization tool to plot the numerical results for most of the hypre example codes. diff -Nru hypre-2.16.0/src/FEI_mv/CMakeLists.txt hypre-2.18.2/src/FEI_mv/CMakeLists.txt --- hypre-2.16.0/src/FEI_mv/CMakeLists.txt 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -1,9 +1,12 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + project(HYPRE_FEI C CXX) -include_directories(fei-base) include_directories(fei-hypre) -include_directories(ml/src/include) # option(HYPRE_USING_SUPERLU "Use internal SuperLU routines" ON) # option(HYPRE_USING_MLI "Use MLI" ON) diff -Nru hypre-2.16.0/src/FEI_mv/fei-base/cfei.h hypre-2.18.2/src/FEI_mv/fei-base/cfei.h --- hypre-2.16.0/src/FEI_mv/fei-base/cfei.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-base/cfei.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,439 +0,0 @@ -#ifndef _cfei_h_ -#define _cfei_h_ - -/*--------------------------------------------------------------------*/ -/* Copyright 2005 Sandia Corporation. */ -/* Under the terms of Contract DE-AC04-94AL85000, there is a */ -/* non-exclusive license for use of this work by or on behalf */ -/* of the U.S. Government. Export of this program may require */ -/* a license from the United States Government. */ -/*--------------------------------------------------------------------*/ - -/*------------------------------------------------------------------------------ - This is the header for the prototypes of the C interface - of the Finite Element Interface to Linear Solvers (FEI). - - For explanations of parameters and semantics, see the C++ FEI.h header, or - doxygen output created there-from. - With the exception of added create/destroy functions, all FEI functions - in this header mirror those in the C++ header except as follows: - - 'FEI_' is pre-pended to function names - - 'CFEI* cfei' is the first argument for every function - - arguments which are references in C++ (e.g., an output int) are - pointers in this C interface. - - NOTE: ALL functions return an error code which is 0 if successful, - non-zero if un-successful. - - Noteworthy special case: the solve function may return non-zero - if the solver failed to converge. This is, of course, a non-fatal - situation, and the caller should then check the 'status' argument for - possible further information (solver-specific/solver-dependent). -------------------------------------------------------------------------------*/ - -#include "fei_LinSysCore_struct.h" - - -/*------------------------------------------------------------------------------ - Next, define an opaque CFEI object which will be an FEI context, and will - be the first argument to all of the C FEI functions which follow in this - header. -------------------------------------------------------------------------------*/ - -struct CFEI_struct { - void* cfei_; -}; -typedef struct CFEI_struct CFEI; - - -/*------------------------------------------------------------------------------ - And now, the function prototypes... -------------------------------------------------------------------------------*/ - -/* include fei_defs.h for the #defines of parameters such as FEI_LOCAL_TIMES, - FEI_NODE_MAJOR, etc. */ -#include "fei_defs.h" -#include "fei_mpi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - Initialization function. Creates an FEI instance, wrapped in a CFEI pointer. -*/ -int FEI_create(CFEI** cfei, - LinSysCore* lsc, - MPI_Comm FEI_COMM_WORLD, - int masterRank); - -/* A function to destroy allocated memory. */ -int FEI_destroy(CFEI** cfei); - -/* A function to destroy LinSysCore objects. (Note that the create function - is specific to the implementation and so is not provided here.) */ -int LinSysCore_destroy(LinSysCore** lsc); - - /* A function to query a named property. */ -int LinSysCore_getProperty_double(LinSysCore* lsc, - const char* name, double* value); - -/* */ -/* And now all of the FEI functions... */ -/* */ - -int FEI_parameters(CFEI* cfei, - int numParams, - char **paramStrings); - -int FEI_setIDLists(CFEI* cfei, - int numMatrices, - const int* matrixIDs, - int numRHSs, - const int* rhsIDs); - -int FEI_setSolveType(CFEI* cfei, - int solveType); - -int FEI_initFields(CFEI* cfei, - int numFields, - int *fieldSizes, - int *fieldIDs); - -int FEI_initElemBlock(CFEI* cfei, - GlobalID elemBlockID, - int numElements, - int numNodesPerElement, - int* numFieldsPerNode, - int** nodalFieldIDs, - int numElemDofFieldsPerElement, - int* elemDOFFieldIDs, - int interleaveStrategy); - -int FEI_initElem(CFEI* cfei, - GlobalID elemBlockID, - GlobalID elemID, - GlobalID *elemConn); - -int FEI_initSharedNodes(CFEI* cfei, - int numSharedNodes, - GlobalID *sharedNodeIDs, - int* numProcsPerNode, - int** sharingProcIDs); - -int FEI_initCRMult(CFEI* cfei, - int numCRNodes, - GlobalID* CRNodes, - int *CRFields, - int* CRID); - -int FEI_initCRPen(CFEI* cfei, - int numCRNodes, - GlobalID* CRNodes, - int *CRFields, - int* CRID); - -int FEI_initSlaveVariable(CFEI* cfei, - GlobalID slaveNodeID, - int slaveFieldID, - int offsetIntoSlaveField, - int numMasterNodes, - const GlobalID* masterNodeIDs, - const int* masterFieldIDs, - const double* weights, - double rhsValue); - -int FEI_initCoefAccessPattern( CFEI* cfei, - int patternID, - int numRowIDs, - int* numFieldsPerRow, - int** rowFieldIDs, - int numColIDsPerRow, - int* numFieldsPerCol, - int** colFieldIDs, - int interleaveStrategy ); - -int FEI_initCoefAccess( CFEI* cfei, - int patternID, - int* rowIDTypes, - GlobalID* rowIDs, - int* colIDTypes, - GlobalID* colIDs ); - -int FEI_initComplete(CFEI* cfei); - -int FEI_resetSystem(CFEI* cfei, double s); -int FEI_resetMatrix(CFEI* cfei, double s); -int FEI_resetRHSVector(CFEI* cfei, double s); -int FEI_resetInitialGuess(CFEI* cfei, double s); - -int FEI_deleteMultCRs(CFEI* cfei); - -int FEI_setCurrentMatrix(CFEI* cfei, int matID); -int FEI_setCurrentRHS(CFEI* cfei, int rhsID); - -int FEI_loadNodeBCs(CFEI* cfei, - int numNodes, - GlobalID *BCNodes, - int fieldID, - int* offsetsIntoField, - double* prescribed_values); - -int FEI_loadElemBCs( CFEI* cfei, - int numElems, - GlobalID *elemIDs, - int fieldID, - double **alpha, - double **beta, - double **gamma ); - -int FEI_sumInElem(CFEI* cfei, - GlobalID elemBlockID, - GlobalID elemID, - GlobalID* elemConn, - double **elemStiffness, - double *elemLoad, - int elemFormat); - -int FEI_sumInElemMatrix(CFEI* cfei, - GlobalID elemBlockID, - GlobalID elemID, - GlobalID* elemConn, - double **elemStiffness, - int elemFormat); - -int FEI_sumInElemRHS(CFEI* cfei, - GlobalID elemBlockID, - GlobalID elemID, - GlobalID* elemConn, - double *elemLoad); - -int FEI_loadElemTransfer(CFEI* cfei, - GlobalID elemBlockID, - GlobalID elemID, - GlobalID* coarseNodeList, - int fineNodesPerCoarseElem, - GlobalID* fineNodeList, - double** elemProlong, - double** elemRestrict); - -int FEI_loadCRMult(CFEI* cfei, - int CRID, - int numCRNodes, - GlobalID *CRNodes, - int *CRFields, - double *CRWeights, - double CRValue); - -int FEI_loadCRPen(CFEI* cfei, - int CRID, - int numCRNodes, - GlobalID *CRNodes, - int *CRFields, - double *CRWeights, - double CRValue, - double penValue); - -int FEI_sumIntoMatrix(CFEI* cfei, - int patternID, - int* rowIDTypes, - GlobalID* rowIDs, - int* colIDTypes, - GlobalID* colIDs, - double** matrixEntries); - -int FEI_getFromMatrix(CFEI* cfei, - int patternID, - int* rowIDTypes, - GlobalID* rowIDs, - int* colIDTypes, - GlobalID* colIDs, - double** matrixEntries); - -int FEI_putIntoMatrix(CFEI* cfei, int patternID, - int* rowIDTypes, - GlobalID* rowIDs, - int* colIDTypes, - GlobalID* colIDs, - double* * matrixEntries); - -int FEI_sumIntoRHS(CFEI* cfei, int patternID, - int* IDTypes, - GlobalID* IDs, - double* vectorEntries); - -int FEI_getFromRHS(CFEI* cfei, int patternID, - int* IDTypes, - GlobalID* IDs, - double* vectorEntries); - -int FEI_putIntoRHS(CFEI* cfei, int patternID, - int* IDTypes, - GlobalID* IDs, - double* vectorEntries); - -int FEI_setMatScalars(CFEI* cfei, - int numScalars, - int* IDs, - double* scalars); - -int FEI_setRHSScalars(CFEI* cfei, - int numScalars, - int* IDs, - double* scalars); - -int FEI_loadComplete(CFEI* cfei); - -int FEI_residualNorm(CFEI* cfei, - int whichNorm, - int numFields, - int* fieldIDs, - double* norms); - -int FEI_solve(CFEI* cfei, int* status); - -int FEI_iterations(CFEI* cfei, int* itersTaken); - -int FEI_getFieldSize(CFEI* cfei, int fieldID, int* numScalars); - -int FEI_getEqnNumbers(CFEI* cfei, - GlobalID ID, - int idType, - int fieldID, - int* numEqns, - int* eqnNumbers); - -int FEI_getNodalFieldSolution(CFEI* cfei, - int fieldID, - int numNodes, - GlobalID* nodeIDs, - double* results); - -int FEI_getNumLocalNodes(CFEI* cfei, int* numNodes); - -int FEI_getLocalNodeIDList(CFEI* cfei, - int* numNodes, - GlobalID* nodeIDs, - int lenNodeIDs); - -int FEI_version(CFEI* cfei, const char** versionStringPtr); - -int FEI_cumulative_cpu_times(CFEI* cfei, - double* initTime, - double* loadTime, - double* solveTime, - double* solnReturnTime); - -int FEI_allocatedSize(CFEI* cfei, - int* bytes); - -int FEI_getBlockNodeSolution(CFEI* cfei, - GlobalID elemBlockID, - int numNodes, - GlobalID* nodeIDs, - int *offsets, - double *results); - -int FEI_getBlockFieldNodeSolution(CFEI* cfei, - GlobalID elemBlockID, - int fieldID, - int numNodes, - GlobalID* nodeIDs, - double *results); - -int FEI_getBlockElemSolution(CFEI* cfei, - GlobalID elemBlockID, - int numElems, - GlobalID *elemIDs, - int* numElemDOFPerElement, - double *results); - -int FEI_getNumCRMultipliers(CFEI* cfei, - int* numMultCRs); - -int FEI_getCRMultIDList(CFEI* cfei, - int numMultCRs, - int* multIDs); - -int FEI_getCRMultipliers(CFEI* cfei, - int numMultCRs, - int* CRIDs, - double* multipliers); - -int FEI_putBlockNodeSolution(CFEI* cfei, - GlobalID elemBlockID, - int numNodes, - GlobalID *nodeIDs, - int *offsets, - double *estimates); - -int FEI_putNodalFieldData(CFEI* cfei, - int fieldID, - int numNodes, - GlobalID* nodeIDs, - double* nodeData); - -int FEI_putBlockFieldNodeSolution(CFEI* cfei, - GlobalID elemBlockID, - int fieldID, - int numNodes, - GlobalID *nodeIDs, - double *estimates); - -int FEI_putBlockElemSolution(CFEI* cfei, - GlobalID elemBlockID, - int numElems, - GlobalID *elemIDs, - int dofPerElem, - double *estimates); - -int FEI_putCRMultipliers(CFEI* cfei, - int numMultCRs, - int* CRIDs, - double *multEstimates); - -int FEI_getBlockNodeIDList(CFEI* cfei, - GlobalID elemBlockID, - int numNodes, - GlobalID* nodeIDs); - -int FEI_getBlockElemIDList(CFEI* cfei, - GlobalID elemBlockID, - int numElems, - GlobalID* elemIDs); - -int FEI_getNumSolnParams(CFEI* cfei, - GlobalID nodeID, - int* numSolnParams); - -int FEI_getNumElemBlocks(CFEI* cfei, int* numElemBlocks); - -int FEI_getNumBlockActNodes(CFEI* cfei, - GlobalID blockID, - int* numNodes); - -int FEI_getNumBlockActEqns(CFEI* cfei, - GlobalID blockID, - int* numEqns); - -int FEI_getNumNodesPerElement(CFEI* cfei, - GlobalID blockID, - int* nodesPerElem); - -int FEI_getNumEqnsPerElement(CFEI* cfei, - GlobalID blockID, - int* numEqns); - -int FEI_getNumBlockElements(CFEI* cfei, - GlobalID blockID, - int* numElems); - -int FEI_getNumBlockElemDOF(CFEI* cfei, - GlobalID blockID, - int* DOFPerElem); - -#ifdef __cplusplus -} -#endif - -#endif diff -Nru hypre-2.16.0/src/FEI_mv/fei-base/fei_bool.h hypre-2.18.2/src/FEI_mv/fei-base/fei_bool.h --- hypre-2.16.0/src/FEI_mv/fei-base/fei_bool.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-base/fei_bool.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -/*--------------------------------------------------------------------*/ -/* Copyright 2005 Sandia Corporation. */ -/* Under the terms of Contract DE-AC04-94AL85000, there is a */ -/* non-exclusive license for use of this work by or on behalf */ -/* of the U.S. Government. Export of this program may require */ -/* a license from the United States Government. */ -/*--------------------------------------------------------------------*/ - -#ifndef _fei_bool_h_ -#define _fei_bool_h_ - -//Simulate bool support if the compiler being used doesn't have built-in bool -//(Is there still such a compiler as of 2007?) -#ifdef FEI_SIMULATE_BOOL - -#ifdef bool -#undef bool -#endif -#ifdef true -#undef true -#endif -#ifdef false -#undef false -#endif - -#define bool int -#define true 1 -#define false 0 - -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/fei-base/fei_Data.hpp hypre-2.18.2/src/FEI_mv/fei-base/fei_Data.hpp --- hypre-2.16.0/src/FEI_mv/fei-base/fei_Data.hpp 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-base/fei_Data.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -#ifndef _fei_Data_hpp_ -#define _fei_Data_hpp_ - -#include -#include - -/** - This is a very simple class for passing stuff around - in a void pointer. It has the ability to store and query - a type name, so at least there can be user-enforced - type safety. - - When setTypeName is called, a char* is created and a copy - of the input argument is taken. This char* is later destroyed - by the Data destructor. The void* dataPtr_ member is not - destroyed, it is just a copy of a pointer. -*/ - -class Data { - public: - /** Default constructor. */ - Data() {typeName_ = NULL; dataPtr_ = NULL;}; - - /** Default destructor. */ - virtual ~Data() {if (typeName_) delete [] typeName_;}; - - /** Set a string representing the type of the object stored in - 'getDataPtr()'. */ - void setTypeName(const char* name) {if (typeName_) delete [] typeName_; - size_t len = strlen(name); - typeName_ = new char[len+1]; - strcpy(typeName_, name); - typeName_[len] = '\0';}; - - /** Query the string representing the type of the object stored in - 'getDataPtr()'. */ - char* getTypeName() const {return(typeName_);}; - - /** Set the contents of the data pointer. */ - void setDataPtr(void* ptr) {dataPtr_ = ptr;}; - - /** Retrieve the contents of the data pointer. */ - void* getDataPtr() const {return(dataPtr_);}; - - private: - char* typeName_; - void* dataPtr_; -}; - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/fei-base/fei_defs.h hypre-2.18.2/src/FEI_mv/fei-base/fei_defs.h --- hypre-2.16.0/src/FEI_mv/fei-base/fei_defs.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-base/fei_defs.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -#ifndef _fei_defs_h_ -#define _fei_defs_h_ - -/* - In this file we set some #defines to use as parameters to - some fei functions, and also some error-code returns. - We also provide the typedef for 'GlobalID' which appears in - many FEI function prototypes. Note that the default case is - for GlobalID to simply be an int. - This file is included by both C and C++ versions of the fei. -*/ - -#ifdef EIGHT_BYTE_GLOBAL_ID - typedef long long GlobalID; - #define GlobalID_MAX LLONG_MAX - #define GlobalID_MIN LLONG_MIN -#else - typedef int GlobalID; -#endif - - -/* solveType (used in 'setSolveType'): */ -#define FEI_SINGLE_SYSTEM 0 -#define FEI_EIGEN_SOLVE 1 -#define FEI_AGGREGATE_SUM 2 -#define FEI_AGGREGATE_PRODUCT 3 - -/* IDType (used in coefficient-access functions) */ -#define FEI_NODE 0 -#define FEI_ELEMENT 1 -#define FEI_ONLY_NODES 2 -#define FEI_ONLY_ELEMENTS 3 - -/* elemFormat (used in 'sumInElem' and 'sumInElemMatrix'): */ -#define FEI_DENSE_ROW 0 -#define FEI_UPPER_SYMM_ROW 1 -#define FEI_LOWER_SYMM_ROW 2 -#define FEI_DENSE_COL 3 -#define FEI_UPPER_SYMM_COL 4 -#define FEI_LOWER_SYMM_COL 5 -#define FEI_DIAGONAL 6 -#define FEI_BLOCK_DIAGONAL_ROW 7 -#define FEI_BLOCK_DIAGONAL_COL 8 - - -/* interleaveStrategy (used in initElemBlock): */ -#define FEI_NODE_MAJOR 0 -#define FEI_FIELD_MAJOR 1 - - -/* timingMode (used in cumulative_MPI_Wtimes): */ -#define FEI_LOCAL_TIMES 0 -#define FEI_MAX_TIMES 1 -#define FEI_MIN_TIMES 2 - -/* FEI function return values */ -#define FEI_SUCCESS 0 -#define FEI_FATAL_ERROR -1 -#define FEI_ID_NOT_FOUND -2 - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/fei-base/fei_LinearSystemCore.hpp hypre-2.18.2/src/FEI_mv/fei-base/fei_LinearSystemCore.hpp --- hypre-2.16.0/src/FEI_mv/fei-base/fei_LinearSystemCore.hpp 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-base/fei_LinearSystemCore.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,606 +0,0 @@ -#ifndef _fei_LinearSystemCore_hpp_ -#define _fei_LinearSystemCore_hpp_ - -class Data; -class Lookup; - -#include - -/** - This is the original internal FEI interface to solver-libraries -- - the destination for the data being assembled into a linear system by the FEI - implementation. - - When creating a specific FEI implementation, i.e., a version that - supports a specific underlying linear solver library, the main - task that must be performed is the implementation of this interface, - LinearSystemCore (Note: the LinearSystemCore interface is being - replaced by the ESI_Broker interface.). - - To date (as of August 2001), implementations of this interface exist for - coupling the following solver libraries to the FEI implementation: -
    -
  • Aztec -
  • HYPRE -
  • ISIS++ -
  • PETSc -
  • Prometheus -
  • SPOOLES -
- - An implementation of LinearSystemCore holds and manipulates all - solver-library-specific stuff, such as matrices/vectors, - solvers/preconditioners, etc. An instance of this class is owned and used by - the class that implements the public FEI spec. i.e., when element - contributions, etc., are received from the finite-element application, the - data is ultimately passed to this - class for assembly into the sparse matrix and associated vectors. This class - will also be asked to launch any underlying solver, and finally to - return the solution. - - Terminology notes: - - I generally refer to connectivities as nodes or nodeIDs, which are - finite-element entities. However, the LinearSystemCore interface functions - don't receive nodeIDs -- instead, nodeNumbers are provided by the FEI - implementation code layer. See note 3 below. - - - I refer to the rows of a matrix or entries in a vector as equations - or equation-numbers, which are linear-algebra entities. - - - An equation can be mapped to a node/field pair. i.e., given a globally - unique node number, and a solution field on that node, a global - equation number can be obtained, and vice versa. - - - The term 'block' is used in two different ways here. A block-entry matrix - is a matrix made up of dense sub-blocks, with each sub-block containing a - number of equations. An element-block is a finite-element term, denoting a - group of elements which are homogeneous in topology. i.e., all elements in - an element-block have the same number of nodes, and the same numbers of - fields per node. - - Key services provided by the FEI implementation layer: - - Mappings: - Map from node/field pairs to equation numbers. - Map from lagrange multipliers to equation numbers. - Map from element-dofs to equation numbers. - - Partitioning and communication: - Decide which processor shared equations belong to. - Move element-contributions for shared equations from - the sharing/contributing processor to the owning processor. - i.e., the LinearSystemCore object will only be given local - equation data. - -NOTES: - -1. The LinearSystemCore object is given a 'Lookup' interface, from which it can - obtain information about the structure of the finite-element problem. e.g., - it can look up the number of fields, the fields' sizes, the number of - element-blocks, etc., etc. For details on the Lookup interface, see the file - Lookup.h. - -2. Except for making calls on the Lookup object, LinearSystemCore is reactive. - All of the functions below are member functions of LinearSystemCore, which - are called by FEI code. 'set' and 'put' functions are for information to be - provided TO LinearSystemCore by the FEI implementation layer, while 'get' - functions are for information to be requested FROM LinearSystemCore by the - FEI implementation layer. - -3. Node-numbers that are given to LinearSystemCore (through setConnectivities, - etc.,) are 0-based and contiguous. Each processor owns a contiguous block - of node-numbers. However, non-local node-numbers may of course appear in - connectivity lists. These node-numbers are not the same as the 'nodeIDs' - that appear in the FEI public interface, and throughout the FEI implementation - code. nodeIDs are provided by the application, and may not be assumed to be - 0-based or contiguous. They are arbitrary node identifiers which need only - be globally unique. nodeIDs never appear in LinearSystemCore functions. - -4. Not all LinearSystemCore functions are necessary for assembling a - linear system. For instance, many implementations will ignore the data that - is passed in by 'setConnectivities', 'setStiffnessMatrices', etc. - -5. Some data is passed into LinearSystemCore redundantly. i.e., matrix - coefficient data appears in the 'setStiffnessMatrices' function as well as - the 'sumIntoSystemMatrix/sumIntoSystemBlkMatrix' function. The difference is, - only local data is supplied through sumIntoSystemMatrix. Additionally, the - FEI implementation layer performs the necessary communication to ensure that - data from shared finite-element nodes is moved onto the 'owning' processor - before being passed to LinearSystemCore::sumIntoSystemMatrix. - The finite-element application doesn't have the concept of node ownership, - instead processors can equally share nodes. The FEI implementation designates - a single processor as the owner of these nodes, and moves any shared - stiffness data onto the appropriate owning processor. - The data supplied through setStiffnessMatrices is the un-modified stiffness - data supplied by the application, including any shared-non-local portions. - - Similarly for setLoadVectors and sumIntoRHSVector. sumIntoRHSVector only - provides local data, while setLoadVectors supplies the un-modified element- - load vectors from the application, including any shared portions. - -*/ - -class LinearSystemCore { - public: - /** Default constructor, typically overridden by the implementing class, which - probably requires an MPI Communicator, and possibly other arguments. - */ - LinearSystemCore(){}; - - /** Destructor, should call through to the implementation's destructor and - destroy all allocated memory, internal objects, etc. Exceptions: objects - created in reponse to calls to the functions 'copyOutMatrix' and - 'copyOutRHSVector' are not destroyed here. The caller is assumed to have - taken responsibility for those matrix/vector copies. - */ - virtual ~LinearSystemCore() {}; - - - /** For cloning a LinearSystemCore instance. Caller recieves a pointer to a - new instantiation of the implementing object. */ - virtual LinearSystemCore* clone() = 0; - - - /** For setting argc/argv style parameters. - @param numParams Number of strings in the params argument - @param params A list of strings which will usually contain space-separated - key-value pairs. Example: "debugOutput /usr/users/me/work_dir" - */ - - virtual int parameters(int numParams, char** params) = 0; - - - /** Supply the LinearSystemCore implementation with an object (created and - owned by the caller) that can be used to obtain various information about - problem layout, shared finite-element nodes, etc. - For details, see the documentation for the Lookup interface. - @param lookup Input. Reference to an implementation of the Lookup interface - */ - virtual int setLookup(Lookup& lookup) = 0; - - - /** Query a named property (such as timing statistics, etc.) from the solver - library. - @param name Input. Name of the property for which a value is being - requested. - @pararm value Output. Requested property's value. - @return error-code 0 if successful. -1 probably indicates that the - named property is not recognized. - */ - virtual int getProperty(const char* /*name*/, double& /*value*/) - { - return(-1); - } - - /** Supply LinearSystemCore with global offset information for the problem - being assembled. - @param len Length of the following list arguments. This will be numProcs+1 - @param nodeOffsets The FEI implementation assigns a global 0-based - numbering to the finite-element nodes in the problem. Each processor - is given ownership of a contiguous subset of these node-numbers. - nodeOffsets[i] gives the first local node-number for processor i. - nodeOffsets[len-1] gives the total number of nodes. - @param eqnOffsets eqnOffsets[i] gives the first local equation number for - processor i, eqnOffsets[len-1] gives the global number of equations. - @param blkEqnOffsets Contains the same kind of information as eqnOffsets, - but for 'block-equations'. A block-equation contains all of the - point-equations present at a finite-element node. Special case: if - this problem contains Lagrange Multiplier constraints, they will - be equations that don't correspond to any node, and there will only be - one of these equations mapped to a block-equation. - */ - virtual int setGlobalOffsets(int len, int* nodeOffsets, - int* eqnOffsets, int* blkEqnOffsets) = 0; - - - /** For passing element-connectivity arrays. - @param elemBlock Identifier for the element-block that these elements - belong to. - @param numElements Length of the elemIDs list. - @param numNodesPerElem Length of each row in the connNodes table. - @param elemIDs Identifiers for each element for which connectivities are - being supplied. - @param connNodes Table, with one row for each element. Each row is a list of - the nodes that are connected to that element. - */ - virtual int setConnectivities(GlobalID elemBlock, - int numElements, - int numNodesPerElem, - const GlobalID* elemIDs, - const int* const* connNodes) = 0; - - - /** For passing element-stiffness arrays. - @param elemBlock Identifier for the element-block that these elements - belong to. - @param numElems Length of the elemIDs list. - @param elemIDs Identifiers for each element for which a stiffness array is - being supplied. - @param stiff List of 'numElems' tables, each table is of size - 'numEqnsPerElem' X 'numEqnsPerElem'. - @param numEqnsPerElem - @param eqnIndices Table, with 'numElems' rows, each row being a list of - 'numEqnsPerElem' scatter indices (0-based global matrix row/column - indices). - */ - virtual int setStiffnessMatrices(GlobalID elemBlock, - int numElems, - const GlobalID* elemIDs, - const double *const *const *stiff, - int numEqnsPerElem, - const int *const * eqnIndices) = 0; - - - /** For passing element-load vectors. - @param elemBlock Identifier for the element-block that these elements - belong to. - @param numElems Length of the elemIDs list. - @param elemIDs Identifiers for each element for which a load vector is - being supplied. - @param load Table with 'numElems' rows, each row is of length - 'numEqnsPerElem'. - @param numEqnsPerElem - @param eqnIndices Table, with 'numElems' rows, each row being a list of - 'numEqnsPerElem' scatter indices (0-based global equation numbers). - */ - virtual int setLoadVectors(GlobalID elemBlock, - int numElems, - const GlobalID* elemIDs, - const double *const * load, - int numEqnsPerElem, - const int *const * eqnIndices) = 0; - - - /** Supply LinearSystemCore with information defining the structure of the - sparse matrix to be assembled. Implementers of LinearSystemCore may safely - assume that this function will not be called until after the - function 'setGlobalOffsets' has been called. Using the information - provided via setGlobalOffsets, the number-of-local-equations can be - trivially calculated. After setMatrixStructure has been called, there - should be enough information to instantiate internal linear-algebra - entities, such as vectors, matrix, etc. - @param ptColIndices Table, with num-local-eqns rows, and the i-th row is of - length ptRowLengths[i]. - @param ptRowLengths - @param blkColIndices Table, with num-local-blkEqns rows, and the i-th row - is of length blkRowLengths[i]. - @param blkRowLengths - @param ptRowsPerBlkRow The i-th local block-equation corresponds to - ptRowsPerBlkRow[i] point-equations. - */ - virtual int setMatrixStructure(int** ptColIndices, - int* ptRrowLengths, - int** blkColIndices, - int* blkRowLengths, - int* ptRowsPerBlkRow) = 0; - - - /** Specify which global equation numbers correspond to Lagrange Multiplier - equations. This function won't be called if there are no Lagrange - Multiplier constraints in the problem. If this function is called, it is - guaranteed to be called after 'setGlobalOffsets' and before - 'setMatrixStructure'. The primary purpose of this function is to give - LinearSystemCore implementers the opportunity to deal with constraints in a - special way, rather than assembling everything into one matrix. If the - problem being assembled does have Lagrange constraints, then the FEI - implementation will request an ESI_MatrixRowWriteAccess interface for - "C_Matrix" from LinearSystemCore. If that is not available, then the FEI - implementation will request "A_Matrix" and assemble everything into that. - @param numCRs number of constraint relations - @param numNodesPerCR number of constrained node in each constraint relation - @param nodeNumbers Table of constrained nodes. 'numCRs' rows, with the i-th - row being of length numNodesPerCR[i]. - @param eqnNumbers Table, same dimensions as 'nodeNumbers'. These are the - global 0-based matrix column indices of the constraint coefficients. - @param multiplierEqnNumbers Equation numbers that the Lagrange Multipliers - correspond to. - */ - virtual int setMultCREqns(int multCRSetID, - int numCRs, int numNodesPerCR, - int** nodeNumbers, int** eqnNumbers, - int* fieldIDs, - int* multiplierEqnNumbers) = 0; - - /** Specify which nodes and equation numbers correspond to penalty - constraints. This function is included for completeness, but hasn't - yet been proven to be useful or necessary, and will probably not be - included in the successor to LinearSystemCore (ESI_LSManager). - */ - virtual int setPenCREqns(int penCRSetID, - int numCRs, int numNodesPerCR, - int** nodeNumbers, int** eqnNumbers, - int* fieldIDs) = 0; - - - /** Provides point-entry data, as well as block-entry data. This is the - primary assembly function, through which the FEI implementation provides - the local equation contributions of all element contributions. - */ - virtual int sumIntoSystemMatrix(int numPtRows, const int* ptRows, - int numPtCols, const int* ptCols, - int numBlkRows, const int* blkRows, - int numBlkCols, const int* blkCols, - const double* const* values) = 0; - - /** Purely point-entry version for accumulating coefficient data into the - matrix. This will be called when a matrix contribution fills only part of - a block-equation. e.g., when a penalty constraint is being applied to a - single solution field on a node that has several solution fields. - (A block-equation contains all solution field equations at a node.) - */ - virtual int sumIntoSystemMatrix(int numPtRows, const int* ptRows, - int numPtCols, const int* ptCols, - const double* const* values) = 0; - - /** Point-entry matrix data as for 'sumIntoSystemMatrix', but in this case - the data should be "put" into the matrix (i.e., overwrite any coefficients - already present) rather than being "summed" into the matrix. - */ - virtual int putIntoSystemMatrix(int numPtRows, const int* ptRows, - int numPtCols, const int* ptCols, - const double* const* values) = 0; - - /** Get the length of a row of the matrix. - @param row Global 0-based equation number - @param length Output. Length of the row. - @return error-code non-zero if any error occurs, e.g., row is not local. - */ - virtual int getMatrixRowLength(int row, int& length) = 0; - - /** Obtain the coefficients and indices for a row of the matrix. - @param row Global 0-based equation number - @param coefs Caller-allocated array, length 'len', to be filled with - coefficients - @param indices Caller-allocated array, length 'len', to be filled with - indices. (These indices will be global 0-based equation numbers.) - @param len Length of the caller-allocated coefs and indices arrays - @param rowLength Output. Actual length of this row. Not referenced if - row is not in the local portion of the matrix. - @return error-code non-zero if any error occurs, e.g., row is not local. - */ - virtual int getMatrixRow(int row, double* coefs, int* indices, - int len, int& rowLength) = 0; - - /** For accumulating coefficients into the rhs vector */ - - virtual int sumIntoRHSVector(int num, const double* values, - const int* indices) = 0; - /** For putting coefficients into the rhs vector */ - virtual int putIntoRHSVector(int num, const double* values, - const int* indices) = 0; - /** For getting coefficients out of the rhs vector */ - virtual int getFromRHSVector(int num, double* values, - const int* indices) = 0; - - /** The FEI implementation calls this function to signal the linsyscore - object that data-loading is finished. - */ - virtual int matrixLoadComplete() = 0; - - /** Pass nodal data that probably doesn't mean anything to the FEI - implementation, but may mean something to the linear solver. Examples: - geometric coordinates, nullspace data, etc. - @param fieldID Identifier for the field that describes this data. Lists of - field identifiers and field sizes defined for the finite-element problem - may be obtained from the Lookup interface that is supplied to the - LinearSystemCore by the FEI implementation. - @param nodeNumbers List of nodes for which data is being supplied. - @param numNodes - @param data List of length numNodes * (size of field 'fieldID') - */ - virtual int putNodalFieldData(int fieldID, int fieldSize, - int* nodeNumbers, int numNodes, - const double* data) = 0; - - - /** For setting the scalar 's' (usually 0.0) throughout the matrix rhs - vector. - */ - virtual int resetMatrixAndVector(double s) = 0; - - /** For setting the scalar 's' (usually 0.0) throughout the matrix. - */ - virtual int resetMatrix(double s) = 0; - - /** For setting the scalar 's' (usually 0.0) throughout the rhs vector. - */ - virtual int resetRHSVector(double s) = 0; - - /** The FEI implementation calls this function to inform LinearSystemCore - of equations that need to have essential (Dirichlet) boundary conditions - enforced on them. The intent is that the LinearSystemCore implementation - will perform the column-modification b[i] = gamma[i]/alpha[i] if i == - globalEqn[i], otherwise b[i] -= gamma[i]/alpha[i] * A(i,globalEqn[i]) if - i != globalEqn[i]. After this operation is performed, all of row - globalEqn[i] and column globalEqn[i] should be set to 0.0, except for the - diagonal position. (Naturally the implementer is free to enforce the - boundary condition another way if they wish.) - @param globalEqn List, of length 'len', of global 0-based equation numbers. - @param alpha List, of length 'len', of coefficients. When the solution to - the linear system is later requested, the solution value for - globalEqn[i] should be gamma[i]/alpha[i]. - @param gamma - @param len - */ - virtual int enforceEssentialBC(int* globalEqn, double* alpha, - double* gamma, int len) = 0; - - /** The FEI implementation calls this function to inform LinearSystemCore - that certain local equations need column-modifications made due to - essential boundary-conditions being enforced on other processors. The - column modification is roughly this: b(globalEqns[i]) -= A(globalEqns[i], - colIndices[i][j]) * coefs[i][j], for i in [0..numEqns-1] and j in [0.. - colIndLen[i]-1]. (Note that A(globalEqns[i], colIndices[i][j]) should be - set = 0.0 after the appropriate value has been accumulated into b also.) - @param numEqns Length of 'globalEqns' - @param globalEqns Equations that are local to this processor. - @param colIndices Table, with 'numEqns' rows, and the i-th row is of length - colIndLen[i]. The i-th row contains column indices in equation - globalEqns[i]. These column indices correspond to equations (rows) that - are owned by other processors, and those other processors are imposing - essential boundary conditions on those equations. - @param colIndLen List of length 'numEqns'. - @param coefs This table holds the gamma/alpha coeficients that are the - value of the boundary conditions being enforced on each of the remote - equations in the 'colIndices' table. - */ - virtual int enforceRemoteEssBCs(int numEqns, int* globalEqns, - int** colIndices, int* colIndLen, - double** coefs) = 0; - - /** This function is called to inform LinearSystemCore that natural (or - Neumann) or mixed boundary conditions are to be enforce on some equations. - Basically, these can be enforced by performing this operation: - A(globalEqn[i], globalEqn[i]) += alpha[i]/beta[i], and b(globalEqn[i]) += - gamma[i]/beta[i], for all i in [0 .. len-1]. (Note that alpha[i]==0.0 - implies a Natural or Neumann boundary condition, while gamma[i]==0.0 implies - a mixed boundary condition. - @param globalEqn List, length 'len', of equation on which to impose - boundary conditions. - @param alpha List, length 'len', of coefficients described above. - @param beta - @param gamma - @param len - */ - virtual int enforceOtherBC(int* globalEqn, double* alpha, - double* beta, double* gamma, int len) = 0; - - /** The FEI implementation calls this function to request a pointer to the - internal 'A-matrix' data. - @param data See Data class documentation. - */ - virtual int getMatrixPtr(Data& data) = 0; - - /** LinearSystemCore's internal 'A-matrix' should be replaced with a scaled - copy of the incoming data. - @param scalar coefficient by which to scale the incoming data. - @param data See documentation for Data class. - */ - virtual int copyInMatrix(double scalar, const Data& data) = 0; - - /** The FEI implementation calls this function to request a scaled copy of - the internal 'A-matrix' data. The FEI implementation will then be - responsible for deciding when this matrix data should be destroyed. The - LinearSystemCore implementation should not keep a reference to the pointer - that was handed out. - @param scalar - @param data See documentation for Data class. - */ - virtual int copyOutMatrix(double scalar, Data& data) = 0; - - /** A scaled copy of the incoming data should be added to the internal - 'A-matrix'. - @param scalar - @param data See documentation for Data class. - */ - virtual int sumInMatrix(double scalar, const Data& data) = 0; - - /** Same semantics as getMatrixPtr, but applied to rhs vector. */ - virtual int getRHSVectorPtr(Data& data) = 0; - - /** Same semantics as copyInMatrix, but applied to rhs vector. */ - virtual int copyInRHSVector(double scalar, const Data& data) = 0; - - /** Same semantics as copyOutMatrix, but applied to rhs vector. */ - virtual int copyOutRHSVector(double scalar, Data& data) = 0; - - /** Same semantics as sumInMatrix, but applied to rhs vector. */ - virtual int sumInRHSVector(double scalar, const Data& data) = 0; - - /** Utility function for destroying the matrix in a Data container. The - caller (owner of 'data') can't destroy the matrix because they don't know - what concrete type it is and can't get to its destructor. The contents of - 'data' is a matrix previously passed out via 'copyOutMatrix'. - @param data See documentation for Data class. - */ - virtual int destroyMatrixData(Data& data) = 0; - - /** Utility function for destroying the vector in a Data container. The - caller (owner of 'data') can't destroy the vector because they don't know what - concrete type it is and can't get to its destructor. The contents of 'data' - is a vector previously passed out via 'copyOutRHSVector'. - @param data See documentation for Data class. - */ - virtual int destroyVectorData(Data& data) = 0; - - /** Indicate the number of rhs-vectors being assembled/solved for. - This function will be called by the FEI implementation at or near the - beginning of the problem assembly. If numRHSs is greater than 1, then - calls to 'getMemberInterface' requesting an interface to an rhs vector - will use the 'objName' argument "b_Vector_n", where n is in [0 .. - numRHSs-1]. If there is only one rhs-vector, then 'objName' will be - simply "b_Vector". - @param numRHSs Length of the rhsIDs list. - @param rhsIDs Caller-supplied integer identifiers for the rhs vectors. This - argument will probably be removed, as it is obsolete (a carry-over from - LinearSystemCore). - */ - virtual int setNumRHSVectors(int numRHSs, const int* rhsIDs) = 0; - - /** Set the 'current context' to the rhs-vector corresponding to rhsID. - Subsequent data received via 'sumIntoRHSVector' should be directed into - this rhs-vector. Any other function-calls having to do with the rhs-vector - should also effect this rhs-vector. - @param rhsID - */ - virtual int setRHSID(int rhsID) = 0; - - /** The FEI implementation will call this function to supply initial-guess - data that should be used as the starting 'x-vector' if an iterative - solution is to be performed. - @param eqnNumbers Global 0-based equation numbers for which the initial - guess should be set. - @param values The initial guess data. - @param len Number of equations for which an initial guess is being supplied. - */ - virtual int putInitialGuess(const int* eqnNumbers, const double* values, - int len) = 0; - - /** The FEI implementation will call this function to request all local - solution values. - @param answers Solution coefficients. - @param len This should equal the number of local equations. If it is less, - the LinearSystemCore implementation should simply pass out the first 'len' - local solution values. If it is more, then just pass out numLocalEqns - solution values. - */ - virtual int getSolution(double* answers, int len) = 0; - - /** The FEI implementation will call this function to request a single - solution value. - @param eqnNumber Global 0-based equation number. - @param answer - */ - virtual int getSolnEntry(int eqnNumber, double& answer) = 0; - - /** This will be called to request that LinearSystemCore form the residual - vector r = b - A*x, and pass the coefficients for r back out in the 'values' - list. - @param values - @param len This should equal num-local-eqns. - */ - virtual int formResidual(double* values, int len) = 0; - - /** Function called to request the launching of the linear solver. - @param solveStatus Output, should indicate the status of the solve. A - successful solve is usually indicated by a value of 0. - @param iterations Output, how many iterations were performed. - @return error-code, 0 if convergence tolerance was achieved within the - specified maximum number of iterations. If error return is non-zero, the - calling application will be expected to check solveStatus, and consult the - solver-library's documentation to figure out exactly what happened. - */ - virtual int launchSolver(int& solveStatus, int& iterations) = 0; - - /** This function's intent is to provide a file-name to be used by - LinearSystemCore in writing the linear system into disk files. Format is - not specified. Implementers may choose to augment this name in the style - of writing 3 files: A_name, x_name, b_name, or some other convention. - This function is ill-defined, obsolete, and will probably never be called - by the FEI implementation. - */ - virtual int writeSystem(const char* name) = 0; -}; - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/fei-base/fei_LinSysCore_struct.h hypre-2.18.2/src/FEI_mv/fei-base/fei_LinSysCore_struct.h --- hypre-2.16.0/src/FEI_mv/fei-base/fei_LinSysCore_struct.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-base/fei_LinSysCore_struct.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -#ifndef _fei_LinSysCore_struct_h_ -#define _fei_LinSysCore_struct_h_ - -/*--------------------------------------------------------------------*/ -/* Copyright 2005 Sandia Corporation. */ -/* Under the terms of Contract DE-AC04-94AL85000, there is a */ -/* non-exclusive license for use of this work by or on behalf */ -/* of the U.S. Government. Export of this program may require */ -/* a license from the United States Government. */ -/*--------------------------------------------------------------------*/ - -/*------------------------------------------------------------------------------ - Define a "Linear System Core" struct. This is the object that - handles all solver-library-specific functionality like sumIntoMatrix, - launchSolver, etc., etc. The pointer 'lsc_' needs to hold an instance - of an object which implements the C++ interface defined in - LinearSystemCore.h. An implementation-specific - function will be required to create one of these. - - e.g., Aztec_LinSysCore_create(LinSysCore** lsc, MPI_Comm comm); - - This function would be found in ../support-Trilinos/cfei_aztec.h, in the case - of an Aztec implementation. -------------------------------------------------------------------------------*/ - -struct LinSysCore_struct { - void* lsc_; -}; -typedef struct LinSysCore_struct LinSysCore; - - -/* The following macro is an artifact of a previous bad design where the - above LinSysCore declaration was located in a bad place, and could be - multiply defined. The following macro prevents the multiple-definition - in headers (such as cfei_prometheus.h in the Prometheus library) that - haven't been revised. -*/ -#ifndef CFEI_LinSysCore_DEFINED -#define CFEI_LinSysCore_DEFINED -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/fei-base/fei_Lookup.hpp hypre-2.18.2/src/FEI_mv/fei-base/fei_Lookup.hpp --- hypre-2.16.0/src/FEI_mv/fei-base/fei_Lookup.hpp 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-base/fei_Lookup.hpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,223 +0,0 @@ -#ifndef _fei_Lookup_hpp_ -#define _fei_Lookup_hpp_ - -#include - -/** - This interface is intended to be used by a LinearSystemCore implementation - (or a ESI_Broker or FiniteElementData implementation) to look up various - information about the structure of the finite-element problem being assembled - into LinearSystemCore by a FEI implementation. - - Lookup basically provides the query functions from the FEI implementation's - SNL_FEI_Structure class. However, unlike the SNL_FEI_Structure header, this - header can be included without also including a bunch of other non-public - FEI implementation headers. SNL_FEI_Structure also provides a lot of - functions for *setting* the structural information, which the - LinearSystemCore object doesn't need access to. - - Background: - The finite element problem consists of a set of element-blocks, each of - which contains a set of elements. Each element has a list of connected - nodes, and each node has a set of fields. Each field consists of 1 to - several scalar quantities. Each of those scalar quantities corresponds - to an equation in the linear system. Exception: some fields may not be - solution-fields. This is indicated by a negative fieldID. There are no - equations corresponding to fields with negative fieldIDs. Data that is - passed in associated with negative fieldIDs is probably coordinate or - nullspace data, or other data passed from the application to the solver - (note that this non-solution-field data won't appear in element-matrices, - it will be passed separately through a special function for supplying - nodal data). - - elem-block IDs and field IDs are application-provided numbers, and no - assumption may be made regarding their order, contiguousness, etc. - - Equation numbers are assigned to node/field pairs by the FEI implementation, - and are also globally unique, and non-shared. Each equation resides on - exactly one processor. Equation numbers are 0-based. - - - NOTES: 1. functions that return an equation number, or a size (e.g., - num-equations, num-fields, etc.) may indicate an error or 'not-found' - condition by returning a negative number. Functions that return a - pointer may indicate an error by returning NULL. -*/ - -class Lookup { - public: - /** Destructor. */ - virtual ~Lookup(){}; - - /** Get the (global) number of fields defined for the problem. A field may - consist of 1 to several scalar quantities. Examples include pressure, - displacement (a 3-vector in 3D), etc. - */ - virtual int getNumFields() = 0; - - /** Given a fieldID, obtain the associated fieldSize - @param fieldID integer identifier for a field - */ - virtual int getFieldSize(int fieldID) = 0; - - - /** - Return a pointer to a list (of length numFields) of the fieldIDs - */ - virtual const int* getFieldIDsPtr() = 0; - - /** - Return a pointer to a list (of length numFields) of the fieldSizes - */ - virtual const int* getFieldSizesPtr() = 0; - - - /** Returns the number of element-blocks in the (local) finite-element - problem. - */ - virtual int getNumElemBlocks() = 0; - - - /** Return a pointer to the list (of length numElemBlocks) containing the - element-block identifiers for the (local) finite-element problem. - */ - virtual const GlobalID* getElemBlockIDs() = 0; - - - /** Given a blockID, provide several pieces of element-block information. - @param interleaveStrategy element-equation ordering: 0 => node-major, - 1 => field-major - @param lumpingStrategy element-matrices may be lumped if they're mass - matrices, 0 => not lumped, 1 => lumped - @param numElemDOF number of element-dof at each element in this block - @param numElements number of elements in this block - @param numNodesPerElem number of nodes connected to each element in this - block - @param numEqnsPerElem number of scalar equations at each element in this - block - */ - virtual void getElemBlockInfo(GlobalID blockID, - int& interleaveStrategy, int& lumpingStrategy, - int& numElemDOF, int& numElements, - int& numNodesPerElem, int& numEqnsPerElem) = 0; - - - /** Given a blockID, return a pointer to a list (of length numNodesPerElem) - of numFieldsPerNode. - @param blockID identifier of the elem-block in question - */ - - virtual const int* getNumFieldsPerNode(GlobalID blockID) = 0; - - - /** Given a blockID, return a pointer to a table, - (num-rows == numNodesPerElem, row-length[i] == fieldsPerNode[i]) - containing the fieldIDs at each node of elements in that element-block. - @param blockID identifier of the elem-block in question - */ - virtual const int* const* getFieldIDsTable(GlobalID blockID) = 0; - - - /** Given a nodeNumber/fieldID pair, this function returns the first global - (0-based) equation number associated with that nodeNumber/fieldID pair. - @param nodeNumber - @param fieldID - */ - virtual int getEqnNumber(int nodeNumber, int fieldID) = 0; - - - /** Given a global (0-based) equation number, return the node-number. - @param eqnNumber - */ - virtual int getAssociatedNodeNumber(int eqnNumber) = 0; - - - /** Given a global (0-based) equation number, return the fieldID. - @param eqnNumber - */ - virtual int getAssociatedFieldID(int eqnNumber) = 0; - - - /** Given a nodeNumber, determine whether that node is connected to a local - element. - @param nodeNumber - @return true if nodeNumber is connected to a local element, false - otherwise. - */ - virtual bool isInLocalElement(int nodeNumber) = 0; - - /** Given a nodeNumber, return the number of subdomains that contain this - node. subdomains correspond to processors. The number of subdomains that - contain a node does not always equal the number of processors that share - a node. There are two kinds of "sharing" -- the "normal" kind, where a - node is shared because it is connected to elements that reside on more - than one processor, and the "wierd" kind where nodes are considered - shared simply because of being in cross-processor constraints. This - function describes how many processors share this node in the "normal" - sense. Thus, in general, this relationship holds: - getNumSubdomains(nodeNum) <= getNumSharingProcs(nodeNum) - @param nodeNumber - @return numSubdomains - */ - virtual int getNumSubdomains(int nodeNumber) = 0; - - /** Given a nodeNumber, return a list of the subdomains that contain this - node. This is the list of subdomains that's counted by the method - 'getNumSubdomains' above. - @param nodeNumber - @return pointer to list of subdomains (processor ranks). NULL if the - specified nodeNumber is not found. - */ - virtual int* getSubdomainList(int nodeNumber) = 0; - - /** Return the number of local nodes that are shared by multiple processors - */ - virtual int getNumSharedNodes() = 0; - - /** Return a pointer to the list of shared nodeNumbers - */ - virtual const int* getSharedNodeNumbers() = 0; - - /** Given a shared nodeNumber, return a pointer to the list of sharing procs. - @param nodeNumber The subject of the query. Function returns NULL if - 'nodeNumber' is not a shared node. - */ - virtual const int* getSharedNodeProcs(int nodeNumber) = 0; - - /** Given a shared nodeNumber, return the number of processors that share it. - @param nodeNumber Function returns -1 if 'nodeNumber' is not a shared - node. - */ - virtual int getNumSharingProcs(int nodeNumber) = 0; - - //- given a blk-eqn and a pt-eqn, return the pt-eqn's offset into the blk-eqn - // (i.e., distance from the 'beginning' of the blk-eqn) - //- given a blk-eqn, return the 'size', or number of pt-eqns corresponding - // to it. - /** Query whether a pt-eqn corresponds exactly to a blk-eqn. in other words, - is pt-eqn the first point equation in a block-equation. - @param ptEqn - */ - virtual bool isExactlyBlkEqn(int ptEqn) = 0; - - /** Given a pt-eqn, return the corresponding blk-eqn. - @param ptEqn - */ - virtual int ptEqnToBlkEqn(int ptEqn) = 0; - - /** Given a blk-eqn and a pt-eqn, return the pt-eqn's offset into the blk-eqn - (i.e., distance from the 'beginning' of the blk-eqn) - @param blkEqn - @param ptEqn - */ - virtual int getOffsetIntoBlkEqn(int blkEqn, int ptEqn) = 0; - - /** Given a blk-eqn, return the 'size', or number of pt-eqns corresponding - to it. - @param blkEqn - */ - virtual int getBlkEqnSize(int blkEqn) = 0; -}; - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/fei-base/fei_mpi.h hypre-2.18.2/src/FEI_mv/fei-base/fei_mpi.h --- hypre-2.16.0/src/FEI_mv/fei-base/fei_mpi.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-base/fei_mpi.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -#ifndef _fei_mpi_h_ -#define _fei_mpi_h_ - -/*--------------------------------------------------------------------*/ -/* Copyright 2005 Sandia Corporation. */ -/* Under the terms of Contract DE-AC04-94AL85000, there is a */ -/* non-exclusive license for use of this work by or on behalf */ -/* of the U.S. Government. Export of this program may require */ -/* a license from the United States Government. */ -/*--------------------------------------------------------------------*/ - -#include "fei_macros.hpp" - -#ifdef FEI_SER -/** - If FEI_SER is defined, the user wants to build/run in purely serial mode, - without linking against MPI. - To minimize #ifdefs in FEI code, we do a few #defines for - some common MPI symbols that appear in the code. -*/ -#define MPI_Comm int -#define MPI_Request int -#define MPI_COMM_WORLD 0 -#define MPI_Abort(a, b) abort() -#define MPI_Wtime() 0.0 -#define MPI_Barrier( a ) (void)a -#define MPI_SUCCESS 0 - -#else -#include -#endif - -#endif // _fei_mpi_h_ - diff -Nru hypre-2.16.0/src/FEI_mv/fei-base/fei_version.h hypre-2.18.2/src/FEI_mv/fei-base/fei_version.h --- hypre-2.16.0/src/FEI_mv/fei-base/fei_version.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-base/fei_version.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -/*--------------------------------------------------------------------*/ -/* Copyright 2005 Sandia Corporation. */ -/* Under the terms of Contract DE-AC04-94AL85000, there is a */ -/* non-exclusive license for use of this work by or on behalf */ -/* of the U.S. Government. Export of this program may require */ -/* a license from the United States Government. */ -/*--------------------------------------------------------------------*/ - -#ifndef _fei_version_h_ -#define _fei_version_h_ - -/* - This 'fei_version_number' provides the version number of the - fei implementation code. This number should be updated whenever - an fei update is released. -*/ -static const char fei_version_number[16] = {"2.23.02"}; - -/* IMPORTANT: Keep the version-number portion of the following macros - synchronized with the above version number. These macros, which redefine - prominent FEI symbols, guard against header-mismatch errors that arise - if an application uses one version of FEI headers with another version - of FEI libraries. -*/ -#define fei_VERSION fei_2_23_02 - -#define FEI_MAJOR_VERSION 2 -#define FEI_MINOR_VERSION 23 -#define FEI_PATCH_VERSION 02 - -#define FEI_Implementation FEI_Implementation_2_23_02 -#define FEI_create FEI_create_2_23_02 - -#endif // _fei_version_h_ - diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/bicgs.c hypre-2.18.2/src/FEI_mv/fei-hypre/bicgs.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/bicgs.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/bicgs.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_FEI.h" diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/bicgstabl.c hypre-2.18.2/src/FEI_mv/fei-hypre/bicgstabl.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/bicgstabl.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/bicgstabl.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/cfei_hypre.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/cfei_hypre.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/cfei_hypre.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/cfei_hypre.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/cfei_hypre.h hypre-2.18.2/src/FEI_mv/fei-hypre/cfei_hypre.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/cfei_hypre.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/cfei_hypre.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef _cfei_hypre_h_ #define _cfei_hypre_h_ diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/cfei-hypre.h hypre-2.18.2/src/FEI_mv/fei-hypre/cfei-hypre.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/cfei-hypre.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/cfei-hypre.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,50 +1,16 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef cfei_hypre_h_included #define cfei_hypre_h_included -/* - This file is part of Sandia National Laboratories - copyrighted software. You are legally liable for any - unauthorized use of this software. - - NOTICE: The United States Government has granted for - itself and others acting on its behalf a paid-up, - nonexclusive, irrevocable worldwide license in this - data to reproduce, prepare derivative works, and - perform publicly and display publicly. Beginning five - (5) years after June 5, 1997, the United States - Government is granted for itself and others acting on - its behalf a paid-up, nonexclusive, irrevocable - worldwide license in this data to reproduce, prepare - derivative works, distribute copies to the public, - perform publicly and display publicly, and to permit - others to do so. - - NEITHER THE UNITED STATES GOVERNMENT, NOR THE UNITED - STATES DEPARTMENT OF ENERGY, NOR SANDIA CORPORATION, - NOR ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS - OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR - RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR - USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, OR - PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT - INFRINGE PRIVATELY OWNED RIGHTS. -*/ #include #include -//#include "basicTypes.h" -//#include "cfei.h" #include "cfei_hypre.h" #endif /*cfei_hypre_h_included*/ diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/CHANGELOG hypre-2.18.2/src/FEI_mv/fei-hypre/CHANGELOG --- hypre-2.16.0/src/FEI_mv/fei-hypre/CHANGELOG 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/CHANGELOG 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ *********************************************************************** * This file records the changes made to this directory */ diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/CMakeLists.txt hypre-2.18.2/src/FEI_mv/fei-hypre/CMakeLists.txt --- hypre-2.16.0/src/FEI_mv/fei-hypre/CMakeLists.txt 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + set(HYPRE_fei_HEADERS cfei-hypre.h @@ -10,14 +15,6 @@ LLNL_FEI_LSCore.h LLNL_FEI_Matrix.h LLNL_FEI_Solver.h - ../fei-base/fei_Data.hpp - ../fei-base/fei_Lookup.hpp - ../fei-base/fei_LinearSystemCore.hpp - ../fei-base/cfei.h - ../fei-base/fei_bool.h - ../fei-base/fei_defs.h - ../fei-base/fei_mpi.h - ../fei-base/fei_version.h ) set(HYPRE_fei_SRCS diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/driver.C hypre-2.18.2/src/FEI_mv/fei-hypre/driver.C --- hypre-2.16.0/src/FEI_mv/fei-hypre/driver.C 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/driver.C 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ // ************************************************************************* // test program for HYPRE_LinSysCore diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/driver.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/driver.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/driver.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/driver.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ // ************************************************************************* // test program for HYPRE_LinSysCore diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/FEI_HYPRE_Impl.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/FEI_HYPRE_Impl.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/FEI_HYPRE_Impl.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/FEI_HYPRE_Impl.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - *********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /************************************************************************** Module: FEI_HYPRE_Impl.cpp diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/FEI_HYPRE_Impl.h hypre-2.18.2/src/FEI_mv/fei-hypre/FEI_HYPRE_Impl.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/FEI_HYPRE_Impl.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/FEI_HYPRE_Impl.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*************************************************************************** Module: FEI_HYPRE_impl.h diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/FEI_HYPRE_include.h hypre-2.18.2/src/FEI_mv/fei-hypre/FEI_HYPRE_include.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/FEI_HYPRE_include.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/FEI_HYPRE_include.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __ALE_FEI_INCLUDE_H__ #define __ALE_FEI_INCLUDE_H__ diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/fei_mv.h hypre-2.18.2/src/FEI_mv/fei-hypre/fei_mv.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/fei_mv.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/fei_mv.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_utilities.h" diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/fgmres.c hypre-2.18.2/src/FEI_mv/fei-hypre/fgmres.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/fgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/fgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_FEI.h" diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_Builder.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_Builder.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_Builder.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_Builder.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ // ************************************************************************* // Link to build an FEI_Implementation based on HYPRE diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/hypre_cfei.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/hypre_cfei.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/hypre_cfei.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/hypre_cfei.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/hypre_cfei.h hypre-2.18.2/src/FEI_mv/fei-hypre/hypre_cfei.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/hypre_cfei.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/hypre_cfei.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef _hypre_cfei_h_ #define _hypre_cfei_h_ diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_FEI.doc hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_FEI.doc --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_FEI.doc 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_FEI.doc 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "utilities.h" diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/_hypre_FEI.h hypre-2.18.2/src/FEI_mv/fei-hypre/_hypre_FEI.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/_hypre_FEI.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/_hypre_FEI.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,10 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + #ifndef hypre_FEI__ #define hypre_FEI__ diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_FEI.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_FEI.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_FEI.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_FEI.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,10 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + #ifndef __HYPRE_FEI__ #define __HYPRE_FEI__ diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_FEI_includes.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_FEI_includes.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_FEI_includes.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_FEI_includes.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ // ************************************************************************* // Different definitions for FEI and NOFEI options diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_fei_matrix.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_fei_matrix.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_fei_matrix.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_fei_matrix.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_fei_mesh.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_fei_mesh.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_fei_mesh.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_fei_mesh.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_fei_mv.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_fei_mv.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_fei_mv.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_fei_mv.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef HYPRE_FE_MV_HEADER #define HYPRE_FE_MV_HEADER diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_fei_vector.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_fei_vector.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_fei_vector.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_fei_vector.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LinSysCore.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LinSysCore.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LinSysCore.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LinSysCore.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - *********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ //*************************************************************************** // system includes @@ -567,7 +562,7 @@ else if ( HYPreconID_ == HYSYSPDE ) HYPRE_ParCSRSysPDEDestroy( HYPrecon_ ); #endif -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU else if ( HYPreconID_ == HYDSLU ) HYPRE_LSI_DSuperLUDestroy(HYPrecon_); #endif @@ -4160,7 +4155,7 @@ else if ( !strcmp(name, "dsuperlu") ) { strcpy( HYSolverName_, name ); -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU HYSolverID_ = HYDSUPERLU; #else printf("HYPRE_LinSysCore:: DSuperLU not available.\n"); @@ -4303,7 +4298,7 @@ else if (HYPreconID_ == HYSYSPDE) HYPRE_ParCSRSysPDEDestroy(HYPrecon_); #endif -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU else if (HYPreconID_ == HYDSLU) HYPRE_LSI_DSuperLUDestroy(HYPrecon_); #endif @@ -4430,7 +4425,7 @@ HYPreconID_ = HYSYSPDE; } #endif -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU else if (!strcmp(name, "dsuperlu")) { strcpy(HYPreconName_, name); @@ -4538,7 +4533,7 @@ #endif break; case HYDSLU : -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU HYPRE_LSI_DSuperLUCreate(comm_, &HYPrecon_); #else printf("HYPRE_LSC::selectPreconditioner-DSUPERLU unsupported.\n"); @@ -4653,6 +4648,11 @@ HYPRE_SlideReduction *slideObj = (HYPRE_SlideReduction *) slideObj_; //------------------------------------------------------------------- + // Clear Errors + //------------------------------------------------------------------- + HYPRE_ClearAllErrors(); + + //------------------------------------------------------------------- // diagnostic message //------------------------------------------------------------------- @@ -5751,7 +5751,7 @@ //---------------------------------------------------------------- case HYDSUPERLU : -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU if ( (HYOutputLevel_ & HYFEI_SPECIALMASK) >= 1 && mypid_ == 0 ) { printf("***************************************************\n"); diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LinSysCore.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LinSysCore.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LinSysCore.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LinSysCore.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ // ************************************************************************* // This is the HYPRE implementation of LinearSystemCore. diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSC_aux.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSC_aux.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSC_aux.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSC_aux.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - *********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ //*************************************************************************** // This file holds the other functions for HYPRE_LinSysCore @@ -2141,7 +2136,7 @@ break; case HYDSLU : -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU if ((HYOutputLevel_ & HYFEI_SPECIALMASK) >= 1 && mypid_ == 0) printf("DSuperLU preconditioning\n"); if ( HYPreconReuse_ == 1 && HYPreconSetup_ == 1 ) @@ -2564,7 +2559,7 @@ break; case HYDSLU : -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU if ((HYOutputLevel_ & HYFEI_SPECIALMASK) >= 1 && mypid_ == 0) printf("DSuperLU preconditioning\n"); if ( HYPreconReuse_ == 1 && HYPreconSetup_ == 1 ) @@ -2832,7 +2827,7 @@ break; case HYDSLU : -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU if ((HYOutputLevel_ & HYFEI_SPECIALMASK) >= 1 && mypid_ == 0) printf("DSuperLU preconditioning\n"); if ( HYPreconReuse_ == 1 && HYPreconSetup_ == 1 ) @@ -3084,7 +3079,7 @@ break; case HYDSLU : -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU if ((HYOutputLevel_ & HYFEI_SPECIALMASK) >= 1 && mypid_ == 0) printf("DSuperLU preconditioning\n"); if ( HYPreconReuse_ == 1 && HYPreconSetup_ == 1 ) @@ -3337,7 +3332,7 @@ break; case HYDSLU : -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU if ((HYOutputLevel_ & HYFEI_SPECIALMASK) >= 1 && mypid_ == 0) printf("DSuperLU preconditioning\n"); if ( HYPreconReuse_ == 1 && HYPreconSetup_ == 1 ) @@ -3586,7 +3581,7 @@ break; case HYDSLU : -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU if ((HYOutputLevel_ & HYFEI_SPECIALMASK) >= 1 && mypid_ == 0) printf("DSuperLU preconditioning\n"); if ( HYPreconReuse_ == 1 && HYPreconSetup_ == 1 ) @@ -3835,7 +3830,7 @@ break; case HYDSLU : -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU if ((HYOutputLevel_ & HYFEI_SPECIALMASK) >= 1 && mypid_ == 0) printf("DSuperLU preconditioning\n"); if ( HYPreconReuse_ == 1 && HYPreconSetup_ == 1 ) @@ -5020,7 +5015,7 @@ double HYPRE_LinSysCore::solveUsingDSuperLU(int& status) { double rnorm=1.0; -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU int ierr; HYPRE_ParCSRMatrix A_csr; HYPRE_ParVector x_csr, b_csr, r_csr; diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/hypre_lsi_amge.c hypre-2.18.2/src/FEI_mv/fei-hypre/hypre_lsi_amge.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/hypre_lsi_amge.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/hypre_lsi_amge.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_blkprec.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_blkprec.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_blkprec.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_blkprec.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - *********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ //****************************************************************************** //****************************************************************************** diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_blkprec.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_blkprec.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_blkprec.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_blkprec.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ // ************************************************************************* // This is the HYPRE implementation of block preconditioners diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_block.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_block.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_block.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_block.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/hypre_lsi_ddamg.c hypre-2.18.2/src/FEI_mv/fei-hypre/hypre_lsi_ddamg.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/hypre_lsi_ddamg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/hypre_lsi_ddamg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_ddict.c hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_ddict.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_ddict.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_ddict.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_ddict.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_ddict.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_ddict.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_ddict.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_ddilut.c hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_ddilut.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_ddilut.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_ddilut.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_ddilut.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_ddilut.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_ddilut.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_ddilut.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_Dsuperlu.c hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_Dsuperlu.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_Dsuperlu.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_Dsuperlu.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -30,7 +25,7 @@ * Distributed SUPERLU include files *-------------------------------------------------------------------------*/ -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU #include "superlu_ddefs.h" typedef struct HYPRE_LSI_DSuperLU_Struct diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_Dsuperlu.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_Dsuperlu.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_Dsuperlu.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_Dsuperlu.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/hypre_lsi_misc.c hypre-2.18.2/src/FEI_mv/fei-hypre/hypre_lsi_misc.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/hypre_lsi_misc.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/hypre_lsi_misc.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_ml.c hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_ml.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_ml.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_ml.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************/ /* HYPRE_LSI_ML interface */ diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_mli.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_mli.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_mli.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_mli.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - *********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************/ /* HYPRE_LSI_MLI interface */ diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_mli.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_mli.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_mli.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_mli.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_mlmaxwell.c hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_mlmaxwell.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_mlmaxwell.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_mlmaxwell.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************/ /* HYPRE_LSI_MLMaxwell interface */ diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_poly.c hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_poly.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_poly.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_poly.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_poly.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_poly.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_poly.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_poly.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_schur.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_schur.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_schur.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_schur.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_schur.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_schur.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_schur.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_schur.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ // ************************************************************************* // This is the HYPRE implementation of Schur reduction diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_schwarz.c hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_schwarz.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_schwarz.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_schwarz.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_schwarz.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_schwarz.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_schwarz.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_schwarz.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_Uzawa_c.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_Uzawa_c.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_Uzawa_c.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_Uzawa_c.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_UZAWA.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_UZAWA.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_UZAWA.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_UZAWA.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - *********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ //*************************************************************************** // Date : Apr 26, 2002 diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_UZAWA.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_UZAWA.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_LSI_UZAWA.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_LSI_UZAWA.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ // ************************************************************************** // This is the class that handles slide surface reduction diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_MHMatrix.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_MHMatrix.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_MHMatrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_MHMatrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************/ /* data structures for local matrix */ diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_MLMatrix.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_MLMatrix.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_MLMatrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_MLMatrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************/ /* data structures for local matrix */ diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_MLMaxwell.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_MLMaxwell.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_MLMaxwell.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_MLMaxwell.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************/ /* data structures for local matrix and ml object */ diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_bicgs.c hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_bicgs.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_bicgs.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_bicgs.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_bicgs.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_bicgs.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_bicgs.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_bicgs.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,19 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_bicgstabl.c hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_bicgstabl.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_bicgstabl.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_bicgstabl.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_bicgstabl.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_bicgstabl.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_bicgstabl.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_bicgstabl.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,19 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_fgmres.c hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_fgmres.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_fgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_fgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_fgmres.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_fgmres.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_fgmres.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_fgmres.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_lsicg.c hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_lsicg.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_lsicg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_lsicg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_lsicg.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_lsicg.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_lsicg.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_lsicg.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,19 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_maxwell.c hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_maxwell.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_maxwell.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_maxwell.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_superlu.c hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_superlu.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_superlu.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_superlu.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - *********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_superlu.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_superlu.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_superlu.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_superlu.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_symqmr.c hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_symqmr.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_symqmr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_symqmr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_symqmr.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_symqmr.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_symqmr.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_symqmr.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,19 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_TFQmr.c hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_TFQmr.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_TFQmr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_TFQmr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_TFQmr.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_TFQmr.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_parcsr_TFQmr.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_parcsr_TFQmr.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,19 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/hypre_schur_reduce.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/hypre_schur_reduce.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/hypre_schur_reduce.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/hypre_schur_reduce.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/hypre_slide_reduce.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/hypre_slide_reduce.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/hypre_slide_reduce.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/hypre_slide_reduce.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - *********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ //*************************************************************************** // system includes diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_SlideReduction.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_SlideReduction.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_SlideReduction.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_SlideReduction.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ //*************************************************************************** // Date : Apr 26, 2002 (This version works sequentially for up to 10000 elems) diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_SlideReduction.h hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_SlideReduction.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/HYPRE_SlideReduction.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/HYPRE_SlideReduction.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ // ************************************************************************** // This is the class that handles slide surface reduction diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI.doc hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI.doc --- hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI.doc 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI.doc 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /** * @name Finite Element Interface diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_Fei.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_Fei.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_Fei.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_Fei.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /************************************************************************** Module: LLNL_FEI_Fei.cxx diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_Fei.h hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_Fei.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_Fei.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_Fei.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*************************************************************************** Module: LLNL_FEI_Fei.h diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_Impl.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_Impl.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_Impl.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_Impl.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /************************************************************************** Module: LLNL_FEI_Impl.cxx diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_Impl.h hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_Impl.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_Impl.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_Impl.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*************************************************************************** Module: LLNL_FEI_Impl.h diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_LSCore.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_LSCore.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_LSCore.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_LSCore.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /************************************************************************** Module: LLNL_FEI_LSCore.cxx diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_LSCore.h hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_LSCore.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_LSCore.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_LSCore.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /************************************************************************** Module: LLNL_FEI_LSCore.h @@ -22,10 +14,10 @@ #define _LLNL_FEI_LSCORE_H_ //New FEI 2.23.02 -#include "FEI_mv/fei-base/fei_defs.h" -#include "FEI_mv/fei-base/fei_Data.hpp" -#include "FEI_mv/fei-base/fei_Lookup.hpp" -#include "FEI_mv/fei-base/fei_LinearSystemCore.hpp" +#include "fei_defs.h" +#include "fei_Data.hpp" +#include "fei_Lookup.hpp" +#include "fei_LinearSystemCore.hpp" #include "cfei_hypre.h" typedef enum { diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_Matrix.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_Matrix.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_Matrix.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_Matrix.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /************************************************************************** Module: LLNL_FEI_Matrix.cpp diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_Matrix.h hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_Matrix.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_Matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_Matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*************************************************************************** Module: LLNL_FEI_Matrix.h diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_Solver.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_Solver.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_Solver.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_Solver.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - *********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /************************************************************************** Module: LLNL_FEI_Solver.cxx diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_Solver.h hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_Solver.h --- hypre-2.16.0/src/FEI_mv/fei-hypre/LLNL_FEI_Solver.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/LLNL_FEI_Solver.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*************************************************************************** Module: LLNL_FEI_Solver.h diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/lsicg.c hypre-2.18.2/src/FEI_mv/fei-hypre/lsicg.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/lsicg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/lsicg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/Makefile hypre-2.18.2/src/FEI_mv/fei-hypre/Makefile --- hypre-2.16.0/src/FEI_mv/fei-hypre/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../../config/Makefile.config @@ -73,11 +66,7 @@ $(BASE_DIR)/fei_Data.hpp \ $(BASE_DIR)/fei_Lookup.hpp \ $(BASE_DIR)/fei_LinearSystemCore.hpp \ - $(BASE_DIR)/cfei.h\ - $(BASE_DIR)/fei_bool.h\ $(BASE_DIR)/fei_defs.h\ - $(BASE_DIR)/fei_mpi.h\ - $(BASE_DIR)/fei_version.h\ LLNL_FEI_Impl.h\ LLNL_FEI_Fei.h\ LLNL_FEI_LSCore.h\ @@ -175,10 +164,7 @@ cp -fR $(BASE_DIR)/fei_Data.hpp $(HYPRE_BUILD_DIR)/include cp -fR $(BASE_DIR)/fei_Lookup.hpp $(HYPRE_BUILD_DIR)/include cp -fR $(BASE_DIR)/fei_LinearSystemCore.hpp $(HYPRE_BUILD_DIR)/include - cp -fR $(BASE_DIR)/cfei.h $(HYPRE_BUILD_DIR)/include - cp -fR $(BASE_DIR)/fei_bool.h $(HYPRE_BUILD_DIR)/include cp -fR $(BASE_DIR)/fei_defs.h $(HYPRE_BUILD_DIR)/include - cp -fR $(BASE_DIR)/fei_mpi.h $(HYPRE_BUILD_DIR)/include install: libHYPRE_FEI${HYPRE_LIB_SUFFIX} cp -fR $(srcdir)/cfei-hypre.h $(HYPRE_INC_INSTALL) @@ -190,10 +176,7 @@ cp -fR $(BASE_DIR)/fei_Data.hpp $(HYPRE_BUILD_DIR)/include cp -fR $(BASE_DIR)/fei_Lookup.hpp $(HYPRE_BUILD_DIR)/include cp -fR $(BASE_DIR)/fei_LinearSystemCore.hpp $(HYPRE_BUILD_DIR)/include - cp -fR $(BASE_DIR)/cfei.h $(HYPRE_BUILD_DIR)/include - cp -fR $(BASE_DIR)/fei_bool.h $(HYPRE_BUILD_DIR)/include cp -fR $(BASE_DIR)/fei_defs.h $(HYPRE_BUILD_DIR)/include - cp -fR $(BASE_DIR)/fei_mpi.h $(HYPRE_BUILD_DIR)/include @echo "" clean: diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/ml_maxwell.cxx hypre-2.18.2/src/FEI_mv/fei-hypre/ml_maxwell.cxx --- hypre-2.16.0/src/FEI_mv/fei-hypre/ml_maxwell.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/ml_maxwell.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ // ************************************************************************* // test program for HYPRE_LinSysCore diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/SymQMR.c hypre-2.18.2/src/FEI_mv/fei-hypre/SymQMR.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/SymQMR.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/SymQMR.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/fei-hypre/TFQmr.c hypre-2.18.2/src/FEI_mv/fei-hypre/TFQmr.c --- hypre-2.16.0/src/FEI_mv/fei-hypre/TFQmr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/fei-hypre/TFQmr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/CMakeLists.txt hypre-2.18.2/src/FEI_mv/femli/CMakeLists.txt --- hypre-2.16.0/src/FEI_mv/femli/CMakeLists.txt 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + set(HYPRE_mli_SRCS mli_utils.c diff -Nru hypre-2.16.0/src/FEI_mv/femli/cmli.cxx hypre-2.18.2/src/FEI_mv/femli/cmli.cxx --- hypre-2.16.0/src/FEI_mv/femli/cmli.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/cmli.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/cmli.h hypre-2.18.2/src/FEI_mv/femli/cmli.h --- hypre-2.16.0/src/FEI_mv/femli/cmli.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/cmli.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/driver_fedata.cxx hypre-2.18.2/src/FEI_mv/femli/driver_fedata.cxx --- hypre-2.16.0/src/FEI_mv/femli/driver_fedata.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/driver_fedata.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /************************************************************************** ************************************************************************** diff -Nru hypre-2.16.0/src/FEI_mv/femli/driver_matrix.cxx hypre-2.18.2/src/FEI_mv/femli/driver_matrix.cxx --- hypre-2.16.0/src/FEI_mv/femli/driver_matrix.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/driver_matrix.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** test program diff -Nru hypre-2.16.0/src/FEI_mv/femli/driver_util.c hypre-2.18.2/src/FEI_mv/femli/driver_util.c --- hypre-2.16.0/src/FEI_mv/femli/driver_util.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/driver_util.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/genTecPlot.c hypre-2.18.2/src/FEI_mv/femli/genTecPlot.c --- hypre-2.16.0/src/FEI_mv/femli/genTecPlot.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/genTecPlot.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/Makefile hypre-2.18.2/src/FEI_mv/femli/Makefile --- hypre-2.16.0/src/FEI_mv/femli/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../../config/Makefile.config diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_amgsa_calib.cxx hypre-2.18.2/src/FEI_mv/femli/mli_amgsa_calib.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_amgsa_calib.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_amgsa_calib.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ // ********************************************************************* // This function is a first experiment to study calibrated smoothed diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_amgsa_coarsen1.cxx hypre-2.18.2/src/FEI_mv/femli/mli_amgsa_coarsen1.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_amgsa_coarsen1.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_amgsa_coarsen1.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ // ********************************************************************* // This file is customized to use HYPRE matrix format diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_amgsa_dd_fedata.cxx hypre-2.18.2/src/FEI_mv/femli/mli_amgsa_dd_fedata.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_amgsa_dd_fedata.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_amgsa_dd_fedata.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ // ********************************************************************* // This file is customized to use HYPRE matrix format diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_amgsa_dd_sfei.cxx hypre-2.18.2/src/FEI_mv/femli/mli_amgsa_dd_sfei.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_amgsa_dd_sfei.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_amgsa_dd_sfei.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ // ********************************************************************* // This file is customized to use HYPRE matrix format diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_amgsa_elem.cxx hypre-2.18.2/src/FEI_mv/femli/mli_amgsa_elem.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_amgsa_elem.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_amgsa_elem.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ // ********************************************************************* // This file is customized to use HYPRE matrix format diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli.cxx hypre-2.18.2/src/FEI_mv/femli/mli.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_defs.h hypre-2.18.2/src/FEI_mv/femli/mli_defs.h --- hypre-2.16.0/src/FEI_mv/femli/mli_defs.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_defs.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_febase.cxx hypre-2.18.2/src/FEI_mv/femli/mli_febase.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_febase.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_febase.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "mli_febase.h" diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_febase.h hypre-2.18.2/src/FEI_mv/femli/mli_febase.h --- hypre-2.16.0/src/FEI_mv/femli/mli_febase.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_febase.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLIFEBASEH__ #define __MLIFEBASEH__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_fedata.cxx hypre-2.18.2/src/FEI_mv/femli/mli_fedata.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_fedata.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_fedata.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /************************************************************************** ************************************************************************** diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_fedata.h hypre-2.18.2/src/FEI_mv/femli/mli_fedata.h --- hypre-2.16.0/src/FEI_mv/femli/mli_fedata.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_fedata.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLIFEDATA_H__ #define __MLIFEDATA_H__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_fedata_utils.cxx hypre-2.18.2/src/FEI_mv/femli/mli_fedata_utils.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_fedata_utils.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_fedata_utils.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /************************************************************************** ************************************************************************** diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_fedata_utils.h hypre-2.18.2/src/FEI_mv/femli/mli_fedata_utils.h --- hypre-2.16.0/src/FEI_mv/femli/mli_fedata_utils.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_fedata_utils.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /************************************************************************** ************************************************************************** diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_festruct.h hypre-2.18.2/src/FEI_mv/femli/mli_festruct.h --- hypre-2.16.0/src/FEI_mv/femli/mli_festruct.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_festruct.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLIFESTRUCTH__ #define __MLIFESTRUCTH__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli.h hypre-2.18.2/src/FEI_mv/femli/mli.h --- hypre-2.16.0/src/FEI_mv/femli/mli.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_mapper.cxx hypre-2.18.2/src/FEI_mv/femli/mli_mapper.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_mapper.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_mapper.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_mapper.h hypre-2.18.2/src/FEI_mv/femli/mli_mapper.h --- hypre-2.16.0/src/FEI_mv/femli/mli_mapper.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_mapper.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_matrix.cxx hypre-2.18.2/src/FEI_mv/femli/mli_matrix.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_matrix.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_matrix.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_matrix.h hypre-2.18.2/src/FEI_mv/femli/mli_matrix.h --- hypre-2.16.0/src/FEI_mv/femli/mli_matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_matrix_misc.h hypre-2.18.2/src/FEI_mv/femli/mli_matrix_misc.h --- hypre-2.16.0/src/FEI_mv/femli/mli_matrix_misc.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_matrix_misc.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_matrix_mult.cxx hypre-2.18.2/src/FEI_mv/femli/mli_matrix_mult.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_matrix_mult.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_matrix_mult.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_matrix_utils.cxx hypre-2.18.2/src/FEI_mv/femli/mli_matrix_utils.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_matrix_utils.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_matrix_utils.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_method_amgcr.cxx hypre-2.18.2/src/FEI_mv/femli/mli_method_amgcr.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_method_amgcr.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_method_amgcr.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #if 0 /* RDF: Not sure this is really needed */ #ifdef WIN32 diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_method_amgcr.h hypre-2.18.2/src/FEI_mv/femli/mli_method_amgcr.h --- hypre-2.16.0/src/FEI_mv/femli/mli_method_amgcr.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_method_amgcr.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_method_amgrs.cxx hypre-2.18.2/src/FEI_mv/femli/mli_method_amgrs.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_method_amgrs.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_method_amgrs.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #define PDEGREE 1 #define MU 0.5 diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_method_amgrs.h hypre-2.18.2/src/FEI_mv/femli/mli_method_amgrs.h --- hypre-2.16.0/src/FEI_mv/femli/mli_method_amgrs.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_method_amgrs.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_method_amgsa.cxx hypre-2.18.2/src/FEI_mv/femli/mli_method_amgsa.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_method_amgsa.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_method_amgsa.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #if 0 /* RDF: Not sure this is really needed */ #ifdef WIN32 diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_method_amgsa.h hypre-2.18.2/src/FEI_mv/femli/mli_method_amgsa.h --- hypre-2.16.0/src/FEI_mv/femli/mli_method_amgsa.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_method_amgsa.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_method.cxx hypre-2.18.2/src/FEI_mv/femli/mli_method.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_method.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_method.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_method.h hypre-2.18.2/src/FEI_mv/femli/mli_method.h --- hypre-2.16.0/src/FEI_mv/femli/mli_method.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_method.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_olapdd.c hypre-2.18.2/src/FEI_mv/femli/mli_olapdd.c --- hypre-2.16.0/src/FEI_mv/femli/mli_olapdd.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_olapdd.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_mv.h" diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_oneLevel.cxx hypre-2.18.2/src/FEI_mv/femli/mli_oneLevel.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_oneLevel.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_oneLevel.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_oneLevel.h hypre-2.18.2/src/FEI_mv/femli/mli_oneLevel.h --- hypre-2.16.0/src/FEI_mv/femli/mli_oneLevel.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_oneLevel.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * Header info each MLI level diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_sfei.cxx hypre-2.18.2/src/FEI_mv/femli/mli_sfei.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_sfei.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_sfei.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /************************************************************************** ************************************************************************** diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_sfei.h hypre-2.18.2/src/FEI_mv/femli/mli_sfei.h --- hypre-2.16.0/src/FEI_mv/femli/mli_sfei.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_sfei.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLISFEI_H__ #define __MLISFEI_H__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_amg.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_amg.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_amg.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_amg.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_amg.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_amg.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_amg.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_amg.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLI_SOLVER_AMG_H__ #define __MLI_SOLVER_AMG_H__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_arpacksuperlu.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_arpacksuperlu.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_arpacksuperlu.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_arpacksuperlu.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifdef MLI_SUPERLU diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_arpacksuperlu.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_arpacksuperlu.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_arpacksuperlu.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_arpacksuperlu.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifdef MLI_SUPERLU diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_bjacobi.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_bjacobi.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_bjacobi.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_bjacobi.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_bjacobi.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_bjacobi.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_bjacobi.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_bjacobi.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLI_SOLVER_BJACOBI_H__ #define __MLI_SOLVER_BJACOBI_H__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_bsgs.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_bsgs.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_bsgs.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_bsgs.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_bsgs.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_bsgs.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_bsgs.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_bsgs.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLI_SOLVER_BSGS_H__ #define __MLI_SOLVER_BSGS_H__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_cg.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_cg.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_cg.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_cg.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_cg.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_cg.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_cg.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_cg.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLI_SOLVER_CG_H__ #define __MLI_SOLVER_CG_H__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_chebyshev.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_chebyshev.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_chebyshev.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_chebyshev.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_chebyshev.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_chebyshev.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_chebyshev.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_chebyshev.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLI_SOLVER_CHEBYSHEV_H__ #define __MLI_SOLVER_CHEBYSHEV_H__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_gmres.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_gmres.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_gmres.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_gmres.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_gmres.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_gmres.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_gmres.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_gmres.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLI_SOLVER_GMRES_H__ #define __MLI_SOLVER_GMRES_H__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_gs.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_gs.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_gs.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_gs.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include "mli_solver_gs.h" diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_gs.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_gs.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_gs.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_gs.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLI_SOLVER_GS_H__ #define __MLI_SOLVER_GS_H__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver.h hypre-2.18.2/src/FEI_mv/femli/mli_solver.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_hschwarz.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_hschwarz.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_hschwarz.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_hschwarz.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_hschwarz.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_hschwarz.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_hschwarz.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_hschwarz.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLI_SOLVER_HSCHWARZ_H__ #define __MLI_SOLVER_HSCHWARZ_H__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_hsgs.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_hsgs.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_hsgs.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_hsgs.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_hsgs.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_hsgs.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_hsgs.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_hsgs.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLI_SOLVER_HSGS_H__ #define __MLI_SOLVER_HSGS_H__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_jacobi.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_jacobi.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_jacobi.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_jacobi.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_jacobi.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_jacobi.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_jacobi.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_jacobi.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLI_SOLVER_JACOBI_H__ #define __MLI_SOLVER_JACOBI_H__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_kaczmarz.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_kaczmarz.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_kaczmarz.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_kaczmarz.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include "mli_solver_kaczmarz.h" diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_kaczmarz.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_kaczmarz.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_kaczmarz.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_kaczmarz.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLI_SOLVER_KACZMARZ_H__ #define __MLI_SOLVER_KACZMARZ_H__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_mli.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_mli.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_mli.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_mli.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_mli.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_mli.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_mli.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_mli.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLI_SOLVER_MLI_H__ #define __MLI_SOLVER_MLI_H__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_mls.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_mls.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_mls.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_mls.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_mls.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_mls.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_mls.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_mls.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLI_SOLVER_MLS_H__ #define __MLI_SOLVER_MLS_H__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_parasails.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_parasails.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_parasails.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_parasails.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_parasails.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_parasails.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_parasails.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_parasails.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLI_SOLVERPARASAILS_H__ #define __MLI_SOLVERPARASAILS_H__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_seqsuperlu.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_seqsuperlu.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_seqsuperlu.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_seqsuperlu.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* **************************************************************************** * -- SuperLU routine (version 1.1) -- diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_seqsuperlu.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_seqsuperlu.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_seqsuperlu.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_seqsuperlu.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifdef MLI_SUPERLU diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_sgs.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_sgs.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_sgs.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_sgs.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_sgs.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_sgs.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_sgs.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_sgs.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef __MLI_SOLVER_SGS_H__ #define __MLI_SOLVER_SGS_H__ diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_superlu.cxx hypre-2.18.2/src/FEI_mv/femli/mli_solver_superlu.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_superlu.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_superlu.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* **************************************************************************** * -- SuperLU routine (version 1.1) -- diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_solver_superlu.h hypre-2.18.2/src/FEI_mv/femli/mli_solver_superlu.h --- hypre-2.16.0/src/FEI_mv/femli/mli_solver_superlu.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_solver_superlu.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifdef MLI_SUPERLU diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_utils.c hypre-2.18.2/src/FEI_mv/femli/mli_utils.c --- hypre-2.16.0/src/FEI_mv/femli/mli_utils.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_utils.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_utils_fortran.f hypre-2.18.2/src/FEI_mv/femli/mli_utils_fortran.f --- hypre-2.16.0/src/FEI_mv/femli/mli_utils_fortran.f 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_utils_fortran.f 2019-10-28 22:30:04.000000000 +0000 @@ -1,120 +1,113 @@ -cBHEADER********************************************************************** -c Copyright (c) 2008, Lawrence Livermore National Security, LLC. -c Produced at the Lawrence Livermore National Laboratory. -c This file is part of HYPRE. See file COPYRIGHT for details. -c -c HYPRE is free software; you can redistribute it and/or modify it under the -c terms of the GNU Lesser General Public License (as published by the Free -c Software Foundation) version 2.1 dated February 1999. -c -c $Revision$ -cEHEADER********************************************************************** - -C ********************************************************************** -C * Eispack functions for computing eigenvalues and eigenvectors -C ********************************************************************** - -C ********************************************************************** -c this subroutine calls the recommended sequence of -c subroutines from the eigensystem subroutine package (eispack) -c to find the eigenvalues and eigenvectors (if desired) -c of a real symmetric matrix. -c -c on input -c -c nm must be set to the row dimension of the two-dimensional -c array parameters as declared in the calling program -c dimension statement. -c -c n is the order of the matrix a. -c -c a contains the real symmetric matrix. -c -c matz is an integer variable set equal to zero if -c only eigenvalues are desired. otherwise it is set to -c any non-zero integer for both eigenvalues and eigenvectors. -c -c on output -c -c w contains the eigenvalues in ascending order. -c -c z contains the eigenvectors if matz is not zero. -c -c ierr is an integer output variable set equal to an error -c completion code described in the documentation for tqlrat -c and tql2. the normal completion code is zero. -c -c fv1 and fv2 are temporary storage arrays. -c -c questions and comments should be directed to burton s. garbow, -c mathematics and computer science div, argonne national laboratory -c -c this version dated august 1983. -c -C ---------------------------------------------------------------------- -c +! Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +! HYPRE Project Developers. See the top-level COPYRIGHT file for details. +! +! SPDX-License-Identifier: (Apache-2.0 OR MIT) + +! ********************************************************************** +! * Eispack functions for computing eigenvalues and eigenvectors +! ********************************************************************** + +! ********************************************************************** +! this subroutine calls the recommended sequence of +! subroutines from the eigensystem subroutine package (eispack) +! to find the eigenvalues and eigenvectors (if desired) +! of a real symmetric matrix. +! +! on input +! +! nm must be set to the row dimension of the two-dimensional +! array parameters as declared in the calling program +! dimension statement. +! +! n is the order of the matrix a. +! +! a contains the real symmetric matrix. +! +! matz is an integer variable set equal to zero if +! only eigenvalues are desired. otherwise it is set to +! any non-zero integer for both eigenvalues and eigenvectors. +! +! on output +! +! w contains the eigenvalues in ascending order. +! +! z contains the eigenvectors if matz is not zero. +! +! ierr is an integer output variable set equal to an error +! completion code described in the documentation for tqlrat +! and tql2. the normal completion code is zero. +! +! fv1 and fv2 are temporary storage arrays. +! +! questions and comments should be directed to burton s. garbow, +! mathematics and computer science div, argonne national laboratory +! +! this version dated august 1983. +! +! ---------------------------------------------------------------------- +! subroutine mli_computeSpectrum(nm,n,a,w,matz,z,fv1,fv2,ierr) integer n,nm,ierr,matz double precision a(nm,n),w(n),z(nm,n),fv1(n),fv2(n) if (n .le. nm) go to 10 ierr = 10 * n go to 50 -c +! 10 if (matz .ne. 0) go to 20 -c .......... find eigenvalues only .......... +! .......... find eigenvalues only .......... call mli_tred1(nm,n,a,w,fv1,fv2) -* tqlrat encounters catastrophic underflow on the Vax -* call tqlrat(n,w,fv2,ierr) +! tqlrat encounters catastrophic underflow on the Vax +! call tqlrat(n,w,fv2,ierr) call mli_tql1(n,w,fv1,ierr) go to 50 -c .......... find both eigenvalues and eigenvectors .......... +! .......... find both eigenvalues and eigenvectors .......... 20 call mli_tred2(nm,n,a,w,fv1,z) call mli_tql2(nm,n,w,fv1,z,ierr) 50 return end -C ********************************************************************** -c -c this subroutine is a translation of the algol procedure tql1, -c num. math. 11, 293-306(1968) by bowdler, martin, reinsch, and -c wilkinson. -c handbook for auto. comp., vol.ii-linear algebra, 227-240(1971). -c -c this subroutine finds the eigenvalues of a symmetric -c tridiagonal matrix by the ql method. -c -c on input -c -c n is the order of the matrix. -c -c d contains the diagonal elements of the input matrix. -c -c e contains the subdiagonal elements of the input matrix -c in its last n-1 positions. e(1) is arbitrary. -c -c on output -c -c d contains the eigenvalues in ascending order. if an -c error exit is made, the eigenvalues are correct and -c ordered for indices 1,2,...ierr-1, but may not be -c the smallest eigenvalues. -c -c e has been destroyed. -c -c ierr is set to -c zero for normal return, -c j if the j-th eigenvalue has not been -c determined after 30 iterations. -c -c calls pythag for dsqrt(a*a + b*b) . -c -c questions and comments should be directed to burton s. garbow, -c mathematics and computer science div, argonne national laboratory -c -c this version dated august 1983. -c -C ---------------------------------------------------------------------- -c +! ********************************************************************** +! +! this subroutine is a translation of the algol procedure tql1, +! num. math. 11, 293-306(1968) by bowdler, martin, reinsch, and +! wilkinson. +! handbook for auto. comp., vol.ii-linear algebra, 227-240(1971). +! +! this subroutine finds the eigenvalues of a symmetric +! tridiagonal matrix by the ql method. +! +! on input +! +! n is the order of the matrix. +! +! d contains the diagonal elements of the input matrix. +! +! e contains the subdiagonal elements of the input matrix +! in its last n-1 positions. e(1) is arbitrary. +! +! on output +! +! d contains the eigenvalues in ascending order. if an +! error exit is made, the eigenvalues are correct and +! ordered for indices 1,2,...ierr-1, but may not be +! the smallest eigenvalues. +! +! e has been destroyed. +! +! ierr is set to +! zero for normal return, +! j if the j-th eigenvalue has not been +! determined after 30 iterations. +! +! calls pythag for dsqrt(a*a + b*b) . +! +! questions and comments should be directed to burton s. garbow, +! mathematics and computer science div, argonne national laboratory +! +! this version dated august 1983. +! +! ---------------------------------------------------------------------- +! subroutine mli_tql1(n,d,e,ierr) integer i,j,l,m,n,ii,l1,l2,mml,ierr double precision d(n),e(n) @@ -124,31 +117,31 @@ ierr = 0 if (n .eq. 1) go to 1001 -c +! do 100 i = 2, n e(i-1) = e(i) 100 continue -c +! f = 0.0d0 tst1 = 0.0d0 e(n) = 0.0d0 -c +! do 290 l = 1, n j = 0 h = dabs(d(l)) + dabs(e(l)) if (tst1 .lt. h) tst1 = h -c .......... look for small sub-diagonal element .......... +! .......... look for small sub-diagonal element .......... do 110 m = l, n tst2 = tst1 + dabs(e(m)) if (tst2 .eq. tst1) go to 120 -c .......... e(n) is always zero, so there is no exit -c through the bottom of the loop .......... +! .......... e(n) is always zero, so there is no exit +! through the bottom of the loop .......... 110 continue -c +! 120 if (m .eq. l) go to 210 130 if (j .eq. 30) go to 1000 j = j + 1 -c .......... form shift .......... +! .......... form shift .......... l1 = l + 1 l2 = l1 + 1 g = d(l) @@ -168,20 +161,20 @@ dl1 = d(l1) h = g - d(l) if (l2 .gt. n) go to 145 -c +! do 140 i = l2, n d(i) = d(i) - h 140 continue -c +! 145 f = f + h -c .......... ql transformation .......... +! .......... ql transformation .......... p = d(m) c = 1.0d0 c2 = c el1 = e(l1) s = 0.0d0 mml = m - l -c .......... for i=m-1 step -1 until l do -- .......... +! .......... for i=m-1 step -1 until l do -- .......... do 200 ii = 1, mml c3 = c2 c2 = c @@ -196,125 +189,125 @@ p = c * d(i) - s * g d(i+1) = h + s * (c * g + s * d(i)) 200 continue -c +! p = -s * s2 * c3 * el1 * e(l) / dl1 e(l) = s * p d(l) = c * p tst2 = tst1 + dabs(e(l)) if (tst2 .gt. tst1) go to 130 210 p = d(l) + f -c .......... order eigenvalues .......... +! .......... order eigenvalues .......... if (l .eq. 1) go to 250 -c .......... for i=l step -1 until 2 do -- .......... +! .......... for i=l step -1 until 2 do -- .......... do 230 ii = 2, l i = l + 2 - ii if (p .ge. d(i-1)) go to 270 d(i) = d(i-1) 230 continue -c +! 250 i = 1 270 d(i) = p 290 continue -c +! go to 1001 -c .......... set error -- no convergence to an -c eigenvalue after 30 iterations .......... +! .......... set error -- no convergence to an +! eigenvalue after 30 iterations .......... 1000 ierr = l 1001 return end -C ********************************************************************** -c -c this subroutine is a translation of the algol procedure tql2, -c num. math. 11, 293-306(1968) by bowdler, martin, reinsch, and -c wilkinson. -c handbook for auto. comp., vol.ii-linear algebra, 227-240(1971). -c -c this subroutine finds the eigenvalues and eigenvectors -c of a symmetric tridiagonal matrix by the ql method. -c the eigenvectors of a full symmetric matrix can also -c be found if tred2 has been used to reduce this -c full matrix to tridiagonal form. -c -c on input -c -c nm must be set to the row dimension of two-dimensional -c array parameters as declared in the calling program -c dimension statement. -c -c n is the order of the matrix. -c -c d contains the diagonal elements of the input matrix. -c -c e contains the subdiagonal elements of the input matrix -c in its last n-1 positions. e(1) is arbitrary. -c -c z contains the transformation matrix produced in the -c reduction by tred2, if performed. if the eigenvectors -c of the tridiagonal matrix are desired, z must contain -c the identity matrix. -c -c on output -c -c d contains the eigenvalues in ascending order. if an -c error exit is made, the eigenvalues are correct but -c unordered for indices 1,2,...,ierr-1. -c -c e has been destroyed. -c -c z contains orthonormal eigenvectors of the symmetric -c tridiagonal (or full) matrix. if an error exit is made, -c z contains the eigenvectors associated with the stored -c eigenvalues. -c -c ierr is set to -c zero for normal return, -c j if the j-th eigenvalue has not been -c determined after 30 iterations. -c -c calls pythag for dsqrt(a*a + b*b) . -c -c questions and comments should be directed to burton s. garbow, -c mathematics and computer science div, argonne national laboratory -c -c this version dated august 1983. -c -C ---------------------------------------------------------------------- -c +! ********************************************************************** +! +! this subroutine is a translation of the algol procedure tql2, +! num. math. 11, 293-306(1968) by bowdler, martin, reinsch, and +! wilkinson. +! handbook for auto. comp., vol.ii-linear algebra, 227-240(1971). +! +! this subroutine finds the eigenvalues and eigenvectors +! of a symmetric tridiagonal matrix by the ql method. +! the eigenvectors of a full symmetric matrix can also +! be found if tred2 has been used to reduce this +! full matrix to tridiagonal form. +! +! on input +! +! nm must be set to the row dimension of two-dimensional +! array parameters as declared in the calling program +! dimension statement. +! +! n is the order of the matrix. +! +! d contains the diagonal elements of the input matrix. +! +! e contains the subdiagonal elements of the input matrix +! in its last n-1 positions. e(1) is arbitrary. +! +! z contains the transformation matrix produced in the +! reduction by tred2, if performed. if the eigenvectors +! of the tridiagonal matrix are desired, z must contain +! the identity matrix. +! +! on output +! +! d contains the eigenvalues in ascending order. if an +! error exit is made, the eigenvalues are correct but +! unordered for indices 1,2,...,ierr-1. +! +! e has been destroyed. +! +! z contains orthonormal eigenvectors of the symmetric +! tridiagonal (or full) matrix. if an error exit is made, +! z contains the eigenvectors associated with the stored +! eigenvalues. +! +! ierr is set to +! zero for normal return, +! j if the j-th eigenvalue has not been +! determined after 30 iterations. +! +! calls pythag for dsqrt(a*a + b*b) . +! +! questions and comments should be directed to burton s. garbow, +! mathematics and computer science div, argonne national laboratory +! +! this version dated august 1983. +! +! ---------------------------------------------------------------------- +! subroutine mli_tql2(nm,n,d,e,z,ierr) integer i,j,k,l,m,n,ii,l1,l2,nm,mml,ierr double precision mli_dsign double precision d(n),e(n),z(nm,n) double precision c,c2,c3,dl1,el1,f,g,h,p,r,s,s2,tst1,tst2 double precision mli_pythag -c +! ierr = 0 if (n .eq. 1) go to 1001 -c +! do 100 i = 2, n e(i-1) = e(i) 100 continue -c +! f = 0.0d0 tst1 = 0.0d0 e(n) = 0.0d0 -c +! do 240 l = 1, n j = 0 h = dabs(d(l)) + dabs(e(l)) if (tst1 .lt. h) tst1 = h -c .......... look for small sub-diagonal element .......... +! .......... look for small sub-diagonal element .......... do 110 m = l, n tst2 = tst1 + dabs(e(m)) if (tst2 .eq. tst1) go to 120 -c .......... e(n) is always zero, so there is no exit -c through the bottom of the loop .......... +! .......... e(n) is always zero, so there is no exit +! through the bottom of the loop .......... 110 continue -c +! 120 if (m .eq. l) go to 220 130 if (j .eq. 30) go to 1000 j = j + 1 -c .......... form shift .......... +! .......... form shift .......... l1 = l + 1 l2 = l1 + 1 g = d(l) @@ -333,20 +326,20 @@ dl1 = d(l1) h = g - d(l) if (l2 .gt. n) go to 145 -c +! do 140 i = l2, n d(i) = d(i) - h 140 continue -c +! 145 f = f + h -c .......... ql transformation .......... +! .......... ql transformation .......... p = d(m) c = 1.0d0 c2 = c el1 = e(l1) s = 0.0d0 mml = m - l -c .......... for i=m-1 step -1 until l do -- .......... +! .......... for i=m-1 step -1 until l do -- .......... do 200 ii = 1, mml c3 = c2 c2 = c @@ -360,15 +353,15 @@ c = p / r p = c * d(i) - s * g d(i+1) = h + s * (c * g + s * d(i)) -c .......... form vector .......... +! .......... form vector .......... do 180 k = 1, n h = z(k,i+1) z(k,i+1) = s * z(k,i) + c * h z(k,i) = c * z(k,i) - s * h 180 continue -c +! 200 continue -c +! p = -s * s2 * c3 * el1 * e(l) / dl1 e(l) = s * p d(l) = c * p @@ -376,118 +369,118 @@ if (tst2 .gt. tst1) go to 130 220 d(l) = d(l) + f 240 continue -c .......... order eigenvalues and eigenvectors .......... +! .......... order eigenvalues and eigenvectors .......... do 300 ii = 2, n i = ii - 1 k = i p = d(i) -c +! do 260 j = ii, n if (d(j) .ge. p) go to 260 k = j p = d(j) 260 continue -c +! if (k .eq. i) go to 300 d(k) = d(i) d(i) = p -c +! do 280 j = 1, n p = z(j,i) z(j,i) = z(j,k) z(j,k) = p 280 continue -c +! 300 continue -c +! go to 1001 -c .......... set error -- no convergence to an -c eigenvalue after 30 iterations .......... +! .......... set error -- no convergence to an +! eigenvalue after 30 iterations .......... 1000 ierr = l 1001 return end -C ********************************************************************** -c -c this subroutine is a translation of the algol procedure tred1, -c num. math. 11, 181-195(1968) by martin, reinsch, and wilkinson. -c handbook for auto. comp., vol.ii-linear algebra, 212-226(1971). -c -c this subroutine reduces a real symmetric matrix -c to a symmetric tridiagonal matrix using -c orthogonal similarity transformations. -c -c on input -c -c nm must be set to the row dimension of two-dimensional -c array parameters as declared in the calling program -c dimension statement. -c -c n is the order of the matrix. -c -c a contains the real symmetric input matrix. only the -c lower triangle of the matrix need be supplied. -c -c on output -c -c a contains information about the orthogonal trans- -c formations used in the reduction in its strict lower -c triangle. the full upper triangle of a is unaltered. -c -c d contains the diagonal elements of the tridiagonal matrix. -c -c e contains the subdiagonal elements of the tridiagonal -c matrix in its last n-1 positions. e(1) is set to zero. -c -c e2 contains the squares of the corresponding elements of e. -c e2 may coincide with e if the squares are not needed. -c -c questions and comments should be directed to burton s. garbow, -c mathematics and computer science div, argonne national laboratory -c -c this version dated august 1983. -c -C ---------------------------------------------------------------------- -C +! ********************************************************************** +! +! this subroutine is a translation of the algol procedure tred1, +! num. math. 11, 181-195(1968) by martin, reinsch, and wilkinson. +! handbook for auto. comp., vol.ii-linear algebra, 212-226(1971). +! +! this subroutine reduces a real symmetric matrix +! to a symmetric tridiagonal matrix using +! orthogonal similarity transformations. +! +! on input +! +! nm must be set to the row dimension of two-dimensional +! array parameters as declared in the calling program +! dimension statement. +! +! n is the order of the matrix. +! +! a contains the real symmetric input matrix. only the +! lower triangle of the matrix need be supplied. +! +! on output +! +! a contains information about the orthogonal trans- +! formations used in the reduction in its strict lower +! triangle. the full upper triangle of a is unaltered. +! +! d contains the diagonal elements of the tridiagonal matrix. +! +! e contains the subdiagonal elements of the tridiagonal +! matrix in its last n-1 positions. e(1) is set to zero. +! +! e2 contains the squares of the corresponding elements of e. +! e2 may coincide with e if the squares are not needed. +! +! questions and comments should be directed to burton s. garbow, +! mathematics and computer science div, argonne national laboratory +! +! this version dated august 1983. +! +! ---------------------------------------------------------------------- +! subroutine mli_tred1(nm,n,a,d,e,e2) integer i,j,k,l,n,ii,nm,jp1 double precision mli_dsign double precision a(nm,n),d(n),e(n),e2(n) double precision f,g,h,scale -C +! do 100 i = 1, n d(i) = a(n,i) a(n,i) = a(i,i) 100 continue -c .......... for i=n step -1 until 1 do -- .......... +! .......... for i=n step -1 until 1 do -- .......... do 300 ii = 1, n i = n + 1 - ii l = i - 1 h = 0.0d0 scale = 0.0d0 if (l .lt. 1) go to 130 -c .......... scale row (algol tol then not needed) .......... +! .......... scale row (algol tol then not needed) .......... do 120 k = 1, l scale = scale + dabs(d(k)) 120 continue -c +! if (scale .ne. 0.0d0) go to 140 -c +! do 125 j = 1, l d(j) = a(l,j) a(l,j) = a(i,j) a(i,j) = 0.0d0 125 continue -c +! 130 e(i) = 0.0d0 e2(i) = 0.0d0 go to 300 -c +! 140 do 150 k = 1, l d(k) = d(k) / scale h = h + d(k) * d(k) 150 continue -c +! e2(i) = scale * scale * h f = d(l) if (f . ge. 0.e0) then @@ -502,100 +495,100 @@ h = h - f * g d(l) = f - g if (l .eq. 1) go to 285 -c .......... form a*u .......... +! .......... form a*u .......... do 170 j = 1, l e(j) = 0.0d0 170 continue -c +! do 240 j = 1, l f = d(j) g = e(j) + a(j,j) * f jp1 = j + 1 if (l .lt. jp1) go to 220 -c +! do 200 k = jp1, l g = g + a(k,j) * d(k) e(k) = e(k) + a(k,j) * f 200 continue -c +! 220 e(j) = g 240 continue -c .......... form p .......... +! .......... form p .......... f = 0.0d0 -c +! do 245 j = 1, l e(j) = e(j) / h f = f + e(j) * d(j) 245 continue -c +! h = f / (h + h) -c .......... form q .......... +! .......... form q .......... do 250 j = 1, l e(j) = e(j) - h * d(j) 250 continue -c .......... form reduced a .......... +! .......... form reduced a .......... do 280 j = 1, l f = d(j) g = e(j) -c +! do 260 k = j, l a(k,j) = a(k,j) - f * e(k) - g * d(k) 260 continue -c +! 280 continue -c +! 285 do 290 j = 1, l f = d(j) d(j) = a(l,j) a(l,j) = a(i,j) a(i,j) = f * scale 290 continue -c +! 300 continue -c +! return end -C ********************************************************************** -c -c this subroutine is a translation of the algol procedure tred2, -c num. math. 11, 181-195(1968) by martin, reinsch, and wilkinson. -c handbook for auto. comp., vol.ii-linear algebra, 212-226(1971). -c -c this subroutine reduces a real symmetric matrix to a -c symmetric tridiagonal matrix using and accumulating -c orthogonal similarity transformations. -c -c on input -c -c nm must be set to the row dimension of two-dimensional -c array parameters as declared in the calling program -c dimension statement. -c -c n is the order of the matrix. -c -c a contains the real symmetric input matrix. only the -c lower triangle of the matrix need be supplied. -c -c on output -c -c d contains the diagonal elements of the tridiagonal matrix. -c -c e contains the subdiagonal elements of the tridiagonal -c matrix in its last n-1 positions. e(1) is set to zero. -c -c z contains the orthogonal transformation matrix -c produced in the reduction. -c -c a and z may coincide. if distinct, a is unaltered. -c -c questions and comments should be directed to burton s. garbow, -c mathematics and computer science div, argonne national laboratory -c -c this version dated august 1983. -c -C ---------------------------------------------------------------------- -C +! ********************************************************************** +! +! this subroutine is a translation of the algol procedure tred2, +! num. math. 11, 181-195(1968) by martin, reinsch, and wilkinson. +! handbook for auto. comp., vol.ii-linear algebra, 212-226(1971). +! +! this subroutine reduces a real symmetric matrix to a +! symmetric tridiagonal matrix using and accumulating +! orthogonal similarity transformations. +! +! on input +! +! nm must be set to the row dimension of two-dimensional +! array parameters as declared in the calling program +! dimension statement. +! +! n is the order of the matrix. +! +! a contains the real symmetric input matrix. only the +! lower triangle of the matrix need be supplied. +! +! on output +! +! d contains the diagonal elements of the tridiagonal matrix. +! +! e contains the subdiagonal elements of the tridiagonal +! matrix in its last n-1 positions. e(1) is set to zero. +! +! z contains the orthogonal transformation matrix +! produced in the reduction. +! +! a and z may coincide. if distinct, a is unaltered. +! +! questions and comments should be directed to burton s. garbow, +! mathematics and computer science div, argonne national laboratory +! +! this version dated august 1983. +! +! ---------------------------------------------------------------------- +! subroutine mli_tred2(nm,n,a,d,e,z) integer i,j,k,l,n,ii,nm,jp1 double precision mli_dsign @@ -603,43 +596,43 @@ double precision f,g,h,hh,scale do 100 i = 1, n -c +! do 80 j = i, n z(j,i) = a(j,i) 80 continue -c +! d(i) = a(n,i) 100 continue -c +! if (n .eq. 1) go to 510 -c .......... for i=n step -1 until 2 do -- .......... +! .......... for i=n step -1 until 2 do -- .......... do 300 ii = 2, n i = n + 2 - ii l = i - 1 h = 0.0d0 scale = 0.0d0 if (l .lt. 2) go to 130 -c .......... scale row (algol tol then not needed) .......... +! .......... scale row (algol tol then not needed) .......... do 120 k = 1, l scale = scale + dabs(d(k)) 120 continue -c +! if (scale .ne. 0.0d0) go to 140 130 e(i) = d(l) -c +! do 135 j = 1, l d(j) = z(l,j) z(i,j) = 0.0d0 z(j,i) = 0.0d0 135 continue -c +! go to 290 -c +! 140 do 150 k = 1, l d(k) = d(k) / scale h = h + d(k) * d(k) 150 continue -c +! f = d(l) if (f . ge. 0.e0) then mli_dsign = dsqrt(h) @@ -652,100 +645,100 @@ e(i) = scale * g h = h - f * g d(l) = f - g -c .......... form a*u .......... +! .......... form a*u .......... do 170 j = 1, l e(j) = 0.0d0 170 continue -c +! do 240 j = 1, l f = d(j) z(j,i) = f g = e(j) + z(j,j) * f jp1 = j + 1 if (l .lt. jp1) go to 220 -c +! do 200 k = jp1, l g = g + z(k,j) * d(k) e(k) = e(k) + z(k,j) * f 200 continue -c +! 220 e(j) = g 240 continue -c .......... form p .......... +! .......... form p .......... f = 0.0d0 -c +! do 245 j = 1, l e(j) = e(j) / h f = f + e(j) * d(j) 245 continue -c +! hh = f / (h + h) -c .......... form q .......... +! .......... form q .......... do 250 j = 1, l e(j) = e(j) - hh * d(j) 250 continue -c .......... form reduced a .......... +! .......... form reduced a .......... do 280 j = 1, l f = d(j) g = e(j) -c +! do 260 k = j, l z(k,j) = z(k,j) - f * e(k) - g * d(k) 260 continue -c +! d(j) = z(l,j) z(i,j) = 0.0d0 280 continue -c +! 290 d(i) = h 300 continue -c .......... accumulation of transformation matrices .......... +! .......... accumulation of transformation matrices .......... do 500 i = 2, n l = i - 1 z(n,l) = z(l,l) z(l,l) = 1.0d0 h = d(i) if (h .eq. 0.0d0) go to 380 -c +! do 330 k = 1, l d(k) = z(k,i) / h 330 continue -c +! do 360 j = 1, l g = 0.0d0 -c +! do 340 k = 1, l g = g + z(k,i) * z(k,j) 340 continue -c +! do 370 k = 1, l z(k,j) = z(k,j) - g * d(k) 370 continue 360 continue -c +! 380 do 400 k = 1, l z(k,i) = 0.0d0 400 continue -c +! 500 continue -c +! 510 do 520 i = 1, n d(i) = z(n,i) z(n,i) = 0.0d0 520 continue -c +! z(n,n) = 1.0d0 e(1) = 0.0d0 return end -C ********************************************************************** -C finds dsqrt(a**2+b**2) without overflow or destructive underflow -C ---------------------------------------------------------------------- -C +! ********************************************************************** +! finds dsqrt(a**2+b**2) without overflow or destructive underflow +! ---------------------------------------------------------------------- +! double precision function mli_pythag(a,b) double precision a,b -C +! double precision p,r,s,t,u p = dmax1(dabs(a),dabs(b)) if (p .eq. 0.0d0) go to 20 @@ -762,7 +755,7 @@ return end -C ********************************************************************** +! ********************************************************************** double precision function mli_dsign(a,b) double precision a,b diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_utils.h hypre-2.18.2/src/FEI_mv/femli/mli_utils.h --- hypre-2.16.0/src/FEI_mv/femli/mli_utils.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_utils.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_vector.cxx hypre-2.18.2/src/FEI_mv/femli/mli_vector.cxx --- hypre-2.16.0/src/FEI_mv/femli/mli_vector.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_vector.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/FEI_mv/femli/mli_vector.h hypre-2.18.2/src/FEI_mv/femli/mli_vector.h --- hypre-2.16.0/src/FEI_mv/femli/mli_vector.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/mli_vector.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/FEI_mv/femli/test/driver.c hypre-2.18.2/src/FEI_mv/femli/test/driver.c --- hypre-2.16.0/src/FEI_mv/femli/test/driver.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/test/driver.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2055 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - -#include -#include -#include -#include -#include "HYPRE.h" -#include "_hypre_utilities.h" -#include "_hypre_parcsr_mv.h" -#include "util/mli_utils.h" -#include "base/mli_defs.h" -#include "cintface/cmli.h" -#include "_hypre_IJ_mv.h" -#include "HYPRE_parcsr_ls.h" -#include "krylov.h" -#define habs(x) ((x)>=0 ? x : -x) - -HYPRE_ParCSRMatrix GenerateLaplacian9pt(MPI_Comm, int, int, int, int, int, - int, double *); -int GenerateConvectionDiffusion3D(MPI_Comm, int, int, int, int, int, int, - int, int, int, double, double, double *, - HYPRE_ParCSRMatrix *,HYPRE_ParVector*); -int GenerateConvectionDiffusion3D2(MPI_Comm, int, int, int, int, int, int, - int, int, int, double, double, double *, - HYPRE_ParCSRMatrix *,HYPRE_ParVector*); -int GenerateRugeStuben1(MPI_Comm,double,double,int,HYPRE_ParCSRMatrix*, - HYPRE_ParVector*); -int GenerateRugeStuben2(MPI_Comm,double,int,HYPRE_ParCSRMatrix*,HYPRE_ParVector*); -int GenerateRugeStuben3(MPI_Comm,double,int,HYPRE_ParCSRMatrix*, HYPRE_ParVector*); -int GenerateStuben(MPI_Comm,double,int,HYPRE_ParCSRMatrix*,HYPRE_ParVector*); - -int main(int argc, char **argv) -{ - int j, nx=401, ny=401, nz=1, P, Q, R, p, q, r, nprocs; - int mypid, startRow, fdScheme; - int *partition, globalSize, localSize, nsweeps, rowSize; - int *colInd, k, *procCnts, *offsets, *rowCnts, ftype; - int ndofs=3, nullDim=6, testProb=2, solver=2, scaleFlag=0; - int fleng, rleng, status, amgMethod=0, scaleFlag2=0; - char *targv[10], fname[100], rhsFname[100], methodName[10]; - char argStr[40]; - double *values, *nullVecs, *scaleVec, *colVal, *gscaleVec; - double *rhsVector=NULL, alpha, beta, *weights, Lvalue=4.0; - double epsilon=0.001, Pweight, dtemp; - HYPRE_IJMatrix newIJA; - HYPRE_IJVector IJrhs; - HYPRE_ParCSRMatrix HYPREA; - hypre_ParCSRMatrix *hypreA; - hypre_ParVector *sol, *rhs; - CMLI *cmli; - CMLI_Matrix *cmliMat; - CMLI_Method *cmliMethod; - CMLI_Vector *csol, *crhs; - MLI_Function *funcPtr; - - /* ------------------------------------------------------------- * - * machine setup - * ------------------------------------------------------------- */ - - MPI_Init(&argc, &argv); - MPI_Comm_size(MPI_COMM_WORLD, &nprocs); - MPI_Comm_rank(MPI_COMM_WORLD, &mypid); - - /* ------------------------------------------------------------- * - * problem setup - * ------------------------------------------------------------- */ - -/* - if ( mypid == 0 ) - { - printf("Which test problem (0-6) : "); - scanf("%d", &testProb); - } - MPI_Bcast(&testProb, 1, MPI_INT, 0, MPI_COMM_WORLD); -*/ -testProb = 0; - if ( testProb < 0 ) testProb = 0; - if ( testProb > 6 ) testProb = 6; - if ( testProb != 1 && testProb != 6) - { -/* - if ( mypid == 0 ) - { - printf("nx = ny = ? "); - scanf("%d", &nx); - } - MPI_Bcast(&nx, 1, MPI_INT, 0, MPI_COMM_WORLD); -*/ - nx = 96; - ny = nx; - nz = nx; - } - - /* --- Test problem 1 --- */ - if ( testProb == 0 ) - { - dtemp = (double) nprocs; - dtemp = pow(dtemp,1.0000001/3.0); - R = (int) (dtemp); - dtemp = (double) nprocs / (double) R; - dtemp = pow(dtemp,1.0000001/2.0); - Q = (int) (dtemp); - P = nprocs/R/Q; - p = mypid % P; - q = (( mypid - p)/P) % Q; - r = ( mypid - p - P*q)/( P*Q ); - values = hypre_CTAlloc(double, 9, HYPRE_MEMORY_HOST); - values[3] = -1.0; - values[2] = -1.0; - values[1] = -1.0; - values[0] = 6.00; -/* - if ( mypid == 0 ) - { - printf("enter alpha : "); - scanf("%lg", &alpha); - printf("enter beta : "); - scanf("%lg", &beta); - printf("enter difference scheme (0 - upwind, center otherwise) : "); - scanf("%d", &fdScheme); - } - MPI_Bcast(&alpha, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); - MPI_Bcast(&beta, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); - MPI_Bcast(&fdScheme, 1, MPI_INT, 0, MPI_COMM_WORLD); -*/ -alpha = 0.0; -beta = 0.0; -fdScheme = 1; -printf("generate problem\n"); - if (fdScheme == 0) - GenerateConvectionDiffusion3D2(MPI_COMM_WORLD,nx,ny,nz,P,Q,R,p, - q, r, alpha, beta, values, &HYPREA, - (HYPRE_ParVector *) &rhs); - else if (fdScheme == 1) - GenerateConvectionDiffusion3D(MPI_COMM_WORLD,nx,ny,nz,P,Q,R,p, - q, r, alpha, beta, values, &HYPREA, - (HYPRE_ParVector *) &rhs); - else - { - values[8] = -1.0; - values[7] = -1.0; - values[6] = -1.0; - values[5] = -1.0; - values[4] = 8.0; - values[3] = -1.0; - values[2] = -1.0; - values[1] = -1.0; - values[0] = 8.0; - dtemp = (double) nprocs; - dtemp = pow(dtemp,1.0000001/2.0); - Q = (int) (dtemp); - P = nprocs/Q; - p = mypid % P; - q = ((mypid - p)/P) % Q; - HYPREA = (HYPRE_ParCSRMatrix) GenerateLaplacian9pt(MPI_COMM_WORLD, - nx, ny, P, Q, p, q, values); - HYPRE_ParCSRMatrixGetRowPartitioning(HYPREA, &partition); - HYPRE_IJVectorCreate(MPI_COMM_WORLD, partition[mypid], - partition[mypid+1]-1, &IJrhs); - free( partition ); - HYPRE_IJVectorSetObjectType(IJrhs, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(IJrhs); - HYPRE_IJVectorAssemble(IJrhs); - HYPRE_IJVectorGetObject(IJrhs, (void**) &rhs); - HYPRE_IJVectorSetObjectType(IJrhs, -1); - HYPRE_IJVectorDestroy(IJrhs); - hypre_ParVectorSetConstantValues( rhs, 1.0 ); - } -printf("generate problem done\n"); - free( values ); - HYPRE_ParCSRMatrixGetRowPartitioning(HYPREA, &partition); - globalSize = partition[nprocs]; - startRow = partition[mypid]; - localSize = partition[mypid+1] - startRow; - free( partition ); - if ( scaleFlag == 1 ) - { - scaleVec = hypre_TAlloc(double, localSize, HYPRE_MEMORY_HOST); - for ( j = startRow; j < startRow+localSize; j++ ) - scaleVec[j-startRow] = 1.0e6 * (0.5 * random() / RAND_MAX + 1.0e-1); - HYPRE_IJMatrixCreate(MPI_COMM_WORLD, startRow, startRow+localSize-1, - startRow, startRow+localSize-1, &newIJA); - HYPRE_IJMatrixSetObjectType(newIJA, HYPRE_PARCSR); - rowCnts = hypre_TAlloc(int, localSize , HYPRE_MEMORY_HOST); - for ( j = startRow; j < startRow+localSize; j++ ) - { - HYPRE_ParCSRMatrixGetRow(HYPREA,j,&rowSize,&colInd,NULL); - rowCnts[j-startRow] = rowSize; - HYPRE_ParCSRMatrixRestoreRow(HYPREA,j,&rowSize,&colInd,NULL); - } - HYPRE_IJMatrixSetRowSizes(newIJA, rowCnts); - HYPRE_IJMatrixInitialize(newIJA); - free( rowCnts ); - for ( j = startRow; j < startRow+localSize; j++ ) - { - HYPRE_ParCSRMatrixGetRow(HYPREA,j,&rowSize,&colInd,&colVal); - for ( k = 0; k < rowSize; k++ ) - colVal[k] = colVal[k] * scaleVec[j-startRow]; - HYPRE_IJMatrixSetValues(newIJA, 1, &rowSize, (const int *) &j, - (const int *) colInd, (const double *) colVal); - HYPRE_ParCSRMatrixRestoreRow(HYPREA,j,&rowSize,&colInd,&colVal); - } - HYPRE_IJMatrixAssemble(newIJA); - HYPRE_ParCSRMatrixDestroy(HYPREA); - HYPRE_IJMatrixGetObject(newIJA, (void **) &HYPREA); - HYPRE_IJMatrixSetObjectType(newIJA, -1); - HYPRE_IJMatrixDestroy(newIJA); - free( scaleVec ); - } - else if ( scaleFlag == 2 ) - { - scaleVec = hypre_TAlloc(double, localSize, HYPRE_MEMORY_HOST); - gscaleVec = hypre_TAlloc(double, globalSize, HYPRE_MEMORY_HOST); - for ( j = startRow; j < startRow+localSize; j++ ) - scaleVec[j-startRow] = 1.0e6 * (0.5 * random() / RAND_MAX + 1.0e-1); - alpha = 0.0; - beta = 1.0e20; - for ( j = startRow; j < startRow+localSize; j++ ) - { - if (scaleVec[j-startRow] > alpha) alpha = scaleVec[j-startRow]; - if (scaleVec[j-startRow] < beta) beta = scaleVec[j-startRow]; - } - printf("scaling min/max = %e %e %d\n", beta, alpha, RAND_MAX); - procCnts = hypre_TAlloc(int, nprocs , HYPRE_MEMORY_HOST); - offsets = hypre_TAlloc(int, nprocs , HYPRE_MEMORY_HOST); - MPI_Allgather(&localSize,1,MPI_INT,procCnts,1,MPI_INT,MPI_COMM_WORLD); - offsets[0] = 0; - for ( j = 1; j < nprocs; j++ ) - offsets[j] = offsets[j-1] + procCnts[j-1]; - MPI_Allgatherv(scaleVec, localSize, MPI_DOUBLE, gscaleVec, - procCnts, offsets, MPI_DOUBLE, MPI_COMM_WORLD); - free( procCnts ); - free( offsets ); - HYPRE_IJMatrixCreate(MPI_COMM_WORLD, startRow, startRow+localSize-1, - startRow, startRow+localSize-1, &newIJA); - HYPRE_IJMatrixSetObjectType(newIJA, HYPRE_PARCSR); - rowCnts = hypre_TAlloc(int, localSize , HYPRE_MEMORY_HOST); - for ( j = startRow; j < startRow+localSize; j++ ) - { - HYPRE_ParCSRMatrixGetRow(HYPREA,j,&rowSize,&colInd,NULL); - rowCnts[j-startRow] = rowSize; - HYPRE_ParCSRMatrixRestoreRow(HYPREA,j,&rowSize,&colInd,NULL); - } - HYPRE_IJMatrixSetRowSizes(newIJA, rowCnts); - HYPRE_IJMatrixInitialize(newIJA); - free( rowCnts ); - for ( j = startRow; j < startRow+localSize; j++ ) - { - HYPRE_ParCSRMatrixGetRow(HYPREA,j,&rowSize,&colInd,&colVal); - for ( k = 0; k < rowSize; k++ ) - colVal[k] = colVal[k] * gscaleVec[colInd[k]]; - HYPRE_IJMatrixSetValues(newIJA, 1, &rowSize, (const int *) &j, - (const int *) colInd, (const double *) colVal); - HYPRE_ParCSRMatrixRestoreRow(HYPREA,j,&rowSize,&colInd,&colVal); - } - HYPRE_IJMatrixAssemble(newIJA); - HYPRE_ParCSRMatrixDestroy(HYPREA); - HYPRE_IJMatrixGetObject(newIJA, (void **) &HYPREA); - HYPRE_IJMatrixSetObjectType(newIJA, -1); - HYPRE_IJMatrixDestroy(newIJA); - free( gscaleVec ); - nullVecs = hypre_TAlloc(double, localSize , HYPRE_MEMORY_HOST); - for ( j = 0; j < localSize; j++ ) nullVecs[j] = 1.0 / scaleVec[j]; - free( scaleVec ); - } - if ( scaleFlag2 == 1 ) - { - scaleVec = hypre_TAlloc(double, localSize, HYPRE_MEMORY_HOST); - gscaleVec = hypre_TAlloc(double, globalSize, HYPRE_MEMORY_HOST); - for ( j = startRow; j < startRow+localSize; j++ ) - { - scaleVec[j-startRow] = 0.0; - HYPRE_ParCSRMatrixGetRow(HYPREA,j,&rowSize,&colInd,&colVal); - for (k = 0; k < rowSize; k++) - if ( colInd[k] == j ) scaleVec[j-startRow] = colVal[k]; - HYPRE_ParCSRMatrixRestoreRow(HYPREA,j,&rowSize,&colInd,&colVal); - } - for (j = 0; j < localSize; j++) - { - if ( scaleVec[j] <= 0.0 ) - { - printf("Proc %d : diag %d = %e <= 0 \n",mypid,j,scaleVec[j]); - exit(1); - } - scaleVec[j] = 1.0/sqrt(scaleVec[j]); - } - procCnts = hypre_TAlloc(int, nprocs , HYPRE_MEMORY_HOST); - offsets = hypre_TAlloc(int, nprocs , HYPRE_MEMORY_HOST); - MPI_Allgather(&localSize,1,MPI_INT,procCnts,1,MPI_INT,MPI_COMM_WORLD); - offsets[0] = 0; - for ( j = 1; j < nprocs; j++ ) - offsets[j] = offsets[j-1] + procCnts[j-1]; - MPI_Allgatherv(scaleVec, localSize, MPI_DOUBLE, gscaleVec, - procCnts, offsets, MPI_DOUBLE, MPI_COMM_WORLD); - free( procCnts ); - free( offsets ); - HYPRE_IJMatrixCreate(MPI_COMM_WORLD, startRow, startRow+localSize-1, - startRow, startRow+localSize-1, &newIJA); - HYPRE_IJMatrixSetObjectType(newIJA, HYPRE_PARCSR); - rowCnts = hypre_TAlloc(int, localSize , HYPRE_MEMORY_HOST); - for ( j = startRow; j < startRow+localSize; j++ ) - { - HYPRE_ParCSRMatrixGetRow(HYPREA,j,&rowSize,&colInd,NULL); - rowCnts[j-startRow] = rowSize; - HYPRE_ParCSRMatrixRestoreRow(HYPREA,j,&rowSize,&colInd,NULL); - } - HYPRE_IJMatrixSetRowSizes(newIJA, rowCnts); - HYPRE_IJMatrixInitialize(newIJA); - free( rowCnts ); - for ( j = startRow; j < startRow+localSize; j++ ) - { - HYPRE_ParCSRMatrixGetRow(HYPREA,j,&rowSize,&colInd,&colVal); - for ( k = 0; k < rowSize; k++ ) - { - colVal[k] = colVal[k] * gscaleVec[colInd[k]] * gscaleVec[j]; - if ( colInd[k] == j && habs(colVal[k]-1.0) > 1.0e-8 ) - printf("Proc %d : diag %d(%d) = %e != 1.0\n",mypid,j,k, - colVal[k]); - } - HYPRE_IJMatrixSetValues(newIJA, 1, &rowSize, (const int *) &j, - (const int *) colInd, (const double *) colVal); - HYPRE_ParCSRMatrixRestoreRow(HYPREA,j,&rowSize,&colInd,&colVal); - } - HYPRE_IJMatrixAssemble(newIJA); - HYPRE_ParCSRMatrixDestroy(HYPREA); - HYPRE_IJMatrixGetObject(newIJA, (void **) &HYPREA); - HYPRE_IJMatrixSetObjectType(newIJA, -1); - HYPRE_IJMatrixDestroy(newIJA); - free( gscaleVec ); - nullVecs = hypre_TAlloc(double, localSize , HYPRE_MEMORY_HOST); - for ( j = 0; j < localSize; j++ ) nullVecs[j] = 1.0 / scaleVec[j]; - free( scaleVec ); - } else nullVecs = NULL; - } - - /* --- Test problem 2 --- */ - else if ( testProb == 1 ) - { - if ( mypid == 0 ) - { - printf("Matrix file name : "); - scanf("%s", fname); - fleng = strlen(fname); - fleng++; - printf("\nMatrix file type (0 - Tumin, 1 - IJA) : "); - scanf("%d", &ftype); - printf("rhs file name : "); - scanf("%s", rhsFname); - rleng = strlen(rhsFname); - rleng++; - } - MPI_Bcast(&fleng, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(&ftype, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(&rleng, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(fname, fleng, MPI_CHAR, 0, MPI_COMM_WORLD); - MPI_Bcast(rhsFname, rleng, MPI_CHAR, 0, MPI_COMM_WORLD); - if ( ftype == 0 ) - { - MLI_Utils_HypreMatrixReadTuminFormat(fname,MPI_COMM_WORLD,ndofs, - (void **) &HYPREA, scaleFlag, &scaleVec); - } - else - { -/* - MLI_Utils_HypreMatrixReadIJAFormat(fname,MPI_COMM_WORLD,ndofs, - (void **) &HYPREA, scaleFlag, &scaleVec); -*/ - MLI_Utils_HypreParMatrixReadIJAFormat(fname,MPI_COMM_WORLD, - (void **) &HYPREA, scaleFlag, &scaleVec); - } - HYPRE_ParCSRMatrixGetRowPartitioning(HYPREA, &partition); - globalSize = partition[nprocs]; - startRow = partition[mypid]; - localSize = partition[mypid+1] - startRow; - free( partition ); - rhsVector = hypre_TAlloc(double, localSize , HYPRE_MEMORY_HOST); - status = MLI_Utils_DoubleParVectorRead(rhsFname, MPI_COMM_WORLD, - localSize, startRow, rhsVector); - if ( status < 0 ) - { - free( rhsVector ); - rhsVector = NULL; - } - HYPRE_ParCSRMatrixGetRowPartitioning(HYPREA, &partition); - HYPRE_IJVectorCreate(MPI_COMM_WORLD, partition[mypid], - partition[mypid+1]-1, &IJrhs); - free( partition ); - HYPRE_IJVectorSetObjectType(IJrhs, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(IJrhs); - HYPRE_IJVectorAssemble(IJrhs); - if ( rhsVector != NULL ) - { - colInd = hypre_TAlloc(int, localSize , HYPRE_MEMORY_HOST); - for (j = 0; j < localSize; j++) colInd[j] = startRow + j; - HYPRE_IJVectorSetValues(IJrhs, localSize, (const int *) colInd, - (const double *) rhsVector); - free(colInd); - } - HYPRE_IJVectorGetObject(IJrhs, (void**) &rhs); - HYPRE_IJVectorSetObjectType(IJrhs, -1); - HYPRE_IJVectorDestroy(IJrhs); - if ( rhsVector == NULL ) - hypre_ParVectorSetConstantValues( rhs, 1.0 ); - else free(rhsVector); - - if ( scaleFlag2 == 1 ) - { - scaleVec = hypre_TAlloc(double, localSize, HYPRE_MEMORY_HOST); - gscaleVec = hypre_TAlloc(double, globalSize, HYPRE_MEMORY_HOST); - for ( j = startRow; j < startRow+localSize; j++ ) - { - scaleVec[j-startRow] = 0.0; - HYPRE_ParCSRMatrixGetRow(HYPREA,j,&rowSize,&colInd,&colVal); - for (k = 0; k < rowSize; k++) - if ( colInd[k] == j ) scaleVec[j-startRow] = colVal[k]; - HYPRE_ParCSRMatrixRestoreRow(HYPREA,j,&rowSize,&colInd,&colVal); - } - for (j = 0; j < localSize; j++) - { - if ( scaleVec[j] <= 0.0 ) - { - printf("Proc %d : diag %d = %e <= 0 \n",mypid,j,scaleVec[j]); - exit(1); - } - scaleVec[j] = 1.0/sqrt(scaleVec[j]); - } - procCnts = hypre_TAlloc(int, nprocs , HYPRE_MEMORY_HOST); - offsets = hypre_TAlloc(int, nprocs , HYPRE_MEMORY_HOST); - MPI_Allgather(&localSize,1,MPI_INT,procCnts,1,MPI_INT,MPI_COMM_WORLD); - offsets[0] = 0; - for ( j = 1; j < nprocs; j++ ) - offsets[j] = offsets[j-1] + procCnts[j-1]; - MPI_Allgatherv(scaleVec, localSize, MPI_DOUBLE, gscaleVec, - procCnts, offsets, MPI_DOUBLE, MPI_COMM_WORLD); - free( procCnts ); - free( offsets ); - HYPRE_IJMatrixCreate(MPI_COMM_WORLD, startRow, startRow+localSize-1, - startRow, startRow+localSize-1, &newIJA); - HYPRE_IJMatrixSetObjectType(newIJA, HYPRE_PARCSR); - rowCnts = hypre_TAlloc(int, localSize , HYPRE_MEMORY_HOST); - for ( j = startRow; j < startRow+localSize; j++ ) - { - HYPRE_ParCSRMatrixGetRow(HYPREA,j,&rowSize,&colInd,NULL); - rowCnts[j-startRow] = rowSize; - HYPRE_ParCSRMatrixRestoreRow(HYPREA,j,&rowSize,&colInd,NULL); - } - HYPRE_IJMatrixSetRowSizes(newIJA, rowCnts); - HYPRE_IJMatrixInitialize(newIJA); - free( rowCnts ); - for ( j = startRow; j < startRow+localSize; j++ ) - { - HYPRE_ParCSRMatrixGetRow(HYPREA,j,&rowSize,&colInd,&colVal); - for ( k = 0; k < rowSize; k++ ) - { - colVal[k] = colVal[k] * gscaleVec[colInd[k]] * gscaleVec[j]; - if ( colInd[k] == j && habs(colVal[k]-1.0) > 1.0e-8 ) - printf("Proc %d : diag %d(%d) = %e != 1.0\n",mypid,j,k, - colVal[k]); - } - HYPRE_IJMatrixSetValues(newIJA, 1, &rowSize, (const int *) &j, - (const int *) colInd, (const double *) colVal); - HYPRE_ParCSRMatrixRestoreRow(HYPREA,j,&rowSize,&colInd,&colVal); - } - HYPRE_IJMatrixAssemble(newIJA); - HYPRE_ParCSRMatrixDestroy(HYPREA); - HYPRE_IJMatrixGetObject(newIJA, (void **) &HYPREA); - HYPRE_IJMatrixSetObjectType(newIJA, -1); - HYPRE_IJMatrixDestroy(newIJA); - free( gscaleVec ); - nullVecs = hypre_TAlloc(double, localSize , HYPRE_MEMORY_HOST); - for ( j = 0; j < localSize; j++ ) nullVecs[j] = 1.0 / scaleVec[j]; - free( scaleVec ); - } else nullVecs = NULL; -#if 0 - nullVecs = hypre_TAlloc(double, localSize * nullDim , HYPRE_MEMORY_HOST); -/* - MLI_Utils_DoubleParVectorRead("rigid_body_mode01",MPI_COMM_WORLD, - localSize, startRow, nullVecs); - MLI_Utils_DoubleParVectorRead("rigid_body_mode02",MPI_COMM_WORLD, - localSize, startRow, &nullVecs[localSize]); - MLI_Utils_DoubleParVectorRead("rigid_body_mode03",MPI_COMM_WORLD, - localSize, startRow, &nullVecs[localSize*2]); -*/ - MLI_Utils_DoubleParVectorRead("rigid_body_mode01",MPI_COMM_WORLD, - localSize, 0, nullVecs); - MLI_Utils_DoubleParVectorRead("rigid_body_mode02",MPI_COMM_WORLD, - localSize, 0, &nullVecs[localSize]); - MLI_Utils_DoubleParVectorRead("rigid_body_mode03",MPI_COMM_WORLD, - localSize, 0, &nullVecs[localSize*2]); - if ( scaleFlag ) - { - for ( j = 0; j < localSize; j++ ) - scaleVec[j] = sqrt(scaleVec[j]); - for ( j = 0; j < localSize; j++ ) nullVecs[j] *= scaleVec[j]; - for ( j = 0; j < localSize; j++ ) - nullVecs[localSize+j] *= scaleVec[j]; - for ( j = 0; j < localSize; j++ ) - nullVecs[2*localSize+j] *= scaleVec[j]; - } - if ( nullDim > 3 ) - { - MLI_Utils_DoubleParVectorRead("rigid_body_mode04",MPI_COMM_WORLD, - localSize, 0, &nullVecs[localSize*3]); - MLI_Utils_DoubleParVectorRead("rigid_body_mode05",MPI_COMM_WORLD, - localSize, 0, &nullVecs[localSize*4]); - MLI_Utils_DoubleParVectorRead("rigid_body_mode06",MPI_COMM_WORLD, - localSize, 0, &nullVecs[localSize*5]); - if ( scaleFlag ) - { - for ( j = 0; j < localSize; j++ ) - nullVecs[3*localSize+j] *= scaleVec[j]; - for ( j = 0; j < localSize; j++ ) - nullVecs[4*localSize+j] *= scaleVec[j]; - for ( j = 0; j < localSize; j++ ) - nullVecs[5*localSize+j] *= scaleVec[j]; - } - } -#endif - } - - /* --- Test problem 3 --- */ - else if ( testProb == 2 ) - { - if ( mypid == 0 ) - { - printf("Convection diffusion equation (1) : L = (0-4) ? "); - scanf("%lg", &Lvalue); - printf("Convection diffusion equation (1) : epsilon = "); - scanf("%lg", &epsilon); - } - MPI_Bcast(&nx, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(&Lvalue, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); - MPI_Bcast(&epsilon, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); - GenerateRugeStuben1(MPI_COMM_WORLD,Lvalue,epsilon,nx,&HYPREA, - (HYPRE_ParVector *) &rhs); - HYPRE_ParCSRMatrixGetRowPartitioning(HYPREA, &partition); - globalSize = partition[nprocs]; - startRow = partition[mypid]; - localSize = partition[mypid+1] - startRow; - free( partition ); - } - - /* --- Test problem 4 --- */ - else if ( testProb == 3 ) - { - if ( mypid == 0 ) - { - printf("Convection diffusion equation (2) : epsilon = "); - scanf("%lg", &epsilon); - } - MPI_Bcast(&nx, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(&epsilon, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); - GenerateRugeStuben2(MPI_COMM_WORLD,epsilon,nx,&HYPREA, - (HYPRE_ParVector *) &rhs); - HYPRE_ParCSRMatrixGetRowPartitioning(HYPREA, &partition); - globalSize = partition[nprocs]; - startRow = partition[mypid]; - localSize = partition[mypid+1] - startRow; - free( partition ); - } - - /* --- Test problem 5 --- */ - else if ( testProb == 4 ) - { - if ( mypid == 0 ) - { - printf("Convection diffusion equation (3) : epsilon = "); - scanf("%lg", &epsilon); - } - MPI_Bcast(&nx, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(&epsilon, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); - GenerateRugeStuben3(MPI_COMM_WORLD,epsilon,nx,&HYPREA, - (HYPRE_ParVector *) &rhs); - HYPRE_ParCSRMatrixGetRowPartitioning(HYPREA, &partition); - globalSize = partition[nprocs]; - startRow = partition[mypid]; - localSize = partition[mypid+1] - startRow; - free( partition ); - } - - /* --- Test problem 6 --- */ - else if ( testProb == 5 ) - { - if ( mypid == 0 ) - { - printf("Convection diffusion equation (4) : epsilon = "); - scanf("%lg", &epsilon); - } - MPI_Bcast(&nx, 1, MPI_INT, 0, MPI_COMM_WORLD); - MPI_Bcast(&epsilon, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); - GenerateStuben(MPI_COMM_WORLD,epsilon,nx,&HYPREA, - (HYPRE_ParVector *) &rhs); - HYPRE_ParCSRMatrixGetRowPartitioning(HYPREA, &partition); - globalSize = partition[nprocs]; - startRow = partition[mypid]; - localSize = partition[mypid+1] - startRow; - free( partition ); - } - - /* --- Test problem 7 --- */ - else if ( testProb == 6 ) - { - if ( mypid == 0 ) - { - printf("HB Matrix file name : "); - scanf("%s", fname); - fleng = strlen(fname); - fleng++; - } - MLI_Utils_HypreMatrixReadHBFormat(fname,MPI_COMM_WORLD, - (void **) &HYPREA); - HYPRE_ParCSRMatrixGetRowPartitioning(HYPREA, &partition); - globalSize = partition[nprocs]; - startRow = partition[mypid]; - localSize = partition[mypid+1] - startRow; - free( partition ); - rhsVector = hypre_TAlloc(double, localSize , HYPRE_MEMORY_HOST); - for (j = 0; j < localSize; j++) rhsVector[j] = 1.0; - HYPRE_ParCSRMatrixGetRowPartitioning(HYPREA, &partition); - HYPRE_IJVectorCreate(MPI_COMM_WORLD, partition[mypid], - partition[mypid+1]-1, &IJrhs); - free( partition ); - HYPRE_IJVectorSetObjectType(IJrhs, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(IJrhs); - HYPRE_IJVectorAssemble(IJrhs); - colInd = hypre_TAlloc(int, localSize , HYPRE_MEMORY_HOST); - for (j = 0; j < localSize; j++) colInd[j] = startRow + j; - HYPRE_IJVectorSetValues(IJrhs, localSize, (const int *) colInd, - (const double *) rhsVector); - free(colInd); - HYPRE_IJVectorGetObject(IJrhs, (void**) &rhs); - HYPRE_IJVectorSetObjectType(IJrhs, -1); - HYPRE_IJVectorDestroy(IJrhs); - free(rhsVector); - nullVecs = NULL; - } - - hypreA = (hypre_ParCSRMatrix *) HYPREA; - HYPRE_ParCSRMatrixGetRowPartitioning(HYPREA, &partition); - sol = hypre_ParVectorCreate(MPI_COMM_WORLD, globalSize, partition); - hypre_ParVectorInitialize( sol ); - hypre_ParVectorSetConstantValues( sol, 0.0 ); - - funcPtr = hypre_TAlloc( MLI_Function , 1, HYPRE_MEMORY_HOST); - MLI_Utils_HypreParVectorGetDestroyFunc(funcPtr); - csol = MLI_VectorCreate(sol, "HYPRE_ParVector", funcPtr); - crhs = MLI_VectorCreate(rhs, "HYPRE_ParVector", funcPtr); - - /* ------------------------------------------------------------- * - * problem setup - * ------------------------------------------------------------- */ - - MLI_Utils_HypreParCSRMatrixGetDestroyFunc(funcPtr); - cmliMat = MLI_MatrixCreate((void*) hypreA,"HYPRE_ParCSR",funcPtr); - free( funcPtr ); - cmli = MLI_Create( MPI_COMM_WORLD ); -/* - if ( mypid == 0 ) - { - printf("Which AMG to use (0 - RSAMG, 1 - SAAMG, 2 - CRAMG) : "); - scanf("%d", &amgMethod); - } - MPI_Bcast(&amgMethod, 1, MPI_INT, 0, MPI_COMM_WORLD); -*/ -amgMethod = 1; - if (amgMethod == 0) strcpy(methodName, "AMGRS"); - else if (amgMethod == 1) strcpy(methodName, "AMGSA"); - else strcpy(methodName, "AMGCR"); - - cmliMethod = MLI_MethodCreate(methodName, MPI_COMM_WORLD); - MLI_MethodSetParams(cmliMethod, "setNumLevels 10", 0, NULL); - MLI_MethodSetParams(cmliMethod, "setMaxIterations 1", 0, NULL); - MLI_MethodSetParams(cmliMethod, "setMinCoarseSize 25", 0, NULL); - MLI_MethodSetParams(cmliMethod, "setCoarseSolver SuperLU", 2, targv); - if (! strcmp(methodName, "AMGRS")) - { - if (mypid == 0) - { - printf("RSAMG number of sweeps = "); - scanf("%d", &nsweeps); - } - MPI_Bcast(&nsweeps, 1, MPI_INT, 0, MPI_COMM_WORLD); - if ( nsweeps <= 0 ) nsweeps = 1; - weights = hypre_TAlloc(double, nsweeps , HYPRE_MEMORY_HOST); - //if ( mypid == 0 ) - //{ - // printf("RSAMG relaxation weights = "); - // scanf("%lg", &weights[0]); - //} - weights[0] = 2.0 / 3.0; - //MPI_Bcast(&weights[0], 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); - //if ( weights[0] <= 0.0 ) weights[0] = 0.67; - for ( j = 1; j < nsweeps; j++ ) weights[j] = weights[0]; - targv[0] = (char *) &nsweeps; - targv[1] = (char *) weights; - MLI_MethodSetParams(cmliMethod, "setPreSmoother Jacobi", 2, targv); - MLI_MethodSetParams(cmliMethod, "setPostSmoother Jacobi", 2, targv); - free(weights); - //MLI_MethodSetParams(cmliMethod, "setCoarsenScheme cljp", 0, NULL); - MLI_MethodSetParams(cmliMethod, "setStrengthThreshold 0.5", 0, NULL); - if ( mypid == 0 ) - { - printf("RSAMG smootherPrintRNorm ? (0 for no, 1 for yes) = "); - scanf("%d", &j); - } - MPI_Bcast(&j, 1, MPI_INT, 0, MPI_COMM_WORLD); - if ( j != 0 ) - MLI_MethodSetParams(cmliMethod, "setSmootherPrintRNorm", 0, NULL); - if ( mypid == 0 ) - { - printf("RSAMG smootherFindOmega ? (0 for no, 1 for yes) = "); - scanf("%d", &j); - } - MPI_Bcast(&j, 1, MPI_INT, 0, MPI_COMM_WORLD); - if ( j != 0 ) - MLI_MethodSetParams(cmliMethod, "setSmootherFindOmega", 0, NULL); - if ( mypid == 0 ) - { - printf("RSAMG nonsymmetric ? (0 for no, 1 for yes) = "); - scanf("%d", &j); - } - MPI_Bcast(&j, 1, MPI_INT, 0, MPI_COMM_WORLD); - if ( j != 0 ) - MLI_MethodSetParams(cmliMethod, "useNonsymmetric", 0, NULL); -/* -MLI_MethodSetParams(cmliMethod, "useInjectionForR", 0, NULL); -*/ - } - else if (! strcmp(methodName, "AMGSA")) - { -/* - if ( mypid == 0 ) - { - printf("SAAMG number of sweeps = "); - scanf("%d", &nsweeps); - } - MPI_Bcast(&nsweeps, 1, MPI_INT, 0, MPI_COMM_WORLD); -*/ -nsweeps = 1; - if ( nsweeps <= 0 ) nsweeps = 1; - weights = hypre_TAlloc(double, nsweeps , HYPRE_MEMORY_HOST); -/* - if ( mypid == 0 ) - { - printf("SAAMG relaxation weights = "); - scanf("%lg", &weights[0]); - } - MPI_Bcast(&weights[0], 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); -*/ -weights[0] = 1.0; - if ( weights[0] <= 0.0 ) weights[0] = 1.0; - for ( j = 1; j < nsweeps; j++ ) weights[j] = weights[0]; - targv[0] = (char *) &nsweeps; - targv[1] = (char *) weights; - MLI_MethodSetParams(cmliMethod, "setPreSmoother Jacobi", 2, targv); - MLI_MethodSetParams(cmliMethod, "setPostSmoother Jacobi", 2, targv); - free(weights); - MLI_MethodSetParams(cmliMethod, "setStrengthThreshold 0.08", 0, NULL); - MLI_MethodSetParams(cmliMethod, "setCalibrationSize 0", 0, NULL); - MLI_MethodSetParams(cmliMethod, "useSAMGDDExt", 0, NULL); -/* - if ( mypid == 0 ) - { - printf("SAAMG Pweight weights = "); - scanf("%lg", &Pweight); - } - MPI_Bcast(&Pweight, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); -*/ -Pweight = 0.0; - if ( Pweight < 0.0 ) Pweight = 0.0; - sprintf( argStr, "setPweight %e", Pweight); - MLI_MethodSetParams(cmliMethod, argStr, 0, NULL); -/* - if ( mypid == 0 ) - { - printf("SAAMG nonsymmetric ? (0 for no, 1 for yes) = "); - scanf("%d", &j); - } - MPI_Bcast(&j, 1, MPI_INT, 0, MPI_COMM_WORLD); -*/ -j = 0; - if ( j != 0 ) - MLI_MethodSetParams(cmliMethod, "useNonsymmetric", 0, NULL); - } - else if (! strcmp(methodName, "AMGCR")) - { - if ( mypid == 0 ) - { - printf("CRAMG number of sweeps = "); - scanf("%d", &nsweeps); - } - MPI_Bcast(&nsweeps, 1, MPI_INT, 0, MPI_COMM_WORLD); - if ( nsweeps <= 0 ) nsweeps = 1; - weights = hypre_TAlloc(double, nsweeps , HYPRE_MEMORY_HOST); - //weights[0] = 2.0 / 3.0; - weights[0] = 1.0 / 1.0; - MPI_Bcast(&weights[0], 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); - if ( weights[0] <= 0.0 ) weights[0] = 1.0; - for ( j = 1; j < nsweeps; j++ ) weights[j] = weights[0]; - targv[0] = (char *) &nsweeps; - targv[1] = (char *) weights; - MLI_MethodSetParams(cmliMethod, "setSmoother Jacobi", 2, targv); - free(weights); - if ( mypid == 0 ) - { - printf("Use MIS ? (0 for no, otherwise yes) "); - scanf("%d", &j); - } - MPI_Bcast(&j, 1, MPI_INT, 0, MPI_COMM_WORLD); - if ( j != 0 ) - { - MLI_MethodSetParams(cmliMethod, "useMIS", 0, NULL); - } - if ( mypid == 0 ) - { - printf("Use CR ? (0 for no, otherwise yes) "); - scanf("%d", &j); - } - MPI_Bcast(&j, 1, MPI_INT, 0, MPI_COMM_WORLD); - if ( j != 0 ) - { - MLI_MethodSetParams(cmliMethod, "setNumTrials 100", 0, NULL); - } - else - { - MLI_MethodSetParams(cmliMethod, "setNumTrials 1", 0, NULL); - } - MLI_MethodSetParams(cmliMethod, "setTargetMu 0.8", 0, NULL); - MLI_MethodSetParams(cmliMethod, "setPDegree 2", 0, NULL); - } - MLI_MethodSetParams(cmliMethod, "setOutputLevel 2", 0, NULL); - - if ( testProb == 0 ) - { - ndofs = 1; - nullDim = 1; - targv[0] = (char *) &ndofs; - targv[1] = (char *) &nullDim; - targv[2] = (char *) nullVecs; - targv[3] = (char *) &localSize; - if ( ! strcmp(methodName, "AMGSA") ) - MLI_MethodSetParams(cmliMethod, "setNullSpace", 4, targv); - free( nullVecs ); - } - if ( testProb == 1 ) - { - targv[0] = (char *) &ndofs; - targv[1] = (char *) &nullDim; - targv[2] = (char *) nullVecs; - targv[3] = (char *) &localSize; - if ( ! strcmp(methodName, "AMGSA") ) - MLI_MethodSetParams(cmliMethod, "setNullSpace", 4, targv); - free( nullVecs ); - } - MLI_MethodSetParams(cmliMethod, "print", 0, NULL); - MLI_SetMethod(cmli, cmliMethod); - MLI_SetSystemMatrix(cmli, 0, cmliMat); - MLI_SetOutputLevel(cmli, 2); - -/* - if ( mypid == 0 ) - { - printf("outer Krylov solver (0 - none, 1 - CG, 2 - GMRES) : "); - scanf("%d", &solver); - } - MPI_Bcast(&solver, 1, MPI_INT, 0, MPI_COMM_WORLD); -*/ -solver = 2; - if ( solver < 0 ) solver = 0; - if ( solver > 2 ) solver = 2; - - if ( solver == 0 ) - { - MLI_Setup(cmli); - MLI_Solve(cmli, csol, crhs); - } - else if ( solver == 1 ) - { - MLI_Utils_HyprePCGSolve(cmli, (HYPRE_Matrix) HYPREA, - (HYPRE_Vector) rhs, (HYPRE_Vector) sol); - } - else - { - MLI_Utils_HypreGMRESSolve(cmli, (HYPRE_Matrix) HYPREA, - (HYPRE_Vector) rhs, (HYPRE_Vector) sol, "mli"); - } - MLI_Print( cmli ); - MLI_Destroy( cmli ); - MLI_MatrixDestroy( cmliMat ); - MLI_VectorDestroy( csol ); - MLI_VectorDestroy( crhs ); - MLI_MethodDestroy( cmliMethod ); - MPI_Barrier(MPI_COMM_WORLD); - exit(0); - MPI_Finalize(); - return 0; -} - -/* **************************************************************** * - * problem generation - * ---------------------------------------------------------------- */ - -/* ---------------------------------------------------------------- * - convection diffusion equation where (value, alpha, beta) determine - the diffusion and convection terms - * ---------------------------------------------------------------- */ - -int hypre_GeneratePartitioning(int, int, int**); - -int hypre_mapCD( int ix, int iy, int iz, int p, int q, int r, - int P, int Q, int R, int *nx_part, int *ny_part, int *nz_part, - int *global_part ) -{ - int nx_local, ny_local, ix_local, iy_local, iz_local; - int global_index, proc_num; - - proc_num = r*P*Q + q*P + p; - nx_local = nx_part[p+1] - nx_part[p]; - ny_local = ny_part[q+1] - ny_part[q]; - ix_local = ix - nx_part[p]; - iy_local = iy - ny_part[q]; - iz_local = iz - nz_part[r]; - global_index = global_part[proc_num] - + (iz_local*ny_local+iy_local)*nx_local + ix_local; - - return global_index; -} - -/* ---------------------------------------------------------------- * - convection diffusion equation where (centered difference) - * ---------------------------------------------------------------- */ - -int GenerateConvectionDiffusion3D( MPI_Comm comm, int nx, int ny, int nz, - int P, int Q, int R, int p, int q, int r, double alpha, - double beta, double *value, HYPRE_ParCSRMatrix *rA, - HYPRE_ParVector *rrhs ) -{ - hypre_ParCSRMatrix *A; - hypre_CSRMatrix *diag, *offd; - HYPRE_IJVector IJrhs; - hypre_ParVector *rhs; - - int *diag_i, *diag_j, *offd_i, *offd_j; - double *diag_data, *offd_data; - int *global_part, ix, iy, iz, cnt, o_cnt, local_num_rows; - int *col_map_offd, row_index, i,j, *partition; - int nx_local, ny_local, nz_local; - int nx_size, ny_size, nz_size, num_cols_offd, grid_size; - int *nx_part, *ny_part, *nz_part; - int num_procs, my_id, P_busy, Q_busy, R_busy; - - MPI_Comm_size(comm,&num_procs); - MPI_Comm_rank(comm,&my_id); - - grid_size = nx*ny*nz; - - hypre_GeneratePartitioning(nx,P,&nx_part); - hypre_GeneratePartitioning(ny,Q,&ny_part); - hypre_GeneratePartitioning(nz,R,&nz_part); - - global_part = hypre_CTAlloc(int, P*Q*R+1, HYPRE_MEMORY_HOST); - - global_part[0] = 0; - cnt = 1; - for (iz = 0; iz < R; iz++) - { - nz_size = nz_part[iz+1]-nz_part[iz]; - for (iy = 0; iy < Q; iy++) - { - ny_size = ny_part[iy+1]-ny_part[iy]; - for (ix = 0; ix < P; ix++) - { - nx_size = nx_part[ix+1] - nx_part[ix]; - global_part[cnt] = global_part[cnt-1]; - global_part[cnt++] += nx_size*ny_size*nz_size; - } - } - } - - nx_local = nx_part[p+1] - nx_part[p]; - ny_local = ny_part[q+1] - ny_part[q]; - nz_local = nz_part[r+1] - nz_part[r]; - - my_id = r*(P*Q) + q*P + p; - num_procs = P*Q*R; - - local_num_rows = nx_local*ny_local*nz_local; - diag_i = hypre_CTAlloc(int, local_num_rows+1, HYPRE_MEMORY_HOST); - offd_i = hypre_CTAlloc(int, local_num_rows+1, HYPRE_MEMORY_HOST); - - P_busy = hypre_min(nx,P); - Q_busy = hypre_min(ny,Q); - R_busy = hypre_min(nz,R); - - num_cols_offd = 0; - if (p) num_cols_offd += ny_local*nz_local; - if (p < P_busy-1) num_cols_offd += ny_local*nz_local; - if (q) num_cols_offd += nx_local*nz_local; - if (q < Q_busy-1) num_cols_offd += nx_local*nz_local; - if (r) num_cols_offd += nx_local*ny_local; - if (r < R_busy-1) num_cols_offd += nx_local*ny_local; - - if (!local_num_rows) num_cols_offd = 0; - - col_map_offd = hypre_CTAlloc(int, num_cols_offd, HYPRE_MEMORY_HOST); - - cnt = 1; - o_cnt = 1; - diag_i[0] = 0; - offd_i[0] = 0; - for (iz = nz_part[r]; iz < nz_part[r+1]; iz++) - { - for (iy = ny_part[q]; iy < ny_part[q+1]; iy++) - { - for (ix = nx_part[p]; ix < nx_part[p+1]; ix++) - { - diag_i[cnt] = diag_i[cnt-1]; - offd_i[o_cnt] = offd_i[o_cnt-1]; - diag_i[cnt]++; - if (iz > nz_part[r]) - diag_i[cnt]++; - else - { - if (iz) - { - offd_i[o_cnt]++; - } - } - if (iy > ny_part[q]) - diag_i[cnt]++; - else - { - if (iy) - { - offd_i[o_cnt]++; - } - } - if (ix > nx_part[p]) - diag_i[cnt]++; - else - { - if (ix) - { - offd_i[o_cnt]++; - } - } - if (ix+1 < nx_part[p+1]) - diag_i[cnt]++; - else - { - if (ix+1 < nx) - { - offd_i[o_cnt]++; - } - } - if (iy+1 < ny_part[q+1]) - diag_i[cnt]++; - else - { - if (iy+1 < ny) - { - offd_i[o_cnt]++; - } - } - if (iz+1 < nz_part[r+1]) - diag_i[cnt]++; - else - { - if (iz+1 < nz) - { - offd_i[o_cnt]++; - } - } - cnt++; - o_cnt++; - } - } - } - - diag_j = hypre_CTAlloc(int, diag_i[local_num_rows], HYPRE_MEMORY_HOST); - diag_data = hypre_CTAlloc(double, diag_i[local_num_rows], HYPRE_MEMORY_HOST); - - if (num_procs > 1) - { - offd_j = hypre_CTAlloc(int, offd_i[local_num_rows], HYPRE_MEMORY_HOST); - offd_data = hypre_CTAlloc(double, offd_i[local_num_rows], HYPRE_MEMORY_HOST); - } - - row_index = 0; - cnt = 0; - o_cnt = 0; - for (iz = nz_part[r]; iz < nz_part[r+1]; iz++) - { - for (iy = ny_part[q]; iy < ny_part[q+1]; iy++) - { - for (ix = nx_part[p]; ix < nx_part[p+1]; ix++) - { - diag_j[cnt] = row_index; - diag_data[cnt++] = value[0]; - if (iz > nz_part[r]) - { - if (value[3] != 0.0) - { - diag_j[cnt] = row_index-nx_local*ny_local; - diag_data[cnt++] = value[3]; - } - } - else - { - if (iz) - { - if (value[3] != 0.0) - { - offd_j[o_cnt] = hypre_mapCD(ix,iy,iz-1,p,q,r-1,P,Q,R, - nx_part,ny_part,nz_part,global_part); - offd_data[o_cnt++] = value[3]; - } - } - } - if (iy > ny_part[q]) - { - diag_j[cnt] = row_index-nx_local; - diag_data[cnt++] = value[2] - 0.5 * beta / (double)(ny - 1); - } - else - { - if (iy) - { - offd_j[o_cnt] = hypre_mapCD(ix,iy-1,iz,p,q-1,r,P,Q,R, - nx_part,ny_part,nz_part,global_part); - offd_data[o_cnt++] = value[2] - 0.5 * beta / (double)(ny - 1); - } - } - if (ix > nx_part[p]) - { - diag_j[cnt] = row_index-1; - diag_data[cnt++] = value[1] - 0.5 * alpha / (double) (nx-1); - } - else - { - if (ix) - { - offd_j[o_cnt] = hypre_mapCD(ix-1,iy,iz,p-1,q,r,P,Q,R, - nx_part,ny_part,nz_part,global_part); - offd_data[o_cnt++] = value[1] - 0.5 * alpha / (double) (nx-1); - } - } - if (ix+1 < nx_part[p+1]) - { - diag_j[cnt] = row_index+1; - diag_data[cnt++] = value[1] + 0.5 * alpha / (double) (nx-1); - } - else - { - if (ix+1 < nx) - { - offd_j[o_cnt] = hypre_mapCD(ix+1,iy,iz,p+1,q,r,P,Q,R, - nx_part,ny_part,nz_part,global_part); - offd_data[o_cnt++] = value[1] + 0.5 * alpha / (double) (nx-1); - } - } - if (iy+1 < ny_part[q+1]) - { - diag_j[cnt] = row_index+nx_local; - diag_data[cnt++] = value[2] + 0.5 * beta / (double) (ny-1); - } - else - { - if (iy+1 < ny) - { - offd_j[o_cnt] = hypre_mapCD(ix,iy+1,iz,p,q+1,r,P,Q,R, - nx_part,ny_part,nz_part,global_part); - offd_data[o_cnt++] = value[2] + 0.5 * beta / (double) (ny-1); - } - } - if (iz+1 < nz_part[r+1]) - { - if (value[3] != 0.0) - { - diag_j[cnt] = row_index+nx_local*ny_local; - diag_data[cnt++] = value[3]; - } - } - else - { - if (iz+1 < nz) - { - if (value[3] != 0.0) - { - offd_j[o_cnt] = hypre_mapCD(ix,iy,iz+1,p,q,r+1,P,Q,R, - nx_part,ny_part,nz_part,global_part); - offd_data[o_cnt++] = value[3]; - } - } - } - row_index++; - } - } - } - - if (num_procs > 1) - { - for (i=0; i < num_cols_offd; i++) - col_map_offd[i] = offd_j[i]; - - qsort0(col_map_offd, 0, num_cols_offd-1); - - for (i=0; i < num_cols_offd; i++) - for (j=0; j < num_cols_offd; j++) - if (offd_j[i] == col_map_offd[j]) - { - offd_j[i] = j; - break; - } - } - - A = hypre_ParCSRMatrixCreate(comm, grid_size, grid_size, - global_part, global_part, num_cols_offd, - diag_i[local_num_rows], - offd_i[local_num_rows]); - - hypre_ParCSRMatrixColMapOffd(A) = col_map_offd; - - diag = hypre_ParCSRMatrixDiag(A); - hypre_CSRMatrixI(diag) = diag_i; - hypre_CSRMatrixJ(diag) = diag_j; - hypre_CSRMatrixData(diag) = diag_data; - - offd = hypre_ParCSRMatrixOffd(A); - hypre_CSRMatrixI(offd) = offd_i; - if (num_cols_offd) - { - hypre_CSRMatrixJ(offd) = offd_j; - hypre_CSRMatrixData(offd) = offd_data; - } - - hypre_TFree(nx_part, HYPRE_MEMORY_HOST); - hypre_TFree(ny_part, HYPRE_MEMORY_HOST); - hypre_TFree(nz_part, HYPRE_MEMORY_HOST); - - HYPRE_ParCSRMatrixGetRowPartitioning((HYPRE_ParCSRMatrix) A, &partition); - HYPRE_IJVectorCreate(comm, partition[my_id], partition[my_id+1]-1, &IJrhs); - free( partition ); - HYPRE_IJVectorSetObjectType(IJrhs, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(IJrhs); - HYPRE_IJVectorAssemble(IJrhs); - HYPRE_IJVectorGetObject(IJrhs, (void**) &rhs); - HYPRE_IJVectorSetObjectType(IJrhs, -1); - HYPRE_IJVectorDestroy(IJrhs); - hypre_ParVectorSetConstantValues( rhs, 1.0 ); - (*rA) = (HYPRE_ParCSRMatrix) A; - (*rrhs) = (HYPRE_ParVector) rhs; - return (0); -} - -/* ---------------------------------------------------------------- * - convection diffusion equation where (upwind difference) - * ---------------------------------------------------------------- */ - -int GenerateConvectionDiffusion3D2( MPI_Comm comm, int nx, int ny, int nz, - int P, int Q, int R, int p, int q, int r, double alpha, - double beta, double *value, HYPRE_ParCSRMatrix *rA, - HYPRE_ParVector *rrhs ) -{ - hypre_ParCSRMatrix *A; - hypre_CSRMatrix *diag, *offd; - HYPRE_IJVector IJrhs; - hypre_ParVector *rhs; - - int *diag_i, *diag_j, *offd_i, *offd_j; - double *diag_data, *offd_data; - int *global_part, ix, iy, iz, cnt, o_cnt, local_num_rows; - int *col_map_offd, row_index, i,j, *partition; - int nx_local, ny_local, nz_local; - int nx_size, ny_size, nz_size, num_cols_offd, grid_size; - int *nx_part, *ny_part, *nz_part; - int num_procs, my_id, P_busy, Q_busy, R_busy; - - MPI_Comm_size(comm,&num_procs); - MPI_Comm_rank(comm,&my_id); - -printf("nx,ny,nz = %d %d %d\n", nx, ny, nz); - grid_size = nx*ny*nz; - - hypre_GeneratePartitioning(nx,P,&nx_part); - hypre_GeneratePartitioning(ny,Q,&ny_part); - hypre_GeneratePartitioning(nz,R,&nz_part); - - global_part = hypre_CTAlloc(int, P*Q*R+1, HYPRE_MEMORY_HOST); - - global_part[0] = 0; - cnt = 1; - for (iz = 0; iz < R; iz++) - { - nz_size = nz_part[iz+1]-nz_part[iz]; - for (iy = 0; iy < Q; iy++) - { - ny_size = ny_part[iy+1]-ny_part[iy]; - for (ix = 0; ix < P; ix++) - { - nx_size = nx_part[ix+1] - nx_part[ix]; - global_part[cnt] = global_part[cnt-1]; - global_part[cnt++] += nx_size*ny_size*nz_size; - } - } - } - - nx_local = nx_part[p+1] - nx_part[p]; - ny_local = ny_part[q+1] - ny_part[q]; - nz_local = nz_part[r+1] - nz_part[r]; - - my_id = r*(P*Q) + q*P + p; - num_procs = P*Q*R; - - local_num_rows = nx_local*ny_local*nz_local; - diag_i = hypre_CTAlloc(int, local_num_rows+1, HYPRE_MEMORY_HOST); - offd_i = hypre_CTAlloc(int, local_num_rows+1, HYPRE_MEMORY_HOST); - - P_busy = hypre_min(nx,P); - Q_busy = hypre_min(ny,Q); - R_busy = hypre_min(nz,R); - - num_cols_offd = 0; - if (p) num_cols_offd += ny_local*nz_local; - if (p < P_busy-1) num_cols_offd += ny_local*nz_local; - if (q) num_cols_offd += nx_local*nz_local; - if (q < Q_busy-1) num_cols_offd += nx_local*nz_local; - if (r) num_cols_offd += nx_local*ny_local; - if (r < R_busy-1) num_cols_offd += nx_local*ny_local; - - if (!local_num_rows) num_cols_offd = 0; - - col_map_offd = hypre_CTAlloc(int, num_cols_offd, HYPRE_MEMORY_HOST); - - cnt = 1; - o_cnt = 1; - diag_i[0] = 0; - offd_i[0] = 0; - for (iz = nz_part[r]; iz < nz_part[r+1]; iz++) - { - for (iy = ny_part[q]; iy < ny_part[q+1]; iy++) - { - for (ix = nx_part[p]; ix < nx_part[p+1]; ix++) - { - diag_i[cnt] = diag_i[cnt-1]; - offd_i[o_cnt] = offd_i[o_cnt-1]; - diag_i[cnt]++; - if (iz > nz_part[r]) - diag_i[cnt]++; - else - { - if (iz) - { - offd_i[o_cnt]++; - } - } - if (iy > ny_part[q]) - diag_i[cnt]++; - else - { - if (iy) - { - offd_i[o_cnt]++; - } - } - if (ix > nx_part[p]) - diag_i[cnt]++; - else - { - if (ix) - { - offd_i[o_cnt]++; - } - } - if (ix+1 < nx_part[p+1]) - diag_i[cnt]++; - else - { - if (ix+1 < nx) - { - offd_i[o_cnt]++; - } - } - if (iy+1 < ny_part[q+1]) - diag_i[cnt]++; - else - { - if (iy+1 < ny) - { - offd_i[o_cnt]++; - } - } - if (iz+1 < nz_part[r+1]) - diag_i[cnt]++; - else - { - if (iz+1 < nz) - { - offd_i[o_cnt]++; - } - } - cnt++; - o_cnt++; - } - } - } - - diag_j = hypre_CTAlloc(int, diag_i[local_num_rows], HYPRE_MEMORY_HOST); - diag_data = hypre_CTAlloc(double, diag_i[local_num_rows], HYPRE_MEMORY_HOST); - - if (num_procs > 1) - { - offd_j = hypre_CTAlloc(int, offd_i[local_num_rows], HYPRE_MEMORY_HOST); - offd_data = hypre_CTAlloc(double, offd_i[local_num_rows], HYPRE_MEMORY_HOST); - } - - row_index = 0; - cnt = 0; - o_cnt = 0; - for (iz = nz_part[r]; iz < nz_part[r+1]; iz++) - { - for (iy = ny_part[q]; iy < ny_part[q+1]; iy++) - { - for (ix = nx_part[p]; ix < nx_part[p+1]; ix++) - { - diag_j[cnt] = row_index; - diag_data[cnt++] = value[0] + 0.5 * alpha / (double)(nx - 1) + - 0.5 * beta / (double) (ny - 1); - if (iz > nz_part[r]) - { - if (value[3] != 0.0) - { - diag_j[cnt] = row_index-nx_local*ny_local; - diag_data[cnt++] = value[3]; - } - } - else - { - if (iz) - { - if (value[3] != 0.0) - { - offd_j[o_cnt] = hypre_mapCD(ix,iy,iz-1,p,q,r-1,P,Q,R, - nx_part,ny_part,nz_part,global_part); - offd_data[o_cnt++] = value[3]; - } - } - } - if (iy > ny_part[q]) - { - diag_j[cnt] = row_index-nx_local; - diag_data[cnt++] = value[2] - 0.5 * beta / (double)(ny - 1); - } - else - { - if (iy) - { - offd_j[o_cnt] = hypre_mapCD(ix,iy-1,iz,p,q-1,r,P,Q,R, - nx_part,ny_part,nz_part,global_part); - offd_data[o_cnt++] = value[2] - 0.5 * beta / (double)(ny - 1); - } - } - if (ix > nx_part[p]) - { - diag_j[cnt] = row_index-1; - diag_data[cnt++] = value[1] - 0.5 * alpha / (double) (nx-1); - } - else - { - if (ix) - { - offd_j[o_cnt] = hypre_mapCD(ix-1,iy,iz,p-1,q,r,P,Q,R, - nx_part,ny_part,nz_part,global_part); - offd_data[o_cnt++] = value[1] - 0.5 * alpha / (double) (nx-1); - } - } - if (ix+1 < nx_part[p+1]) - { - diag_j[cnt] = row_index+1; - diag_data[cnt++] = value[1]; - } - else - { - if (ix+1 < nx) - { - offd_j[o_cnt] = hypre_mapCD(ix+1,iy,iz,p+1,q,r,P,Q,R, - nx_part,ny_part,nz_part,global_part); - offd_data[o_cnt++] = value[1]; - } - } - if (iy+1 < ny_part[q+1]) - { - diag_j[cnt] = row_index+nx_local; - diag_data[cnt++] = value[2]; - } - else - { - if (iy+1 < ny) - { - offd_j[o_cnt] = hypre_mapCD(ix,iy+1,iz,p,q+1,r,P,Q,R, - nx_part,ny_part,nz_part,global_part); - offd_data[o_cnt++] = value[2]; - } - } - if (iz+1 < nz_part[r+1]) - { - if (value[3] != 0.0) - { - diag_j[cnt] = row_index+nx_local*ny_local; - diag_data[cnt++] = value[3]; - } - } - else - { - if (iz+1 < nz) - { - if (value[3] != 0.0) - { - offd_j[o_cnt] = hypre_mapCD(ix,iy,iz+1,p,q,r+1,P,Q,R, - nx_part,ny_part,nz_part,global_part); - offd_data[o_cnt++] = value[3]; - } - } - } - row_index++; - } - } - } - - if (num_procs > 1) - { - for (i=0; i < num_cols_offd; i++) - col_map_offd[i] = offd_j[i]; - - qsort0(col_map_offd, 0, num_cols_offd-1); - - for (i=0; i < num_cols_offd; i++) - for (j=0; j < num_cols_offd; j++) - if (offd_j[i] == col_map_offd[j]) - { - offd_j[i] = j; - break; - } - } - - A = hypre_ParCSRMatrixCreate(comm, grid_size, grid_size, - global_part, global_part, num_cols_offd, - diag_i[local_num_rows], - offd_i[local_num_rows]); - - hypre_ParCSRMatrixColMapOffd(A) = col_map_offd; - - diag = hypre_ParCSRMatrixDiag(A); - hypre_CSRMatrixI(diag) = diag_i; - hypre_CSRMatrixJ(diag) = diag_j; - hypre_CSRMatrixData(diag) = diag_data; - - offd = hypre_ParCSRMatrixOffd(A); - hypre_CSRMatrixI(offd) = offd_i; - if (num_cols_offd) - { - hypre_CSRMatrixJ(offd) = offd_j; - hypre_CSRMatrixData(offd) = offd_data; - } - - hypre_TFree(nx_part, HYPRE_MEMORY_HOST); - hypre_TFree(ny_part, HYPRE_MEMORY_HOST); - hypre_TFree(nz_part, HYPRE_MEMORY_HOST); - - HYPRE_ParCSRMatrixGetRowPartitioning((HYPRE_ParCSRMatrix) A, &partition); - HYPRE_IJVectorCreate(comm, partition[my_id], partition[my_id+1]-1, &IJrhs); - free( partition ); - HYPRE_IJVectorSetObjectType(IJrhs, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(IJrhs); - HYPRE_IJVectorAssemble(IJrhs); - HYPRE_IJVectorGetObject(IJrhs, (void**) &rhs); - HYPRE_IJVectorSetObjectType(IJrhs, -1); - HYPRE_IJVectorDestroy(IJrhs); - hypre_ParVectorSetConstantValues( rhs, 1.0 ); - (*rA) = (HYPRE_ParCSRMatrix) A; - (*rrhs) = (HYPRE_ParVector) rhs; - return (0); -} -/* ---------------------------------------------------------------- * - convection diffusion equation - - epsilon del^2 u + a(x,y) u_x + b(x,y) u_y - a(x,y) = sin (L * pi/8), b(x,y) = cos(L*pi/8), L - input - * ---------------------------------------------------------------- */ - -int GenerateRugeStuben1(MPI_Comm comm, double Lval, double epsilon, int n, - HYPRE_ParCSRMatrix *rA, HYPRE_ParVector *rrhs) -{ - hypre_ParCSRMatrix *A; - hypre_ParVector *rhs; - hypre_CSRMatrix *diag, *offd; - HYPRE_IJVector IJrhs; - - int *diag_i, *diag_j, *offd_i, mypid; - double *diag_data, sum1, L=2.0; - - int *global_part, cnt, local_num_rows, *partition; - int row_index, i,j, grid_size; - double h, ac, bc, pi=3.1415928, mu_x, mu_y; - - h = 1.0 / (n + 1.0); - ac = sin(Lval * pi / 8.0); - bc = cos(Lval * pi / 8.0); - if ( ac * h >= epsilon ) mu_x = epsilon / ( 2 * ac * h ); - else if ( ac * h < - epsilon ) mu_x = 1 + epsilon / ( 2 * ac * h ); - else mu_x = 0.5; - if ( bc* h >= epsilon ) mu_y = epsilon / ( 2 * bc* h ); - else if ( bc* h < - epsilon ) mu_y = 1 + epsilon / ( 2 * bc* h ); - else mu_y = 0.5; - - grid_size = n * n; - global_part = hypre_CTAlloc(int, 2, HYPRE_MEMORY_HOST); - global_part[0] = 0; - global_part[1] = grid_size; - local_num_rows = grid_size; - diag_i = hypre_CTAlloc(int, local_num_rows+1, HYPRE_MEMORY_HOST); - offd_i = hypre_CTAlloc(int, local_num_rows+1, HYPRE_MEMORY_HOST); - for ( i = 0; i <= local_num_rows; i++ ) offd_i[i] = 0; - diag_j = hypre_CTAlloc(int, 5*local_num_rows, HYPRE_MEMORY_HOST); - diag_data = hypre_CTAlloc(double, 5*local_num_rows, HYPRE_MEMORY_HOST); - cnt = 0; - diag_i[0] = 0; - for ( j = 0; j < n; j++ ) - { - for ( i = 0; i < n; i++ ) - { - row_index = j * n + i; - cnt++; - sum1 = 0.0; - if ( j > 0 ) - { - diag_j[cnt] = row_index - n; - diag_data[cnt++] = - epsilon + bc * h * (mu_y - 1); - } - sum1 = sum1 + epsilon - bc * h * (mu_y - 1); - if ( i > 0 ) - { - diag_j[cnt] = row_index - 1; - diag_data[cnt++] = - epsilon + ac * h * (mu_x - 1); - } - sum1 = sum1 + epsilon - ac * h * (mu_x - 1); - if ( i < n-1 ) - { - diag_j[cnt] = row_index + 1; - diag_data[cnt++] = - epsilon + ac * h * mu_x; - } - sum1 = sum1 + epsilon - ac * h * mu_x; - if ( j < n-1 ) - { - diag_j[cnt] = row_index + n; - diag_data[cnt++] = - epsilon + bc * h * mu_y; - } - sum1 = sum1 + epsilon - bc * h * mu_y; - diag_j[diag_i[row_index]] = row_index; - diag_data[diag_i[row_index]] = sum1; - diag_i[row_index+1] = cnt; - } - } - - A = hypre_ParCSRMatrixCreate(comm, grid_size, grid_size, - global_part, global_part, 0, - diag_i[local_num_rows], - offd_i[local_num_rows]); -/* - hypre_ParCSRMatrixColMapOffd(A) = NULL; -*/ - diag = hypre_ParCSRMatrixDiag(A); - hypre_CSRMatrixI(diag) = diag_i; - hypre_CSRMatrixJ(diag) = diag_j; - hypre_CSRMatrixData(diag) = diag_data; - offd = hypre_ParCSRMatrixOffd(A); - hypre_CSRMatrixI(offd) = offd_i; - - HYPRE_ParCSRMatrixGetRowPartitioning((HYPRE_ParCSRMatrix) A, &partition); - MPI_Comm_rank(comm, &mypid); - HYPRE_IJVectorCreate(comm, partition[mypid], partition[mypid+1]-1, &IJrhs); - free( partition ); - HYPRE_IJVectorSetObjectType(IJrhs, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(IJrhs); - HYPRE_IJVectorAssemble(IJrhs); - HYPRE_IJVectorGetObject(IJrhs, (void**) &rhs); - HYPRE_IJVectorSetObjectType(IJrhs, -1); - HYPRE_IJVectorDestroy(IJrhs); - hypre_ParVectorSetConstantValues( rhs, 1.0 ); - (*rA) = (HYPRE_ParCSRMatrix) A; - (*rrhs) = (HYPRE_ParVector) rhs; - return (0); -} - -/* ---------------------------------------------------------------- * - convection diffusion equation - - epsilon del^2 u + a(x,y) u_x + b(x,y) u_y - a(x,y) = (2y-1)(1-x^2), b(x,y) = 2xy(y-1) - * ---------------------------------------------------------------- */ - -int GenerateRugeStuben2(MPI_Comm comm, double epsilon, int n, - HYPRE_ParCSRMatrix *rA, HYPRE_ParVector *rrhs) -{ - hypre_ParCSRMatrix *A; - hypre_CSRMatrix *diag, *offd; - hypre_ParVector *rhs; - HYPRE_IJVector IJrhs; - - int *diag_i, *diag_j, *offd_i; - double *diag_data, sum1; - - int *global_part, cnt, local_num_rows, *partition; - int mypid, row_index, i,j, grid_size; - double h, ac, bc, mu_x, mu_y; - - h = 1.0 / (n + 1.0); - - grid_size = n * n; - global_part = hypre_CTAlloc(int, 2, HYPRE_MEMORY_HOST); - global_part[0] = 0; - global_part[1] = grid_size; - local_num_rows = grid_size; - diag_i = hypre_CTAlloc(int, local_num_rows+1, HYPRE_MEMORY_HOST); - offd_i = hypre_CTAlloc(int, local_num_rows+1, HYPRE_MEMORY_HOST); - for ( i = 0; i <= local_num_rows; i++ ) offd_i[i] = 0; - diag_j = hypre_CTAlloc(int, 5*local_num_rows, HYPRE_MEMORY_HOST); - diag_data = hypre_CTAlloc(double, 5*local_num_rows, HYPRE_MEMORY_HOST); - cnt = 0; - diag_i[0] = 0; - for ( j = 0; j < n; j++ ) - { - for ( i = 0; i < n; i++ ) - { - row_index = j * n + i; - cnt++; - sum1 = 0.0; - ac = ( 2.0 * j * h - 1.0 ) * ( 1.0 - i * i * h * h ); - bc = 2.0 * i * h * j * h * ( j * h - 1.0); - if ( ac * h >= epsilon ) mu_x = epsilon / ( 2 * ac * h ); - else if ( ac * h < - epsilon ) mu_x = 1 + epsilon / ( 2 * ac * h ); - else mu_x = 0.5; - if ( bc* h > epsilon ) mu_y = epsilon / ( 2 * bc* h ); - else if ( bc* h < - epsilon ) mu_y = 1 + epsilon / ( 2 * bc* h ); - else mu_y = 0.5; - if ( j > 0 ) - { - diag_j[cnt] = row_index - n; - diag_data[cnt++] = - epsilon + bc * h * (mu_y - 1); - } - sum1 = sum1 + epsilon - bc * h * (mu_y - 1); - if ( i > 0 ) - { - diag_j[cnt] = row_index - 1; - diag_data[cnt++] = - epsilon + ac * h * (mu_x - 1); - } - sum1 = sum1 + epsilon - ac * h * (mu_x - 1); - if ( i < n-1 ) - { - diag_j[cnt] = row_index + 1; - diag_data[cnt++] = - epsilon + ac * h * mu_x; - } - sum1 = sum1 + epsilon - ac * h * mu_x; - if ( j < n-1 ) - { - diag_j[cnt] = row_index + n; - diag_data[cnt++] = - epsilon + bc * h * mu_y; - } - sum1 = sum1 + epsilon - bc * h * mu_y; - diag_j[diag_i[row_index]] = row_index; - diag_data[diag_i[row_index]] = sum1; - diag_i[row_index+1] = cnt; - } - } - - A = hypre_ParCSRMatrixCreate(comm, grid_size, grid_size, - global_part, global_part, 0, - diag_i[local_num_rows], - offd_i[local_num_rows]); -/* - hypre_ParCSRMatrixColMapOffd(A) = NULL; -*/ - diag = hypre_ParCSRMatrixDiag(A); - hypre_CSRMatrixI(diag) = diag_i; - hypre_CSRMatrixJ(diag) = diag_j; - hypre_CSRMatrixData(diag) = diag_data; - offd = hypre_ParCSRMatrixOffd(A); - hypre_CSRMatrixI(offd) = offd_i; - - HYPRE_ParCSRMatrixGetRowPartitioning((HYPRE_ParCSRMatrix) A, &partition); - MPI_Comm_rank(comm, &mypid); - HYPRE_IJVectorCreate(comm, partition[mypid], partition[mypid+1]-1, &IJrhs); - free( partition ); - HYPRE_IJVectorSetObjectType(IJrhs, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(IJrhs); - HYPRE_IJVectorAssemble(IJrhs); - HYPRE_IJVectorGetObject(IJrhs, (void**) &rhs); - HYPRE_IJVectorSetObjectType(IJrhs, -1); - HYPRE_IJVectorDestroy(IJrhs); - hypre_ParVectorSetConstantValues( rhs, 1.0 ); - (*rA) = (HYPRE_ParCSRMatrix) A; - (*rrhs) = (HYPRE_ParVector) rhs; - return (0); -} - -/* ---------------------------------------------------------------- * - convection diffusion equation - - epsilon del^2 u + a(x,y) u_x + b(x,y) u_y - a(x,y) = 4x(x-1)(1-2y), b(x,y) = -4y(y-1)(1-2x) - * ---------------------------------------------------------------- */ - -int GenerateRugeStuben3(MPI_Comm comm, double epsilon, int n, - HYPRE_ParCSRMatrix *rA,HYPRE_ParVector *rrhs) -{ - hypre_ParCSRMatrix *A; - hypre_CSRMatrix *diag, *offd; - hypre_ParVector *rhs; - HYPRE_IJVector IJrhs; - int *diag_i, *diag_j, *offd_i; - double *diag_data, sum1; - int *global_part, cnt, local_num_rows, *partition; - int row_index, i,j, grid_size, mypid, nprocs; - double h, ac, bc, mu_x, mu_y; - - MPI_Comm_size(comm, &nprocs); - if ( nprocs != 1 ) - { - printf("GenerateStuben ERROR : nprocs > 1\n"); - exit(1); - } - - h = 1.0 / (n + 1.0); - - grid_size = n * n; - global_part = hypre_CTAlloc(int, 2, HYPRE_MEMORY_HOST); - global_part[0] = 0; - global_part[1] = grid_size; - local_num_rows = grid_size; - diag_i = hypre_CTAlloc(int, local_num_rows+1, HYPRE_MEMORY_HOST); - offd_i = hypre_CTAlloc(int, local_num_rows+1, HYPRE_MEMORY_HOST); - for ( i = 0; i <= local_num_rows; i++ ) offd_i[i] = 0; - diag_j = hypre_CTAlloc(int, 5*local_num_rows, HYPRE_MEMORY_HOST); - diag_data = hypre_CTAlloc(double, 5*local_num_rows, HYPRE_MEMORY_HOST); - cnt = 0; - diag_i[0] = 0; - for ( j = 0; j < n; j++ ) - { - for ( i = 0; i < n; i++ ) - { - row_index = j * n + i; - cnt++; - sum1 = 0.0; - ac = 4.0 * i * h * ( i * h - 1.0 ) * ( 1.0 - 2 * j * h ); - bc = -4.0 * j * h * ( j * h - 1.0) * ( 1.0 - 2 * i * h ); - if ( ac * h >= epsilon ) mu_x = epsilon / ( 2 * ac * h ); - else if ( ac * h < - epsilon ) mu_x = 1 + epsilon / ( 2 * ac * h ); - else mu_x = 0.5; - if ( bc* h > epsilon ) mu_y = epsilon / ( 2 * bc* h ); - else if ( bc* h < - epsilon ) mu_y = 1 + epsilon / ( 2 * bc* h ); - else mu_y = 0.5; - if ( j > 0 ) - { - diag_j[cnt] = row_index - n; - diag_data[cnt++] = - epsilon + bc * h * (mu_y - 1); - } - sum1 = sum1 + epsilon - bc * h * (mu_y - 1); - if ( i > 0 ) - { - diag_j[cnt] = row_index - 1; - diag_data[cnt++] = - epsilon + ac * h * (mu_x - 1); - } - sum1 = sum1 + epsilon - ac * h * (mu_x - 1); - if ( i < n-1 ) - { - diag_j[cnt] = row_index + 1; - diag_data[cnt++] = - epsilon + ac * h * mu_x; - } - sum1 = sum1 + epsilon - ac * h * mu_x; - if ( j < n-1 ) - { - diag_j[cnt] = row_index + n; - diag_data[cnt++] = - epsilon + bc * h * mu_y; - } - sum1 = sum1 + epsilon - bc * h * mu_y; - diag_j[diag_i[row_index]] = row_index; - diag_data[diag_i[row_index]] = sum1; - diag_i[row_index+1] = cnt; - } - } - - A = hypre_ParCSRMatrixCreate(comm, grid_size, grid_size, - global_part, global_part, 0, - diag_i[local_num_rows], - offd_i[local_num_rows]); -/* - hypre_ParCSRMatrixColMapOffd(A) = NULL; -*/ - diag = hypre_ParCSRMatrixDiag(A); - hypre_CSRMatrixI(diag) = diag_i; - hypre_CSRMatrixJ(diag) = diag_j; - hypre_CSRMatrixData(diag) = diag_data; - offd = hypre_ParCSRMatrixOffd(A); - hypre_CSRMatrixI(offd) = offd_i; - - HYPRE_ParCSRMatrixGetRowPartitioning((HYPRE_ParCSRMatrix) A, &partition); - MPI_Comm_rank(comm, &mypid); - HYPRE_IJVectorCreate(comm, partition[mypid], partition[mypid+1]-1, &IJrhs); - free( partition ); - HYPRE_IJVectorSetObjectType(IJrhs, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(IJrhs); - HYPRE_IJVectorAssemble(IJrhs); - HYPRE_IJVectorGetObject(IJrhs, (void**) &rhs); - HYPRE_IJVectorSetObjectType(IJrhs, -1); - HYPRE_IJVectorDestroy(IJrhs); - hypre_ParVectorSetConstantValues( rhs, 1.0 ); - (*rA) = (HYPRE_ParCSRMatrix) A; - (*rrhs) = (HYPRE_ParVector) rhs; - return (0); -} - -/* ---------------------------------------------------------------- * - convection diffusion equation - - epsilon del^2 u + a(x,y) u_x + b(x,y) u_y - a(x,y) = -sin(pi*x)cos(pi*y), b(x,y)=sin(pi*y)cos(pi*x) - * ---------------------------------------------------------------- */ - -int GenerateStuben(MPI_Comm comm, double epsilon, int n, - HYPRE_ParCSRMatrix *rA, HYPRE_ParVector *rrhs) -{ - hypre_ParCSRMatrix *A; - hypre_CSRMatrix *diag, *offd; - int *diag_i, *diag_j, *offd_i; - double *diag_data, sum1, *rhsVec; - int *global_part, cnt, local_num_rows, *colInd; - int row_index, i,j, grid_size, mypid, nprocs, *partition; - double h, ac, bc, pi=3.1415928; - hypre_ParVector *rhs; - HYPRE_IJVector IJrhs; - - MPI_Comm_size(comm, &nprocs); - if ( nprocs != 1 ) - { - printf("GenerateStuben ERROR : nprocs > 1\n"); - exit(1); - } - MPI_Comm_rank(comm, &mypid); - - h = 1.0 / (n + 1.0); - - grid_size = n * n; - global_part = hypre_CTAlloc(int, 2, HYPRE_MEMORY_HOST); - global_part[0] = 0; - global_part[1] = grid_size; - local_num_rows = grid_size; - diag_i = hypre_CTAlloc(int, local_num_rows+1, HYPRE_MEMORY_HOST); - offd_i = hypre_CTAlloc(int, local_num_rows+1, HYPRE_MEMORY_HOST); - for ( i = 0; i <= local_num_rows; i++ ) offd_i[i] = 0; - diag_j = hypre_CTAlloc(int, 5*local_num_rows, HYPRE_MEMORY_HOST); - diag_data = hypre_CTAlloc(double, 5*local_num_rows, HYPRE_MEMORY_HOST); - cnt = 0; - diag_i[0] = 0; - rhsVec = hypre_TAlloc(double, grid_size , HYPRE_MEMORY_HOST); - for ( j = 0; j < n; j++ ) - { - for ( i = 0; i < n; i++ ) - { - row_index = j * n + i; - cnt++; - rhsVec[row_index] = 1.0; - sum1 = 0.0; - ac = - sin(pi*(i+0.5)*h) * cos(pi*(j+0.5)*h); - bc = sin(pi*(j+0.5)*h) * cos(pi*(i+0.5)*h); - if ( j > 0 ) - { - diag_j[cnt] = row_index - n; - diag_data[cnt++] = - epsilon - bc * h; - } - sum1 = sum1 + epsilon + bc * h; - if ( j == 0 ) - rhsVec[row_index] -= (epsilon+bc*h)* - (sin(pi*(i+1)*h)+sin(13.0*pi*(i+1)*h)); - if ( i > 0 ) - { - diag_j[cnt] = row_index - 1; - diag_data[cnt++] = - epsilon - ac * h; - } - sum1 = sum1 + epsilon + ac * h; - if ( i == 0 ) - rhsVec[row_index] -= (epsilon+ac*h)* - (sin(pi*(j+1)*h)+sin(13.0*pi*(j+1)*h)); - if ( i < n-1 ) - { - diag_j[cnt] = row_index + 1; - diag_data[cnt++] = - epsilon; - } - sum1 = sum1 + epsilon; - if ( i == (n-1) ) - rhsVec[row_index] -= epsilon * - (sin(pi*(j+1)*h)+sin(13.0*pi*(j+1)*h)); - if ( j < n-1 ) - { - diag_j[cnt] = row_index + n; - diag_data[cnt++] = - epsilon; - } - sum1 = sum1 + epsilon; - if ( j == (n-1) ) - rhsVec[row_index] -= epsilon * - (sin(pi*(i+1)*h)+sin(13.0*pi*(i+1)*h)); - diag_j[diag_i[row_index]] = row_index; - diag_data[diag_i[row_index]] = sum1; - diag_i[row_index+1] = cnt; - } - } - - A = hypre_ParCSRMatrixCreate(comm, grid_size, grid_size, - global_part, global_part, 0, - diag_i[local_num_rows], - offd_i[local_num_rows]); - diag = hypre_ParCSRMatrixDiag(A); - hypre_CSRMatrixI(diag) = diag_i; - hypre_CSRMatrixJ(diag) = diag_j; - hypre_CSRMatrixData(diag) = diag_data; - offd = hypre_ParCSRMatrixOffd(A); - hypre_CSRMatrixI(offd) = offd_i; - - HYPRE_ParCSRMatrixGetRowPartitioning((HYPRE_ParCSRMatrix) A, &partition); - HYPRE_IJVectorCreate(comm, partition[mypid], partition[mypid+1]-1, &IJrhs); - free( partition ); - HYPRE_IJVectorSetObjectType(IJrhs, HYPRE_PARCSR); - HYPRE_IJVectorInitialize(IJrhs); - colInd = hypre_TAlloc(int, grid_size , HYPRE_MEMORY_HOST); - for (j = 0; j < grid_size; j++) colInd[j] = j; - HYPRE_IJVectorSetValues(IJrhs, grid_size, (const int *) colInd, - (const double *) rhsVec); - free( colInd ); - free( rhsVec ); - HYPRE_IJVectorAssemble(IJrhs); - HYPRE_IJVectorGetObject(IJrhs, (void**) &rhs); - HYPRE_IJVectorSetObjectType(IJrhs, -1); - HYPRE_IJVectorDestroy(IJrhs); - hypre_ParVectorSetConstantValues( rhs, 1.0 ); - (*rA) = (HYPRE_ParCSRMatrix) A; - (*rrhs) = (HYPRE_ParVector) rhs; - return (0); -} - diff -Nru hypre-2.16.0/src/FEI_mv/femli/test/make.csh hypre-2.18.2/src/FEI_mv/femli/test/make.csh --- hypre-2.16.0/src/FEI_mv/femli/test/make.csh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/test/make.csh 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -#!/bin/csh -mpiCC -c -DHYPRE_TIMING -I../../../hypre/include -I.. -I../../.. driver.c -mpiCC -o driver driver.o -L../../../hypre/lib -L/usr/lib -lHYPRE -lHYPRE_superlu -lHYPRE_LSI -lg2c -lm - diff -Nru hypre-2.16.0/src/FEI_mv/femli/test/Makefile hypre-2.18.2/src/FEI_mv/femli/test/Makefile --- hypre-2.16.0/src/FEI_mv/femli/test/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/test/Makefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. -# -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - - - -include ../../../config/Makefile.config - - -CC= mpicc - -C_COMPILE_FLAGS=-O2 -LD_LINK_FLAGS= -CINCLUDES= -CDEFS = -DHYPRE_TIMING - -CFLAGS = \ - ${C_COMPILE_FLAGS}\ - -I..\ - -I$(srcdir)/..\ - -I../../../\ - -I../../../utilities\ - -I../../../parcsr_mv\ - -I../../../parcsr_ls\ - -I../../../krylov\ - -I../../../IJ_mv\ - -I../../../seq_mv\ - ${CINCLUDES}\ - ${CDEFS} - -MPILIBFLAGS = -LIBFLAGS = -lm -lg2c -LDLIBFLAGS = @LIBM@ -LAPACKLIBFLAGS = -L/usr/lib -L/usr/local/lib -llapack -BLASLIBFLAGS = ${BLASLIBDIRS} ${BLASLIBS} - - -################################################################## -# Targets -################################################################## - -all: driver - -install: - -clean: - @rm -f *.o - -distclean: clean - -################################################################## -# Rules -################################################################## - -driver: driver.o - @echo "Building" $@ "... " - ${CC} -o $@ $@.o ${MPILIBFLAGS} ${LIBFLAGS} ${LDLIBFLAGS} - @echo " " diff -Nru hypre-2.16.0/src/FEI_mv/femli/Usage_amgs hypre-2.18.2/src/FEI_mv/femli/Usage_amgs --- hypre-2.16.0/src/FEI_mv/femli/Usage_amgs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/Usage_amgs 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ To create the smoothed aggregation or Ruge Stuben AMG methods, diff -Nru hypre-2.16.0/src/FEI_mv/femli/Usage_solver hypre-2.18.2/src/FEI_mv/femli/Usage_solver --- hypre-2.16.0/src/FEI_mv/femli/Usage_solver 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/femli/Usage_solver 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ To create a smoother/solver, diff -Nru hypre-2.16.0/src/FEI_mv/Makefile hypre-2.18.2/src/FEI_mv/Makefile --- hypre-2.16.0/src/FEI_mv/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/jostle.h hypre-2.18.2/src/FEI_mv/ml/src/Include/jostle.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/jostle.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/jostle.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -extern void jostle_env(char*); - -extern void jostle_wrkspc_input(int*,char*); - -extern void jostle(int*,int*,int*,int*,int*, - int*,int*,int*,int*,int*,int*,int*,double*); - -extern void pjostle_init(int*,int*); -extern void pjostle(int*,int*,int*,int*,int*,int*,int*,int*, - int*,int*,int*,int*,int*,int*,int*,double*); - -extern int jostle_mem(void); -extern int jostle_cut(void); -extern double jostle_bal(void); -extern double jostle_tim(void); - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_1level.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_1level.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_1level.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_1level.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the ML_1Level structure */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : March, 1999 */ -/* ******************************************************************** */ - -#ifndef __ML1LEVEL__ -#define __ML1LEVEL__ - -/* ******************************************************************** */ -/* data structure type definition */ -/* ******************************************************************** */ - -typedef struct ML_1Level_Struct ML_1Level; - -/* ******************************************************************** */ -/* include files */ -/* ******************************************************************** */ - -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_bdrypts.h" -#include "ml_mapper.h" -#include "ml_grid.h" -#include "ml_comm.h" -#include "ml_comminfoop.h" -#include "ml_operator.h" -#include "ml_smoother.h" -#include "ml_csolve.h" -#include "ml_vec.h" - -/* ******************************************************************** */ -/* data definition for the ML_1Level Class */ -/* ******************************************************************** */ -/* -------------------------------------------------------------------- */ -/* This data structure defines the components of a grid level in a */ -/* multilevel environment. */ -/* -------------------------------------------------------------------- */ - -struct ML_1Level_Struct -{ - int id, levelnum; - ML_Operator *Amat, *Rmat, *Pmat; - ML_BdryPts *BCs; - ML_Mapper *eqn2grid; - ML_Mapper *grid2eqn; - ML_Grid *Grid; - ML_DVector *Amat_Normalization; - ML_Smoother *pre_smoother; - ML_Smoother *post_smoother; - ML_CSolve *csolve; - ML_Comm *comm; -}; - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_genP.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_genP.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_genP.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_genP.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,147 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ************************************************************************* */ -/* See the file COPYRIGHT for a complete copyright notice, contact person */ -/* and disclaimer. */ -/* ************************************************************************* */ - -/* ************************************************************************* */ -/* data structures to hold aggregation information */ -/* ************************************************************************* */ -/* Author : Ray Tuminaro (SNL), Charles Tong (LLNL) */ -/* Date : August, 1999 */ -/* ************************************************************************* */ - -#ifndef __MLGENP__ -#define __MLGENP__ - -#include "ml_common.h" -#include "ml_operator.h" -#include "ml_aggregate.h" - -/* ************************************************************************* */ -/* data structure to hold getrow function */ -/* ------------------------------------------------------------------------- */ - -struct ML_AGG_Matrix_Context -{ - ML_Operator *Amat; - double omega; - double drop_tol; - char *near_bdry; - int *aggr_info; -}; - -#define ML_POLY_ORDER_MAX 10 - -struct ML_Field_Of_Values -{ - double real_max; - double imag_max; - double eta; - int poly_order; - double R_coeff[ML_POLY_ORDER_MAX]; - double P_coeff[ML_POLY_ORDER_MAX]; - void * EigenList; - int choice; - int compute_field_of_values; - int compute_field_of_values_non_scaled; -}; - - - -/* ************************************************************************* */ -/* functions defined here */ -/* ************************************************************************* */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -/* ************************************************************************* */ -/* functions called by users */ -/* ------------------------------------------------------------------------- */ - -extern int ML_Gen_MGHierarchy_UsingAggregation(ML *, int start, - int increment_or_decrement, ML_Aggregate *); - -extern int ML_Gen_MultiLevelHierarchy_UsingSmoothedAggr_ReuseExistingAgg(ML *ml, - ML_Aggregate *ag); - -/* ************************************************************************* */ -/* internal functions called by developers */ -/* ------------------------------------------------------------------------- */ - -extern int ML_Gen_MGHierarchy(ML *, int fine_level, - int (*next_level)(ML *, int, void *), - int (*user_gen_prolongator)(ML *,int,int,void *), - void *data, ML_Aggregate *); -extern int ML_AGG_Gen_Prolongator(ML*,int ,int,void *data); -extern int ML_AGG_Gen_Prolongator_MinEnergy(ML*,int ,int,void *data); -extern int ML_AGG_Gen_Restriction_MinEnergy(ML*,int ,int,void *data); -extern int ML_AGG_Increment_Level(ML *, int current_level, void *); -extern int ML_AGG_Decrement_Level(ML *, int current_level, void *); -extern int ML_AGG_Increment_Two_Level(ML *, int current_level, void *); -extern int ML_AGG_Decrement_Two_Level(ML *, int current_level, void *); -extern int ML_AGG_JacobiSmoother_Getrows(ML_Operator *data, int N_requested_rows, - int requested_rows[], int allocated_space, int columns[], - double values[], int row_lengths[]); -extern int ML_AGG_Compute_Near_Bdry(ML_Operator *Amatrix, char *near_bdry); -extern int ML_AGG_Gen_DDProlongator(ML*,int ,int,void *data); -extern int ML_AGG_Gen_DDProlongator2(ML *ml,int level, int clevel, void *data); -extern int ML_AGG_DD_Matvec(ML_Operator *, int , double *, int, double *); -extern int ML_AGG_DD_Getrow(ML_Operator *,int, int *, int, int *, double *, int *); -extern int ML_AGG_Extract_Diag( ML_Operator *, double *diag); -extern void ML_AGG_Matrix_Context_Clean(void *data); -extern int ML_AGG_DD_Solve(void *data, int, double *, int, double *); -extern int ML_AGG_Extract_Matrix(ML_Operator *mat, int *, int **, double ***); -extern int ML_AGG_Smoother_Wrapper(void *obj, int leng1, double *outvec, - int leng2, double *invec); -extern int ML_Gen_MGHierarchy_ReuseExistingOperators(ML *ml ); -extern int ML_Gen_MGHierarchy_UsingSmoothedAggr_ReuseExistingAgg(ML *ml, - ML_Aggregate *ag); - -extern int ML_AGG_Amat_Getrows(ML_Operator *data, int N_requested_rows, - int requested_rows[], int allocated_space, int columns[], - double values[], int row_lengths[]); -extern int ML_AGG_DinvP(ML_Operator *Ptemp, struct MLSthing *mls_widget, - int blk_size); - - -extern int ML_Gen_MultiLevelHierarchy(ML *ml, int fine_level, - int (*user_next_level)(ML *, int, void *), - int (*user_gen_restriction)(ML *, int, int, void *), - int (*user_gen_prolongator)(ML *, int, int, void *), - void *user_data); -extern int ML_Gen_MultiLevelHierarchy_UsingAggregation(ML *ml, int start, - int increment_or_decrement, - ML_Aggregate *ag); -extern int ML_MultiLevel_Gen_Prolongator(ML *ml,int level, int clevel, void *data); -extern int ML_MultiLevel_Gen_Restriction(ML *ml,int level, int clevel, void *data); -extern void ML_Project_Coordinates(ML_Operator* Amat, ML_Operator* Pmat, - ML_Operator* Cmat); - - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_info.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_info.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_info.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_info.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/********************************************************************* */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/********************************************************************* */ -/* some information about the aggregates */ -/********************************************************************* */ - -#ifndef __MLAGGINFO__ -#define __MLAGGINFO__ - - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - - /* function ML_Aggregate_VizAndStats_Setup and ML_Aggregate_VizAndStats_Clean - are declared in ml_aggregate.h */ - - extern void ML_Aggregate_ComputeRadius( ML_Aggregate_Viz_Stats finer_level, - ML_Aggregate_Viz_Stats coarser_level, - double R[] ); - extern void ML_Aggregate_ComputeBox( ML_Aggregate_Viz_Stats finer_level,int, - double R[], int,ML_Comm * comm ); - extern void ML_Aggregate_ComputeCenterOfGravity( ML_Aggregate_Viz_Stats finer_level, - ML_Aggregate_Viz_Stats coarser_level, - ML_Comm * comm); - extern void ML_Aggregate_ComputeVolume( int N_fine, - int N_aggregates, - int graph_decomposition[], - int local_or_global, - double volume[], - double V[] ); - extern void ML_Aggregate_AnalyzeLocalGraphDec( int N_aggregates, - int *nodes_per_aggregate, - int *min_loc_aggre, - int *max_loc_aggre, - double *avg_loc_aggre, - double *std_loc_aggre, - ML_Comm *comm ); - extern void ML_Aggregate_AnalyzeVector( int Nlocal, - double vector[], - double *min_vec, - double *max_vec, - double *avg_vec, - double *std_vec, - ML_Comm *comm ); - extern void ML_Aggregate_CountLocal( int N_fine, int graph_decomposition[], - int N_aggregates, int nodes_per_aggregate[] ); - extern int ML_Aggregate_Viz_Stats_SetUpLevel( ML_Aggregate_Viz_Stats finer_level, - ML_Aggregate_Viz_Stats *coarser_level, - int dim ); - extern int ML_Aggregate_VizAndStats_Compute( ML *ml, ML_Aggregate *ag, int MaxMgLevels, - double *x, double *y, double *z, int Ndimensions, - char *base_filename ); - extern int ML_Info_DomainDecomp( ML_Aggregate_Viz_Stats info, - ML_Comm *comm, double *H, double *h ); - extern int ML_Compute_AggregateGraphRadius( int Nrows, int ia[], int ja[], - int dep [], - int *pradius, int *pNcenter ); - extern int ML_Aggregate_Stats_ComputeCoordinates( ML *ml, ML_Aggregate *ag, - double *x, double *y, double *z); - extern int ML_Aggregate_Stats_CopyCoordinates( ML *ml, ML_Aggregate *ag, - double *x, double *y, double *z); - extern int ML_Aggregate_Stats_Analyze( ML *ml, ML_Aggregate *ag); - extern int ML_Aggregate_Viz( ML *ml, ML_Aggregate *ag, int choice, - double *, char * base_filename, int level); - extern int ML_Aggregate_Viz_Amalgamate( ML *ml, ML_Aggregate *ag); - extern int ML_Aggregate_Viz_UnAmalgamate( ML *ml, ML_Aggregate *ag); - extern int ML_Aggregate_Stats_CleanUp_Info( ML *ml); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif /* #ifndef __MLAGGMETIS__ */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_METIS.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_METIS.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_METIS.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_METIS.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/********************************************************************* */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/********************************************************************* */ -/* Decomposition with METIS */ -/********************************************************************* */ - -#ifndef __MLAGGMETIS__ -#define __MLAGGMETIS__ - -/*MS*/ -#define ML_AGGREGATE_OPTIONS_ID 13579 - -/* undefined will be a negative number */ -#define ML_NUM_LOCAL_AGGREGATES 0 -#define ML_NUM_GLOBAL_AGGREGATES 1 -#define ML_NUM_NODES_PER_AGGREGATE 2 - -typedef struct ML_Aggregate_Options_Struct -{ - int id; - int Naggregates_local; - int Nnodes_per_aggregate; - int Naggregates_global; - int choice; - int reordering_flag; - int desired_aggre_per_proc; /* for ParMETIS */ -} ML_Aggregate_Options; -/*ms*/ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - - extern int ML_Aggregate_Options_Defaults( ML_Aggregate_Options * pointer, - int NumLevels ); - - extern int ML_Aggregate_Set_NodesPerAggr( ML *ml, ML_Aggregate *ag, - int level, int nodes_per_aggre ); - extern int ML_Aggregate_Set_LocalNumber( ML *ml, ML_Aggregate *ag, - int level, int Nlocal ); - extern int ML_Aggregate_Set_GlobalNumber( ML *ml, ML_Aggregate *ag, - int level, int Nglobal ); - extern int ML_Aggregate_Set_ReorderingFlag( ML *ml, ML_Aggregate *ag, - int level, int reordering_flag); - extern int ML_Aggregate_CoarsenMETIS( ML_Aggregate *ml_ag, - ML_Operator *Amatrix, - ML_Operator **Pmatrix, ML_Comm *comm); - extern int ML_DecomposeGraph_BuildOffsets( int N_parts, - int offsets[], - int N_procs, - USR_COMM comm); - extern int ML_Aggregate_Set_OptimalNumberOfNodesPerAggregate( int optimal_value ); - extern int ML_Aggregate_Get_OptimalNumberOfNodesPerAggregate( ); - - extern int ML_Aggregate_Set_UseDropping(int i); - - extern int ML_Aggregate_Get_UseDropping(); - - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif /* #ifndef __MLAGGMETIS__ */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_min_energy.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_min_energy.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_min_energy.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_min_energy.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#ifndef ML_AGG_MIN_ENERGY -#define ML_AGG_MIN_ENERGY - -#include "ml_common.h" -#include "ml_include.h" - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif - -int ML_AGG_Gen_Prolongator_MinEnergy(ML *ml,int level, int clevel, void *data); -int ML_AGG_Gen_Restriction_MinEnergy(ML *ml,int level, int clevel, void *data); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_ParMETIS.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_ParMETIS.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_ParMETIS.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_ParMETIS.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/********************************************************************* */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/********************************************************************* */ -/* Decomposition with METIS */ -/********************************************************************* */ - -#ifndef __MLAGGPARMETIS__ -#define __MLAGGPARMETIS__ - -#include "ml_comm.h" - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - - - extern int ML_Aggregate_Set_ReqLocalCoarseSize( ML *ml, ML_Aggregate *ag, - int level, - int desired_aggre_per_proc ); - extern int ML_DecomposeGraph_BuildOffsets( int N_parts, - int offsets[], - int N_procs, USR_COMM ); - extern int ML_Aggregate_Set_OptimalNumberOfNodesPerAggregate( int optimal_value ); - extern int ML_Aggregate_Set_ReqLocalCoarseSize( ML *ml, ML_Aggregate *ag, - int level, - int desired_aggre_per_proc ); - extern int ML_Aggregate_CoarsenParMETIS( ML_Aggregate *ml_ag, - ML_Operator *Amatrix, - ML_Operator **Pmatrix, - ML_Comm *comm); - extern int ML_Aggregate_Set_OptimalNumberOfNodesPerAggregate( int optimal_value ); - extern int ML_Aggregate_Get_OptimalNumberOfNodesPerAggregate( ); - - extern int ML_CountNodesPerAggre(int Nrows, int GraphDecomposition[], - int Naggre, int * NnodesPerAggre, - USR_COMM Comm); - - extern int ML_BuildReorderedOffset( int starting_offset[], - int desired_aggre_per_proc, int Nprocs, - int nodes_per_aggre[], int Naggregates, - int reordered_offset[], int mypid ); - - /* those are coded in ml_agg_METIS.c */ - extern int ML_Aggregate_Set_UseDropping(int i); - - extern int ML_Aggregate_Get_UseDropping(); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif /* #ifndef __MLAGGPARMETIS__ */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_aggregate.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_aggregate.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_aggregate.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_aggregate.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,445 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ************************************************************************* */ -/* See the file COPYRIGHT for a complete copyright notice, contact person */ -/* and disclaimer. */ -/* ************************************************************************* */ - -/* ************************************************************************* */ -/* data structure to hold aggregation information */ -/* ************************************************************************* */ -/* Author : Charles Tong (LLNL) */ -/* Date : August, 1999 */ -/* ************************************************************************* */ - -#ifndef __MLAGGH__ -#define __MLAGGH__ - -#include -/* #include */ - -#define ML_AGGR_UNCOUPLED 1 -#define ML_AGGR_COUPLED 2 -#define ML_AGGR_MIS 3 -#define ML_AGGR_DD 4 -#define ML_AGGR_HYBRIDUC 5 -#define ML_AGGR_HYBRIDUM 6 -/*MS*/ -#define ML_AGGR_METIS 7 -#define ML_AGGR_PARMETIS 8 -#define ML_AGGR_ZOLTAN 9 -#define ML_AGGR_VBMETIS 10 /*mgee*/ -#define ML_AGGR_USER 11 -/*ms*/ - -/* ************************************************************************* */ -/** definition of the aggregate structure */ -/* ------------------------------------------------------------------------- */ - -typedef struct ML_Aggregate_Struct -{ - int ML_id; - double print_flag; - int max_coarse_size; /**< maximum size of coarsest grid */ - int ordering; /**< natural, random, graph */ - int min_nodes_per_aggregate; /**< aggregate size control */ - int max_neigh_already_selected; /**< complexity control */ - double threshold; /**< for pruning matrix */ - double curr_threshold; /**< adjusted for levels */ - double drop_tol_for_smoothing; /**< self-explanatory */ - int attach_scheme; /**< aggregate shape control */ - int spectral_radius_scheme; /**< way to compute approx maxeigen*/ - double smoothP_damping_factor; /**< for prolongator smoother */ - int smoothP_type; /**< point, block */ - int coarsen_scheme; /**< Uncoupled, Coupled, MIS */ - int * coarsen_scheme_level; - int num_PDE_eqns; /**< block size */ - int nullspace_dim; /**< self-explanatory */ - double *nullspace_vect; /**< for null space vectors */ - int nullspace_corrupted; /**< indicates whether fine grid */ - /**< nullspace has been overwritten*/ - int *aggr_count; /**< no. aggregates at each level */ - int keep_agg_information; /**< 1: keep aggr_info */ - /**< otherwise: free it */ - int **aggr_info; /**< node to aggregate map */ - int max_levels; /**< maximum number of levels */ - int begin_level; /**< finest grid level */ - int cur_level; /**< temporary variable */ - double operator_complexity; /**< sum of nnz for all A's */ - double fine_complexity; /**< nnz of the finest A */ - int nvblocks; /**< for variable blocks (finest) */ - int *vblock_info; /**< for variable blocks (finest) */ - int keep_P_tentative; /**< keeping tentative prolongator */ - struct ML_Operator_Struct **P_tentative; /**< so it can be reused later.*/ - int smooth_existing_P_tentative; /**< already have P tent, don't create it*/ - int use_transpose; /**< Used to build restriction by doing */ - int Restriction_smoothagg_transpose; /**< smoothed aggregation on A^T */ -/*MS*/ - void *aggr_options; /**< option about METIS and ParMETIS */ - void *aggr_viz_and_stats; /**< information about the aggregates */ - /**< only if the user explicitely - < requires them */ - void * field_of_values; - int block_scaled_SA; /**< = 1 indicates that the prolongator - smoother should use block diagonal - scaling (blocksize = num_PDE_eqns) */ - - double phase3_agg_creation; /**< Steers how the MIS and Uncoupled - handle phase 3 of aggregation. - Values near 0 create few additional - aggregates.Large values create many - additional aggregates. Convergence - can be improve convergence by new - aggregates but nonzero fill-in - increases on coarse meshes. - Default: .5 */ - double **nodal_coord; /**< Coordinates of fine-grid nodes - and aggregates */ - int N_dimensions; -/*ms*/ -/*mgee*/ - void *vblock_data; /**< holds data structure aggr_vblock */ - int minimizing_energy; - -} ML_Aggregate; - -/* ************************************************************************* */ -/* other ML include files */ -/* ------------------------------------------------------------------------- */ - -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_comm.h" -#include "ml_memory.h" -#include "ml_operator.h" - - -/* ************************************************************************* */ -/* linked list structures for holding free node information */ -/* ------------------------------------------------------------------------- */ - -typedef struct ML_Node_Struct -{ - int node_id; - struct ML_Node_Struct *next; -} ML_Node; - -/* ************************************************************************* */ -/* definition of the structure for holding aggregate information */ -/* ------------------------------------------------------------------------- */ - -typedef struct ML_SuperNode_Struct -{ - int length; - int maxlength; - int index; - int *list; - struct ML_SuperNode_Struct *next; - -} ML_SuperNode; - -/* ************************************************************************* */ -/* definition of the structure for holding communication information in */ -/* aggregation procedure */ -/* ------------------------------------------------------------------------- */ - -typedef struct ML_Aggregate_Comm_Struct -{ - int N_send_neighbors, N_recv_neighbors; - int local_nrows; - int *send_neighbors, *recv_neighbors; - int *send_leng, *recv_leng; - int *send_list; - ML_Comm *comm; - -} ML_Aggregate_Comm; - -typedef struct ML_agg_indx_comm_struct { - int N_neighbors; - int *temp_leng, *send_leng, *recv_leng, *send_list, *recv_list, *tem2_index, - *neighbors, *temp_index; -} ML_agg_indx_comm; - -/* ************************************************************************* */ -/* ************************************************************************* */ -/* functions to manipulate the aggregate data structure */ -/* ------------------------------------------------------------------------- */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif - -/* ------------------------------------------------------------------------- */ -/* constructor/destructor and level control */ -/* ------------------------------------------------------------------------- */ - -int ML_Aggregate_Create( ML_Aggregate ** ); -int ML_Aggregate_Destroy( ML_Aggregate ** ); - -int ML_Aggregate_Set_OutputLevel( ML_Aggregate *, double level ); -int ML_Aggregate_Set_Reuse(ML_Aggregate *ag); - -int ML_Aggregate_Set_MaxLevels( ML_Aggregate *, int level ); -int ML_Aggregate_Set_CurrentLevel( ML_Aggregate *, int level ); -int ML_Aggregate_Set_StartLevel( ML_Aggregate *, int level ); - -/* ------------------------------------------------------------------------- */ -/* aggregate size and shape control */ -/* ------------------------------------------------------------------------- */ - -int ML_Aggregate_Set_MinNodesPerAggregate(ML_Aggregate *,int n); -int ML_Aggregate_Set_AttachScheme_MaxLink( ML_Aggregate * ); -int ML_Aggregate_Set_AttachScheme_MinRank( ML_Aggregate * ); -int ML_Aggregate_Set_Phase3AggregateCreationAggressiveness( - ML_Aggregate *ag, double factor); - -/* ------------------------------------------------------------------------- */ -/* aggregation node traversal control */ -/* ------------------------------------------------------------------------- */ - -int ML_Aggregate_Set_NaturalOrdering( ML_Aggregate * ); -int ML_Aggregate_Set_RandomOrdering( ML_Aggregate * ); -int ML_Aggregate_Set_GraphOrdering( ML_Aggregate * ); - -/* ------------------------------------------------------------------------- */ -/* control when to stop coarsening */ -/* ------------------------------------------------------------------------- */ - -int ML_Aggregate_Set_MaxCoarseSize( ML_Aggregate *, int size ); - -/* ------------------------------------------------------------------------- */ -/* different parallel coarsening schemes */ -/* ------------------------------------------------------------------------- */ - -int ML_Aggregate_Set_CoarsenScheme_Uncoupled( ML_Aggregate * ); -int ML_Aggregate_Set_CoarsenScheme_Coupled( ML_Aggregate * ); -int ML_Aggregate_Set_CoarsenScheme_MIS( ML_Aggregate *ag ); -int ML_Aggregate_Set_CoarsenScheme_DD( ML_Aggregate *ag ); -int ML_Aggregate_Set_CoarsenScheme_UncoupledMIS( ML_Aggregate *ag ); -int ML_Aggregate_Set_CoarsenScheme_UncoupledCoupled( ML_Aggregate *ag ); -int ML_Aggregate_Set_CoarsenScheme_METIS( ML_Aggregate *ag ); -int ML_Aggregate_Set_CoarsenScheme_ParMETIS( ML_Aggregate *ag ); -int ML_Aggregate_Set_CoarsenScheme_Zoltan( ML_Aggregate *ag ); -int ML_Aggregate_Set_CoarsenScheme_User( ML_Aggregate *ag ); -int ML_Aggregate_Phase2_3_Cleanup(ML_Aggregate *ml_ag, ML_Operator *Amatrix, - int *aggr_count, int nvertices, - int *aggr_index, int exp_Nrows, - ML_Comm *comm, char *input_bdry,char *label, - ML_agg_indx_comm *); -int ML_Aggregate_Set_CoarsenSchemeLevel( int level, int, ML_Aggregate *ag, - int choice ); -int ML_Aggregate_Set_CoarsenSchemeLevel_Coupled( int level, int, ML_Aggregate *ag ); -int ML_Aggregate_Set_CoarsenSchemeLevel_Uncoupled( int level, int, ML_Aggregate *ag ); -int ML_Aggregate_Set_CoarsenSchemeLevel_MIS( int level, int, ML_Aggregate *ag ); -int ML_Aggregate_Set_CoarsenSchemeLevel_METIS( int level, int, ML_Aggregate *ag ); -int ML_Aggregate_Set_CoarsenSchemeLevel_ParMETIS( int level, int, ML_Aggregate *ag ); -int ML_Aggregate_Set_CoarsenSchemeLevel_Zoltan( int level, int, ML_Aggregate *ag ); -int ML_Aggregate_Set_CoarsenSchemeLevel_User( int level, int, ML_Aggregate *ag ); - -/* ------------------------------------------------------------------------- */ -/* set threshold for pruning matrix graph */ -/* ------------------------------------------------------------------------- */ - -int ML_Aggregate_Set_Threshold( ML_Aggregate *, double epsilon ); -int ML_Aggregate_Reset_Threshold( ML_Aggregate * ); - -/* ------------------------------------------------------------------------- */ -/* whether to smooth existing tentative prolongator */ -/* ------------------------------------------------------------------------- */ - -extern int ML_Aggregate_Set_Flag_SmoothExistingTentativeP( ML_Aggregate *, int); -extern int ML_Aggregate_Get_Flag_SmoothExistingTentativeP( ML_Aggregate *); - -/* ------------------------------------------------------------------------- */ -/* damping factor for prolongator smoother */ -/* ------------------------------------------------------------------------- */ - -int ML_Aggregate_Set_DampingFactor( ML_Aggregate *, double factor ); -int ML_Aggregate_Set_PSmootherType( ML_Aggregate *, int stype ); -int ML_Aggregate_Set_PointDiagScaling( ML_Aggregate *ag); -int ML_Aggregate_Set_BlockDiagScaling( ML_Aggregate *ag); - -/* ------------------------------------------------------------------------- */ -/* set up scheme to compute spectral radius of A at each level */ -/* ------------------------------------------------------------------------- */ - -int ML_Aggregate_Set_SpectralNormScheme_Calc( ML_Aggregate * ); -int ML_Aggregate_Set_SpectralNormScheme_Anorm( ML_Aggregate * ); -int ML_Aggregate_Set_SpectralNormScheme_Anasazi( ML_Aggregate * ); -int ML_Aggregate_Set_SpectralNormScheme_PowerMethod( ML_Aggregate *ag); - -/* ------------------------------------------------------------------------- */ -/* accessing aggregation information */ -/* ------------------------------------------------------------------------- */ - -int ML_Aggregate_Get_AggrCount( ML_Aggregate *, int level ); -int ML_Aggregate_Get_AggrMap( ML_Aggregate *, int level, int**); -extern int ML_Gen_Blocks_Aggregates(ML_Aggregate *ag, int level, - int *nblocks, int **block_list); - - -/* ------------------------------------------------------------------------- */ -/* set null space for the finest grid */ -/* ------------------------------------------------------------------------- */ - -int ML_Aggregate_Set_NullSpace(ML_Aggregate *, int, int, double *, int); -int ML_Aggregate_Scale_NullSpace(ML_Aggregate *ag, double *scale_vect, - int length); - -int ML_Aggregate_Coarsen( ML_Aggregate *, ML_Operator *A, - ML_Operator **P, ML_Comm *comm ); - -/* ------------------------------------------------------------------------- */ -/* functions for performing aggregation */ -/* ------------------------------------------------------------------------- */ - -int ML_Aggregate_CoarsenMIS(ML_Aggregate *ml_ag,ML_Operator *Amatrix, - ML_Operator **Pmatrix, ML_Comm *comm); - -int ML_Aggregate_CoarsenDomainDecomp(ML_Aggregate *ml_ag, - ML_Operator *Amatrix, ML_Operator **Pmatrix, ML_Comm *comm); - -int ML_Aggregate_CoarsenUncoupled(ML_Aggregate *ml_ag, - ML_Operator *Amatrix, ML_Operator **Pmatrix, ML_Comm *comm); - -int ML_Aggregate_CoarsenCoupled(ML_Aggregate *ml_ag, - ML_Operator *Amatrix, ML_Operator **Pmatrix, ML_Comm *comm); - -int ML_Aggregate_CoarsenMETIS(ML_Aggregate *ml_ag, - ML_Operator *Amatrix, ML_Operator **Pmatrix, ML_Comm *comm); - -int ML_Aggregate_CoarsenParMETIS(ML_Aggregate *ml_ag, - ML_Operator *Amatrix, ML_Operator **Pmatrix, ML_Comm *comm); - - /* ------------------------------------------------------------------------- */ -/* miscellaneous local functions */ -/* ------------------------------------------------------------------------- */ -int ML_Aggregate_KeepInfo(ML_Aggregate *ag, int value); -int ML_Aggregate_LabelVertices(int, int *, int, char *,char *,int, - int *, int *, int, int **, int, int **, int *, int *, - int, int **, int *, int *, int **, int, ML_Comm *, int *); - -int ML_Aggregate_UpdateVertexStates(int N_remaining_vertices, - char vertex_state[], int recv_cnt, int recv_proc[], - int recv_leng[], int **recv_buf, int **recv_list, - int proc_flag[], int *NremainingRcvProcs, int send_cnt, - int send_proc[], int send_leng[], int **send_buf, - int *send_flag, USR_REQ *Request, ML_Comm *comm, int); - -int ML_Aggregate_ExchangeBdry(double *data, void *comm); - -int ML_Aggregate_ExchangeData(char *rbuf, char *sbuf, int N_neigh, - int *neigh, int *rleng, int *sleng, - int msgid, int datatype, ML_Comm *comm); - -int ML_aggr_index_communicate(int N_neighbors, int temp_leng[], int send_leng[], - int recv_leng[], int send_list[], int recv_list[], - int nvertices, - ML_Comm *comm, int aggr_index[], int msgtype, - int tem2_index[], int neighbors[], int temp_index[],int); - - - - -int ML_Aggregate_Print(ML_Aggregate *); -int ML_Aggregate_Print_Complexity(ML_Aggregate *); - -void ML_CSR_MSR_ML_memorydata_Destroy(void *data); - - -/* ************************************************************************* */ -/* internal function defined later on in this file */ -/* ------------------------------------------------------------------------- */ - -extern int ML_modified_matvec(void *Amat_in, int, double *,int , double *,int); -extern int ML_random_global_subset(ML_Operator *Amat, double reduction, - int **list, int *length, int num_PDE_eqns); -extern int ML_repartition_matrix(ML_Operator *mat, ML_Operator **new_mat, - ML_Operator **permutation, - ML_Operator **permt, int num_PDE_eqns,int, - double *, double *, double *, int, - ML_Partitioner); -extern ML_Operator** ML_repartition_Acoarse(ML *ml, int fine, int coarse, - ML_Aggregate *ag, int R_is_Ptranspose, int ReturnPerm); - - - -int ML_Aggregate_Compress_Matrix(ML_GetrowFunc *getrow_obj, int *mat_indx, - int num_PDEs, ML_Comm *comm, int **new_mat_indx, - int *N_neighbors, int **neighbors, int **recv_leng, - int **send_leng, int **send_list, int **recv_list, int *bc_array); -int ML_Aggregate_CoarsenCoupledCore(ML_Aggregate *, ML_Comm *comm, - int *amal_mat_indx, int *aggr_count, int **aggr_index2, - int N_neighbors, int *neighbors, int *recv_leng, int *send_leng, - int *send_list,int *,int **, int *bc_array); -int ML_Aggregate_ExchangeStatus(char *recvbuf, char *sendbuf, - int N_neighbors, int *neighbors, int *recv_leng, - int *send_leng, int *recv_list, int Nrows, int msgid, - int datatype, ML_Comm *comm); -int ML_Aggregate_ComposeExpandedCommInfo(ML_GetrowFunc *getrow_obj, - int num_PDEs, ML_Comm *comm, - int *new_N_neighbors, int **new_neighbors, int **new_recv_leng, - int **new_send_leng, int **new_send_list, int **new_recv_list); -int ML_Aggregate_ComposeRecvFromSend(int nprocs, int mypid, int new_N_send, - int *new_send_leng, int *new_send_neighbors, int *N_rcv, - int **recv_leng, int **recv_neighbors, ML_Comm *comm); -int ML_Aggregate_Form_Aggregates(int phaseID, int phaseAFlag, int Nrows, - int *mat_indx, int *aggr_index, int *aggr_stat, - int *node_type, int *node_type2, int *order_array, - int *aggr_count_in, int *aggr_cnt_leng_in, - int **aggr_cnt_array_in, int max_row_nnz, int min_agg_size, - int max_neigh_selected, int N_neighbors, int *neighbors, - int *send_leng, int *send_list, int *recv_leng, int *recv_list, - int *sendlist_proc, ML_Comm *comm, double printflag); -int ML_Aggregate_PutInto_Aggregates(char phaseID, int attach_scheme, - int *mat_indx, int *aggr_index, int *aggr_stat, - int *aggr_count_in, int **aggr_cnt_array_in, - int N_neighbors, int *neighbors, int *send_leng, int *send_list, - int *recv_leng, int *recv_list, ML_Comm *comm, double printflag); -int ML_Graph_CreateFromMatrix(ML_Aggregate *ml_ag, ML_Operator *Amatrix, - int **mat_indx_out, ML_Comm *comm, double epsilon, int *nrows, - int **bc_array); - -int ML_Aggregate_CoarsenUncoupledCore(ML_Aggregate *, ML_Comm *, - ML_Operator *, int *mat_indx, int *bdry_array, - int *aggr_count_in, int **aggr_index_in, char *true_bdry); -int ML_Aggregate_Set_CoarsenScheme_METIS( ML_Aggregate *ag ); -int ML_Aggregate_Set_CoarsenScheme_ParMETIS( ML_Aggregate *ag ); - -int ML_Aggregate_Set_SmoothRestrictionWithA( ML_Aggregate *ag ); -int ML_Aggregate_Set_SmoothRestrictionWithAT( ML_Aggregate *ag ); - -extern int ML_Aggregate_Set_NodalCoordinates(ML* ml, ML_Aggregate *ag, double *ptr); -extern int ML_Aggregate_Set_Dimensions(ML_Aggregate *ag, int N_dimensions); -extern int ML_Aggregate_Get_CoarsenScheme( ML_Aggregate *ag ); - -/* ------------------------------------------------------------------------- */ -/* functions for visualization */ -/* ------------------------------------------------------------------------- */ - -extern int ML_Aggregate_VizAndStats_Setup( ML *ml); -extern int ML_Aggregate_VizAndStats_Clean( ML *ml); -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_reitzinger.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_reitzinger.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_reitzinger.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_reitzinger.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ - -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the ML_Operator structure */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : March, 1999 */ -/* ******************************************************************** */ - -#ifndef __MLAGGREITZINGER__ -#define __MLAGGREITZINGER__ -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_mat_formats.h" -#include "ml_agg_genP.h" -#include "ml_op_utils.h" -#include "ml_operator_blockmat.h" -#include "ml_utils.h" -/* ******************************************************************** */ -/* ******************************************************************** */ -/* User Interface Proto-types */ -/* ******************************************************************** */ -/* ******************************************************************** */ -struct ml_linked_list { - struct ml_linked_list *next; - int duplicate_row; -}; - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -extern int ML_Gen_MGHierarchy_UsingReitzinger(ML *ml_edges, ML** ml_nodes, - int fine_level, int incr_or_decrease, - ML_Aggregate *ag, - ML_Operator *Tmat, - ML_Operator *Tmat_trans, - ML_Operator ***Tmat_array, - ML_Operator ***Tmat_trans_array, - int smooth_flag, double smooth_factor, - double enrich_beta, - double droptolPeEntries); -extern int ML_MGHierarchy_ReitzingerDestroy(int finest_level, - ML_Operator ***Tmat_array, - ML_Operator ***Tmat_trans_array); - -extern int ML_Gen_Hierarchy_ComplexMaxwell(ML *ml_edges, - ML **newml, ML_Operator *M); - -extern int ML_Gen_SmoothPnodal(ML *ml,int level, int clevel, void *data, - double smoothP_damping_factor, - ML_Operator *SPn_mat); - - -extern int ml_comp_Pe_entries(int coef_cols[], double coef_values[], - int coef_count, int leftagg, - struct ml_linked_list **Trecorder, - int *Trowcount, int *Tnzcount, - struct ML_CSR_MSRdata *Tcoarse, - int *Pnzcount, int Pe_columns[], - double Pe_values[]); - -extern int ml_record_entry(struct ml_linked_list **Trecorder,int lower, - int therow); -extern int ml_dup_entry(int node1, int node2, struct ml_linked_list **Trecorder, - int Tcols[], int Trowptr[], int *lower, int *upper, - int *duplicate_row); - -extern int ml_clean_Trecorder(struct ml_linked_list ***Trecorder ,int N); - -extern int ml_leastsq_edge_interp(ML_Operator *Pn_mat, ML_Operator *SPn_mat, - ML_Operator *Tfine_mat, ML_Operator *Tcoarse_mat, - ML_Operator *Pe_mat, int); - -void ML_Reitzinger_CheckCommutingProperty(ML *ml_nodes, ML *ml_edges, - ML_Operator **Tmat_array, - ML_Operator **Tmat_trans_array, - int finelevel, int coarselevel, - int writeflag); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - - - - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_user.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_user.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_user.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_user.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#ifndef ML_AGG_USER_H -#define ML_AGG_USER_H - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -int ML_SetUserLabel(char *user()); - -int ML_SetUserNumAggr(int (user)(ML_Operator*)); - -int ML_SetUserPartitions(int (user)(ML_Operator* Amat, char* bdry_nodes, - double epsilon, - double* x,double* y,double* z, - int* partitions, int* LocalNonzeros)); - -extern int ML_Aggregate_CoarsenUser( ML_Aggregate *ml_ag, - ML_Operator *Amatrix, - ML_Operator **Pmatrix, ML_Comm *comm); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif /* #ifndef ML_AGG_USER_H */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_VBMETIS.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_VBMETIS.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_VBMETIS.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_VBMETIS.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/********************************************************************* */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/********************************************************************* */ -/* Decomposition with METIS */ -/********************************************************************* */ - -#ifndef __MLAGGVBMETIS__ -#define __MLAGGVBMETIS__ - - -/* ------------------------------------------------------------------------ */ -/*! - \brief structure for variable block METIS -
-    used to implement support for variable block sizes  
-    used in ML_Aggregate_CoarsenVBMETIS.
-    It holds user supplied block data and space to temporarily store values
-    which otherwise would be lost when applying 
-    ML_Operator_AmalgamateAndDropWeak_VBlocks                           
-    data is set applying ML_Aggregate_Set_Vblocks_CoarsenScheme_VBMETIS 
-    and                  ML_Aggregate_Set_CoarsenScheme_VBMETIS         
-    data is destroyed using ML_Aggregate_Destroy_Vblocks_CoarsenScheme_VBMETIS
-    data can be handled using ML_Aggregate_Get_Vblocks_CoarsenScheme_VBMETIS
-    
-    Author:  Michael W. Gee, SNL Org. 9214, November 2004
-     
- 
- - \sa ML_Aggregate_CoarsenVBMETIS ML_Operator_AmalgamateAndDropWeak_VBlocks - ML_Aggregate_Set_Vblocks_CoarsenScheme_VBMETIS - ML_Aggregate_Set_CoarsenScheme_VBMETIS - ML_Aggregate_Destroy_Vblocks_CoarsenScheme_VBMETIS - ML_Aggregate_Get_Vblocks_CoarsenScheme_VBMETIS -*/ -/* ------------------------------------------------------------------------ */ -struct aggr_vblock { - int nblocks; /*!< number of variable blocks */ - int block_dim; /*!< dimension of blocks & block_pde */ - int *blocks; /*!< variable block indizes */ - int *block_pde; /*!< which pde for each row*/ - int old_invec_leng; /*!< original invec_leng */ - int old_outvec_leng; /*!< original outvec_leng */ -}; - -/*MS*/ -#define ML_AGGREGATE_OPTIONS_ID 13579 - -/* undefined will be a negative number */ -#define ML_NUM_LOCAL_AGGREGATES 0 -#define ML_NUM_GLOBAL_AGGREGATES 1 -#define ML_NUM_NODES_PER_AGGREGATE 2 - - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -int ML_Aggregate_Set_CoarsenScheme_VBMETIS( ML_Aggregate *ag ); -int ML_Aggregate_Set_Vblocks_CoarsenScheme_VBMETIS( ML_Aggregate *ag, - const int level, - const int N_levels, - const int nblocks, - const int *blocks, - const int *block_pde, - const int block_dim); -int ML_Aggregate_Get_Vblocks_CoarsenScheme_VBMETIS( const ML_Aggregate *ag, - const int level, - const int N_levels, - int *nblocks, - int **blocks, - int **block_pde); -int ML_Aggregate_Destroy_Vblocks_CoarsenScheme_VBMETIS( const ML_Aggregate *ag, - const int level); -int ML_Aggregate_CoarsenVBMETIS( ML_Aggregate *ml_ag, ML_Operator *Amatrix, - ML_Operator **Pmatrix, ML_Comm *comm); -int ML_Operator_AmalgamateAndDropWeak_VBlocks(ML_Operator *Amat, int block_size, - double drop_tolerance, int nblocks, int* blocks); -int ML_Operator_UnAmalgamateAndDropWeak_Vblocks(ML_Operator *Amat, int block_size, - double drop_tolerance); -int ML_amalg_drop_getrow_VBlocks(ML_Operator *data, int N_requested_rows, - int requested_rows[],int allocated_space, int columns[], double values[], - int row_lengths[]); - - - - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif /* #ifndef __MLAGGVBMETIS__ */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_Zoltan.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_Zoltan.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_agg_Zoltan.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_agg_Zoltan.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/********************************************************************* */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/********************************************************************* */ -/* Decomposition with Zoltan */ -/********************************************************************* */ - -#ifndef ML_AGG_ZOLTAN_H -#define ML_AGG_ZOLTAN_H - -#include "ml_comm.h" - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - - extern int ML_Aggregate_CoarsenParZoltan(ML_Aggregate *ml_ag, - ML_Operator *Amatrix, - ML_Operator **Pmatrix, - ML_Comm *comm); - extern int ML_Aggregate_CoarsenZoltan(ML_Aggregate *ml_ag, - ML_Operator *Amatrix, ML_Operator **Pmatrix, ML_Comm *comm); - /* those are coded in ml_agg_METIS.c */ - extern int ML_Aggregate_Set_UseDropping(int i); - - extern int ML_Aggregate_Get_UseDropping(); - - extern int ML_DecomposeGraph_with_Zoltan(ML_Operator *Amatrix, - int N_parts, - int graph_decomposition[], - double bdry_nodes[], - double [], double [], double [], - int); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif /* #ifndef ML_AGG_ZOLTAN_H */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_amesos.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_amesos.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_amesos.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_amesos.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ************************************************************************* */ -/* See the file COPYRIGHT for a complete copyright notice, contact person, */ -/* and disclaimer. */ -/* ************************************************************************* */ - -#ifndef __ML_AMESOS_H__ -#define __ML_AMESOS_H__ - -#include -#include -#include "ml_struct.h" - -#define ML_AMESOS_LAPACK -1 -#define ML_AMESOS_KLU 0 -#define ML_AMESOS_UMFPACK 1 -#define ML_AMESOS_SUPERLUDIST 2 -#define ML_AMESOS_MUMPS 3 -#define ML_AMESOS_SCALAPACK 4 -#define ML_AMESOS_SUPERLU 5 - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - - /** Applies the Amesos direct solver to the given vector. */ - extern int ML_Smoother_Amesos(ML_Smoother *sm,int inlen,double x[],int outlen, - double rhs[]); - - /** Clean memory associated to Amesos_Handle. */ - void ML_Smoother_Clean_Amesos(void *Amesos_Handle); - - /** Generates the coarse solver using Amesos. */ - /*! Generates the coarse solver using one of the Amesos supported - direct solvers. - - \param ml (InOut) - ML_Structure; - - \param nl (In) - level for which we have to define the coarse solver; - - \param AmesosSolver (In) - integer variable, that can be ML_AMESOS_KLU, - ML_AMESOS_UMFPACK, ML_AMESOS_SUPERLUDIST, ML_AMESOS_MUMPS, - ML_AMESOS_SCALAPACK; - - \param MaxProcs (In) - integer defining the maximum number of - processes to use in the coarse solution (only for some of the - supported Amesos solvers). - - \param AddToDiag (In) - add the specified value to the - diagonals of the matrix. - */ - -int ML_Gen_Smoother_Amesos(ML *ml, int nl, int AmesosSolver, - int MaxProcs, double AddToDiag); - - -#ifndef ML_CPP -#ifdef __cplusplus - } -#endif -#endif - -#endif /* #ifndef __ML_AMESOS_H__ */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_amesos_wrap.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_amesos_wrap.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_amesos_wrap.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_amesos_wrap.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,111 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/*! - * \file ml_amesos_wrap.h - * - * \brief Interface to the Trilinos package Amesos. - * - * The ML/Amesos interface can be used to solve the coarse problem with some - * of the sparse direct solvers supported by Amesos: - * - KLU, a simple serial sparse solver, distributed with Amesos; - * - UMFPACK, a serial sparse solver; - * - SuperLU and SuperLU_DIST - * - MUMPS, a multifrontal sparse direct solver. - * - * For serial solvers, Amesos will take care to redistribute all required data - * to process 0, solve the linear system on process 0, then broadcast the - * solution back to all the processes. - * - * For parallel solvers (like SuperLU_DIST and MUMPS), the user can tell - * Amesos how many processes should be used for the coarse solution. This - * number can be: - * - a positive number, that defines how many processes will be used (if - * available); - * - the number -1, meaning that Amesos will estimate the "best" number of - * processes; - * - the number -2, meaning that Amesos will use the square root of the - * available processes. - * - * In its current implementation, ML/Amesos converts the ML_Operator for the - * coarse level to and Epetra matrix ("heavy conversion"). - * - * \note If \c ML_AMESOS_DEBUG is defined, some checks are performed to verify - * that the linear system has been solved up to machine precision. - * - * \note We experienced some problems with \c out on TFLOPS. These problems - * were solved by replacing \c cout with \c puts(). - * - * \date Last update to Doxygen: 21-Jun-05 - * - */ - -#ifndef _MLAMESOSWRAP_ -#define _MLAMESOSWRAP_ - -#include "ml_include.h" - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - - /** Generates the direct solver using Amesos. */ - /*! This function performs several operations: - - wrap the ML_Operator for the given level to an Epetra_CrsMatrix - - creates the Amesos object; - - compute the symbolic and numeric factorzation. - - \param ml (InOut) : ML_Structure - - \param curr_level (In) : specifies the level for which we have to - define the direct solver; - - \param choice (In) : integer variable, that can be ML_AMESOS_KLU, - ML_AMESOS_UMFPACK, ML_AMESOS_SUPERLUDIST, ML_AMESOS_MUMPS, - ML_AMESOS_SCALAPACK; - - \param MaxProcs (In) : integer defining the maximum number of - processes to use in the coarse solution (only for some of the - supported Amesos solvers); - - \param Amesos (In) : add the specified value to the diagonal - elements of the matrix. - - \param Amesos_Handle (Out) : it will contain a pointer to the Amesos object (casted - to void *). - - If the required solver is not avaiable, ML_Amesos_Gen will create - a KLU solver. KLU is distributed with Amesos, and is enabled by default. - - */ - int ML_Amesos_Gen(ML *ml, int curr_level, int choice, int MaxProcs, - double AddToDiag, void **Amesos_Handle); - - /** Solves using Amesos, and the factorization computed by ML_Amesos_Gen. */ - int ML_Amesos_Solve( void *Amesos_Handle, double x[], double rhs[] ) ; - - /** Destroy the Amesos object. Prints out some timing. */ - void ML_Amesos_Destroy(void *Amesos_Handle); - - int ML_isKLUAvailable(); -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_amg_genP.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_amg_genP.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_amg_genP.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_amg_genP.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* functions for setting up AMG */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) */ -/* Date : October, 2000 */ -/* ******************************************************************** */ - -#ifndef __MLAMGGENP__ -#define __MLAMGGENP__ - -#include "ml_common.h" -#include "ml_amg.h" -#include "ml_operator.h" - -/* ******************************************************************** */ -/* functions defined here */ -/* ******************************************************************** */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -/* ******************************************************************** */ -/* functions called by users */ -/* -------------------------------------------------------------------- */ - -extern int ML_Gen_MGHierarchy_UsingAMG(ML *, int start, - int increment_or_decrement, ML_AMG *); - -/* ******************************************************************** */ -/* internal functions called by developers */ -/* -------------------------------------------------------------------- */ - -extern int ML_AMG_Gen_MGHierarchy(ML *, int fine_level, - int (*next_level)(ML *, int, ML_Operator *, ML_AMG *), - int (*user_gen_prolongator)(ML *,int,int,void *,ML_AMG*), - void *data, ML_AMG *); -extern int ML_AMG_Gen_Prolongator(ML*,int ,int,void *data,ML_AMG*); -extern int ML_AMG_Increment_Level(ML *,int level,ML_Operator *Amat,ML_AMG*); -extern int ML_AMG_Decrement_Level(ML *,int level,ML_Operator *Amat,ML_AMG*); -extern int ML_AMG_Identity_Getrows(ML_Operator *data, int N_requested_rows, - int requested_rows[], int allocated_space, int columns[], - double values[], int row_lengths[]); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_amg.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_amg.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_amg.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_amg.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,230 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ************************************************************************* */ -/* See the file COPYRIGHT for a complete copyright notice, contact person */ -/* and disclaimer. */ -/* ************************************************************************* */ - -/* ************************************************************************* */ -/* data structure to hold AMG information */ -/* ************************************************************************* */ -/* Author : Charles Tong (LLNL) */ -/* Date : October, 2000 */ -/* ************************************************************************* */ - -#ifndef __MLAMGH__ -#define __MLAMGH__ - -#include -/* #include */ -#include "ml_common.h" -#include "ml_defs.h" - -/* ************************************************************************* */ -/* local defines */ -/* ------------------------------------------------------------------------- */ - -#define ML_AMG_MIS 21 -#define ML_AMG_SCALAR 0 -#define ML_AMG_SYSTEM_UNKNOWN 1 -#define ML_AMG_SYSTEM_NODAL 2 -#define ML_AMG_SM_JACOBI 11 -#define ML_AMG_SM_GS 12 -#define ML_AMG_SM_SGS 13 -#define ML_AMG_SM_VBJACOBI 14 -#define ML_AMG_SM_VBGS 15 -#define ML_AMG_SM_VBSGS 16 -#define ML_AMG_SM_ASCHWARZ 17 -#define ML_AMG_SM_MSCHWARZ 18 -#define ML_AMG_SM_SUPERLU 19 - -/* ************************************************************************* */ -/* other ML include files */ -/* ------------------------------------------------------------------------- */ - -#include "ml_defs.h" -#include "ml_comm.h" -#include "ml_memory.h" -#include "ml_operator.h" - -/* ************************************************************************* */ -/* definition of the AMG structure */ -/* ------------------------------------------------------------------------- */ - -typedef struct ML_AMG_Struct -{ - int ML_id; - double print_flag; - int max_coarse_size; /** maximum size of coarsest grid */ - double threshold; /** for pruning matrix */ - double curr_threshold; /** adjusted for levels */ - int coarsen_scheme; /** MIS */ - int amg_scheme; /** scalar(0),unknown(1),system(2)*/ - int num_PDE_eqns; /** block size */ - int *blk_info; /** store dof information */ - int max_levels; /** maximum number of levels */ - int begin_level; /** finest grid level */ - int cur_level; /** temporary variable */ - double operator_complexity; /** sum of nnz for all A's */ - double fine_complexity; /** nnz of the finest A */ - - ML_Operator *fine_Amat; - int presmoother_type; - int postsmoother_type; - int presmoother_ntimes; - int postsmoother_ntimes; - double presmoother_jacobiwt; - double postsmoother_jacobiwt; - int coarse_solver_type; - int coarse_solver_ntimes; - double coarse_solver_jacobiwt; - int *pre_aztec_options; - double *pre_aztec_params; - int *pre_aztec_proc_config; - double *pre_aztec_status; - void (*pre_function)(int); - /* Trying to avoid including az_aztec.h - void (*pre_function)(double *, int *, int *, double *, - struct AZ_MATRIX_STRUCT *, - struct AZ_PREC_STRUCT *); - */ - int *post_aztec_options; - double *post_aztec_params; - int *post_aztec_proc_config; - double *post_aztec_status; - void (*post_function)(int); - /* Trying to avoid including az_aztec.h - void (*post_function)(double *, int *, int *, double *, - struct AZ_MATRIX_STRUCT *, - struct AZ_PREC_STRUCT *); - */ -} ML_AMG; - -/* ************************************************************************* */ -/* ************************************************************************* */ -/* functions to manipulate the AMG data structure */ -/* ------------------------------------------------------------------------- */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif - -/* ------------------------------------------------------------------------- */ -/* constructor/destructor and level control */ -/* ------------------------------------------------------------------------- */ - -extern int ML_AMG_Create( ML_AMG ** ); -extern int ML_AMG_Destroy( ML_AMG ** ); - -extern int ML_AMG_Set_OutputLevel( ML_AMG *amg, double outputlevel ); - -extern int ML_AMG_Set_MaxLevels( ML_AMG *amg, int level ); -extern int ML_AMG_Set_CurrentLevel( ML_AMG *amg, int level ); -extern int ML_AMG_Set_StartLevel( ML_AMG *amg, int level ); - -/* ------------------------------------------------------------------------- */ -/* control when to stop coarsening */ -/* ------------------------------------------------------------------------- */ - -extern int ML_AMG_Set_MaxCoarseSize( ML_AMG *amg, int size ); - -/* ------------------------------------------------------------------------- */ -/* different AMG scheme (scalar, unknown, system) */ -/* ------------------------------------------------------------------------- */ - -extern int ML_AMG_Set_AMGScheme_Scalar( ML_AMG *amg ); -extern int ML_AMG_Set_AMGScheme_SystemUnknown( ML_AMG *amg, int ); -extern int ML_AMG_Set_AMGScheme_SystemNodal( ML_AMG *amg, int ); - -/* ------------------------------------------------------------------------- */ -/* different parallel coarsening schemes */ -/* ------------------------------------------------------------------------- */ - -extern int ML_AMG_Set_CoarsenScheme_MIS( ML_AMG *amg ); - -/* ------------------------------------------------------------------------- */ -/* set threshold for pruning matrix graph */ -/* ------------------------------------------------------------------------- */ - -extern int ML_AMG_Set_Threshold( ML_AMG *amg, double epsilon ); - -/* ------------------------------------------------------------------------- */ -/* functions for performing coarsening */ -/* ------------------------------------------------------------------------- */ - -extern int ML_AMG_Coarsen(ML_AMG *amg, ML_Operator *Amatrix, - ML_Operator **Pmatrix, ML_Comm *comm); -extern int ML_AMG_CoarsenMIS(ML_AMG *ml_amg,ML_Operator *Amatrix, - ML_Operator **Pmatrix, ML_Comm *comm); - -/* ------------------------------------------------------------------------- */ -/* miscellaneous functions */ -/* ------------------------------------------------------------------------- */ - -extern int ML_AMG_Set_Smoother(ML_AMG *ml_amg,int smoother_type,int pre_or_post, - ML_Operator *Amatrix,int ntimes, double weight); - -extern int ML_AMG_Set_SmootherAztec(ML_AMG *ml_amg, int pre_or_post, - int *options, double *params, int *proc_config, - double *status, void (*post_function)(int) - /* Trying to avoid including az_aztec.h - void (*post_function)(double *,int *,int *,double *, - struct AZ_MATRIX_STRUCT*,struct AZ_PREC_STRUCT*)*/); - -extern int ML_AMG_Set_CoarseSolve(ML_AMG *ml_amg, int solve_type, int ntimes, - double weight); - -/* ------------------------------------------------------------------------- */ -/* miscellaneous functions */ -/* ------------------------------------------------------------------------- */ - -extern int ML_AMG_Print(ML_AMG *); -extern int ML_AMG_Print_Complexity(ML_AMG *); - -extern int ML_AMG_LabelVertices(int nvertices, int *vlist, int, - char *state, char *vtype, int nvert, int *rowptr, - int *columns, int mypid, int **proclist, int Nneigh, - int **sndbuf, int *neigh, int *sndleng, int Nneigh2, - int **rcvbuf, int *neigh2, int *rcvleng, int **recvlist, - ML_Comm *comm, int *CF_array); - - -int ML_AMG_GetCommInfo(ML_CommInfoOP *mat_comm, int Nrows, int *A_Nneigh, - int **A_neigh, int ***A_sendlist, int ***A_recvlist, - int ***A_sndbuf, int ***A_rcvbuf, int **A_sndleng, - int **A_rcvleng, int *Nghost); - -int ML_AMG_UpdateVertexStates(int N_remaining_vertices, char vertex_state[], - int recv_cnt, int recv_proc[], int recv_leng[], int **recv_buf, - int **recv_list, int proc_flag[], int *NremainingRcvProcs, - int send_cnt, int send_proc[], int send_leng[], int **send_buf, - int *send_flag, USR_REQ *Request, ML_Comm *comm, int msgtype); - - -int ML_AMG_CompatibleRelaxation(int *CF_array, - ML_Operator *Amat, int *Ncoarse, int limit); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_anasazi.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_anasazi.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_anasazi.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_anasazi.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,165 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* Copyright (2004) Sandia Corportation. Under the terms of Contract - * DE-AC04-94AL85000, there is a non-exclusive license for use of this - * work by or on behalf of the U.S. Government. Export of this program - * may require a license from the United States Government. */ - - /* NOTICE: The United States Government is granted for itself and others - * acting on its behalf a paid-up, nonexclusive, irrevocable worldwide - * license in ths data to reproduce, prepare derivative works, and - * perform publicly and display publicly. Beginning five (5) years from - * July 25, 2001, the United States Government is granted for itself and - * others acting on its behalf a paid-up, nonexclusive, irrevocable - * worldwide license in this data to reproduce, prepare derivative works, - * distribute copies to the public, perform publicly and display - * publicly, and to permit others to do so. - * - * NEITHER THE UNITED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT - * OF ENERGY, NOR SANDIA CORPORATION, NOR ANY OF THEIR EMPLOYEES, MAKES - * ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR - * RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY - * INFORMATION, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS - * THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS. */ - -/*! - * \file ml_anasazi.h - * - * \brief Interface to the Trilinos package Anasazi. - * - * Anasazi can be used by ML to eigenvalue computations. The user can: - * - use Anasazi to estimate the maximum eigenvalue of a given level matrix - * (for smoothed aggregation); - * - use Anasazi to compute the low-convergence modes, and filter them; - * - use Anasazi to compute the field-of-values of a non-symmetric operator, - * and use this information to improve smoothed aggregation for highly - * non-symmetric systems. - * - * \author Marzio Sala, SNL (9214) - * - * \date Last update to Doxygen: 22-Jul-04 - * - */ - -#ifndef _ML_ANASAZI_H_ -#define _ML_ANASAZI_H_ - -#include "ml_include.h" -#include "ml_struct.h" -#include "ml_smoother.h" - -#if defined(HAVE_ML_EPETRA) && defined(HAVE_ML_TEUCHOS) && defined(HAVE_ML_ANASAZI) - -// anasazi interface - -#include "Teuchos_ParameterList.hpp" - -//! ML_Anasazi: default namespace for all Anasazi interfaces. - -namespace ML_Anasazi { - - //! \brief Interface to Anasazi to eigen-computations. - /*! - This function creates an interface from an Epetra_RowMatrix and Anasazi. - Parameters are specified using a Teuchos parameters list. - - \param RowMatrix (In) : Epetra_RowMatrix; - - \param EigenVectors (Out) : Epetra_MultiVectors, that will contain the - requested eigenvectors; - - \param RealEigenvalues (Out) : double array that will contain the real - part of the computed eigenvalues; - - \param ImagEigenvalues (Out) : double array that will contain the - imaginary part of the computed eigenvalues; - - \param RealEigenvectors (Out) : pointer to allocated space to store the - real eigenvectors - - \param ImagEigenvectors (Out) : pointer to allocated space to store the - imaginary eigenvectors - - \param NumRealEigenvectors (Out) : number of computed real eigenvectors - - \param NumImagEigenvectors (Out) : number of computed imaginary eigenvectors - - \param List (InOut) : Teuchos parameters' list containing the required options. - - \param ml (In) : already filled ML hierarchy (only for the eigen-analysis - of "I-ML^{-1}A"). - - The following parameters parsed from List: - - "eigen-analysis: use diagonal scaling". Enables - scaling by the diagonal. Default: \c true. - - "eigen-analysis: symmetric problem" . Instructs Anasazi to use an - algorithm for symmetric problems. Default: \c false. - - "eigen-analysis: matrix operation". Defined the matrix-vector product. - Possible values are: - - "A" - - "I-A" - - "A+A^T" - - "A-A^T" - - "I-ML^{-1}A" (this defines no scaling, and "eigen-analysis: symmetric problem" = \c false. - Default: "A" - - "eigen-analysis: length", 20) - - "eigen-analysis: block-size", 1) - - "eigen-analysis: tolerance", 1.0e-5) - - "eigen-analysis: action", "LM" - - "eigen-analysis: restart", 100) - - "eigen-analysis: output". Defined the output level, from 0 to 10 (1- being verbose). - */ - int Interface(const Epetra_RowMatrix * RowMatrix, Epetra_MultiVector & EigenVectors, - double RealEigenvalues[], double ImagEigenvalues[], - Teuchos::ParameterList & List, - double RealEigenvectors[] = 0, double ImagEigenvectors[] = 0, - int * NumRealEigenvectors = 0, int * NumImagEigenvectors = 0, - ML * ml = 0); - - //! Computes the size of a box containing the field of values. - int GetFieldOfValuesBox(const Epetra_RowMatrix * RowMatrix, - double & MaxReal, double & MaxImag, - Teuchos::ParameterList & AnasaziList); - -} - -#endif - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif - - //! Interface from C code to Anasazi to compute the field of values. - extern int ML_Anasazi_Get_FieldOfValuesBox_Interface(ML_Operator * Amat, - struct ML_Field_Of_Values * fov ); - - //! Interface from C code to Anasazi to compute the maximum eigenvalue. - extern int ML_Anasazi_Get_SpectralNorm_Anasazi(ML_Operator* Amat, - ML_Smoother* smoother, - int MaxIters, double Tolerance, - int IsProblemSymmetric, - int UseDiagonalScaling, - double* LambdaMax ); -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif /* #ifndef _ML_ANASAZI_H_ */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_aztec_lapack.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_aztec_lapack.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_aztec_lapack.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_aztec_lapack.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/********************************************************************* */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/********************************************************************* */ -/* BLAS/LAPACK Utilities for Aztec/ML users */ -/********************************************************************* */ - -#ifndef __MLAZTECLAPACK__ -#define __MLAZTECLAPACK__ - - - -#ifdef AZTEC -#include "ml_common.h" -#include "ml_defs.h" -#define ML_IDAMAX_FUNC -#define ML_DSWAP_FUNC -#define ML_DSCAL_FUNC -#define ML_DAXPY_FUNC -#define ML_DASUM_FUNC -#define ML_DDOT_FUNC -#define ML_DNRM2_FUNC -#define ML_DCOPY_FUNC -#define ML_DGEMM_FUNC -#define ML_DTRSM_FUNC -#define ML_DTRMM_FUNC -#define ML_DGETRS_FUNC -#define ML_LSAME_FUNC -#define ML_XERBLA_FUNC -#define ML_DLASWP_FUNC -#define ML_DGEMV_FUNC -#define ML_DGETRF_FUNC -#define ML_DGER_FUNC -#define ML_DTRMV_FUNC -#define ML_DTRSV_FUNC - -#ifndef FSUB_TYPE -# if defined(ncube) -# define FSUB_TYPE void -# elif defined(paragon) -# define FSUB_TYPE void -# elif defined(hp) -# define FSUB_TYPE void -# else -# define FSUB_TYPE int -# endif -#endif - - -#endif -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_aztec_utils.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_aztec_utils.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_aztec_utils.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_aztec_utils.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,308 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/********************************************************************* */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/********************************************************************* */ -/* Utilities for Aztec/ML users */ -/********************************************************************* */ - -#ifndef __MLAZUTILS__ -#define __MLAZUTILS__ - - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -#ifdef AZTEC -#if defined(ML_MPI) && !defined(AZ_MPI) -#define AZ_MPI -#endif - -#define AZ_ONLY_PRECONDITIONER -7778 - -#include "ml_common.h" -#include "az_aztec.h" - -/******************************************************************************/ -/* structure/function to wrap Aztec subblocks into a large Aztec matrix. */ -/******************************************************************************/ -struct AZ_MAT_blockmat_data { - int N, Nghost; - AZ_MATRIX *Ke; - AZ_MATRIX *M; -}; - - - -struct aztec_context { - AZ_MATRIX *Amat; - AZ_PRECOND *Prec; - int *proc_config; - int *options; - double *params; - double *status; - void *getrowstuff; - int prec_or_solver; - ML_Comm *comm; - int offset; - int matrix_type; -#ifdef AZ_ver2_1_0_3 - struct AZ_SCALING *scaling; -#endif -}; -#ifndef AZTEC2_0 -extern void ML_Gen_SmootherAztec(ML *ml_handle, int level, int options[], - double params[], int proc_config[], double status[], int N_iter, - int pre_or_post, void (*prec_function)( - double *, int *, int *, double *, struct AZ_MATRIX_STRUCT *, - struct AZ_PREC_STRUCT *)); - -extern int az_wrap_solvers(ML_Smoother *, int in, double x[], int out, - double rhs[]); - -extern void AZ_ML_SmootherClean(void *data); - -#else -#ifdef ML_MPI -#include -#define MPI_AZRequest MPI_Request -#define MPI_AZComm MPI_Comm -#else -#define MPI_AZRequest int -#define MPI_AZComm int -#endif - -#define AZ_fixed_pt 33 -extern struct AZ_MATRIX_STRUCT *AZ_matrix_create(int local); -extern struct AZ_PREC_STRUCT *AZ_precond_create(struct AZ_MATRIX_STRUCT *Pmat, - void (*prec_fun)( double *, int *, int *, double *, - struct AZ_MATRIX_STRUCT *, struct AZ_PREC_STRUCT *) ); - -extern void AZ_matrix_destroy( struct AZ_MATRIX_STRUCT **Amat); -extern void AZ_precond_destroy(struct AZ_PREC_STRUCT **precond); - int data_org[]); - -extern void AZ_set_VBR(AZ_MATRIX *Amat, int rpntr[], int cpntr[], int bpntr[], - - int N_update, int num_PDE_eqns, int *update); - -#define mdwrap_wait(a,b,c,x,y,z) md_wrap_wait(a,b,c,(x),(y),(z)) -#define mdwrap_iwrite(a,b,c,x,y,z) md_wrap_iwrite(a,b,c,(x),(y),(z)) -#define mdwrap_iread(a,b,c,x,y) md_wrap_iread((a),(b),(c),(x),(y)) -#define mdwrap_write(a,b,c,x,y) md_wrap_write((a),(b),(c),(x),(y)) - -#if defined(caps) -# define az_set_proc_config_ AZ_SET_PROC_CONFIG -#else -#if defined(matched) -# define az_set_proc_config_ az_set_proc_config -#endif -#endif - -extern void AZ_set_proc_config(int proc_config[], MPI_AZComm ); - - -#endif -extern void AZ_mlcomm2data_org(ML_CommInfoOP *comm_info,int *data_org[]); - -extern void AZ_set_ML_preconditioner(AZ_PRECOND **Precond, AZ_MATRIX *Amat, - ML *ml_handle, int options[]); - - -extern int az_comm_wrapper(double vector[], void *data); -extern int az_wrap_ml_comm(double vector[], AZ_MATRIX *Amat); - -extern int az_msrgetrow_wrapper(ML_Operator *data, int N_requested_rows, - int requested_rows[], int allocated_space, int columns[], double values[], - int row_lengths[]); - -extern int az_vbrgetrow_wrapper(ML_Operator *data, int N_requested_rows, - int requested_rows[], int allocated_space, int columns[], double values[], - int row_lengths[]); -extern int az_wrap_ml_getrow(int columns[], double values[], int row_lengths[], - struct AZ_MATRIX_STRUCT *Amat, int N_requested_rows, - int requested_rows[], int allocated_space); - - -extern int az_usergetrow_wrapper(ML_Operator *data, int N_requested_rows, - int requested_rows[], int allocated_space, int columns[], double values[], - int row_lengths[]); - -extern int az_matvec_wrapper(ML_Operator *data, int, double p[], int, double ap[]); - -extern void az_wrap_ml_matvec(double invec[], double outvec[], AZ_MATRIX *Amat, - int proc_config[]); -extern int AZ_convert_aztec_matrix_2ml_matrix(AZ_MATRIX *AZmat, ML_Operator *MLmat, - int *proc_config); -extern int AZ_ML_Set_Amat(ML *ml_handle, int level, int isize, int osize, - AZ_MATRIX *Amat, int *proc_config); - -extern void AZ_ML_set_vbrdiagonal(ML *ml, int level, AZ_MATRIX *matrix); - -extern void AZ_ML_set_userdiagonal(ML *ml, int level, AZ_MATRIX *matrix); - -extern void ML_precondition(double ff[], int options[], int proc_config[], - double params[], AZ_MATRIX *mat, AZ_PRECOND *prec); -extern void MLsmoother_precondition(double ff[], int options[], - int proc_config[], double params[], - AZ_MATRIX *mat, AZ_PRECOND *prec); - -extern void AZ_ML_Clean(void *data); - -extern int ML_MSR_sym_diagonal_scaling(AZ_MATRIX *Amat, - int proc_config[], double **); - -extern int ML_MSR_scalesol(double *x, double *scale_vect,int length); -extern int ML_MSR_scalerhs(double *x, double *scale_vect,int length); - int N_update, int num_PDE_eqns, int *update); - - -extern int wrapper_DCSR_getrow(int columns[], double values[], int row_lengths[], - struct AZ_MATRIX_STRUCT *Amat, int N_requested_rows, - int requested_rows[], int allocated_space); -extern void wrapper_DCSR_matvec(double *b, double *c,AZ_MATRIX *Amat, - int proc_config[]); -extern void AZ_transform_norowreordering(int proc_config[], int *external[], - int *extern_index[], int *data_org[], int N_update, int indx[], int bnptr[], - int rnptr[], int *cnptr[], int mat_type); -extern void AZ_input_msr_matrix_nodiag(char datafile[], int update[], - int N_update, int proc_config[]); -extern void AZ_add_new_row_nodiag(int therow, int *nz_ptr, int *current, - int *column0); - int *sorted_ext, int N_external, int map[], int start, int end); - -extern void AZ_Tmat_transform2ml(int Nexterns, int global_node_externs[], int *reordered_node_externs, - int global_node_inds[], ML_Comm *comm, int Nlocal_edges, - ML_Operator **Tmat); - -extern void AZ_zeroDirichletcolumns(AZ_MATRIX *Amat, double rhs[], - int proc_config[] ); -extern int ML_Tmat_applyDirichletBC(ML_Operator **Tmat, int *dirichlet_rows, - int num_dirichlet_rows); -extern void AZ_block_matvec(double *, double *, AZ_MATRIX *, int *); - -extern int ML_Aggregate_AztecRead(ML_Aggregate *ag); -extern void new_norm(AZ_PRECOND *prec, double res[], double *result); -/* mgee */ -extern void ML_AZ_Reader_ReadVariableBlocks(char *cmd_file_name, int *nblocks, int **blocks, - int **block_pde, int *N_update, int **update, - int proc_config[]); - - -/* The following definition and function declaration as used by - MLAZ_iterate, which is supposed to replace AZ_iterate in code - currently developed for Aztec (one-level prec), to test ML - preconditioners (based on aggregation). Only a small part - of ML's functionalities is currently supported. */ - -#define MLAZ_MAX_LEVELS 30 -#define MLAZ_COARSE_LEVEL (MLAZ_MAX_LEVELS-1) -#define MLAZ_ALL -1 -#define MLAZ_yes 1 -#define MLAZ_no 0 - -/* options */ -#define MLAZ_smoother 1 -#define MLAZ_max_levels 2 -#define MLAZ_num_smoother_steps 3 -#define MLAZ_output 7 -#define MLAZ_coarsen_scheme 8 -#define MLAZ_metis_aggregation_property 9 -#define MLAZ_metis_aggregation_value 10 -#define MLAZ_max_coarse_size 11 -#define MLAZ_is_problem_symmetric 12 -#define MLAZ_pre_or_post_smoother 13 -#define MLAZ_num_pde_eqns 14 -#define MLAZ_smoother_damping 15 -#define MLAZ_amesos_solver 16 -#define MLAZ_max_procs 17 -#define MLAZ_req_aggre_per_proc 18 -#define MLAZ_MLS_poly_order 19 -#define MLAZ_MLS_alpha 20 -#define MLAZ_timing_detailed 21 -#define MLAZ_prec_type 22 - -/* MLAZ_smoother */ -#define MLAZ_Jacobi 0 /* ML's Jacobi smoother */ -#define MLAZ_GaussSeidel 1 /* ML's GS smoother */ -#define MLAZ_SymGaussSeidel 2 -#define MLAZ_MLS 3 -#define MLAZ_Aztec 4 -#define MLAZ_BlockGaussSeidel 5 -#define MLAZ_IFPACK 7 -#define MLAZ_SuperLU -1 -#define MLAZ_Amesos -2 - -/* MLAZ_aggregates */ -#define MLAZ_METIS 0 -#define MLAZ_ParMETIS 1 -#define MLAZ_Uncoupled 2 -#define MLAZ_MIS 3 -/* MLAZ_metis_aggregate_property */ -#define MLAZ_NumLocalAggregates 0 -#define MLAZ_NumGlobalAggregates 1 -#define MLAZ_NumNodesPerAggregate 2 - -/* params */ -#define MLAZ_smoothP_damping_factor 1 -#define MLAZ_omega 2 -#define MLAZ_threshold 3 -#define MLAZ_dumping_factor 4 - -extern void MLAZ_Defaults(void); -extern void MLAZ_Iterate( double delta_x[], double resid_vector[], - int options[], double params[], - double status[], int proc_config[], - AZ_MATRIX *Amat, struct AZ_SCALING *scaling ); -extern void MLAZ_Set_Option(int, int); -extern void MLAZ_Set_Param( int,double); -extern void MLAZ_Set_LevelOption( int level,int option, int value); -extern void MLAZ_Set_LevelParam( int level, int option, double value); -extern void MLAZ_Set_LevelAztecSmoother( int level, int options[], double value[]); -extern int MLAZ_Setup_MLandAggregate( int N_update, int num_PDE_eqns, - int proc_config[AZ_PROC_SIZE], - ML *ml, ML_Aggregate *ag); -void MLAZ_Direct_Solve_Amesos( double delta_x[], double resid_vector[], - AZ_MATRIX * Amat, int proc_config[], - int choice, int max_procs ); -void AZ_ML_Build_NodalCoordinates( int N, int N_update, int N_external, - int update[], int external[], - int update_index[], int extern_index[], - double x[], double y[], double z[], - int option ); -#endif - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#ifdef AZTEC_RAY_WILL_FIX - -#include "az_aztec.h" -/*********************************************************************/ -/*********************************************************************/ -/*********************************************************************/ -#endif -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_bdrypts.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_bdrypts.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_bdrypts.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_bdrypts.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,88 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the ML_BdryPts structure */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : March, 1999 */ -/* ******************************************************************** */ - -#ifndef __MLBDRYPTSH__ -#define __MLBDRYPTSH__ - -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_memory.h" - -/* ******************************************************************** */ -/* data definition for the ML_BdryPts Class */ -/* ******************************************************************** */ -/* -------------------------------------------------------------------- */ -/* This data structure stores two arrays : one integer array for a list */ -/* of boundary conditions in the grid space, and another integer array */ -/* for a list of boundary conditions in the equation space. In this */ -/* implementation, only Dirichlet boundary conditions are stored. */ -/* -------------------------------------------------------------------- */ - -typedef struct ML_BdryPts_Struct ML_BdryPts; - -struct ML_BdryPts_Struct { - int ML_id; - int Dirichlet_grid_CreateOrDup; - int Dirichlet_grid_length; - int *Dirichlet_grid_list; - int Dirichlet_eqn_CreateOrDup; - int Dirichlet_eqn_length; - int *Dirichlet_eqn_list; -}; - -/* ******************************************************************** */ -/* function for accessing the ML_BdryPts Class */ -/* ******************************************************************** */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -extern int ML_BdryPts_Create(ML_BdryPts **); -extern int ML_BdryPts_Init(ML_BdryPts *); -extern int ML_BdryPts_Destroy(ML_BdryPts **); -extern int ML_BdryPts_Clean(ML_BdryPts *); -extern int ML_BdryPts_Check_Dirichlet_Grid(ML_BdryPts *); -extern int ML_BdryPts_Check_Dirichlet_Eqn(ML_BdryPts *); -extern int ML_BdryPts_Get_Dirichlet_Grid_Info(ML_BdryPts *, int *, int **); -extern int ML_BdryPts_Get_Dirichlet_Eqn_Info(ML_BdryPts *, int *, int **); -extern int ML_BdryPts_Load_Dirichlet_Grid(ML_BdryPts *,int,int*); -extern int ML_BdryPts_Load_Dirichlet_Eqn(ML_BdryPts *,int,int*); -extern int ML_BdryPts_Copy_Dirichlet_GridToEqn(ML_BdryPts *); -extern int ML_BdryPts_ApplyZero_Dirichlet_Grid(ML_BdryPts *, double *); -extern int ML_BdryPts_ApplyZero_Dirichlet_Eqn(ML_BdryPts *, double *); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_bicgstabl.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_bicgstabl.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_bicgstabl.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_bicgstabl.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Functions for the BICGSTABL Krylov solver */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) */ -/* Date : December, 1999 */ -/* ******************************************************************** */ - -#include "ml_common.h" -#include "ml_krylov.h" - -#ifndef __MLCGSTABL__ -#define __MLCGSTABL__ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -extern int ML_BICGSTABL_Solve(ML_Krylov *,int,double *rhs,double *sol); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_cg.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_cg.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_cg.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_cg.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Functions for the CG solver */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) */ -/* Date : December, 1999 */ -/* ******************************************************************** */ - -#ifndef __MLCG__ -#define __MLCG__ - -#include "ml_common.h" -#include "ml_krylov.h" - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -extern int ML_CG_Solve(ML_Krylov *, int, double *, double *); -extern int ML_CG_ComputeEigenvalues(ML_Krylov *data, int length, int); -extern int ML_Power_ComputeEigenvalues(ML_Krylov *data, int length, int); - - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_check.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_check.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_check.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_check.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -#ifndef __MLCHECK__ -#define __MLCHECK__ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -#include "ml_common.h" - -extern void ML_check_it(double sol[], double rhs[], ML *ml); - -extern void ML_interp_check(ML *ml, int, int); - -extern int ML_Check(ML *ml); - -extern int ML_Reitzinger_Check_Hierarchy(ML *ml, ML_Operator **Tmat_array, int incr_or_decr); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_comm.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_comm.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_comm.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_comm.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,155 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the ML communicator structure */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) */ -/* Date : September, 1998 */ -/* ******************************************************************** */ - -#ifndef _MLCOMM_ -#define _MLCOMM_ - -#include -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_memory.h" - -/* ******************************************************************** */ -/* communicator can be loaded by users or use the resident mpi */ -/* -------------------------------------------------------------------- */ - -#ifdef ML_MPI -#include -#define USR_COMM MPI_Comm -#define USR_REQ MPI_Request - -#define USR_ERRHANDLER MPI_Errhandler - -#ifdef ML_CATCH_MPI_ERRORS_IN_DEBUGGER - -/* the following might be necessary to avoid compiler warnings, since - in newer versions of MPI (e.g., recent lam implementations), certain - error handling functions may be deprecated. */ -/* -#define USR_ERRHANDLER_FUNCTION MPI_Comm_errhandler_fn -#define USR_ERRHANDLER_SET MPI_Comm_set_errhandler -#define USR_ERRHANDLER_CREATE MPI_Comm_create_errhandler -*/ -#define USR_ERRHANDLER_FUNCTION MPI_Handler_function -#define USR_ERRHANDLER_SET MPI_Errhandler_set -#define USR_ERRHANDLER_CREATE MPI_Errhandler_create - -#endif /* ifdef ML_CATCH_MPI_ERRORS_IN_DEBUGGER */ - -#else - -#define USR_COMM int -#define USR_REQ int - -#define USR_ERRHANDLER int - -#ifdef ML_CATCH_MPI_ERRORS_IN_DEBUGGER -#define USR_ERRHANDLER_FUNCTION void -#endif /* ifdef ML_CATCH_MPI_ERRORS_IN_DEBUGGER */ - -#endif /* ifdef ML_MPI */ - -/* ******************************************************************** */ -/* components of the ML communicator */ -/* -------------------------------------------------------------------- */ - -typedef struct ML_Comm_Struct -{ - int ML_id; - int ML_mypid; - int ML_nprocs; - USR_COMM USR_comm; - int (*USR_sendbytes)(void*,unsigned int,int,int,USR_COMM); - int (*USR_irecvbytes)(void*,unsigned int,int*,int*,USR_COMM,USR_REQ*); - int (*USR_waitbytes)(void*,unsigned int,int*,int*,USR_COMM,USR_REQ*); - void (*USR_cheapwaitbytes)(void*,unsigned int,int*,int*,USR_COMM,USR_REQ*); - USR_ERRHANDLER *USR_errhandler; - -} ML_Comm; - -extern ML_Comm *global_comm; /* should be made obsolete */ - -/* ******************************************************************** */ -/* functions for the ML communicator */ -/* -------------------------------------------------------------------- */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif - -extern int ML_Comm_Create( ML_Comm ** comm ); -extern int ML_Comm_Destroy( ML_Comm ** comm ); -extern int ML_Comm_Check( ML_Comm *comm ); - -extern int ML_Comm_Set_UsrComm( ML_Comm *comm, USR_COMM com ); -extern int ML_Comm_Set_Mypid( ML_Comm *comm, int mypid ); -extern int ML_Comm_Set_Nprocs( ML_Comm *comm, int nprocs); -extern int ML_Comm_Set_SendFcn( ML_Comm *comm, int (*SendFcn)(void*,unsigned int,int,int,USR_COMM)); -extern int ML_Comm_Set_RecvFcn( ML_Comm *comm, int (*RecvFcn)(void*,unsigned int,int*,int*,USR_COMM,USR_REQ*)); -extern int ML_Comm_Set_WaitFcn( ML_Comm *comm, int (*WaitFcn)(void*,unsigned int,int*,int*,USR_COMM,USR_REQ*)); - -extern int ML_Comm_GmaxInt( ML_Comm *comm, int intdata ); -extern double ML_Comm_GmaxDouble(ML_Comm *comm, double ddata ); -extern int ML_Comm_GsumInt( ML_Comm *comm, int intdata ); -extern double ML_Comm_GsumDouble(ML_Comm *comm, double ddata ); -extern int ML_Comm_GsumVecInt(ML_Comm *,int *invec,int *tmpvec,int vleng); -extern int ML_Comm_GappendInt(ML_Comm *,int *invec,int *lleng, int tleng); -extern int ML_Comm_GappendBigInt(ML_Comm *,ml_big_int *invec,int *lleng, int tleng); -extern int ML_Comm_GappendDouble(ML_Comm*,double *dvec,int *lleng,int tleng); - -extern int ML_Comm_Irecv(void*,unsigned int,int *,int *,USR_COMM,USR_REQ*); -extern int ML_Comm_Wait (void*,unsigned int,int *,int *,USR_COMM,USR_REQ*); -extern void ML_Comm_CheapWait (void*,unsigned int,int *,int *,USR_COMM,USR_REQ*); -extern int ML_Comm_Send (void*,unsigned int,int, int, USR_COMM ); -extern int ML_gpartialsum_int(int val, ML_Comm *comm); - - -#ifdef ML_CATCH_MPI_ERRORS_IN_DEBUGGER -extern int ML_Comm_ErrorHandlerSet(USR_COMM, USR_ERRHANDLER*); -/* -extern int ML_Comm_ErrorHandlerCreate( - void *(*HandlerFcn)(USR_COMM*,int*), - USR_ERRHANDLER*); -*/ -extern int ML_Comm_ErrorHandlerCreate( - USR_ERRHANDLER_FUNCTION (*HandlerFcn), - USR_ERRHANDLER*); -extern int ML_Comm_ErrorHandlerDestroy(USR_ERRHANDLER**); -extern void ML_Comm_ErrorHandler(USR_COMM*, int*,...); -#endif - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_comminfoagx.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_comminfoagx.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_comminfoagx.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_comminfoagx.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,99 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Data structure to hold the send and receive information for grid */ -/* interpolation queries. */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) */ -/* Date : February, 1999 */ -/* ******************************************************************** */ - -#ifndef _MLCOMMINFOAGX_ -#define _MLCOMMINFOAGX_ - -#include -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_memory.h" - -/* ******************************************************************** */ -/* send_cur : keeps track of how many send sublist has been loaded */ -/* send_cnt : total number of send sublists to be loaded */ -/* send_proc : a list of processor numbers for send */ -/* send_ia : send_ia[i] to send_ia[i-1] point to the locations in */ -/* send_list : send_list for indices to send to send_proc[i] */ -/* recv_cur : keeps track of how many recv sublist has been loaded */ -/* recv_cnt : total number of recv sublists to be loaded */ -/* recv_proc : a list of processor numbers for recv */ -/* recv_ia : recv_ia[i] to recv_ia[i-1] point to the locations in */ -/* recv_list : recv_list for indices to recv from recv_proc[i] */ -/* recv_xyz : storing coordinate information to be received. */ -/* -------------------------------------------------------------------- */ - -typedef struct ML_CommInfoAGX_Struct -{ - int ML_id; - int proc_id; - int send_cur; - int send_cnt; - int *send_proc; - int *send_ia; - ml_big_int *send_list; - int recv_cur; - int recv_cnt; - int *recv_proc; - int *recv_ia; - ml_big_int *recv_list; - double *recv_xyz; - -} ML_CommInfoAGX; - -/* ******************************************************************** */ -/* functions to manipulate the ML_CommInfoAGX structure */ -/* -------------------------------------------------------------------- */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif - -extern int ML_CommInfoAGX_Create(ML_CommInfoAGX **); -extern int ML_CommInfoAGX_Setup_Send(ML_CommInfoAGX *, int, int); -extern int ML_CommInfoAGX_Load_SendList(ML_CommInfoAGX *, int, int, ml_big_int*); -extern int ML_CommInfoAGX_Get_SendList(ML_CommInfoAGX *,int,int*,int*,ml_big_int**); -extern int ML_CommInfoAGX_Setup_Recv(ML_CommInfoAGX *, int, int); -extern int ML_CommInfoAGX_Load_RecvInfo(ML_CommInfoAGX *, int, int); -extern int ML_CommInfoAGX_Load_RecvData(ML_CommInfoAGX*,int,ml_big_int*,double*, - double*, double*); -extern int ML_CommInfoAGX_Get_RecvList(ML_CommInfoAGX *,int,int*,int*,ml_big_int**); -extern int ML_CommInfoAGX_Destroy(ML_CommInfoAGX **); -extern int ML_CommInfoAGX_Print(ML_CommInfoAGX *); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_comminfoop.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_comminfoop.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_comminfoop.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_comminfoop.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,161 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the New stuff */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : March, 1999 */ -/* ******************************************************************** */ - -#ifndef __MLCOMMINFOOP__ -#define __MLCOMMINFOOP__ - -#include "ml_common.h" -#include "ml_comm.h" - -typedef struct ML_CommInfoOP_Struct ML_CommInfoOP; -typedef struct ML_NeighborList_Struct ML_NeighborList; -typedef struct ML_Comm_Envelope_Struct ML_Comm_Envelope; - -/* ******************************************************************** */ -/* ******************************************************************** */ -/* Internal data struction definition */ -/* ******************************************************************** */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* data definition for the ML_Operator Class */ -/* ******************************************************************** */ -/* -------------------------------------------------------------------- */ -/* 'NeighborList' stores the send and receive information of a given */ -/* neighbor. This data structure is used primarily in the construction */ -/* of Galerkin coarse grid operator. */ -/* -------------------------------------------------------------------- */ - -struct ML_NeighborList_Struct -{ - int ML_id; - int N_rcv, N_send; - int *rcv_list, *send_list; -}; - -/* -------------------------------------------------------------------- */ -/* 'CommInfoOP' records communication information: no. of neighboring */ -/* processors, an array of pointers to the neighbors, and 'add_rcfd' */ -/* which indicates whether or not received information is added to */ -/* existing values or overwrites existing values. That is, if we */ -/* receive a value that should be stored in the kth location of a */ -/* vector, do we add it with the value already in the kth location or */ -/* do we over-write. Additionally, if remap != NULL, the locations of */ -/* the values are effectively permuted after communication. In */ -/* particular, remap[i] = -1 indicates that the ith value of the vector */ -/* is no longer used while remap[i] = k indicates that the ith value of */ -/* the vector is actually stored in the kth index of the array. */ -/* -------------------------------------------------------------------- */ - -struct ML_CommInfoOP_Struct { - int N_neighbors; - ML_NeighborList *neighbors; - int add_rcvd; - int *remap; - int total_rcv_length; - int minimum_vec_size, remap_length, remap_max; - double time; - int NumActiveProc; - int proc_active; - ML_Comm *comm; -}; - -/* -------------------------------------------------------------------- - 'Comm_Envelope' holds message envelope information (e.g., message - tag). The motivation is to avoid asynchronous communication behavior. - - tag the message tag - -------------------------------------------------------------------- */ - -struct ML_Comm_Envelope_Struct { - int tag; -}; - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -extern int ML_CommInfoOP_Generate(ML_CommInfoOP **comm_info, - int (*user_comm)(double *, void *), void *user_data, - ML_Comm *ml_comm, int N_cols, int Nghost ); -extern int ML_CommInfoOP_Clone(ML_CommInfoOP **newone, ML_CommInfoOP *oldone); - -extern ML_CommInfoOP *ML_CommInfoOP_Create(void); -extern void ML_CommInfoOP_Destroy(ML_CommInfoOP **comm_info); - -extern int ML_CommInfoOP_Get_Nneighbors(ML_CommInfoOP *c_info); -extern int *ML_CommInfoOP_Get_neighbors( ML_CommInfoOP *c_info); -extern int *ML_CommInfoOP_Get_sendlist( ML_CommInfoOP *c_info, int neighbor); -extern int ML_CommInfoOP_Get_Nsendlist( ML_CommInfoOP *c_info, int neighbor); -extern int ML_CommInfoOP_Get_Nrcvlist( ML_CommInfoOP *c_info, int neighbor); -extern int *ML_CommInfoOP_Get_rcvlist( ML_CommInfoOP *c_info, int neighbor); -extern int ML_CommInfoOP_Set_neighbors(ML_CommInfoOP **c_info,int N_neighbors, - int *neighbors, int add_or_not, int *remap, int remap_leng); -extern int ML_CommInfoOP_Set_exch_info(ML_CommInfoOP *comm_info, int k, - int N_rcv, int *rcv_list, int N_send, int *send_list); - -extern int ML_CommInfoOP_Compute_TotalRcvLength(ML_CommInfoOP *comm_info); - -extern int ML_CommInfoOP_Print(ML_CommInfoOP *c_info, char *label); - -extern int ML_CommInfoOP_TransComm(ML_CommInfoOP *pre_comm, - ML_CommInfoOP **post_comm, - int invec_leng); - -extern void ML_create_unique_col_id(int Ncols, int **map, ML_CommInfoOP *, - int *max_per_proc, ML_Comm *comm); -extern void ML_create_unique_id(int N_local, int **map, ML_CommInfoOP *, ML_Comm *comm, int offset); -extern void ML_cheap_exchange_bdry(double dtemp[], ML_CommInfoOP *comm_info, - int start_location, int total_send, - ML_Comm *comm); -extern void ML_exchange_bdry(double dtemp[], ML_CommInfoOP *comm_info, - int start_location, ML_Comm *comm, - int overwrite_or_add, ML_Comm_Envelope *envelope); -extern int ML_reverse_exchange(double *, ML_CommInfoOP *, int, ML_Comm *comm); - -extern void ML_transposed_exchange_bdry(double x[], ML_CommInfoOP *comm_info, - int start_location, ML_Comm *comm, int overwrite_or_add); - -extern int ML_Comm_Envelope_Create(ML_Comm_Envelope**); -extern int ML_Comm_Envelope_Init(ML_Comm_Envelope* envelope); -extern int ML_Comm_Envelope_Destroy(ML_Comm_Envelope*); -extern int ML_Comm_Envelope_Clean(ML_Comm_Envelope*); -extern int ML_Comm_Envelope_Get_Tag(ML_Comm_Envelope*, int* tag); -extern int ML_Comm_Envelope_Set_Tag(ML_Comm_Envelope*, int, int); -extern int ML_Comm_Envelope_Increment_Tag(ML_Comm_Envelope*); -#define ML_Comm_Envelope_Print - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_common.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_common.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_common.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_common.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,198 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Include file that should be included in every header file. */ -/* ******************************************************************** */ -/* Author : Jonathan Hu */ -/* Date : July, 2003 */ -/* ******************************************************************** */ - -#ifndef __MLCOMMON__ -#define __MLCOMMON__ - -/* this avoids the classic build system from picking up a spurious - * macro from other packages that may have been autotooled */ -#ifdef ML_CLASSIC_BUILD -#ifdef HAVE_CONFIG_H -#undef HAVE_CONFIG_H -#endif -#endif - -/* The macros PACKAGE, PACKAGE_NAME, etc, get defined for each package and need to - be undef'd here to avoid warnings when this file is included from another package. - Based on what Kevin Long did for Epetra. */ -#ifdef PACKAGE -#undef PACKAGE -#endif - -#ifdef PACKAGE_NAME -#undef PACKAGE_NAME -#endif - -#ifdef PACKAGE_BUGREPORT -#undef PACKAGE_BUGREPORT -#endif - -#ifdef PACKAGE_STRING -#undef PACKAGE_STRING -#endif - -#ifdef PACKAGE_TARNAME -#undef PACKAGE_TARNAME -#endif - -#ifdef PACKAGE_VERSION -#undef PACKAGE_VERSION -#endif - -#ifdef VERSION -#undef VERSION -#endif - -#ifdef HAVE_CONFIG_H -#include "ml_config.h" - -/* aztecoo depends on epetra ...*/ -#if defined(HAVE_ML_AZTEC) || defined(HAVE_ML_AZTECOO) -#ifndef AZTEC -#define AZTEC -#endif -#define ML_WITH_EPETRA -#endif - -#ifdef HAVE_ML_AZTEC2_1 -#ifndef AZTEC -#define AZTEC -#endif -#endif - -/* ... but not vice versa */ -#ifdef HAVE_ML_EPETRA -#ifndef ML_WITH_EPETRA -#define ML_WITH_EPETRA -#endif -#endif - -#ifdef HAVE_ML_SUPERLU -#define SUPERLU -#endif - -#ifdef HAVE_ML_SUPERLU2_0 -#define SUPERLU -#endif - -#ifdef HAVE_ML_SUPERLU_DIST -#define DSUPERLU -#endif - -#ifdef HAVE_MPI -#ifndef ML_MPI -#define ML_MPI -#endif -#endif - -#if defined(HAVE_ML_EXTERNAL_MPI_FUNCTIONS) && defined(HAVE_MPI) -#define ML_USING_MPI_FUNCTIONS -#endif - -#ifdef HAVE_BLAS -#define USE_VENDOR_BLAS -#endif - -#ifdef HAVE_LAPACK -#define USE_VENDOR_LAPACK -#endif - -#ifdef HAVE_ML_ENRICH -#define ML_ENRICH -#endif - -#ifdef HAVE_ML_MEMORY_CHECK -#define ML_MEMORY_CHK -#endif - -#ifdef HAVE_ML_NEW_T_PE -#define ML_NEW_T_PE -#endif - -#ifdef HAVE_ML_COMPLEX_MAXWELL -#define GREG -#endif - -#ifdef HAVE_ML_TIMING -#define ML_TIMING -#define ML_TIMING_DETAILED -#endif - -#ifdef ML_MULTIPLE_RHS_BLOCK_FACTOR -#define WKC ML_MULTIPLE_RHS_BLOCK_FACTOR -#define ML_CPP -#endif - -#ifdef HAVE_ML_FLOPS -#define ML_FLOPS -#endif - -#ifdef HAVE_ML_BENCHMARKING -#define ML_BENCHMARK -#endif - -#ifdef HAVE_AMESOS -#ifndef HAVE_ML_AMESOS -#define HAVE_ML_AMESOS -#endif -#endif - -#ifdef HAVE_IFPACK -#ifndef HAVE_ML_IFPACK -#define HAVE_ML_IFPACK -#endif -#endif - -#ifdef HAVE_TEUCHOS -#ifndef HAVE_ML_TEUCHOS -#define HAVE_ML_TEUCHOS -#endif -#endif - -#ifdef HAVE_ANASAZI -#ifndef HAVE_ML_ANASAZI -#define HAVE_ML_ANASAZI -#endif -#endif - -#ifdef HAVE_TRIUTILS -#ifndef HAVE_ML_TRIUTILS -#define HAVE_ML_TRIUTILS -#endif -#endif - -#if defined(HAVE_ML_EPETRA) && defined(HAVE_ML_AMESOS) && defined(HAVE_ML_IFPACK) && defined(HAVE_ML_TEUCHOS) -#define HAVE_ML_MLAPI -#else -#ifdef HAVE_ML_MLAPI -#undef HAVE_ML_MLAPI -#endif -#endif - -#endif /*ifdef HAVE_CONFIG_H*/ - -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_config.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_config.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_config.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_config.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,278 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* src/ml_config.h. Generated by configure. */ -/* src/ml_config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to dummy `main' function (if any) required to link to the Fortran - libraries. */ -/* #undef F77_DUMMY_MAIN */ - -/* Define to a macro mangling the given C identifier (in lower and upper - case), which must not contain underscores, for linking with Fortran. */ -#define F77_FUNC(name,NAME) name ## _ - -/* As F77_FUNC, but for C identifiers containing underscores. */ -#define F77_FUNC_(name,NAME) name ## __ - -/* Define if F77 and FC dummy `main' functions are identical. */ -/* #undef FC_DUMMY_MAIN_EQ_F77 */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ASSERT_H */ - -/* Define if you have a BLAS library. */ -#define HAVE_BLAS 1 - -/* define if bool is a built-in type */ -#define HAVE_BOOL - -/* Define to 1 if you have the header file. */ -#define HAVE_CASSERT 1 - -/* Define if the C complier supports __PRETTY_FUNCTION__ */ -#define HAVE_CFUNC - -/* Define to 1 if you have the header file. */ -#define HAVE_CMATH 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_CSTDIO 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_CSTDLIB 1 - -/* Define if you want to build export makefiles. */ -#define HAVE_EXPORT_MAKEFILES - -/* Define if you are using gnumake - this will shorten your link lines. */ -/* #undef HAVE_GNUMAKE */ - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_IOMANIP 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_IOMANIP_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_IOSTREAM 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_IOSTREAM_H */ - -/* Define if you have LAPACK library. */ -#define HAVE_LAPACK 1 - -/* Define if want to build libcheck */ -#define HAVE_LIBCHECK - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -/* #undef HAVE_MALLOC */ - -/* Define to 1 if you have the header file. */ -#define HAVE_MALLOC_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MATH_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define if want to build with ml enabled */ -/* #undef HAVE_ML_AMESOS */ - -/* Define if want to build with ml enabled */ -/* #undef HAVE_ML_ANASAZI */ - -/* Define if want to build with ml_arpack enabled */ -/* #undef HAVE_ML_ARPACK */ - -/* Define if want to build with ml_aztec2_1 enabled */ -/* #undef HAVE_ML_AZTEC2_1 */ - -/* Define if want to build with ml enabled */ -/* #undef HAVE_ML_AZTECOO */ - -/* Define if want to build with ml_benchmarking enabled */ -/* #undef HAVE_ML_BENCHMARKING */ - -/* Define if want to build with ml_complex_maxwell enabled */ -/* #undef HAVE_ML_COMPLEX_MAXWELL */ - -/* Define if want to build with ml_enrich enabled */ -/* #undef HAVE_ML_ENRICH */ - -/* Define if want to build with ml enabled */ -/* #undef HAVE_ML_EPETRA */ - -/* Define if want to build with ml enabled */ -/* #undef HAVE_ML_EPETRAEXT */ - -/* Define if want to build ml-examples */ -#define HAVE_ML_EXAMPLES - -/* Define if want to build with ml_external_mpi_functions enabled */ -#define HAVE_ML_EXTERNAL_MPI_FUNCTIONS - -/* Define if want to build with ml_flops enabled */ -/* #undef HAVE_ML_FLOPS */ - -/* Define if want to build with ml enabled */ -/* #undef HAVE_ML_IFPACK */ - -/* Define if want to build with ml_memory_checking enabled */ -/* #undef HAVE_ML_MEMORY_CHECK */ - -/* Define if want to build with ml_metis enabled */ -/* #undef HAVE_ML_METIS */ - -/* Define if want to build with ml_newtpe enabled */ -#define HAVE_ML_NEW_T_PE 1 - -/* Define if want to build with ml_nox enabled */ -/* #undef HAVE_ML_NOX */ - -/* Define if want to build with ml_parasails enabled */ -/* #undef HAVE_ML_PARASAILS */ - -/* Define if want to build with ml_parmetis2x enabled */ -/* #undef HAVE_ML_PARMETIS_2x */ - -/* Define if want to build with ml_parmetis3x enabled */ -/* #undef HAVE_ML_PARMETIS_3x */ - -/* Define if want to build with ml_parpack enabled */ -/* #undef HAVE_ML_PARPACK */ - -/* Define if want to build with ml_superlu enabled */ -/* #undef HAVE_ML_SUPERLU */ - -/* Define if want to build with ml_superlu2 enabled */ -/* #undef HAVE_ML_SUPERLU2_0 */ - -/* Define if want to build with ml_superlu_dist enabled */ -/* #undef HAVE_ML_SUPERLU_DIST */ - -/* Define if want to build ml-tests */ -#define HAVE_ML_TESTS - -/* Define if want to build with ml enabled */ -/* #undef HAVE_ML_TEUCHOS */ - -/* Define if want to build with ml_timing enabled */ -/* #undef HAVE_ML_TIMING */ - -/* Define if want to build with ml enabled */ -/* #undef HAVE_ML_TRIUTILS */ - -/* Define if want to build with ml_zoltan enabled */ -/* #undef HAVE_ML_ZOLTAN */ - -/* define if we want to use MPI */ -/* #undef HAVE_MPI */ - -/* define if the compiler supports the mutable keyword */ -#define HAVE_MUTABLE - -/* define if the compiler implements namespaces */ -#define HAVE_NAMESPACES - -/* define if the compiler accepts the new for scoping rules */ -#define HAVE_NEW_FOR_SCOPING - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STDIO_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* define if std::sprintf is supported */ -#define HAVE_STD_SPRINTF - -/* define if the compiler supports Standard Template Library */ -#define HAVE_STL - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define if want to build tests */ -#define HAVE_TESTS - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Support for 64-bit integers */ -#define ML_BIG_INT int - -/* mallinfo with ML */ -#define ML_MALLINFO - -/* Support for multiple right hand sides. */ -/* #undef ML_MULTIPLE_RHS_BLOCK_FACTOR */ - -/* Name of package */ -#define PACKAGE "ml" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "jhu@sandia.gov" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "ml" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "ml 4.0" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "ml" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "4.0" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "4.0" - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -/* #undef inline */ -#endif - -/* Define to rpl_malloc if the replacement function should be used. */ -/* #undef malloc */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_csolve.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_csolve.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_csolve.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_csolve.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the ML_CSolve structure */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : March, 1999 */ -/* ******************************************************************** */ - -#ifndef __MLCSOLVE__ -#define __MLCSOLVE__ - -/* ******************************************************************** */ -/* data structure type definition */ -/* ******************************************************************** */ - -typedef struct ML_CSolveFunc_Struct ML_CSolveFunc; -typedef struct ML_CSolve_Struct ML_CSolve; - -/* ******************************************************************** */ -/* local include files */ -/* ******************************************************************** */ - -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_memory.h" -#include "ml_1level.h" -#include "ml_solver.h" - -#ifdef WKC -#include -#endif - -/* ******************************************************************** */ -/* data definition for the ML_CSolve Class */ -/* ******************************************************************** */ -/* -------------------------------------------------------------------- */ -/* These data structures define the coarse solver object. */ -/* -------------------------------------------------------------------- */ - -struct ML_CSolveFunc_Struct -{ - int ML_id; - int (*func_ptr)(ML_Solver *, int, double *, int, double *); -}; - -struct ML_CSolve_Struct -{ - int ML_id; - struct ML_1Level_Struct *my_level; - int ntimes; - double tol; - ML_CSolveFunc *func; - void *data; - void (*data_destroy)(void *); - double build_time, apply_time; - char *label; -}; - -/* ******************************************************************** */ -/* ******************************************************************** */ -/* User Interface Proto-types */ -/* ******************************************************************** */ -/* ******************************************************************** */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif -extern int ML_CSolve_Create(ML_CSolve **); -extern int ML_CSolve_Set_Label(ML_CSolve *, char *label); -extern int ML_CSolve_Init(ML_CSolve *); -extern int ML_CSolve_Destroy(ML_CSolve **); -extern int ML_CSolve_Clean(ML_CSolve *); -extern int ML_CSolve_Check(ML_CSolve *); -extern int ML_CSolve_Set_1Level(ML_CSolve *, ML_1Level *); -extern int ML_CSolve_Apply(ML_CSolve *, int, double *, int, double *); - -#ifdef WKC -/* WKC -- Added prototype */ -extern int ML_CSolve_Apply(ML_CSolve *, int, Epetra_MultiVector &, int, - Epetra_MultiVector &); -#endif - -extern int ML_CSolve_Aggr(ML_Solver *, int, double *, int, double *); -extern int ML_CSolve_Clean_Aggr(void *, ML_CSolveFunc *); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_DD_prec.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_DD_prec.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_DD_prec.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_DD_prec.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#ifndef ML_DD_PREC_H -#define ML_DD_PREC_H - -#include "ml_common.h" -#include "ml_struct.h" -#include "ml_smoother.h" -#include "ml_defs.h" - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -double ML_DD_OneLevel(ML_1Level *curr, double *sol, double *rhs, - int approx_all_zeros, ML_Comm *comm, - int res_norm_or_not, ML *ml); -double ML_DD_Additive(ML_1Level *curr, double *sol, double *rhs, - int approx_all_zeros, ML_Comm *comm, - int res_norm_or_not, ML *ml); -double ML_DD_Hybrid(ML_1Level *curr, double *sol, double *rhs, - int approx_all_zeros, ML_Comm *comm, - int res_norm_or_not, ML *ml); -double ML_DD_Hybrid_2(ML_1Level *curr, double *sol, double *rhs, - int approx_all_zeros, ML_Comm *comm, - int res_norm_or_not, ML *ml); -int ML_Aggregate_Stats_CleanUp_Info( ML *ml); -int ML_Aggregate_Stats_ComputeCoordinates( ML *ml, ML_Aggregate *ag, - double *x, double *y, double *z); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif /* ifdef ML_DD_PREC_H */ - - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_defs.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_defs.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_defs.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_defs.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,190 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#ifndef __MLDEFS__ -#define __MLDEFS__ - -#include "ml_common.h" - -/* -#ifdef ML_MATCHED -#define MLFORTRAN(aaa) aaa -#else -#define MLFORTRAN(aaa) aaa ## _ -#endif -*/ - -#define ML_VERSION ml4_0 - -#define ML_LOCATION __FILE__,"(", __LINE__,"): " - -#ifndef MB_MODIF -#define MB_MODIF -#endif -#ifndef MB_MODIF_QR -#define MB_MODIF_QR -#endif -#ifndef RST_MODIF -#define RST_MODIF -#endif -#define ML_NONE 10 -#define ML_MGV 11 -#define ML_MG2CGC 12 -#define ML_MGFULLV 13 -#define ML_RSAMG 14 -#define ML_SAAMG 15 -#define ML_MGW 16 -#define ML_PAMGV 17 -/*MS*/ -/* those are to mimic one-level and two-level DD methods. - They are a bit experimental now */ -#define ML_ONE_LEVEL_DD -30 -#define ML_TWO_LEVEL_DD_ADD -31 -#define ML_TWO_LEVEL_DD_HYBRID -32 -#define ML_TWO_LEVEL_DD_HYBRID_2 -33 -/*ms*/ - -#define ML_GRID_DIMENSION 21 -#define ML_GRID_NVERTICES 22 -#define ML_GRID_NELEMENTS 23 -#define ML_GRID_ELEM_GLOBAL 24 -#define ML_GRID_ELEM_NVERT 25 -#define ML_GRID_ELEM_VLIST 26 -#define ML_GRID_VERT_GLOBAL 27 -#define ML_GRID_VERT_COORD 28 -#define ML_GRID_BASISFCNS 29 -#define ML_GRID_ELEM_VOLUME 30 -#define ML_GRID_ELEM_MATRIX 31 - -#define ML_ID_ML 101 -#define ML_ID_SL 102 -#define ML_ID_SLSOL 103 -#define ML_ID_KLUDGE 104 -#define ML_ID_VEC 105 -#define ML_ID_OPAGX 106 -#define ML_ID_ILIST 107 -#define ML_ID_COMM 108 -#define ML_ID_COMMINFOAGX 109 -#define ML_ID_COMMINFOOP 110 -#define ML_ID_GRIDAGX 111 -#define ML_ID_GRIDFCN 112 -#define ML_ID_GGRAPH 113 -#define ML_ID_MATRIX 114 -#define ML_ID_DESTROYED 115 -#define ML_ID_SOLVER 116 -#define ML_ID_MAPPER 117 -#define ML_ID_MATCSR 118 -#define ML_ID_BC 119 -#define ML_ID_GRID 120 -#define ML_ID_SMOOTHER 121 -#define ML_ID_CSOLVE 122 -#define ML_ID_OP 123 -#define ML_ID_MATRIXDCSR 124 -#define ML_ID_AGGRE 125 -#define ML_ID_KRYLOVDATA 126 -#define ML_ID_AMG 127 - -#define ML_COMPUTE_RES_NORM 129 -#define ML_NO_RES_NORM 179 - -#define ML_INCREASING 717 -#define ML_DECREASING 718 - -#define ML_PRESMOOTHER 201 -#define ML_POSTSMOOTHER 202 -#define ML_BOTH 203 - -#define ML_BDRY_DIRICHLET 1 -#define ML_BDRY_NEUMANN 2 -#define ML_BDRY_INSIDE 'I' -#define ML_BDRY_RIDGE 'R' -#define ML_BDRY_FACE 'F' -#define ML_BDRY_CORNER 'C' - -#define ML_FALSE 0 -#define ML_TRUE 1 - -#ifndef ML_MAX_NEIGHBORS -#define ML_MAX_NEIGHBORS 250 -#endif -#ifndef ML_MAX_MSG_BUFF_SIZE -#define ML_MAX_MSG_BUFF_SIZE 100000 /* max usable message buffer size */ -#endif - -#define ML_OVERWRITE 0 -#define ML_ADD 1 -#define ML_NO 0 -#define ML_YES 1 -#define ML_Set 111 - -#define ML_EMPTY -1 -#define ML_DEFAULT -2 -#define ML_DDEFAULT -2.0 -#define ML_ONE_STEP_CG -100 -#define ML_ZERO 3 -#define ML_NONZERO 4 -#define ML_CONVERGE -2 -#define ML_NOTSET -1 -#define ML_NONEMPTY 111 - -#define ML_CHAR 1 -#define ML_INT 2 -#define ML_DOUBLE 3 - -#define ML_ALL_LEVELS -1237 -#define ML_MSR_MATRIX -201 -#define ML_CSR_MATRIX -203 -#define ML_EpetraCRS_MATRIX -205 - -/* JJH -- these are message tags */ -#define ML_TAG_BASE 27000 -#define ML_TAG_PRESM 1 -#define ML_TAG_POSTSM 101 - -/*MS*/ -/* those are for the aggregate ordering within METIS or ParMETIS */ -#define ML_LOCAL_INDICES 0 -#define ML_GLOBAL_INDICES 1 -/*ms*/ - -/* maximum dimension of the subspace associated with an ML_Operator type */ -#define ML_MAX_SUBSPACE_DIM 3 - -/* block partitioning option to use Parmetis */ -enum ml_partitioner_enum {ML_USEPARMETIS,ML_USEMETIS,ML_USEZOLTAN,ML_USEJOSTLE}; -typedef enum ml_partitioner_enum ML_Partitioner; - - - -/* Allow 64-bit integer support. This is needed when the ML library is used - * with MPSalsa. MPSalsa requires 64-bit global element numbers. */ -#ifndef ML_BIG_INT -#define ML_BIG_INT int -#endif -typedef ML_BIG_INT ml_big_int; - -/* Eigenvalue options */ -#define ML_DIAGSCALE 1 -#define ML_NO_SCALE 0 -#define ML_SYMMETRIC 0 -#define ML_NONSYMM 1 -#define ML_SYMMETRIZE_MATRIX 1 -#define ML_NO_SYMMETRIZE 0 - -#define ML_Get_MySmootherData(smoother_obj) ((smoother_obj)->smoother->data) -#define ML_Get_MyGetrowData(matrix_obj) ((matrix_obj)->data) -#define ML_Get_MyMatvecData(matrix_obj) ((matrix_obj)->data) - -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_eigf2c.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_eigf2c.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_eigf2c.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_eigf2c.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,88 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#ifndef __MLEIGF2C__ -#define __MLEIGF2C__ - -#include "ml_common.h" -#include "ml_lapack.h" -#include "ml_memory.h" -#include "ml_comm.h" - -#define DMOUT_F77 F77_FUNC(dmout,DMOUT) -#define PDMOUT_F77 F77_FUNC(pdmout,PDMOUT) -#define DNEUPD_F77 F77_FUNC(dneupd,DNEUPD) - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif - - - - extern int ml_pdmout__(USR_COMM *comm, int *lout, int *m, int *n, double *a, - int *lda, int *idigit); - - extern int ml_pdneupc__(USR_COMM *comm, - int *ivec, char *howmny, int *celect, double *d__, - double *v, int *ldv, double *workev, char *bmat, int *n, - char *which, int *nev, double *tol, double *resid, int *ncv, - int *iparam, int *ipntr, double *workd, double *workl, - int *lworkl, int *ierr, ftnlen howmny_len, ftnlen bmat_len, - ftnlen which_len); - /* - extern int ml_pdneupc__(int *comm, - int *ivec, char *howmny, int *celect, double *d__, - double *v, int *ldv, double *workev, char *bmat, int *n, - char *which, int *nev, double *tol, double *resid, int *ncv, - int *iparam, int *ipntr, double *workd, double *workl, - int *lworkl, int *ierr, ftnlen howmny_len, ftnlen bmat_len, - ftnlen which_len); - */ -extern void PREFIX DMOUT_F77(int *, int *, int *, double *, int *lda, int *idigit, - char *, ftnlen); - -extern void PREFIX PDMOUT_F77(int *, - int *, int *, int *, double *, int *lda, int *idigit, - char *, ftnlen); - - -extern void PREFIX DNEUPD_F77(int *, char *, int *, double *, double *, double *, - int *, double *, double *, double *, char *bmat, - int *n, char *which, int *nev, double *tol, double *, - int *ncv, double *, int *, int *, int *, double *, - double *, int *, int *, ftnlen, ftnlen, ftnlen); - - -extern void PREFIX PDNEUPD_F77(int *, - int *, char *, int *, double *, double *, double *, - int *, double *, double *, double *, char *bmat, - int *n, char *which, int *nev, double *tol, double *, - int *ncv, double *, int *, int *, int *, double *, - double *, int *, int *, ftnlen, ftnlen, ftnlen); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - - - -#endif - - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_elementagx.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_elementagx.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_elementagx.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_elementagx.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Data structure to hold the most basic information about a finite */ -/* element (used locally only). */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : April, 1998 */ -/* ******************************************************************** */ - -#ifndef _MLELMNTAGX_ -#define _MLELMNTAGX_ - -#include -/* #include */ - -#include "ml_common.h" -#include "ml_memory.h" - -/* ******************************************************************* */ -/* ndim : dimension of the grid */ -/* Nvertices : number of vertices in the element */ -/* vertices : an array storing the node number of the vertices */ -/* x,y,z : stores the coordinates of the vertices */ -/* ------------------------------------------------------------------- */ - -typedef struct ML_ElementAGX_Struct - { - int ndim; - int Nvertices; - int *vertices; - double *x, *y, *z; - -} ML_ElementAGX; - -/* ******************************************************************** */ -/* functions to manipulate the Simple_element structure */ -/* -------------------------------------------------------------------- */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif - -extern int ML_ElementAGX_Create(ML_ElementAGX**, int, int); -extern int ML_ElementAGX_Destroy(ML_ElementAGX **); -extern int ML_ElementAGX_Reuse(ML_ElementAGX *); -extern int ML_ElementAGX_Print(ML_ElementAGX *); -extern int ML_ElementAGX_Load_VertCoordinate - (ML_ElementAGX*, int, double, double, double); -extern int ML_ElementAGX_Get_VertCoordinate - (ML_ElementAGX *, int, int*, double *, double *, double *); -extern int ML_ElementAGX_ComposeCandidates - (ML_ElementAGX *, int, double *, int *, int *, int *, int *); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_epetra.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_epetra.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_epetra.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_epetra.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#ifndef ML_EPETRA_H -#define ML_EPETRA_H - -// prints out an error message if variable is not zero, -// and return this value. This macro always returns. -#define ML_RETURN(ml_err) \ - { if (ml_err != 0) { \ - cerr << "ML::ERROR:: " << ml_err << ", " \ - << __FILE__ << ", line " << __LINE__ << endl; } \ - return(ml_err); } - -// prints out an error message if variable is not zero, -// and return this value. -#define ML_CHK_ERR(ml_err) \ - { if (ml_err != 0) { \ - cerr << "ML::ERROR:: " << ml_err << ", " \ - << __FILE__ << ", line " << __LINE__ << endl; \ - return(ml_err); } } - -// prints out an error message if variable is not zero -// and returns. -#define ML_CHK_ERRV(ml_err) \ - { if (ml_err != 0) { \ - cerr << "ML::ERROR:: " << ml_err << ", " \ - << __FILE__ << ", line " << __LINE__ << endl; \ - return; } } - -#define ML_EXIT(ml_err) \ - { if (ml_err != 0) { \ - cerr << "ML::FATAL ERROR:: " << ml_err << ", " \ - << __FILE__ << ", line " << __LINE__ << endl; } \ - exit(ml_err); } - -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_epetra_operator.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_epetra_operator.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_epetra_operator.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_epetra_operator.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* Copyright (2001) Sandia Corportation. Under the terms of Contract - * DE-AC04-94AL85000, there is a non-exclusive license for use of this - * work by or on behalf of the U.S. Government. Export of this program - * may require a license from the United States Government. */ - - -/* NOTICE: The United States Government is granted for itself and others - * acting on its behalf a paid-up, nonexclusive, irrevocable worldwide - * license in ths data to reproduce, prepare derivative works, and - * perform publicly and display publicly. Beginning five (5) years from - * July 25, 2001, the United States Government is granted for itself and - * others acting on its behalf a paid-up, nonexclusive, irrevocable - * worldwide license in this data to reproduce, prepare derivative works, - * distribute copies to the public, perform publicly and display - * publicly, and to permit others to do so. - * - * NEITHER THE UNITED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT - * OF ENERGY, NOR SANDIA CORPORATION, NOR ANY OF THEIR EMPLOYEES, MAKES - * ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR - * RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY - * INFORMATION, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS - * THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS. */ - -#ifndef ML_EPETRA_OPERATOR_H -#define ML_EPETRA_OPERATOR_H - -/* simply recall the other header. This is for compatibility - * reasons: file "ml_MultiLevelOperator.h" was previously - * called "ml_epetra_operator.h". - */ - -#include "ml_MultiLevelOperator.h" - -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_epetra_preconditioner.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_epetra_preconditioner.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_epetra_preconditioner.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_epetra_preconditioner.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* Copyright (2004) Sandia Corportation. Under the terms of Contract - * DE-AC04-94AL85000, there is a non-exclusive license for use of this - * work by or on behalf of the U.S. Government. Export of this program - * may require a license from the United States Government. */ - - /* NOTICE: The United States Government is granted for itself and others - * acting on its behalf a paid-up, nonexclusive, irrevocable worldwide - * license in ths data to reproduce, prepare derivative works, and - * perform publicly and display publicly. Beginning five (5) years from - * July 25, 2001, the United States Government is granted for itself and - * others acting on its behalf a paid-up, nonexclusive, irrevocable - * worldwide license in this data to reproduce, prepare derivative works, - * distribute copies to the public, perform publicly and display - * publicly, and to permit others to do so. - * - * NEITHER THE UNITED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT - * OF ENERGY, NOR SANDIA CORPORATION, NOR ANY OF THEIR EMPLOYEES, MAKES - * ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR - * RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY - * INFORMATION, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS - * THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS. */ - -#ifndef ML_EPETRA_PRECONDITIONER_H -#define ML_EPETRA_PRECONDITIONER_H - -/* simply recall the other header. This is for compatibility - * reasons: file "ml_MultiLevelPreconditioner.h" was previously - * called "ml_epetra_preconditioner.h". - */ - -#include "ml_MultiLevelPreconditioner.h" - -#endif /* _ML_EPETRA_PRECONDITIONER_H_ */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_epetra_utils.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_epetra_utils.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_epetra_utils.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_epetra_utils.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,219 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/*! - * \file ml_epetra_utils.h - * - * \brief Interface to the Trilinos package Anasazi. - * - * \date Last update to Doxygen: 22-Jul-04 - * - */ - - -#ifndef _ML_EPETRA_UTILS_H_ -#define _ML_EPETRA_UTILS_H_ - -class Epetra_Comm; -class Epetra_BlockMap; -class Epetra_MultiVector; -class Epetra_RowMatrix; -class Epetra_Map; -class Epetra_Vector; -class Epetra_Import; -class Epetra_Object; -class Epetra_CrsMatrix; -class Epetra_RowMatrix; -class Epetra_LinearProblem; -class Epetra_SerialDenseMatrix; -namespace Teuchos { - class ParameterList; -} - -#include "ml_common.h" - -#ifdef ML_MPI -#ifndef EPETRA_MPI -#define EPETRA_MPI -#endif -#include "mpi.h" -#endif -#include "ml_include.h" -#include - -#ifndef ML_CPP -extern "C" { -#endif - -// ====================================================================== -//! Matrix-vector function for Epetra matrices. -/*! This is the ML matrix-vector wrap for Epetra matrices. - */ -int ML_Epetra_matvec(ML_Operator *data, int in, double *p, - int out, double *ap); -int ML_Epetra_CrsMatrix_matvec(ML_Operator *data, int in, double *p, - int out, double *ap); -int ML_Epetra_VbrMatrix_matvec(ML_Operator *data, int in, double *p, - int out, double *ap); -int Epetra_ML_GetCrsDataptrs(ML_Operator *data, double **values, int **cols, int **rowptr); - -#ifdef WKC -int ML_Epetra_matvec_WKC(ML_Operator *data, int in, double *p, int out, - double *ap); -#endif - -//! Getrow function for matrix of type Epetra_RowMatrix. -/*! - Supply local matrix (without ghost node columns) for rows given by - requested_rows[0 ... N_requested_rows-1]. Return this information in - 'row_lengths, columns, values'. If there is not enough space to complete - this operation, return 0. Otherwise, return 1. - - \param data (In) - Points to user's data containing matrix values. - \param N_requested_rows (In) Number of rows for which nonzero are to be - returned. - \param requested_rows (In) - Requested_rows[0...N_requested_rows-1] give the - row indices of the rows for which nonzero values are - returned. - \param row_lengths (Out) - Row_lengths[i] is the number of nonzeros in the - row 'requested_rows[i]' - \param columns,values (Out) - Columns[k] and values[k] contains the column - number and value of a matrix nonzero where all nonzeros for - requested_rows[i] appear before requested_rows[i+1]'s - nonzeros. NOTE: Arrays are of size 'allocated_space'. - \param allocated_space (In) - Indicates the space available in 'columns' and - 'values' for storing nonzeros. If more space is needed, - return 0. - */ -int ML_Epetra_getrow(ML_Operator *data, int N_requested_rows, - int requested_rows[], int allocated_space, int columns[], - double values[], int row_lengths[]); - -int ML_Epetra_CrsMatrix_getrow(ML_Operator *data, int N_requested_rows, - int requested_rows[], - int allocated_space, int columns[], double values[], - int row_lengths[]); - -int ML_Epetra_VbrMatrix_getrow(ML_Operator *data, - int N_requested_rows, int requested_rows[], - int allocated_space, int columns[], double values[], - int row_lengths[]); - -void ML_Set_Filter(Teuchos::ParameterList& List); - -int ML_Epetra_matvec_Filter(ML_Operator *data, int in, double *p, - int out, double *ap); - -int ML_Epetra_getrow_Filter(ML_Operator *data, int N_requested_rows, - int requested_rows[], int allocated_space, int columns[], - double values[], int row_lengths[]); -//! Update vec's ghost node via communication. -/*! Update vec's ghost node via communication. Note: the length of vec is - given by N_local + N_ghost where Amat was created via - \c AZ_matrix_create(N_local); - and a 'getrow' function was supplied via - \c AZ_set_MATFREE_getrow(Amat,,,,N_ghost,). - - \param vec Vector containing data. On output, ghost values - are updated. - - \param data points to user's data containing matrix values. - and communication information. - */ -int ML_Epetra_comm_wrapper(double vec[], void *data); -int ML_Epetra_CrsMatrix_comm_wrapper(double vec[], void *data); -int ML_Epetra_VbrMatrix_comm_wrapper(double vec[], void *data); - -#ifndef ML_CPP -} -#endif - -//! Wraps an Epetra_RowMatrix into an ML_Operators. -/*! This function creates an ML_Operator that is based on the input - * Epetra_RowMatrix. This is a "cheap" wrap in the sense that - * only function and pointers are created. Data is still coded as an - * Epetra_RowMatrix. - * - * \note ML requires A->RowMatrixRowMap() == A->OperatorRangeMap() - */ -int EpetraMatrix2MLMatrix(ML *ml_handle, int level, - Epetra_RowMatrix * Amat); - -//! Wraps an Epetra_RowMatrix into an ML_Operators, for the given level. -/*! This function creates an ML_Operator that is based on the input - * Epetra_RowMatrix. This is a "cheap" wrap in the sense that - * only function and pointers are created. Data is still coded as an - * Epetra_RowMatrix. The ML_Operator is set in the specified level of the - * hierarchy. - * - * \note ML requires A->RowMatrixRowMap() == A->OperatorRangeMap() - */ -int ML_Operator_WrapEpetraMatrix(Epetra_RowMatrix * A, ML_Operator *Result); - -//! Multiplies two Epetra_RowMatrix's, returns the results as an Epetra_CrsMatrix. -Epetra_CrsMatrix *Epetra_MatrixMult(Epetra_RowMatrix *B, Epetra_RowMatrix *Bt); - -//! Adds two Epetra_RowMatrix's, returns the result as an Epetra_CrsMatrix -Epetra_CrsMatrix *Epetra_MatrixAdd(Epetra_RowMatrix *B, Epetra_RowMatrix *Bt, double scalar); -int ML_Epetra_CRSinsert(ML_Operator *, int, int *, double *, int); - -//! Converts an ML_Operator into an Epetra_CrsMatrix -/*! This function creates a new Epetra_CrsMatrix, and inserts all the nonzero - * elements of the ML_Operator in it. This is an expensive conversion, in the - * sense that the Epetra_RowMatrix is a \sl copy of the input ML_Operator. - * - * \note This function can be used with rectangular matrices. - */ -int ML_Operator2EpetraCrsMatrix(ML_Operator *Ke, Epetra_CrsMatrix * & - CrsMatrix, int & MaxNumNonzeros, - bool CheckNonzeroRow, double &); - -Epetra_Map* Epetra_ML_readupdatevector(char* filename, Epetra_Comm& comm); -Epetra_CrsMatrix* Epetra_ML_readaztecmatrix(char* filename,Epetra_Map& map, - Epetra_Comm& comm); - -#ifdef FIXME -string ML_toString(const int& x); -string ML_toString(const double& x); -#endif - - -#ifdef __cplusplus -extern "C" { -#endif -int ML_Operator_Destroy_DiscreteLaplacian(); -int ML_Operator_DiscreteLaplacian(ML_Operator* Op, int SymmetricPattern, - double* x_coord, double* y_coord, - double* z_coord, double theta, - ML_Operator** NewOp); -bool Epetra_ML_readaztecvector(char* filename, Epetra_MultiVector& Vector, - Epetra_Map& map,Epetra_Comm& comm, int ivec); -bool Epetra_ML_readvariableblocks(char* filename, Epetra_Map& map, - Epetra_Comm& comm, - int**blocks, int** block_pde); -bool Epetra_ML_writegidviz(char* filename, int label, - Epetra_MultiVector& vector, int ivec, - Epetra_Map& map, Epetra_Comm& comm); - -#ifdef __cplusplus -} -#endif - -#endif /* _ML_EPETRA_UTILS_H_ */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_FilterType.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_FilterType.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_FilterType.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_FilterType.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#ifndef ML_FILTERTYPE_H -#define ML_FILTERTYPE_H - -/* \file ml_FilterType.h - * - * \brief Enum for filtering. - */ - -namespace ML_Epetra { - -/*! \enum FilterType - * - * \brief Defined the type of filter to be applied after each - * ExtractMyRowCopy(). - * - * \author Marzio Sala, SNL 9214. - * - * \date Last updated on 15-Mar-05. - */ - -enum FilterType { - ML_NO_FILTER, /*< no filter is applied */ - ML_EQN_FILTER, /*< decouples the equations */ - ML_TWO_BLOCKS_FILTER, /*< decoupled the system in two blocks */ - ML_THREE_BLOCKS_FILTER, /*< decoupled the system in three blocks */ - ML_MASK_FILTER /*< general approach */ -}; - -} // namespace ML_Epetra -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_ggb.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_ggb.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_ggb.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_ggb.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,112 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#ifndef __MLGGB_ -#define __MLGGB_ - - - -#define SHIFTS 0 -#define MAX_ITRS 2 -#define MODE 6 - -#include -#include -#include "ml_common.h" -#include "ml_mat_formats.h" -#include "ml_lapack.h" -#include "ml_eigf2c.h" - -#define DNAUPD_F77 F77_FUNC(dnaupd,DNAUPD) -#define PDNAUPD_F77 F77_FUNC(pdnaupd,PDNAUPD) - - -struct ML_Eigenvalue_Struct { - int Max_Iter; /* User input from input file */ - int Num_Eigenvalues; - int Arnoldi; - double Residual_Tol; - int Fattening; - - - int Nflag; /* Flag to indicate the first Newton iteration */ - int Pnconv; /* Previous number of converged eigenvalues */ - double *Evec, *Eval; /* eigenvectors and eigenvalues to be reused - with MGGB */ - -}; - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - - - -void ML_ARPACK_driver(char which[], - char bmat[], int iparam[], int mode, - int nev, int ncv, double tol, ML *ml, - struct ML_CSR_MSRdata *mydata, int Fattening, - struct ML_Eigenvalue_Struct *eigen_struct, - int Debug_Flag, int GGB_alp_flag); - - - void ML_GGB2CSR (double *v, int nconv, int MatSize, int proc_id, - struct ML_CSR_MSRdata *mydata, int Debug_Flag ); - - - void ML_GGBalp (double *NewVec, int nconv, int nloc2, struct ML_Eigenvalue_Struct - *eigen_struct); - - extern double ML_subspace (int nrows, double *inp1, int ncols1, double *inp2, int ncols2); - - - - extern void ML_ARPACK_GGB( - struct ML_Eigenvalue_Struct *eigen_struct,ML *ml, - struct ML_CSR_MSRdata *mydata, int Debug_Flag, - int GGB_alp_flag); - - extern int ML_MGGB_angle(struct ML_Eigenvalue_Struct *eigen_struct,ML *ml, - struct ML_CSR_MSRdata *mydata); - - extern int ML_Rayleigh (ML *ml, int nrows, double *q, int count); - - extern double *ML_complex_gdot(int leng, double *ureal, double *uimag, double *vreal, double *vimag, - ML_Comm *comm); - - extern double ML_normc(double *real, double *imag, int leng ); - - extern void ML_Eig_Destroy(void *data); - - extern int ML_OperatorGGB_Apply (double *densemat, int Nrows, int Ncols, double *din, double *dout, int Transpose); - -void PREFIX DNAUPD_F77(int *, char *, int *, char *, int *, double *, double *, - int *, double *, int *, int *, int *, double *, double *, - int *, int *); - -void PREFIX PDNAUPD_F77(int *, int *, char *, int *, char *, int *, double *, double *, - int *, double *, int *, int *, int *, double *, double *, - int *, int *); - - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_ggraph.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_ggraph.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_ggraph.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_ggraph.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* data structure to hold grid information in the form of a graph */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) */ -/* Date : September, 1998 */ -/* ******************************************************************** */ - -#ifndef __MLGRIDG__ -#define __MLGRIDG__ - -#include -/* #include */ - -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_comm.h" -#include "ml_gridfunc.h" -#include "ml_memory.h" -#include "ml_comminfoop.h" -#include "ml_operator.h" -#include "ml_mat_formats.h" - -/* ******************************************************************** */ -/* definition of the grid graph structure */ -/* -------------------------------------------------------------------- */ - -typedef struct ML_GGraph_Struct -{ - int ML_id; - int Npoints, Nselected; - int ML_rank; - int *row_ptr, *col_ptr; - int send_cnt, *send_leng, *send_proc, **send_list; - int recv_cnt, *recv_leng, *recv_proc, **recv_list; - char *bdry_type; - char *vertex_state; - -} ML_GGraph; - -/* ******************************************************************** */ -/* functions to manipulate the grid graph data structure */ -/* -------------------------------------------------------------------- */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif - -extern int ML_GGraph_Create( ML_GGraph ** ); -extern int ML_GGraph_Destroy( ML_GGraph ** ); -extern int ML_GGraph_Print( ML_GGraph * ); -extern int ML_GGraph_Load_BdryTypes( ML_GGraph *, int , char *); -extern int ML_GGraph_Coarsen(ML_GGraph*, ML_Comm *); -extern int ML_GGraph_Gen_NodeGraph(ML_GGraph*,void*,void (*func),ML_Comm *); -extern int ML_GGraph_Get_NodeStates(ML_GGraph*, int *, char **); -extern int ML_GGraph_Gen_ElementGraph(ML_GGraph*,void*,void (*gf),ML_Comm*); -extern int ML_GGraph_Gen_Restrictor(ML_GGraph*); -extern int ML_GGraph_CheckMIS( ML_GGraph *ml_gg, ML_Comm *comm ); -extern int ML_GGraph_Find_NeighborElements(int leng1, int *list1, int leng2, - int *list2, int *vlist3); -extern int ML_GGraph_LabelVertices(int, int *, int, char *, char *, int, - int *, int *, int, int **, int, int **, int *, int *, - int, int **, int *, int *, int **, int, ML_Comm *); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_gmres.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_gmres.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_gmres.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_gmres.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Functions for the GMRES Krylov solver */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) */ -/* Date : December, 1999 */ -/* ******************************************************************** */ - -#include "ml_common.h" -#include "ml_krylov.h" - -#ifndef __MLGMRES__ -#define __MLGMRES__ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -extern int ML_GMRES_Solve(ML_Krylov *,int length,double *rhs,double *sol); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_gridagx.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_gridagx.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_gridagx.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_gridagx.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,112 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* local (to ML) data structure to hold mesh information given a finite */ -/* element mesh (used in automatic grid transfer generation) */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : April, 1997 */ -/* ******************************************************************** */ - -#ifndef __MLGRIDAGX__ -#define __MLGRIDAGX__ - -#include -/* #include */ -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_memory.h" -#include "ml_intlist.h" -#include "ml_elementagx.h" - -/* ******************************************************************** */ -/* definition of the grid structure */ -/* Ndim : no. of spatial dimensions */ -/* Nvertices : no. of vertices residing in local processor */ -/* Nelements : no. of elements residing locally */ -/* ele_nodes : element to node list (local node no.) */ -/* x[i],y[i],z[i] : coordinate of local (and ghost) node i */ -/* global_element[i] : global element number of the i-th local element */ -/* global_vertex[i] : global vertex number of the i-th local vertex */ -/* elmnt_proc_map[i] : processor where element[global_element[i]] is */ -/* node_proc_map[i] : processor where global_vertex[i]] is */ -/* */ -/* Note : x,y,z, and global_vertex arrays can have length longer than */ -/* Nvertices since they also have to store external vertices */ -/* that are vertices to local elements. */ -/* -------------------------------------------------------------------- */ - -typedef struct ML_GridAGX_Struct -{ - int ML_id; - int Ndim; - int Nvertices, Nvertices_expanded; - int Nelements; - ML_IntList *ele_nodes; - double *x, *y, *z; - ml_big_int *global_element; - int *global_vertex; - int *elmnt_proc_map; - int *node_proc_map; - -} ML_GridAGX; - -/* ******************************************************************** */ -/* functions to manipulate the grid structure */ -/* -------------------------------------------------------------------- */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif - -extern int ML_GridAGX_Create( ML_GridAGX ** ); -extern int ML_GridAGX_Destroy( ML_GridAGX ** ); -extern int ML_GridAGX_Get_Element(ML_GridAGX *,int,ML_ElementAGX *); -extern int ML_GridAGX_Print( ML_GridAGX * ); - -extern int ML_GridAGX_Get_Dimension( ML_GridAGX * ); -extern int ML_GridAGX_Get_NVert( ML_GridAGX * ); -extern int ML_GridAGX_Get_NElmnts( ML_GridAGX * ); -extern ml_big_int ML_GridAGX_Get_ElmntGlobalNum( ML_GridAGX *, int ); -extern int ML_GridAGX_Get_ElmntNVert( ML_GridAGX *, int ); -extern int ML_GridAGX_Get_ElmntVertList( ML_GridAGX *, int, int * ); -extern int ML_GridAGX_Get_VertGlobalNum( ML_GridAGX *, int ); -extern int ML_GridAGX_Get_VertCoordinate(ML_GridAGX *grid,int,double*); - -extern int ML_GridAGX_Set_Dimension(ML_GridAGX *, int); -extern int ML_GridAGX_Set_NVert(ML_GridAGX *, int); -extern int ML_GridAGX_Set_NElmnts(ML_GridAGX *, int, int); -extern int ML_GridAGX_Load_ElmntGlobalNum(ML_GridAGX *, int, ml_big_int *); -extern int ML_GridAGX_Load_VertGlobalNum(ML_GridAGX *, int, int *); -extern int ML_GridAGX_Load_ElmntVertList(ML_GridAGX *, int, int *); -extern int ML_GridAGX_Load_AllVertCoordinates(ML_GridAGX*,int,double*); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_gridfunc.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_gridfunc.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_gridfunc.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_gridfunc.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,108 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the Grid and its access functions data structure */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : March, 1999 */ -/* ******************************************************************** */ - -#ifndef __MLGRIDFUNC__ -#define __MLGRIDFUNC__ - -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_memory.h" - -typedef struct ML_GridFunc_Struct ML_GridFunc; - -/* ******************************************************************** */ -/* definition of the data structure for Grid and its access functions */ -/* -------------------------------------------------------------------- */ - -struct ML_GridFunc_Struct -{ - int ML_id; - int ML_MaxElmntVert; - - int (*USR_grid_get_dimension)( void * ); - int (*USR_grid_get_nvertices)( void * ); - int (*USR_grid_get_nelements)( void * ); - ml_big_int (*USR_grid_get_element_global_num)( void *, int ); - int (*USR_grid_get_element_nvertices)( void *, int ); - int (*USR_grid_get_element_vlist)( void *, int, int * ); - int (*USR_grid_get_vertex_global_num)( void *, int ); - int (*USR_grid_get_vertex_coordinate)( void *, int, double *); - - int (*USR_compute_basis_coefficients)(void*,int,double*,int,double*,int*); - - int (*USR_grid_get_element_volumes)(void*,int,int*,double*); - int (*USR_grid_get_element_matrix)(void*,int,double**); - int (*USR_grid_get_element_nullspace)(void*,int,double*); - -}; - -/* ******************************************************************** */ -/* definition of the functions */ -/* -------------------------------------------------------------------- */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif - -extern int ML_GridFunc_Create( ML_GridFunc ** ); -extern int ML_GridFunc_Destroy( ML_GridFunc ** ); -extern int ML_GridFunc_Check( ML_GridFunc * ); -extern int ML_GridFunc_Set_MaxVertPerElmnt(ML_GridFunc *, int); -#ifdef NOTSTRICT_PROTO -extern int ML_GridFunc_Set_Function(ML_GridFunc *, int, int (*func)()); -#endif -extern int ML_GridFunc_Set_GetDimension(ML_GridFunc *, int (*func)(void *)); -extern int ML_GridFunc_Set_GetNVert(ML_GridFunc *, int (*func)(void *)); -extern int ML_GridFunc_Set_GetNElmnts(ML_GridFunc *, int (*func)(void *)); -extern int ML_GridFunc_Set_GetElmntGlobalNum(ML_GridFunc*,ml_big_int(*func)(void *, int)); -extern int ML_GridFunc_Set_GetElmntNVert(ML_GridFunc*,int(*func)(void *, int)); -extern int ML_GridFunc_Set_GetElmntVertList(ML_GridFunc *, int (*func)(void *, int, int *)); -extern int ML_GridFunc_Set_GetVertGlobalNum(ML_GridFunc*,int (*func)(void *, int)); -extern int ML_GridFunc_Set_GetVertCoordinate(ML_GridFunc*,int (*func)(void *, int, double *)); -extern int ML_GridFunc_Set_ComputeBasisCoef(ML_GridFunc *, int (*func)(void*,int,double*,int,double*,int*)); -extern int ML_GridFunc_Set_GetElmntVolumes(ML_GridFunc *, int (*func)(void*,int,int*,double*)); -extern int ML_GridFunc_Set_GetElmntMatrix(ML_GridFunc *, int (*func)(void*,int,double**)); -extern int ML_GridFunc_Set_GetElmntNullSpace(ML_GridFunc*,int (*func)(void*,int,double*)); - - - -int ML_compute_basis_coefficients3D(void *grid, double *coord, - int ncoord, double *coefs, int *coef_ptr); -int ML_compute_basis_coefficients2D(void *grid, double *coord, - int ncoord, double *coefs, int *coef_ptr); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_grid.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_grid.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_grid.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_grid.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the Grid and its access functions data structure */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : March, 1999 */ -/* ******************************************************************** */ - -#ifndef __MLGRID__ -#define __MLGRID__ - -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_memory.h" -#include "ml_gridfunc.h" - -typedef struct ML_Grid_Struct ML_Grid; - -/* ******************************************************************** */ -/* definition of the data structure for Grid */ -/* -------------------------------------------------------------------- */ - -struct ML_Grid_Struct -{ - int ML_id; - void *Grid; /* user grid data structure */ - ML_GridFunc *gridfcn; /* a set of grid access functions */ - int gf_SetOrLoad; /* see if gridfcn is created locally */ -}; - -/* ******************************************************************** */ -/* definition of the functions */ -/* -------------------------------------------------------------------- */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif - -extern int ML_Grid_Create( ML_Grid ** ); -extern int ML_Grid_Init( ML_Grid * ); -extern int ML_Grid_Destroy( ML_Grid ** ); -extern int ML_Grid_Clean( ML_Grid * ); -extern int ML_Grid_Set_Grid( ML_Grid *, void * ); -extern int ML_Grid_Set_GridFunc( ML_Grid *, ML_GridFunc * ); -extern int ML_Grid_Get_GridFunc( ML_Grid *, ML_GridFunc ** ); -extern int ML_Grid_Create_GridFunc( ML_Grid * ); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_ifpack.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_ifpack.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_ifpack.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_ifpack.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ************************************************************************* */ -/* See the file COPYRIGHT for a complete copyright notice, contact person, */ -/* and disclaimer. */ -/* ************************************************************************* */ - -#ifndef ML_IFPACK_H -#define ML_IFPACK_H - -#include "ml_include.h" - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -#if defined(HAVE_ML_EPETRA) && defined(HAVE_ML_IFPACK) && defined(HAVE_ML_TEUCHOS) - -int ML_Smoother_Ifpack(ML_Smoother *sm,int inlen,double x[],int outlen, - double rhs[]); - -void ML_Smoother_Clean_Ifpack(void * Ifpack_Handle); - -/** Solves using IFPACK */ -int ML_Ifpack_Solve(void * Ifpack_Handle, double * x, double * rhs); - -/** Destroy all data associated to the IFPACK smoother. */ -void ML_Ifpack_Destroy(void * Ifpack_Handle); - -#endif - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif /* #ifndef ML_IFPACK_H */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_Ifpack_ML.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_Ifpack_ML.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_Ifpack_ML.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_Ifpack_ML.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,287 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* Copyright (2001) Sandia Corportation. Under the terms of Contract - * DE-AC04-94AL85000, there is a non-exclusive license for use of this - * work by or on behalf of the U.S. Government. Export of this program - * may require a license from the United States Government. */ - - -/* NOTICE: The United States Government is granted for itself and others - * acting on its behalf a paid-up, nonexclusive, irrevocable worldwide - * license in ths data to reproduce, prepare derivative works, and - * perform publicly and display publicly. Beginning five (5) years from - * July 25, 2001, the United States Government is granted for itself and - * others acting on its behalf a paid-up, nonexclusive, irrevocable - * worldwide license in this data to reproduce, prepare derivative works, - * distribute copies to the public, perform publicly and display - * publicly, and to permit others to do so. - * - * NEITHER THE UNITED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT - * OF ENERGY, NOR SANDIA CORPORATION, NOR ANY OF THEIR EMPLOYEES, MAKES - * ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR - * RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY - * INFORMATION, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS - * THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS. */ - -/*! - * \file ml_Ifpack_ML.h - * - * \class Ifpack_ML - * - * \brief Wrapper for Ifpack_Preconditioner - * - * \author Marzio Sala, SNL 9214. - * - * \date Last update do Doxygen: 08-Mar-05. - * - */ - -#ifndef ML_IFPACK_ML_H -#define ML_IFPACK_ML_H - -#include "ml_include.h" -#if defined(HAVE_ML_EPETRA) && defined(HAVE_ML_TEUCHOS) && defined(HAVE_ML_IFPACK) - -#include "ml_epetra.h" -#include "Ifpack_Preconditioner.h" -#include "Ifpack_Amesos.h" -#include "ml_MultiLevelPreconditioner.h" - -namespace ML_Epetra { - -/*! - * \class Ifpack_ML - * - * \brief Wraps an ML preconditioner as an Ifpack_Preconditioner - * - * \author Marzio Sala, SNL 9214 - * - * \date Last updated on 14-Mar-05. - * - */ - -class Ifpack_ML : public Ifpack_Preconditioner { - -public: - - //! Constructor. - Ifpack_ML(Epetra_RowMatrix* A) : - A_(A), - MLPrec_(0) - {}; - - //! Destructor. - virtual ~Ifpack_ML() - { - if (MLPrec_) - delete MLPrec_; - } - - //! Sets all the parameters for the preconditioner from the list. - virtual int SetParameters(Teuchos::ParameterList& MLList) - { - MLList_ = MLList; - return(0); - } - - //! Initialize the preconditioner. - virtual int Initialize() - { - return(0); - }; - - //! Returns true if the preconditioner has been successfully initialized, false otherwise - virtual bool IsInitialized() const - { - return(true); - } - - //! Computes all it is necessary to apply the preconditioner. - virtual int Compute() - { - if (MLPrec_) - delete MLPrec_; - - MLPrec_ = new ML_Epetra::MultiLevelPreconditioner(*A_, MLList_); - if (MLPrec_->IsPreconditionerComputed() == false) { - ML_CHK_ERR(-1); - } - else - return(0); - } - - //! Returns true if the preconditioner has been successfully computed, false otherwise. - virtual bool IsComputed() const - { - return(MLPrec_->IsPreconditionerComputed()); - } - - //! Computes the condition number estimate, returns its value. - virtual double Condest(const Ifpack_CondestType CT = Ifpack_Cheap, - const int MaxIters = 1550, - const double Tol = 1e-9, - Epetra_RowMatrix* Matrix = 0) - { - return(-1.0); - } - - //! Returns the computed condition number estimate, or -1.0 if not computed. - virtual double Condest() const - { - return(-1.0); - } - - - //! Applies the preconditioner to vector X, returns the result in Y. - virtual int ApplyInverse(const Epetra_MultiVector& X, - Epetra_MultiVector& Y) const - { - ML_RETURN(MLPrec_->ApplyInverse(X, Y)); - } - - //! Returns a pointer to the matrix to be preconditioned. - virtual const Epetra_RowMatrix& Matrix() const - { - return(*A_); - } - - //! Returns the number of calls to Initialize(). - virtual int NumInitialize() const - { - return(-1); - } - - //! Returns the number of calls to Compute(). - virtual int NumCompute() const - { - return(-1); - } - - //! Returns the number of calls to ApplyInverse(). - virtual int NumApplyInverse() const - { - return(-1); - } - - //! Returns the time spent in Initialize(). - virtual double InitializeTime() const - { - return(0.0); - } - - //! Returns the time spent in Compute(). - virtual double ComputeTime() const - { - return(0.0); - } - - //! Returns the time spent in ApplyInverse(). - virtual double ApplyInverseTime() const - { - return(0.0); - } - - //! Returns the number of flops in the initialization phase. - virtual double InitializeFlops() const - { - return(0.0); - } - - //! Returns the number of flops in the computation phase. - virtual double ComputeFlops() const - { - return(0.0); - } - - //! Returns the number of flops in the application of the preconditioner. - virtual double ApplyInverseFlops() const - { - return(0.0); - } - - //! Prints basic information on iostream. This function is used by operator<<. - virtual ostream& Print(std::ostream& os) const - { - return(os); - } - - //! Sets the use of transpose 9NOT SUPPORTED) - int SetUseTranspose(bool) - { - ML_CHK_ERR(-1); - } - - //! Applies the matrix to a vector (NOT SUPPORTED) - int Apply(const Epetra_MultiVector&, Epetra_MultiVector&) const - { - ML_CHK_ERR(-1); - } - - //! Returns the norm inf (NOT SUPPORTED) - double NormInf() const - { - return(-1.0); - } - - //! Returns the label of \c this object. - const char* Label() const - { - return("Ifpack_ML"); - } - - //! Returns \c true if the transpose is used. - bool UseTranspose() const - { - ML_CHK_ERR(-1); - } - - //! Returns \c true if the class furnishes an infinite norm. - bool HasNormInf() const - { - return(false); - } - - //! Returns a reference to the communicator of \c this object. - const Epetra_Comm& Comm() const - { - return(A_->Comm()); - } - - //! Returns a reference to the operator domain map. - const Epetra_Map& OperatorDomainMap() const - { - return(A_->OperatorDomainMap()); - } - - //! Returns a reference to the operator range map. - const Epetra_Map& OperatorRangeMap() const - { - return(A_->OperatorRangeMap()); - } - -private: - //! Pointer to the matrix used to build the preconditioner. - Epetra_RowMatrix* A_; - //! Pointer to the ML preconditioner. - ML_Epetra::MultiLevelPreconditioner* MLPrec_; - //! Copy of the input parameter list. - Teuchos::ParameterList MLList_; -}; // class Ifpack_ML - -} // namespace ML_Epetra - -#endif -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_ifpack_wrap.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_ifpack_wrap.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_ifpack_wrap.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_ifpack_wrap.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* Copyright (2004) Sandia Corportation. Under the terms of Contract - * DE-AC04-94AL85000, there is a non-exclusive license for use of this - * work by or on behalf of the U.S. Government. Export of this program - * may require a license from the United States Government. */ - - /* NOTICE: The United States Government is granted for itself and others - * acting on its behalf a paid-up, nonexclusive, irrevocable worldwide - * license in ths data to reproduce, prepare derivative works, and - * perform publicly and display publicly. Beginning five (5) years from - * July 25, 2001, the United States Government is granted for itself and - * others acting on its behalf a paid-up, nonexclusive, irrevocable - * worldwide license in this data to reproduce, prepare derivative works, - * distribute copies to the public, perform publicly and display - * publicly, and to permit others to do so. - * - * NEITHER THE UNITED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT - * OF ENERGY, NOR SANDIA CORPORATION, NOR ANY OF THEIR EMPLOYEES, MAKES - * ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR - * RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY - * INFORMATION, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS - * THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS. */ - -#ifndef ML_IFPACK_WRAP -#define ML_IFPACK_WRAP - -#include "ml_include.h" -#if defined(HAVE_ML_EPETRA) && defined(HAVE_ML_TEUCHOS) && defined(HAVE_ML_IFPACK) - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -namespace Teuchos { - class ParameterList; -} -class Epetra_Comm; - -int ML_Smoother_Ifpack(ML_Smoother *sm,int inlen,double x[],int outlen, - double rhs[]); - -void ML_Smoother_Clean_Ifpack(void * Ifpack_Handle); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -/** Generates the ifpack smoother */ -int ML_Gen_Smoother_Ifpack(ML *ml, const char* Type, int Overlap, - int nl, int pre_or_post, - Teuchos::ParameterList& List, - const Epetra_Comm& Comm); - -#endif -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_include.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_include.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_include.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_include.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Include file */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : January, 1998 */ -/* ******************************************************************** */ - -#ifndef _MLINCLUDE_ -#define _MLINCLUDE_ - -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_struct.h" -#include "ml_agg_genP.h" -#include "ml_aggregate.h" -#include "ml_amg.h" -#include "ml_amg_genP.h" -#include "ml_bicgstabl.h" -#include "ml_cg.h" -#include "ml_comm.h" -#include "ml_gmres.h" -#include "ml_grid.h" -#include "ml_gridagx.h" -#include "ml_gridfunc.h" -#include "ml_krylov.h" -#include "ml_operator.h" -#include "mli_solver.h" -#include "ml_pde.h" -#include "ml_solver.h" -#include "ml_vec.h" -#include "ml_elementagx.h" -#include "ml_intlist.h" -#include "ml_operatoragx.h" -#include "ml_xyt.h" -#include "ml_op_utils.h" -#include "ml_operator_blockmat.h" -#include "ml_agg_reitzinger.h" -#include "ml_aztec_utils.h" -#include "ml_memory.h" -//#include "ml_vampir.h" -#include "ml_amesos.h" -#include "ml_ifpack.h" -#include "ml_agg_METIS.h" -#include "ml_agg_ParMETIS.h" - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_intlist.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_intlist.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_intlist.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_intlist.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Data structure to hold multiple lists of integers (used to hold the */ -/* element to node lists in this context) */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) */ -/* Date : April, 1997 */ -/* ******************************************************************** */ - -#ifndef _MLINTLIST_ -#define _MLINTLIST_ - -#include -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_memory.h" - -/* ******************************************************************** */ -/* length : number of sub-lists */ -/* start : the range of locations pointed to by start[i] and */ -/* in members hold the node information for element [i]. */ -/* members : an one-dimensional integer array to store the node lists */ -/* -------------------------------------------------------------------- */ - -typedef struct ML_IntList_Struct -{ - int ML_id; - int cur_mem_leng; - int length; - int *start; - int *members; - -} ML_IntList; - -/* ******************************************************************** */ -/* functions to manipulate the Int_lists structures */ -/* -------------------------------------------------------------------- */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif - -extern int ML_IntList_Create(ML_IntList **, int, int); -extern int ML_IntList_Load_Sublist(ML_IntList *, int, int *); -extern int ML_IntList_Get_Sublist(ML_IntList *, int, int *, int *); -extern int ML_IntList_Destroy(ML_IntList **); -extern int ML_IntList_Print(ML_IntList *); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/mli_solver.h hypre-2.18.2/src/FEI_mv/ml/src/Include/mli_solver.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/mli_solver.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/mli_solver.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,152 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the MLI_Solver data structure */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) */ -/* Date : December, 1999 */ -/* ******************************************************************** */ - -#ifndef _MLSOLVERIFACE_ -#define _MLSOLVERIFACE_ - -#include "ml_common.h" -#include "ml_comm.h" -#include "ml_aggregate.h" -#include "ml_amg.h" - -typedef struct -{ - int Nrows; - int *rowptr; - int *colnum; - int *map; - double *values; - int sendProcCnt; - int *sendProc; - int *sendLeng; - int **sendList; - int recvProcCnt; - int *recvProc; - int *recvLeng; -} -MLI_CSRMatrix; - -#ifdef ML_MPI -#include -#define ML_MPI_Request MPI_Request -#define ML_MPI_Comm MPI_Comm -#else -#define ML_MPI_Request int -#define ML_MPI_Comm int -#endif - -typedef struct -{ - MLI_CSRMatrix *Amat; - ML_MPI_Comm comm; - int globalEqns; - int *partition; -} -MLI_Context; - -typedef struct -{ - ML_MPI_Comm comm; - ML *ml_ptr; - int nlevels; - int method; - int pre, post; - int pre_sweeps, post_sweeps; - double jacobi_wt; - double ag_threshold; - int ag_coarsen; - int ag_method; - int ndiag; - double *diag_scale; - ML_Aggregate *ml_ag; - ML_AMG *ml_amg; - MLI_Context *contxt; - int nRows; - int *mat_ia; - int *mat_ja; - double *mat_a; - int nPDE; - int nNullVectors; - double *nullSpace; - double *rhs; - double *sol; -} MLI_Solver; - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -MLI_Solver *MLI_Solver_Create( ML_MPI_Comm ); -int MLI_Solver_Destroy( MLI_Solver * ); -int MLI_Solver_Setup(MLI_Solver *, double *x ); -int MLI_Solver_SetupDD(MLI_Solver *,int startRow, int Nrows, int *mat_ia, - int *mat_ja, double *mat_a, double *b, double *x ); -int MLI_Solver_Solve( MLI_Solver *solver ); -int MLI_Solver_Set_MLNumLevels( MLI_Solver *, int nlevels ); -int MLI_Solver_Set_KrylovMethod( MLI_Solver *, int method ); -int MLI_Solver_Set_StrongThreshold( MLI_Solver *, double strong_threshold ); -int MLI_Solver_Set_NumPreSmoothings( MLI_Solver *, int num_sweeps ); -int MLI_Solver_Set_NumPostSmoothings( MLI_Solver *, int num_sweeps ); -int MLI_Solver_Set_PreSmoother( MLI_Solver *, int smoother_type ); -int MLI_Solver_Set_PostSmoother( MLI_Solver *, int smoother_type ); -int MLI_Solver_Set_DampingFactor( MLI_Solver *, double factor ); -int MLI_Solver_Set_MGMethod( MLI_Solver *, int ); -int MLI_Solver_Set_CoarsenScheme( MLI_Solver *, int ); -int MLI_Solver_Get_IJAFromFile(MLI_Solver *, char *matfile, char *rhsfile); -int MLI_Solver_Get_NullSpaceFromFile(MLI_Solver *, char *rbmfile); -int MLI_Irecv(void* buf, unsigned int count, int *src, int *mid, - ML_MPI_Comm comm, ML_MPI_Request *request ); -int MLI_SIrecv(void* buf, unsigned int count, int *src, int *mid, - ML_MPI_Comm comm, ML_MPI_Request *request ); -int MLI_Wait(void* buf, unsigned int count, int *src, int *mid, - ML_MPI_Comm comm, ML_MPI_Request *request ); -int MLI_SWait(void* buf, unsigned int count, int *src, int *mid, - ML_MPI_Comm comm, ML_MPI_Request *request ); -int MLI_Send(void* buf, unsigned int count, int dest, int mid, ML_MPI_Comm comm ); -int MLI_SSend(void* buf, unsigned int count, int dest, int mid, ML_MPI_Comm comm ); -int MLI_CSRExchBdry(double *vec, void *obj); -int MLI_CSRMatVec(ML_Operator *obj, int leng1, double p[], int leng2, double ap[]); -int MLI_CSRGetRow(ML_Operator *obj, int N_requested_rows, int requested_rows[], - int allocated_space, int columns[], double values[], int row_lengths[]); -void MLI_Solver_Read_IJAFromFile(double **val, int **ia, int **ja, int *N, - double **rhs, char *matfile, char *rhsfile); -extern int MLI_Solver_Construct_CSRMatrix(int, int*, int*, double*, - MLI_CSRMatrix *, MLI_Solver*, int *,MLI_Context*); -extern int MLI_Solver_Construct_LocalCSRMatrix(int nrows, int *mat_ia, - int *mat_ja, double *mat_a, MLI_CSRMatrix *mli_mat, - MLI_Solver *solver, int *partition, MLI_Context *obj); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_krylov.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_krylov.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_krylov.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_krylov.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,123 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the ML_KrylovData structure */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) */ -/* Date : December, 1999 */ -/* ******************************************************************** */ - -#ifndef __MLKRYLOVDATA_ -#define __MLKRYLOVDATA_ -#define ML_CG 0 -#define ML_GMRES 1 - -/* ******************************************************************** */ -/* local include files */ -/* ******************************************************************** */ - -typedef struct ML_Krylov_Struct ML_Krylov; - -/* #include "ml_struct.h" */ -#include "ml_common.h" -#include "ml_comm.h" -#include "ml_operator.h" - -/* -------------------------------------------------------------------- */ -/* This data structure defines an enriched operator class for the */ -/* specification of the discretization matrix, the restriction and the */ -/* prolongation operator. */ -/* -------------------------------------------------------------------- */ - -struct ML_Krylov_Struct -{ - int ML_id; - int ML_method; - int ML_gmres_dim; - int ML_cgstabl_dim; - int ML_max_iterations; - int ML_print_freq; - double ML_tolerance; - double *diag_scale; - ML_Operator *ML_matrix; - void *ML_precon; - ML_Comm *ML_com; - int ML_eigen; - int ML_nonsym_eigen; - double ML_eigen_max; - double ML_eigen_min; - int (*ML_precfcn)(void*, int, double*, int, double*); - int ML_dont_scale_by_diag; -}; - -/* ******************************************************************** */ -/* ******************************************************************** */ -/* User Interface Proto-types */ -/* ******************************************************************** */ -/* ******************************************************************** */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -extern ML_Krylov *ML_Krylov_Create(ML_Comm *); -extern int ML_Krylov_Destroy(ML_Krylov **); -extern ML_Comm *ML_Krylov_Get_Comm(ML_Krylov *data); -extern int ML_Krylov_Set_PrintFreq(ML_Krylov *, int n); -extern int ML_Krylov_Get_PrintFreq(ML_Krylov *); -extern int ML_Krylov_Set_Method(ML_Krylov *, int method); -extern int ML_Krylov_Set_GMRESSize(ML_Krylov *, int size); -extern int ML_Krylov_Get_GMRESSize(ML_Krylov *); -extern int ML_Krylov_Set_BICGSTABLSize(ML_Krylov *, int size); -extern int ML_Krylov_Get_BICGSTABLSize(ML_Krylov *); -extern int ML_Krylov_Set_Amatrix(ML_Krylov *, ML_Operator *mat); -extern ML_Operator* ML_Krylov_Get_Amatrix(ML_Krylov *); -extern int ML_Krylov_Set_MaxIterations(ML_Krylov *, int iter); -extern int ML_Krylov_Get_MaxIterations(ML_Krylov *); -extern int ML_Krylov_Set_Tolerance(ML_Krylov *, double tol); -extern int ML_Krylov_Set_Diagonal(ML_Krylov *, int leng, double *diag); -extern double ML_Krylov_Get_Tolerance(ML_Krylov *); -extern int ML_Krylov_Set_Precon(ML_Krylov *, void *); -extern int ML_Krylov_Set_PreconFunc(ML_Krylov*, - int (*func)(void*,int,double*,int,double*)); -extern void *ML_Krylov_Get_Precon(ML_Krylov *); -extern int ML_Krylov_Set_ComputeEigenvalues(ML_Krylov *); -extern int ML_Krylov_Set_ComputeNonSymEigenvalues(ML_Krylov *); -extern int ML_Krylov_Set_DiagScaling_Eig(ML_Krylov *data, int scale); - -extern double ML_Krylov_Get_MaxEigenvalue(ML_Krylov *); - -extern int ML_Krylov_Solve(ML_Krylov *, int, double *, double*); -extern int ML_MGVSolve_Wrapper(void *, int, double *, int, double*); -extern int ML_AMGVSolve_Wrapper(void *, int, double *, int, double*); -extern int ML_DiagScale_Wrapper(void *, int, double *, int, double*); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_lapack.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_lapack.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_lapack.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_lapack.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,666 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#ifndef ML_BLAS_LAPACK_WRAPPERS_H -#define ML_BLAS_LAPACK_WRAPPERS_H - -/* Wrappers for blas & lapack routines. This file is the result of merging - * Epetra_BLAS_wrappers.h & Epetra_LAPACK_wrappers.h and a few cosmetic - * changes. */ - -#include "ml_common.h" - -#ifdef f2c_i2 -/* for -i2 */ -typedef short ftnlen; -#else -typedef long ftnlen; -#endif - -#if defined(CRAY_T3X) || defined(INTEL_CXML) || defined(INTEL_MKL) - -/* All three of these machines use a simple uppercase mangling of Fortran names */ - -/* if F77_FUNC is defined undefine it because we want to redefine */ - -#if defined(CRAY_T3X) - -#include "fortran.h" -#define ml_fcd fcd -#define PREFIX - -#define DGETRF_F77 F77_FUNC(sgetrf,SGETRF) -#define DGETRS_F77 F77_FUNC(sgetrs,SGETRS) -#define DGESVD_F77 F77_FUNC(sgesvd,SGESVD) -#define DPOTRF_F77 F77_FUNC(spotrf,SPOTRF) -#define DPOTRS_F77 F77_FUNC(spotrs,SPOTRS) -#define DPOTRI_F77 F77_FUNC(spotri,SPOTRI) -#define DPOCON_F77 F77_FUNC(spocon,SPOCON) -#define DPOSV_F77 F77_FUNC(sposv,SPOSV) -#define DPOEQU_F77 F77_FUNC(spoequ,SPOEQU) -#define DPORFS_F77 F77_FUNC(sporfs,SPORFS) -#define DPOSVX_F77 F77_FUNC(sposvx,SPOSVX) -#define DGELS_F77 F77_FUNC(sgels,SGELS) -#define DGEEV_F77 F77_FUNC(sgeev,SGEEV) -#define DGEHRD_F77 F77_FUNC(sgehrs,SGEHRS) -#define DHSEQR_F77 F77_FUNC(shseqr,SHSEQR) -#define DORGHR_F77 F77_FUNC(sorghr,SORGHR) -#define DORMHR_F77 F77_FUNC(sormhr,SORMHR) -#define DTREVC_F77 F77_FUNC(strevc,STREVC) -#define DTREXC_F77 F77_FUNC(strexc,STREXC) -#define DGELSS_F77 F77_FUNC(sgelss,SGELSS) -#define DSTEV_F77 F77_FUNC(sstev,SSTEV) -#define DGEQPF_F77 F77_FUNC(sgeqpf,SGEQPF) -#define DGEQRF_F77 F77_FUNC(sgeqrf,SGEQRF) -#define DORGQR_F77 F77_FUNC(sorgqr,SORGQR) - -#endif -#if defined(INTEL_CXML) - -#define ml_fcd char *, unsigned int -#define PREFIX __stdcall - -#define DGEEV_F77 F77_FUNC(dgeev,DGEEV) -#define DGEHRD_F77 F77_FUNC(dgehrd,DGEHRD) -#define DGELS_F77 F77_FUNC(dgels,DGELS) -#define DGETRF_F77 F77_FUNC(dgetrf,DGETRF) -#define DGETRS_F77 F77_FUNC(dgetrs,DGETRS) -#define DGESVD_F77 F77_FUNC(dgesvd,DGESVD) -#define DHSEQR_F77 F77_FUNC(dhseqr,DHSEQR) -#define DORGHR_F77 F77_FUNC(dorghr,DORGHR) -#define DORMHR_F77 F77_FUNC(dormhr,DORMHR) -#define DPOTRF_F77 F77_FUNC(dpotrf,DPOTRF) -#define DPOTRS_F77 F77_FUNC(dpotrs,DPOTRS) -#define DPOTRI_F77 F77_FUNC(dpotri,DPOTRI) -#define DPOCON_F77 F77_FUNC(dpocon,DPOCON) -#define DPOSV_F77 F77_FUNC(dposv,DPOSV) -#define DPOEQU_F77 F77_FUNC(dpoequ,DPOEQU) -#define DPORFS_F77 F77_FUNC(dporfs,DPORFS) -#define DPOSVX_F77 F77_FUNC(dposvx,DPOSVX) -#define DTREVC_F77 F77_FUNC(dtrevc,DTREVC) -#define DTREXC_F77 F77_FUNC(dtrexc,DTREXC) -#define DGELSS_F77 F77_FUNC(dgelss,DGELSS) -#define DSTEV_F77 F77_FUNC(dstev,DSTEV) -#define DGEQPF_F77 F77_FUNC(dgeqpf,DGEQPF) -#define DGEQRF_F77 F77_FUNC(dgeqrf,DGEQRF) -#define DORGQR_F77 F77_FUNC(dorgqr,DORGQR) - -#endif -#if defined(INTEL_MKL) - -#define ml_fcd char * -#define PREFIX - -#define DGETRF_F77 F77_FUNC(dgetrf,DGETRF) -#define DGETRS_F77 F77_FUNC(dgetrs,DGETRS) -#define DGESVD_F77 F77_FUNC(dgesvd,DGESVD) -#define DPOTRF_F77 F77_FUNC(dpotrf,DPOTRF) -#define DPOTRS_F77 F77_FUNC(dpotrs,DPOTRS) -#define DPOTRI_F77 F77_FUNC(dpotri,DPOTRI) -#define DPOCON_F77 F77_FUNC(dpocon,DPOCON) -#define DPOSV_F77 F77_FUNC(dposv,DPOSV) -#define DPOEQU_F77 F77_FUNC(dpoequ,DPOEQU) -#define DPORFS_F77 F77_FUNC(dporfs,DPORFS) -#define DPOSVX_F77 F77_FUNC(dposvx,DPOSVX) -#define DGELS_F77 F77_FUNC(dgels,DGELS) -#define DGEEV_F77 F77_FUNC(dgeev,DGEEV) -#define DGEHRD_F77 F77_FUNC(dgehrd,DGEHRD) -#define DHSEQR_F77 F77_FUNC(dhseqr,DHSEQR) -#define DORGHR_F77 F77_FUNC(dorghr,DORGHR) -#define DORMHR_F77 F77_FUNC(dormhr,DORMHR) -#define DTREVC_F77 F77_FUNC(dtrevc,DTREVC) -#define DTREXC_F77 F77_FUNC(dtrexc,DTREXC) -#define DGELSS_F77 F77_FUNC(dgelss,DGELSS) -#define DSTEV_F77 F77_FUNC(dstev,DSTEV) -#define DGEQPF_F77 F77_FUNC(dgeqpf,DGEQPF) -#define DGEQRF_F77 F77_FUNC(dgeqrf,DGEQRF) -#define DORGQR_F77 F77_FUNC(dorgqr,DORGQR) - -#endif - -#ifdef F77_FUNC -#undef F77_FUNC -#endif - -#define F77_FUNC(lcase,UCASE) UCASE - -#else - -#define ml_fcd char * -#define PREFIX - -/* Use autoconf's definition of F77_FUNC - unless using old make system */ - -#ifndef HAVE_CONFIG_H - -#ifdef F77_FUNC -#undef F77_FUNC -#endif - -#ifdef TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE -#define F77_FUNC(lcase,UCASE) lcase -#else /* TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE not defined*/ -#define F77_FUNC(lcase,UCASE) lcase ## _ -#endif /* TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE */ -#endif /* HAVE_CONFIG_H */ - -#define DGETRF_F77 F77_FUNC(dgetrf,DGETRF) -#define DGETRS_F77 F77_FUNC(dgetrs,DGETRS) -#define DGESVD_F77 F77_FUNC(dgesvd,DGESVD) -#define DPOTRF_F77 F77_FUNC(dpotrf,DPOTRF) -#define DPOTRS_F77 F77_FUNC(dpotrs,DPOTRS) -#define DPOTRI_F77 F77_FUNC(dpotri,DPOTRI) -#define DPOCON_F77 F77_FUNC(dpocon,DPOCON) -#define DPOSV_F77 F77_FUNC(dposv,DPOSV) -#define DPOEQU_F77 F77_FUNC(dpoequ,DPOEQU) -#define DPORFS_F77 F77_FUNC(dporfs,DPORFS) -#define DPOSVX_F77 F77_FUNC(dposvx,DPOSVX) -#define DGELS_F77 F77_FUNC(dgels,DGELS) -#define DGEEV_F77 F77_FUNC(dgeev,DGEEV) -#define DGEHRD_F77 F77_FUNC(dgehrd,DGEHRD) -#define DHSEQR_F77 F77_FUNC(dhseqr,DHSEQR) -#define DORGHR_F77 F77_FUNC(dorghr,DORGHR) -#define DORMHR_F77 F77_FUNC(dormhr,DORMHR) -#define DTREVC_F77 F77_FUNC(dtrevc,DTREVC) -#define DTREXC_F77 F77_FUNC(dtrexc,DTREXC) -#define DGELSS_F77 F77_FUNC(dgelss,DGELSS) -#define DSTEV_F77 F77_FUNC(dstev,DSTEV) -#define DGEQPF_F77 F77_FUNC(dgeqpf,DGEQPF) -#define DGEQRF_F77 F77_FUNC(dgeqrf,DGEQRF) -#define DORGQR_F77 F77_FUNC(dorgqr,DORGQR) - -#endif - -#define DGETRI_F77 F77_FUNC(dgetri,DGETRI) -#define DGERFS_F77 F77_FUNC(dgerfs,DGERFS) -#define DGECON_F77 F77_FUNC(dgecon,DGECON) -#define DGESVX_F77 F77_FUNC(dgesvx,DGESVX) -#define DGESV_F77 F77_FUNC(dgesv,DGESV) -#define DGEEQU_F77 F77_FUNC(dgeequ,DGEEQU) -#define DLAMCH_F77 F77_FUNC(dlamch,DLAMCH) -#define DGELSS_F77 F77_FUNC(dgelss,DGELSS) -#define DSTEV_F77 F77_FUNC(dstev,DSTEV) -#define DGEQPF_F77 F77_FUNC(dgeqpf,DGEQPF) -#define DGEQRF_F77 F77_FUNC(dgeqrf,DGEQRF) -#define DORGQR_F77 F77_FUNC(dorgqr,DORGQR) - -#define SGETRF_F77 F77_FUNC(sgetrf,SGETRF) -#define SGETRS_F77 F77_FUNC(sgetrs,SGETRS) -#define SGESVD_F77 F77_FUNC(sgesvd,SGESVD) -#define SGETRI_F77 F77_FUNC(sgetri,SGETRI) -#define SGERFS_F77 F77_FUNC(sgerfs,SGERFS) -#define SGECON_F77 F77_FUNC(sgecon,SGECON) -#define SGESVX_F77 F77_FUNC(sgesvx,SGESVX) -#define SGESV_F77 F77_FUNC(sgesv,SGESV) -#define SGEEQU_F77 F77_FUNC(sgeequ,SGEEQU) -#define SPOTRF_F77 F77_FUNC(spotrf,SPOTRF) -#define SPOTRS_F77 F77_FUNC(spotrs,SPOTRS) -#define SPOTRI_F77 F77_FUNC(spotri,SPOTRI) -#define SPOCON_F77 F77_FUNC(spocon,SPOCON) -#define SPOSV_F77 F77_FUNC(sposv,SPOSV) -#define SPOEQU_F77 F77_FUNC(spoequ,SPOEQU) -#define SPORFS_F77 F77_FUNC(sporfs,SPORFS) -#define SPOSVX_F77 F77_FUNC(sposvx,SPOSVX) -#define SGELS_F77 F77_FUNC(sgels,SGELS) -#define SGEEV_F77 F77_FUNC(sgeev,SGEEV) -#define SGEHRD_F77 F77_FUNC(sgehrd,SGEHRD) -#define SHSEQR_F77 F77_FUNC(shseqr,SHSEQR) -#define SORGHR_F77 F77_FUNC(sorghr,SORGHR) -#define SORMHR_F77 F77_FUNC(sormhr,SORMHR) -#define STREVC_F77 F77_FUNC(strevc,STREVC) -#define STREXC_F77 F77_FUNC(strexc,STREXC) -#define SLAMCH_F77 F77_FUNC(slamch,SLAMCH) -#define SGELSS_F77 F77_FUNC(sgelss,SGELSS) -#define SSTEV_F77 F77_FUNC(sstev,SSTEV) -#define SGEQPF_F77 F77_FUNC(sgeqpf,SGEQPF) - -#define DLASWP_F77 F77_FUNC(dlaswp,DLASWP) -#define DLAIC1_F77 F77_FUNC(dlaic1,DLAIC1) - - -#ifdef __cplusplus -extern "C" { -#endif - -/* Aztec-2.1 already defines these variables in header files */ - -#ifndef HAVE_ML_AZTEC2_1 - - /* Double precision LAPACK linear solvers */ -void PREFIX DGETRF_F77(int* m, int* n, double* a, int* lda, int* ipiv, int* info); -void PREFIX DGETRS_F77(ml_fcd, int* n, int* nrhs, double* a, - int* lda, int* ipiv, double* x , int* ldx, int* info); -void PREFIX DGESVD_F77(ml_fcd, ml_fcd, int* m, int* n, double* a, - int* lda, double* s, double* u, int* ldu, double* vt, int* ldut, - double* work, int* lwork, int* info); -void PREFIX DGETRI_F77(int* n, double* a, int* lda, int*ipiv, double * work , int* lwork, int* info); -void PREFIX DGECON_F77(ml_fcd norm, int* n, double* a, int* lda, - double *anorm, double * rcond, double * work, - int * iwork, int* info); -void PREFIX DGESV_F77(int * n, int * nrhs, double* a, - int* lda, int*ipiv, double*x , int* ldx, int* info); -void PREFIX DGEEQU_F77(int* m, int* n, double* a, int* lda, double * r, double * c, - double * rowcnd, double * colcnd, - double * amax, int* info); -void PREFIX DGERFS_F77(ml_fcd, int * n, int * nrhs, double * a, - int * lda, double * af, int * ldaf, int*ipiv, - double * b, int * ldb, double * x, int * ldx, - double * ferr, double * berr, double * work, - int * iwork, int * info); -void PREFIX DGESVX_F77(ml_fcd, ml_fcd, int * n, int * nrhs, double * a, - int * lda, double * af, int * ldaf, int*ipiv, ml_fcd, - double * r, double *c, double * b, int * ldb, double * x, int * ldx, - double * rcond, double * ferr, double * berr, double * work, - int * iwork, int * info); - -void PREFIX DPOTRF_F77(ml_fcd, int* n, double* a, int* lda, int* info); -void PREFIX DPOTRS_F77(ml_fcd, int * n, int * nrhs, double* a, - int* lda, double*x , int* ldx, int* info); -void PREFIX DPOTRI_F77(ml_fcd, int* n, double* a, int* lda, int* info); -void PREFIX DPOCON_F77(ml_fcd, int* n, double* a, int* lda, - double * anorm, double * rcond, double * work, - int * iwork, int* info); -void PREFIX DPOSV_F77(ml_fcd, int * n, int * nrhs, double* a, - int* lda, double*x , int* ldx, int* info); -void PREFIX DPOEQU_F77(int* n, double* a, int* lda, double * s, double * scond, - double * amax, int* info); - -void PREFIX DPORFS_F77(ml_fcd, int * n, int * nrhs, double * a, - int * lda, double * af, int * ldaf, - double * b, int * ldb, double * x, int * ldx, - double * ferr, double * berr, double * work, - int * iwork, int * info); - -void PREFIX DPOSVX_F77(ml_fcd, ml_fcd, int * n, int * nrhs, double * a, - int * lda, double * af, int * ldaf, ml_fcd, - double * s, double * b, int * ldb, double * x, int * ldx, - double * rcond, double * ferr, double * berr, double * work, - int * iwork, int * info); - -void PREFIX DGELSS_F77(int * m, int * n, int * nrhs, double * a, - int * lda, double * b, int * ldb, double * s, - double * rcond, int * rank, double * work, - int * lwork, int * info); - -void PREFIX DGEQPF_F77(int * m, int * n, double * a, - int * lda, int * jpvt, double * tau, - double * work, int * info); -/* -#define DGEQRF_F77 F77_FUNC(sgeqrf,SGEQRF) -#define DORGQR_F77 F77_FUNC(sorgqr,SORGQR) -*/ -void PREFIX DGEQRF_F77(int *, int *, double *, int *, - double *, double *, int *, int *); - -void PREFIX DORGQR_F77(int *m, int *n, int *k, double * a, - int *lda, double *tau, double *work, int *lwork, - int *info); - - /* Single precision LAPACK linear solvers*/ -void PREFIX SGETRF_F77(int* m, int* n, float* a, int* lda, int* ipiv, int* info); -void PREFIX SGETRS_F77(ml_fcd, int* n, int* nrhs, float* a, - int* lda, int* ipiv, float* x , int* ldx, int* info); -void PREFIX SGESVD_F77(ml_fcd, ml_fcd, int* m, int* n, float* a, - int* lda, float* s, float* u, int* ldu, float* vt, int* ldut, - float* work, int* lwork, int* info); -void PREFIX SGETRI_F77(int* n, float* a, int* lda, int*ipiv, float * work , int* lwork, int* info); -void PREFIX SGECON_F77(ml_fcd norm, int* n, float* a, int* lda, - float * anorm, float * rcond, float * work, - int * iwork, int* info); -void PREFIX SGESV_F77(int * n, int * nrhs, float* a, - int* lda, int*ipiv, float*x , int* ldx, int* info); -void PREFIX SGEEQU_F77(int* m, int* n, float* a, int* lda, float * r, float * c, - float * rowcnd, float * colcnd, - float * amax, int* info); -void PREFIX SGERFS_F77(ml_fcd, int * n, int * nrhs, float * a, - int * lda, float * af, int * ldaf, int*ipiv, - float * b, int * ldb, float * x, int * ldx, - float * ferr, float * berr, float * work, - int * iwork, int * info); -void PREFIX SGESVX_F77(ml_fcd, ml_fcd, int * n, int * nrhs, float * a, - int * lda, float * af, int * ldaf, int*ipiv, ml_fcd, - float * r, float *c, float * b, int * ldb, float * x, int * ldx, - float * rcond, float * ferr, float * berr, float * work, - int * iwork, int * info); - -void PREFIX SPOTRF_F77(ml_fcd, int* n, float* a, int* lda, int* info); -void PREFIX SPOTRS_F77(ml_fcd, int * n, int * nrhs, float* a, - int* lda, float*x , int* ldx, int* info); -void PREFIX SPOTRI_F77(ml_fcd, int* n, float* a, int* lda, int* info); -void PREFIX SPOCON_F77(ml_fcd, int* n, float* a, int* lda, - float * anorm, float * rcond, float * work, - int * iwork, int* info); -void PREFIX SPOSV_F77(ml_fcd, int * n, int * nrhs, float* a, - int* lda, float*x , int* ldx, int* info); -void PREFIX SPOEQU_F77(int* n, float* a, int* lda, float * s, float * scond, - float * amax, int* info); - -void PREFIX SPORFS_F77(ml_fcd, int * n, int * nrhs, float * a, - int * lda, float * af, int * ldaf, - float * b, int * ldb, float * x, int * ldx, - float * ferr, float * berr, float * work, - int * iwork, int * info); - -void PREFIX SPOSVX_F77(ml_fcd, ml_fcd, int * n, int * nrhs, float * a, - int * lda, float * af, int * ldaf, ml_fcd, - float * s, float * b, int * ldb, float * x, int * ldx, - float * rcond, float * ferr, float * berr, float * work, - int * iwork, int * info); - -void PREFIX SGELSS_F77(int * m, int * n, int * nrhs, float * a, - int * lda, float * b, int * ldb, float * s, - float * rcond, int * rank, float * work, - int * lwork, int * info); - -void PREFIX SGEQPF_F77(int * m, int * n, float * a, - int * lda, int * jpvt, float * tau, - float * work, int * info); - - /* Double precision LAPACK eigen solvers*/ -void PREFIX DGELS_F77(ml_fcd ch, int*, int*, int*, - double*, int*, double*, int*, double*, int*, int*); - -void PREFIX DGEEV_F77(ml_fcd, ml_fcd, int*, double*, int*, - double*, double*, double*, int*, double*, int*, - double*, int*, int*); - -void PREFIX DGEHRD_F77(int * n, int * ilo, int * ihi, double * A, - int * lda, double * tau, double * work, int * lwork, - int * info); - -void PREFIX DHSEQR_F77(ml_fcd job, ml_fcd, int * n, int * ilo, int * ihi, - double * h, int * ldh, double * wr, double * wi, double * z, - int * ldz, double * work, int * lwork, int * info); - -void PREFIX DORGHR_F77(int * n, int * ilo, int * ihi, double * a, int * lda, double * tau, - double * work, int * lwork, int * info); - -void PREFIX DORMHR_F77(ml_fcd, ml_fcd, int * m, int * n, int * ilo, - int * ihi, double * a, int * lda, double * tau, double * c, - int * ldc, double * work, int * lwork, int * info); - -void PREFIX DTREVC_F77(ml_fcd, ml_fcd, int * select, int * n, double * t, - int * ldt, double *vl, int * ldvl, double * vr, int * ldvr, - int * mm, int * m, double * work, int * info); - -void PREFIX DTREXC_F77(ml_fcd, int * n, double * t, int * ldt, double * q, - int * ldq, int * ifst, int * ilst, double * work, int * info); - -void PREFIX DSTEV_F77(ml_fcd jobz, int * n, double * d, - double * e, double * z, int * ldz, - double * work, int * info); - -double PREFIX DLAMCH_F77(ml_fcd); - - - /* Single precision LAPACK eigen solvers*/ -void PREFIX SGELS_F77(ml_fcd, int*, int*, int*, - float*, int*, float*, int*, float*, int*, int*); - -void PREFIX SGEEV_F77(ml_fcd, ml_fcd, int*, float*, int*, - float*, float*, float*, int*, float*, int*, - float*, int*, int*); - -void PREFIX SGEHRD_F77(int * n, int * ilo, int * ihi, float * A, - int * lda, float * tau, float * work, int * lwork, - int * info); - -void PREFIX SHSEQR_F77(ml_fcd job, ml_fcd, int * n, int * ilo, int * ihi, - float * h, int * ldh, float * wr, float * wi, float * z, - int * ldz, float * work, int * lwork, int * info); - -void PREFIX SORGHR_F77(int * n, int * ilo, int * ihi, float * a, int * lda, float * tau, - float * work, int * lwork, int * info); - -void PREFIX SORMHR_F77(ml_fcd, ml_fcd, int * m, int * n, int * ilo, - int * ihi, float * a, int * lda, float * tau, float * c, - int * ldc, float * work, int * lwork, int * info); - -void PREFIX STREVC_F77(ml_fcd, ml_fcd, int * select, int * n, float * t, - int * ldt, float *vl, int * ldvl, float * vr, int * ldvr, - int * mm, int * m, float * work, int * info); - -void PREFIX STREXC_F77(ml_fcd, int * n, float * t, int * ldt, float * q, - int * ldq, int * ifst, int * ilst, float * work, int * info); - -void PREFIX SSTEV_F77(ml_fcd jobz, int * n, float * d, - float * e, float * z, int * ldz, - float * work, int * info); - -float PREFIX SLAMCH_F77(ml_fcd); - -#endif - -#ifdef __cplusplus -} -#endif - - -/* Define fcd (Fortran ml_fcd descriptor) for non-standard situations */ - -#if defined(CRAY_T3X) || defined(INTEL_CXML) || defined(INTEL_MKL) - - -#if defined(CRAY_T3X) - -#include -#define PREFIX -#define ml_fcd fcd - -#define DASUM_F77 F77_FUNC(sasum,SASUM) -#define DAXPY_F77 F77_FUNC(saxpy,SAXPY) -#define DCOPY_F77 F77_FUNC(scopy,SCOPY) -#define DDOT_F77 F77_FUNC(sdot,SDOT) -#define DNRM2_F77 F77_FUNC(snrm2,SNRM2) -#define DSCAL_F77 F77_FUNC(sscal,SSCAL) -#define IDAMAX_F77 F77_FUNC(isamax,ISAMAX) -#define DGEMV_F77 F77_FUNC(sgemv,SGEMV) -#define DGER_F77 F77_FUNC(sger,SGER) -#define DTRMV_F77 F77_FUNC(strmv,STRMV) -#define DGEMM_F77 F77_FUNC(sgemm,SGEMM) -#define DSYMM_F77 F77_FUNC(ssymm,SSYMM) -#define DTRMM_F77 F77_FUNC(strmm,STRMM) -#define DTRSM_F77 F77_FUNC(strsm,STRSM) - -#elif defined(INTEL_CXML) - -#define PREFIX __stdcall -#define ml_fcd char *, unsigned int - -#define DASUM_F77 F77_FUNC(dasum,DASUM) -#define DAXPY_F77 F77_FUNC(daxpy,DAXPY) -#define DCOPY_F77 F77_FUNC(dcopy,DCOPY) -#define DDOT_F77 F77_FUNC(ddot,DDOT) -#define DNRM2_F77 F77_FUNC(dnrm2,DNRM2) -#define DSCAL_F77 F77_FUNC(dscal,DSCAL) -#define IDAMAX_F77 F77_FUNC(idamax,IDAMAX) -#define DGEMV_F77 F77_FUNC(dgemv,DGEMV) -#define DGER_F77 F77_FUNC(dger,DGER) -#define DTRMV_F77 F77_FUNC(dtrmv,DTRMV) -#define DGEMM_F77 F77_FUNC(dgemm,DGEMM) -#define DSYMM_F77 F77_FUNC(dsymm,DSYMM) -#define DTRMM_F77 F77_FUNC(dtrmm,DTRMM) -#define DTRSM_F77 F77_FUNC(dtrsm,DTRSM) - - -#elif defined(INTEL_MKL) - -#define PREFIX -#define ml_fcd char * - -#define DASUM_F77 F77_FUNC(dasum,DASUM) -#define DAXPY_F77 F77_FUNC(daxpy,DAXPY) -#define DCOPY_F77 F77_FUNC(dcopy,DCOPY) -#define DDOT_F77 F77_FUNC(ddot,DDOT) -#define DNRM2_F77 F77_FUNC(dnrm2,DNRM2) -#define DSCAL_F77 F77_FUNC(dscal,DSCAL) -#define IDAMAX_F77 F77_FUNC(idamax,IDAMAX) -#define DGEMV_F77 F77_FUNC(dgemv,DGEMV) -#define DGER_F77 F77_FUNC(dger,DGER) -#define DTRMV_F77 F77_FUNC(dtrmv,DTRMV) -#define DGEMM_F77 F77_FUNC(dgemm,DGEMM) -#define DSYMM_F77 F77_FUNC(dsymm,DSYMM) -#define DTRMM_F77 F77_FUNC(dtrmm,DTRMM) -#define DTRSM_F77 F77_FUNC(dtrsm,DTRSM) - - -#endif - -/* All three of these machines use a simple uppercase mangling of Fortran names */ - -/* if F77_FUNC is defined undefine it because we want to redefine */ - -#ifdef F77_FUNC -#undef F77_FUNC -#endif - - -#define F77_FUNC(lcase,UCASE) UCASE - -#else /* Define ml_fcd for all other machines */ - -#define PREFIX -#define ml_fcd char * - -/* Use autoconf's definition of F77_FUNC - unless using old make system */ - -#ifndef HAVE_CONFIG_H - -#ifdef F77_FUNC -#undef F77_FUNC -#endif - -#ifdef TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE -#define F77_FUNC(lcase,UCASE) lcase -#else /* TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE not defined*/ -#define F77_FUNC(lcase,UCASE) lcase ## _ -#endif /* TRILINOS_HAVE_NO_FORTRAN_UNDERSCORE */ -#endif /* HAVE_CONFIG_H */ - -#define DASUM_F77 F77_FUNC(dasum,DASUM) -#define DAXPY_F77 F77_FUNC(daxpy,DAXPY) -#define DCOPY_F77 F77_FUNC(dcopy,DCOPY) -#define DDOT_F77 F77_FUNC(ddot,DDOT) -#define DNRM2_F77 F77_FUNC(dnrm2,DNRM2) -#define DSCAL_F77 F77_FUNC(dscal,DSCAL) -#define IDAMAX_F77 F77_FUNC(idamax,IDAMAX) -#define DGEMV_F77 F77_FUNC(dgemv,DGEMV) -#define DGER_F77 F77_FUNC(dger,DGER) -#define DTRMV_F77 F77_FUNC(dtrmv,DTRMV) -#define DGEMM_F77 F77_FUNC(dgemm,DGEMM) -#define DSYMM_F77 F77_FUNC(dsymm,DSYMM) -#define DTRMM_F77 F77_FUNC(dtrmm,DTRMM) -#define DTRSM_F77 F77_FUNC(dtrsm,DTRSM) - - -#endif - - -#define SSCAL_F77 F77_FUNC(sscal,SSCAL) -#define SCOPY_F77 F77_FUNC(scopy,SCOPY) -#define SAXPY_F77 F77_FUNC(saxpy,SAXPY) -#define SDOT_F77 F77_FUNC(sdot,SDOT) -#define SNRM2_F77 F77_FUNC(snrm2,SNRM2) -#define SASUM_F77 F77_FUNC(sasum,SASUM) -#define ISAMAX_F77 F77_FUNC(isamax,ISAMAX) - -#define SGEMV_F77 F77_FUNC(sgemv,SGEMV) -#define SGER_F77 F77_FUNC(sger,SGER) -#define STRMV_F77 F77_FUNC(strmv,STRMV) -#define SGEMM_F77 F77_FUNC(sgemm,SGEMM) -#define SSYMM_F77 F77_FUNC(ssymm,SSYMM) -#define STRMM_F77 F77_FUNC(strmm,STRMM) -#define STRSM_F77 F77_FUNC(strsm,STRSM) - -/* Explicitly define each F77 name for all BLAS kernels */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Aztec-2.1 already contains these definitions in the header files */ -#ifndef HAVE_ML_AZTEC2_1 -/* Double precision BLAS 1 */ -double PREFIX DASUM_F77(int* n, double x[], int* incx); -void PREFIX DAXPY_F77(int* n, double* alpha, double x[], int* incx, double y[], int* incy); -void PREFIX DCOPY_F77(int* n, double *x, int* incx, double *y, int* incy); -double PREFIX DDOT_F77(int* n, double x[], int* incx, double y[], int* incy); -double PREFIX DNRM2_F77(int* n, double x[], int* incx); -void PREFIX DSCAL_F77(int* n, double* alpha, double *x, int* incx); -int PREFIX IDAMAX_F77(int* n, double *x, int* incx); - -/* Single precision BLAS 1 */ -float PREFIX SASUM_F77(int* n, float x[], int* incx); -void PREFIX SAXPY_F77(int* n, float* alpha, float x[], int* incx, float y[], int* incy); -void PREFIX SCOPY_F77(int* n, float *x, int* incx, float *y, int* incy); -float PREFIX SDOT_F77(int* n, float x[], int* incx, float y[], int* incy); -float PREFIX SNRM2_F77(int* n, float x[], int* incx); -void PREFIX SSCAL_F77(int* n, float* alpha, float *x, int* incx); -int PREFIX ISAMAX_F77(int* n, float *x, int* incx); - -/* Double precision BLAS 2 */ -void PREFIX DGEMV_F77(ml_fcd, int* m, int* n, double* alpha, double A[], int* lda, - double x[], int* incx, double* beta, double y[], int* incy); -void PREFIX DTRMV_F77(ml_fcd, ml_fcd, ml_fcd, int *n, - double *a, int *lda, double *x, int *incx); -void PREFIX DGER_F77(int *m, int *n, double *alpha, double *x, int *incx, double *y, - int *incy, double *a, int *lda); - - -/* Single precision BLAS 2 */ -void PREFIX SGEMV_F77(ml_fcd, int* m, int* n, float* alpha, float A[], int* lda, - float x[], int* incx, float* beta, float y[], int* incy); -void PREFIX STRMV_F77(ml_fcd, ml_fcd, ml_fcd, int *n, - float *a, int *lda, float *x, int *incx); -void PREFIX SGER_F77(int *m, int *n, float *alpha, float *x, int *incx, float *y, - int *incy, float *a, int *lda); - -/* Double precision BLAS 3 */ -void PREFIX DGEMM_F77(ml_fcd, ml_fcd, int *m, int * - n, int *k, double *alpha, double *a, int *lda, - double *b, int *ldb, double *beta, double *c, int *ldc); -void PREFIX DSYMM_F77(ml_fcd, ml_fcd, int *m, int * n, - double *alpha, double *a, int *lda, - double *b, int *ldb, double *beta, double *c, int *ldc); -void PREFIX DTRMM_F77(ml_fcd, ml_fcd, ml_fcd, ml_fcd, - int *m, int *n, double *alpha, double *a, int * lda, double *b, int *ldb); -void PREFIX DTRSM_F77(ml_fcd, ml_fcd, ml_fcd, ml_fcd, - int *m, int *n, double *alpha, double *a, int * - lda, double *b, int *ldb); - -/* Single precision BLAS 3 */ -void PREFIX SGEMM_F77(ml_fcd, ml_fcd, int *m, int * - n, int *k, float *alpha, float *a, int *lda, - float *b, int *ldb, float *beta, float *c, int *ldc); -void PREFIX SSYMM_F77(ml_fcd, ml_fcd, int *m, int * n, - float *alpha, float *a, int *lda, - float *b, int *ldb, float *beta, float *c, int *ldc); -void PREFIX STRMM_F77(ml_fcd, ml_fcd, ml_fcd, ml_fcd, - int *m, int *n, float *alpha, float *a, int * lda, float *b, int *ldb); -void PREFIX STRSM_F77(ml_fcd, ml_fcd, ml_fcd, ml_fcd, - int *m, int *n, float *alpha, float *a, int * - lda, float *b, int *ldb); - -void PREFIX XERBLA_F77(ml_fcd, int *info); - -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* ML_BLAS_LAPACK_WRAPPERS_H */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_mapper.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_mapper.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_mapper.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_mapper.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the ML_Mapper structure */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : March, 1999 */ -/* ******************************************************************** */ - -#ifndef __MLMAPPERH__ -#define __MLMAPPERH__ - -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_memory.h" - -#ifdef WKC -#include -#include -#endif - -typedef struct ML_Mapper_Struct ML_Mapper; - -/* ******************************************************************** */ -/* data definition for the ML_Mapper Class */ -/* ******************************************************************** */ -/* -------------------------------------------------------------------- */ -/* This data structure stores a mapping function that maps unknowns */ -/* between the grid and equation spaces (One is instantiated for grid */ -/* to equation space mapping, and the other for equation to grid space */ -/* mapping. */ -/* -------------------------------------------------------------------- */ - -struct ML_Mapper_Struct { - int ML_id; - void *data; - int inlength, outlength; - int (*map)(void*, double *, double *); -}; - -/* ******************************************************************** */ -/* function for accessing the ML_Mapper Class */ -/* ******************************************************************** */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -extern int ML_Mapper_Create(ML_Mapper **); -extern int ML_Mapper_Init(ML_Mapper *); -extern int ML_Mapper_Destroy(ML_Mapper **); -extern int ML_Mapper_Clean(ML_Mapper *); -extern int ML_Mapper_Check(ML_Mapper *); -extern int ML_Mapper_SetFunc(ML_Mapper*,int,int, - int (*func)(void*,double*,double*)); -extern int ML_Mapper_SetData(ML_Mapper*,void*); -extern int ML_Mapper_GetLength(ML_Mapper*,int*,int*); -extern int ML_Mapper_Apply(ML_Mapper *, double *, double *); - -/* WKC -- Added header for Epetra stuff */ -#ifdef WKC -extern int ML_Mapper_Apply(ML_Mapper *, Epetra_MultiVector & , Epetra_MultiVector &); -#endif - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_mat_formats.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_mat_formats.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_mat_formats.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_mat_formats.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,169 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of matrix-format specific stuff */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Ray Tuminaro (SNL) */ -/* Date : April, 1999 */ -/* ******************************************************************** */ - -#ifndef _MLMATFORMATS_ -#define _MLMATFORMATS_ - - -/* ******************************************************************** */ -/* Structure used for ML_MSR_getrows and ML_CSR_getrows */ -/* */ -/* For CSR matrices, we have */ -/* A(i,j) where 0 <= i < N | j = columns[k] , A(i,j) = values[k] */ -/* and 0 <= j < N | where rowptr[i] <= k -#include -#include "ml_common.h" - -#define MAX_MALLOC_LOG 1000 - -#ifdef size_t -#define ml_size_t size_t -#else -#define ml_size_t int -#endif -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif -#ifndef ML_MEM_CHECK -extern void ML_free(void *); -extern void *ML_allocate(ml_size_t size); -#endif -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#ifndef ML_MEM_CHECK -#define ML_allocate(i) malloc((i + sizeof(double) )) -#define ML_realloc(i,j) realloc(i,j) -extern void *ml_void_mem_ptr; -#define ML_free(i) { ml_void_mem_ptr = (void *) i; if (ml_void_mem_ptr != NULL) {free( (void*) i); i = NULL;} } -#else -#define ML_free(i) { ML_myfree(i); i = NULL; } -#define ML_realloc(i,j) ML_myrealloc(i,j) -#endif -#define ML_allocate_check(ptr_to_check) \ - {if ((ptr_to_check) == NULL) {\ - printf("In file %s (line %d): memory allocation failed for pointer #%lu\n", __FILE__, __LINE__, (long unsigned int) ptr_to_check);\ - exit(1);\ - }\ - } - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif - extern char *ML_memory_check(char *fmt, ...); - - -extern int ML_memory_alloc( void **, unsigned int, char * ); -extern int ML_memory_free( void ** ); -extern int ML_memory_check_var(void *); -extern int ML_memory_inquire(void); -extern int ML_memory_inquire_short( int ); -extern int ML_memory_clean( char *, int ); -#ifdef ML_MEM_CHECK -extern void ML_print_it(); -extern char *ML_allocate(unsigned int isize); -extern void ML_myfree(void *vptr); -extern char *ML_myrealloc(void *vptr, unsigned int new_size); -extern void ML_spit_it_out(); -#endif -extern int ML_MaxAllocatableSize(); -extern int ML_MaxMemorySize(); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_mls.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_mls.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_mls.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_mls.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#ifndef __MLMLS__ -#define __MLMLS__ - -#include "ml_common.h" - -#define MLS_MAX_DEG 5 /* max. degree of MLS smoother */ - -struct MLSthing { - /* - * set degree and - * the precomputed coefficients used in MLS application - */ - int mlsDeg; /* degree for current level */ - double mlsBoost; - double mlsOver; - double mlsOm[MLS_MAX_DEG]; - double mlsOm2; - double mlsCf[MLS_MAX_DEG]; - double *pAux, *res, *y; /* workarrays allocated in .... to be reused */ - double eig_ratio; - double beta_real, beta_img; - - ML_Sm_BGS_Data *block_scaling;/* these last arguments are used to */ - ML_Operator *unscaled_matrix; /* implement block scaling instead */ - ML_Operator *scaled_matrix; /* of point scaling when doing */ - /* Chebyshev smoothing. The basic */ - /* idea is to turn off diagonal */ - /* scaling by setting the diagonal */ - /* to 1. Then to create a matrix */ - /* wrapper that does Dinv*Amat*v */ - /* when a matvec is requested (where*/ - /* D is some block diagonal */ -}; - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -int ML_MLS_Smooth0( double b[], double vx[], double vy[], int deg, - double *om, double *cf, int nit, double over, - double wk); -int ML_MLS_Smooth1( double b[], double vx[], double vy[], int deg, - double *om, double *cf, int nit, double over, - double wk); -int ML_MLS_SandwPres(void *sm, int inlen, double x[], int outlen, double y[]); -int ML_MLS_SandwPost(void *sm, int inlen, double x[], int outlen, double y[]); -int ML_MLS_SPrime_Apply(void *sm,int inlen,double x[],int outlen, double rhs[]); - - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_MultiLevelOperator.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_MultiLevelOperator.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_MultiLevelOperator.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_MultiLevelOperator.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,243 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* Copyright (2001) Sandia Corportation. Under the terms of Contract - * DE-AC04-94AL85000, there is a non-exclusive license for use of this - * work by or on behalf of the U.S. Government. Export of this program - * may require a license from the United States Government. */ - - -/* NOTICE: The United States Government is granted for itself and others - * acting on its behalf a paid-up, nonexclusive, irrevocable worldwide - * license in ths data to reproduce, prepare derivative works, and - * perform publicly and display publicly. Beginning five (5) years from - * July 25, 2001, the United States Government is granted for itself and - * others acting on its behalf a paid-up, nonexclusive, irrevocable - * worldwide license in this data to reproduce, prepare derivative works, - * distribute copies to the public, perform publicly and display - * publicly, and to permit others to do so. - * - * NEITHER THE UNITED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT - * OF ENERGY, NOR SANDIA CORPORATION, NOR ANY OF THEIR EMPLOYEES, MAKES - * ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR - * RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY - * INFORMATION, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS - * THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS. */ - -/*! - * \file ml_MultiLevelOperator.h - * - * \brief Defines an ML preconditioner as a Epetra_Operator derived class. - * - * ML offers two preconditioners suitable for the solution of - * Epetra_LinearProblem objects. This file define one the two, called - * MultiLevelOperator (in the ML_Epetra namespace). This preconditioner is - * simple wrapper of the ML_Solve() function, so that ML can be applied to - * Epetra_MultiVector's. - * - * When you should use MultiLevelOperator: - * - when your code already defines the required ML objects, with the optimal - * choice of parameters, and you want to use ML for Epetra_LinearProblem or - * AztecOO problems; - * - * When you should use MultiLevelPreconditioner: - * - when you have an Epetra_RowMatrix, and you don't want to code the - * conversion to ML_Operator, the creation of the hierarchy and the - * parameters, simply changing some parameters in a Teuchos::ParameterList. - * - * - * \date Last update to Doxygen: 22-Jul-04 - * - */ - -#ifndef ML_MULTILEVELOPERATOR_H -#define ML_MULTILEVELOPERATOR_H - -class Epetra_MultiVector; -class Epetra_BlockMap; -class Epetra_Comm; - -#include "ml_common.h" -#include "Epetra_LinearProblem.h" -#include "Epetra_Object.h" -#include "ml_include.h" - -//! ML_Epetra: default namespace for all Epetra interfaces. - -namespace ML_Epetra -{ - -//! MultiLevelOperator: An implementation of the Epetra_Operator class. -/*! MultiLevelOperator class implements Epetra_Operator using a - pre-constructed ML solver object. This allows ML to be used as - preconditioner within an AztecOO solver object. -*/ - -class MultiLevelOperator: public virtual Epetra_Operator { - - public: - - //@{ \name Constructor. - //! Uses an ML instance to implement the Epetra_Operator interface. - /*! This is designed - for using ML as a preconditioner within an AztecOO solver instance. - \param ml_handle A fully-constructed ML object (In) - \param myComm - Epetra communicator (In) - \param DomainMap - Epetra domain map (In) - \param RangeMap - Epetra range map (In) - */ - MultiLevelOperator(ML * ml_handle, const Epetra_Comm & myComm, - const Epetra_Map & DomainMap, - const Epetra_Map & RangeMap); - //@{ \name Destructor. - //! Destructor - ~MultiLevelOperator(); - //@} - - - //@{ \name Atribute set methods. - - //! If set true, the multigrid hierarchy is destroyed when the Operator is destroyed. - /*! This flag determines the ownership of the multigrid - hierarchy. When set to true, this object owns the multigrid - hierarchy and so it destroys it when freed. Otherwise, it is - assumed that the multigrid hierarchy is owned by another object - and so it is not freed. By default, the multigrid hierarchy is - not owned by this object. - - \param ownership (In) - If true, this object owns the corresponding - multigrid hierarchy. - - */ - int SetOwnership(bool ownership){ ownership_ = ownership; return(-1);}; - //@} - - - //@{ \name Atribute set methods. - - //! If set true, transpose of this operator will be applied. - /*! This flag allows the transpose of the given operator to be used - implicitly. Setting this flag affects only the Apply() and - ApplyInverse() methods. If the implementation of this interface - does not support transpose use, this method should return a - value of -1. - - \param UseTranspose (In) - If true, multiply by the transpose of - operator, otherwise just use operator. - - \warning - This method has no effect and returns -1 as error code. - */ - int SetUseTranspose(bool UseTranspose){ ML_avoid_unused_param((void *) UseTranspose); - return(-1);} - //@} - - //@{ \name Mathematical functions. - - //! Returns the result of a Operator applied to a Epetra_MultiVector X in Y. - /*! - \param X (In) - A Epetra_MultiVector of dimension NumVectors to multiply with matrix. - \param Y (Out) -A Epetra_MultiVector of dimension NumVectors containing result. - \warning - This method has no effect and returns -1 as error code. - */ - int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const { - return(-1);} - - //! Returns the result of a Operator inverse applied to an Epetra_MultiVector X in Y. - /*! - \param X (In) - A Epetra_MultiVector of dimension NumVectors to solve for. - \param Y (Out) -A Epetra_MultiVector of dimension NumVectors containing result. - - \return Integer error code, set to 0 if successful. - */ -#ifdef WKC - -#if WKC < 1 -#error Blocking parameter (WKC) is not properly defined! -#endif - - - int ApplyInverse_WKC(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const -; -// int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y, int iBlockSize = WKC) const; - int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; -#else - int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; -#endif - - //int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; - - //! Returns the infinity norm of the global matrix. - /* Returns the quantity \f$ \| A \|_\infty\f$ such that - \f[\| A \|_\infty = \max_{1\lei\lem} \sum_{j=1}^n |a_{ij}| \f]. - - \warning This method must not be called unless HasNormInf() returns true. - */ - double NormInf() const {return(0.0);}; - //@} - - //@{ \name Atribute access functions - - const char * Label() const{return(Label_);}; - - //! Returns the current UseTranspose setting. - bool UseTranspose() const {return(false);}; - - //! Returns true if the \e this object can provide an approximate Inf-norm, false otherwise. - bool HasNormInf() const{return(false);}; - - //! Returns a pointer to the Epetra_Comm communicator associated with this operator. - const Epetra_Comm & Comm() const{return(Comm_);}; - - //! Returns the Epetra_Map object associated with the domain of this operator. - const Epetra_Map & OperatorDomainMap() const {return(DomainMap_);}; - //! Returns the Epetra_Map object associated with the range of this operator. - const Epetra_Map & OperatorRangeMap() const {return(RangeMap_);}; - //@} - - protected: - - //@{ Private data - //! Pointer to the ML_Structure. - ML * solver_; - //! Label for this object. - char * Label_; - - private: - //! Copy constructor (NOT DEFINED) - MultiLevelOperator(const MultiLevelOperator& RHS) : - Comm_(RHS.Comm()), - DomainMap_(RHS.OperatorDomainMap()), - RangeMap_(RHS.OperatorRangeMap()) - { } - - //! Operator= (NOT DEFINED) - MultiLevelOperator& operator=(const MultiLevelOperator& RHS) - { - return(*this); - } - - //! Reference to Epetra communicator. - const Epetra_Comm& Comm_; - //! Reference to Domain Map. - const Epetra_Map& DomainMap_; - //! Reference to Range Map. - const Epetra_Map& RangeMap_; - bool ownership_; -}; - -} - -#endif /* ML_MULTILEVELOPERATOR_H */ - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_MultiLevelPreconditioner.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_MultiLevelPreconditioner.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_MultiLevelPreconditioner.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_MultiLevelPreconditioner.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,750 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* Copyright (2001) Sandia Corportation. Under the terms of Contract - * DE-AC04-94AL85000, there is a non-exclusive license for use of this - * work by or on behalf of the U.S. Government. Export of this program - * may require a license from the United States Government. */ - - -/* NOTICE: The United States Government is granted for itself and others - * acting on its behalf a paid-up, nonexclusive, irrevocable worldwide - * license in ths data to reproduce, prepare derivative works, and - * perform publicly and display publicly. Beginning five (5) years from - * July 25, 2001, the United States Government is granted for itself and - * others acting on its behalf a paid-up, nonexclusive, irrevocable - * worldwide license in this data to reproduce, prepare derivative works, - * distribute copies to the public, perform publicly and display - * publicly, and to permit others to do so. - * - * NEITHER THE UNITED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT - * OF ENERGY, NOR SANDIA CORPORATION, NOR ANY OF THEIR EMPLOYEES, MAKES - * ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR - * RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY - * INFORMATION, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS - * THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS. */ - -/*! - * \file ml_MultiLevelPreconditioner.h - * - * \class MultiLevelPreconditioner - * - * \brief ML black-box preconditioner for Epetra_RowMatrix derived classes. - * - * \date Last update do Doxygen: 22-Jul-04 - * - */ - -#ifndef ML_MULTILEVELPRECONDITIONER_H -#define ML_MULTILEVELPRECONDITIONER_H - -#include "ml_include.h" - -#if defined(HAVE_ML_EPETRA) && defined(HAVE_ML_TEUCHOS) -// define the following to allow compilation without AztecOO -#ifndef HAVE_ML_AZTECOO -#ifndef AZ_PROC_SIZE -#define AZ_PROC_SIZE 1 -#endif -#ifndef AZ_OPTIONS_SIZE -#define AZ_OPTIONS_SIZE 1 -#endif -#ifndef AZ_PARAMS_SIZE -#define AZ_PARAMS_SIZE 1 -#endif -#ifndef AZ_STATUS_SIZE -#define AZ_STATUS_SIZE 1 -#endif -#endif - -class Epetra_Map; -class Epetra_BlockMap; -class Epetra_MultiVector; -class Epetra_Comm; -class Epetra_CrsMatrix; -class Epetra_FECrsMatrix; -class Epetra_VbrMatrix; - -#include "Epetra_SerialDenseMatrix.h" -#include "Epetra_SerialDenseVector.h" -#include "Epetra_SerialDenseSolver.h" - -#define ML_MEM_SIZE 20 -#define ML_MEM_INITIAL 0 -#define ML_MEM_FINAL 1 -#define ML_MEM_SMOOTHER 2 -#define ML_MEM_COARSE 3 -#define ML_MEM_HIERARCHY 4 -#define ML_MEM_PREC_FIRST 5 -#define ML_MEM_PREC_OTHER 6 -#define ML_MEM_TOT1 7 -#define ML_MEM_TOT2 8 -#define ML_MEM_INITIAL_MALLOC 10 -#define ML_MEM_FINAL_MALLOC 11 -#define ML_MEM_SMOOTHER_MALLOC 12 -#define ML_MEM_COARSE_MALLOC 13 -#define ML_MEM_HIERARCHY_MALLOC 14 -#define ML_MEM_PREC_FIRST_MALLOC 15 -#define ML_MEM_PREC_OTHER_MALLOC 16 -#define ML_MEM_TOT1_MALLOC 17 -#define ML_MEM_TOT2_MALLOC 18 - -#ifdef HAVE_ML_TRIUTILS -#include "Trilinos_Util_CommandLineParser.h" -#endif - -#include "Epetra_Operator.h" -#include "Epetra_RowMatrix.h" -#ifdef HAVE_ML_AZTECOO -#include "Epetra_MsrMatrix.h" -#endif -#include "Teuchos_ParameterList.hpp" - -namespace ML_Epetra -{ - - //! Sets default parameters for aggregation-based 2-level domain decomposition preconditioners. - /*! This function, defined in the namespace ML_Epetra, can be used to set - default values in a user's defined Teuchos::ParameterList. - \param ProblemType (In) : a string, whose possible values are: - - "DD" : defaults for 2-level domain decomposition preconditioners based - on aggregation; - - "DD-ML" : 3-level domain decomposition preconditioners, with coarser - spaces defined by aggregation; - - "SA" : classical smoothed aggregation preconditioners; - - "maxwell" : default values for Maxwell. - \param List (Out) : list which will populated by the default parameters - \param options (In) : integer array, of size \c AZ_OPTIONS_SIZE, that will be - populated with suitable values. A pointer to \c options will be stick into - the parameters list. Note that this array is still required to apply the - preconditioner! Do not delete options, nor let it go out of scope. The default value is - 0, meaning that \c SetDefaults() will allocate the array. It is - responsibility of the user to free this memory. - \param params (Out) : double array, of size \c AZ_PARAMS_SIZE. See comments - for \c options. - */ - int SetDefaults(string ProblemType, Teuchos::ParameterList & List, - int * options = 0, double * params = 0); - - //! Sets default parameters for aggregation-based 2-level domain decomposition preconditioners. - int SetDefaultsDD(Teuchos::ParameterList & List, - int * options = 0, double * params = 0); - - //! Sets default parameters for aggregation-based 2-level domain decomposition preconditioners, using LU on each subdomain - int SetDefaultsDD_LU(Teuchos::ParameterList & List, - int * options = 0, double * params = 0); - - //! Sets default parameters for aggregation-based 3-level domain decomposition preconditioners. - int SetDefaultsDD_3Levels(Teuchos::ParameterList & List, - int * options = 0, double * params = 0); - - //! Sets default parameters for aggregation-based 3-level domain decomposition preconditioners with LU. - int SetDefaultsDD_3Levels_LU(Teuchos::ParameterList & List, - int * options = 0, double * params = 0); - - //! Sets default parameters for Maxwell's equations. - int SetDefaultsMaxwell(Teuchos::ParameterList & List, - int * options = 0, double * params = 0); - - //! Sets classical smoothed aggregation. - int SetDefaultsSA(Teuchos::ParameterList & List, - int * options = 0, double * params = 0); - -/*! - - \brief MultiLevelPreconditioner: a class to define black-box multilevel preconditioners using aggregation methods. - - Class ML_Epetra::MultiLevelPreconditioner defined black-box algebraic - multilevel preconditioners of matrices defined as Epetra_RowMatrix derived - objects. The resulting preconditioner can be used in AztecOO, and in any - other solver that accepts Epetra_Operator derived objects, and apply the - action of the given Epetra_Operator using ApplyInverse(). - - Please refer to the user's guide for a detailed introduction to - this class, examples, and description of input parameters. - - This file requires ML to be configured with the following options: - - \c --enable-epetra - - \c --enable-teuchos - - The following option is suggested: - - \c --enable-amesos - - \c --enable-ifpack - - Some part of this class needs the following options: - - \c --enable-aztecoo - - \c --enable-anasazi - - It is important to note that ML is more restrictive than Epetra for - the definition of maps. It is required that RowMatrixRowMap() is equal - to OperatorRangeMap(). This is because ML needs to perform matrix-vector - product, as well as getrow() functions, on the same data distribution. - - Also, for square matrices, OperatorDomainMap() must be as - OperatorRangeMap(). - - Several examples are provided in the \c examples subdirectories: - - \ref ml_preconditioner_cpp is an introductory - example; - - \ref ml_2level_DD_cpp shows how to - define a 2-level domain decomposition preconditioner using - this class; - - \ref ml_viz_cpp details how to visualize the aggregates; - - \ref ml_maxwell_cpp reports how to - use this class for Maxwell problems. - - \note - Namespace ML_Epetra contains another Epetra_Operator derived class, - ML_Epetra::MultiLevelOperator. - - you should use MultiLevelOperator - when your code already defines the required ML objects, with the optimal - choice of parameters, and you just want to wrap the already defined ML - preconditioners for AztecOO problems; - - you should use MultiLevelPreconditioner - when you have an Epetra_RowMatrix, and you don't want to code the - conversion to ML_Operator, the creation of the hierarchy and the - parameters, simply changing some parameters in a Teuchos::ParameterList. - - Defaults parameters can be specified using function SetDefaults(). - - \warning The Maxwell interface is still under development. - - \author Marzio Sala, SNL 9214 -*/ -class MultiLevelPreconditioner : public virtual Epetra_Operator { - -public: - - //@{ \name Constructors. - - //! Constructs an MultiLevelPreconditioner with default values. - - MultiLevelPreconditioner(const Epetra_RowMatrix & RowMatrix, - const bool ComputePrec); - - //! Constructs an MultiLevelPreconditioner. Retrives parameters from \c List. - - MultiLevelPreconditioner(const Epetra_RowMatrix & RowMatrix, - const Teuchos::ParameterList & List, - const bool ComputePrec = true); - - //! Constructs an MultiLevelPreconditioner from an ML_Operator. Retrives parameters from \c List. - - MultiLevelPreconditioner(ML_Operator* Operator, - const Teuchos::ParameterList& List, - const bool ComputePrec = true); - - //! Constructs an MultiLevelPreconditioner for Maxwell equations. Retrives parameters from \c List. - /*! Constructs an MultiLevelPreconditioner for Maxwell equations. The constructor - requires the edge matrix, the connectivity matrix T, the nodal matrix. - */ - MultiLevelPreconditioner(const Epetra_RowMatrix& EdgeMatrix, - const Epetra_RowMatrix& TMatrix, - const Epetra_RowMatrix& NodeMatrix, - const Teuchos::ParameterList& List, - const bool ComputePrec = true); - //! Constructs an MultiLevelPreconditioner for Maxwell equations. Retrives parameters from \c List. - /*! Constructs an MultiLevelPreconditioner for Maxwell equations. The constructor - requires the edge matrix, the connectivity matrix T, the nodal matrix. - */ -#ifdef HAVE_ML_AZTECOO -MultiLevelPreconditioner(const Epetra_MsrMatrix & EdgeMatrix, - ML_Operator * ML_TMatrix, - AZ_MATRIX * AZ_NodeMatrix, - int * proc_config, - const Teuchos::ParameterList & List, - const bool ComputePrec); -#endif - - //@} - - //@{ \name Destructor. - - //! Destroys the preconditioner. - ~MultiLevelPreconditioner() { - if (IsComputePreconditionerOK_) - DestroyPreconditioner(); - } - - //@} - - //@{ \name Query functions - - //! Prints label associated to this object. - const char* Label() const{return(Label_);}; - - //! Prints unused parameters in the input ParameterList on standard output. */ - void PrintUnused() const - { - List_.unused(std::cout); - } - - //! Prints unused parameters in the input ParameterList on the specified stream. - void PrintUnused(ostream & os) const - { - List_.unused(os); - } - - //! Prints unused parameters in the input ParameterList to cout on proc \c MyPID. - /*! Mispelled parameters are simply ignored. Therefore, it is often the best - * choice to print out the parameters that have not been used in the - * construction phase. - * - \param MyPID (In) : ID of process that should print the unused parameters. - */ - void PrintUnused(const int MyPID) const; - - //! Gets a reference to the internally stored parameters' list. - Teuchos::ParameterList& GetList() - { - return List_; - } - - // Get a copy of the internally stored output list. - Teuchos::ParameterList GetOutputList() - { - return OutputList_; - } - - //! Prints on \c cout the values of the internally stored parameter list for processor \c MyPID - void PrintList(int MyPID); - - //! Copies \c List into the internally stored parameter list object. - int SetParameterList(const Teuchos::ParameterList& List); - - //@} - - //@{ \name Mathematical functions. - - //! Apply the inverse of the preconditioner to an Epetra_MultiVector (NOT AVAILABLE) - int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const { - return(-1);} - - //! Apply the preconditioner to an Epetra_MultiVector X, puts the result in Y - int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; - - //@} - - //@{ \name Atribute access functions - - - //! Computes the multilevel hierarchy. - /*! Computes the multilevel hierarchy. This function retrives the user's defines parameters (as - specified in the input ParameterList), or takes default values otherwise, and creates the ML - objects for aggregation and hierarchy. Allocated data can be freed used DestroyPreconditioner(), - or by the destructor, - - In a Newton-type procedure, several linear systems have to be solved, Often, these systems - are not too different. In this case, it might be convenient to keep the already - computed preconditioner (with hierarchy, coarse solver, smoothers), and use it to - precondition the next linear system. ML offers a way to determine whether the - already available preconditioner is "good enough" for the next linear system. - The user should proceed as follows: - - define \c "adaptive: enable" == \c true - - solve the first linear system. ML tries to estimate the rate of convergence, and record it; - - change the values of the linear system matrix (but NOT its structure) - - compute the new preconditioner as \c ComputePreconditioner(true) - It is supposed that the pointer to the Epetra_RowMatrix remains constant. Currently, - it is not possible to modify this pointer (other than creating a new preconditioner) - */ - - int ComputePreconditioner(const bool CheckFiltering = false); - - //! Recomputed the preconditioner (not implemented for Maxwell). - int ReComputePreconditioner(); - - //! Print the individual operators in the multigrid hierarchy. - void Print(const char *whichHierarchy = "main"); - - int ComputeAdaptivePreconditioner(int TentativeNullSpaceSize, - double* TentativeNullSpace); - - //! Queries whether multilevel hierarchy has been computed or not. - int IsPreconditionerComputed() const - { - return(IsComputePreconditionerOK_); - } - - // following functions are required to derive Epetra_RowMatrix objects. - - //! Sets ownership. - int SetOwnership(bool ownership){ ownership_ = ownership; return(-1);}; - - //! Sets use transpose (not implemented). - int SetUseTranspose(bool UseTranspose){return(-1);} - - //! Returns the infinity norm (not implemented). - double NormInf() const {return(0.0);}; - - //! Returns the current UseTranspose setting. - bool UseTranspose() const {return(false);}; - - //! Returns true if the \e this object can provide an approximate Inf-norm, false otherwise. - bool HasNormInf() const{return(false);}; - - //! Returns a pointer to the Epetra_Comm communicator associated with this operator. - const Epetra_Comm& Comm() const{return(*Comm_);}; - - //! Returns the Epetra_Map object associated with the domain of this operator. - const Epetra_Map& OperatorDomainMap() const {return(*DomainMap_);}; - - //! Returns the Epetra_Map object associated with the range of this operator. - const Epetra_Map& OperatorRangeMap() const {return(*RangeMap_);}; - //@} - - //! Destroys all structures allocated in \c ComputePreconditioner() if the preconditioner has been computed. - int DestroyPreconditioner(); - - //! Returns a reference to the internally stored RowMatrix. - const Epetra_RowMatrix& RowMatrix() const - { - return(*RowMatrix_); - } - - //! Returns a reference to RowMatrix->Map(). - const Epetra_BlockMap& Map() const - { - return(RowMatrix_->Map()); - } - - //! Returns the global number of rows in the matrix. - int NumGlobalRows() const - { - return(RowMatrix_->NumGlobalRows()); - } - - //! Returns the global number of columns in the matrix. - int NumGlobalCols() const - { - return(RowMatrix_->NumGlobalCols()); - } - - //! Returns the local number of rows in the matrix. - int NumMyRows() const - { - return(RowMatrix_->NumMyRows()); - } - - //! Returns the local number of columns in the matrix. - int NumMyCols() const - { - return(RowMatrix_->NumMyCols()); - } - - //@} - //@{ \name debugging and other utilities - - //! Stops the code, waiting for a debugger to attach - /*! BreakForDebugger() is useful when the user wants to attach to the running - * process(es). This is a very easy task for serial runs -- just run gdb. - * Parallel runs may result more problematic. In this case, one can proceed as - * follows: - * - define the enviromental variable ML_BREAK_FOR_DEBUGGER (example, in BASH, - * \c export \c ML_BREAK_FOR_DEBUGGER=1 ) - * - run the parallel code on a terminal (example, \c mpirun \c -np \c 4 \c - * ml_example.exe ) - * - the code will stop in the first call to ComputePreconditioner(). This may - * occur in the construction phase. Some information about the ID number of - * each process will be shown. - * - in another terminal, attach to the desired process. - * - insert one character to let the code continue, and debug as required. - */ - int BreakForDebugger(); - - //! Prints the computational stencil for the specified row and equation (for 2D Cartesian grids only) - /*! For problems defined on 2D Cartesian grids (with node numbering increasing - * along the x-axis), this function prints out the stencil in an intelligible - * form. - * \param nx (In) : number of nodes along the X-axis - * \param ny (In) : number of nodes along the Y-axis - * \param NodeID (In) : (local) ID of node that will be used to print the - * stencil. If set to -1, the code will automatically chose an internal node. - * Default: -1. - * \param EquationID (In) : ID of the equation that will be used to print the - * stencil (default = 0) - */ - int PrintStencil2D(const int nx, const int ny, - int NodeID = -1, - const int EquationID = 0); - - //! Cheap analysis of each level matrix. - int AnalyzeHierarchy(const bool AnalyzeMatrices, - const int PreCycles, const int PostCycles, - const int MLCycles); - - //! Analyze the effect of each level's smoother on a random vector. - int AnalyzeSmoothers(const int NumPreCycles = 1, - const int NumPostCycles = 1); - - //! Analyze the effect of the coarse solver on a random vector. - int AnalyzeCoarse(); - - //! Analyze the effect of the ML cycle on a random vector. - int AnalyzeCycle(const int NumCycles = 1); - - //! Test several smoothers on fine-level matrix. - int TestSmoothers(Teuchos::ParameterList& InputList, - const bool IsSymmetric = false); - - //! Test several smoothers on fine-level matrix using the current parameters. - int TestSmoothers(const bool IsSymmetric = false) { - return(TestSmoothers(List_,IsSymmetric)); - } - - //! Returns a pointer to the internally stored ml pointer - const ML* GetML(const int WhichML= -1) const - { - if (WhichML < 0) - return ml_; - else if (WhichML == 0) - return ml_nodes_; - else - return(0); - } - - bool SolvingMaxwell() const - { - return SolvingMaxwell_; - } - - //! Returns a pointer to the internally stored agg pointer - const ML_Aggregate* GetML_Aggregate() const - { - return agg_; - } - - //! Generic interface to visualization methods. - int Visualize(bool VizAggre, bool VizPreSmoother, - bool VizPostSmoother, bool VizCycle, - int NumApplPreSmoother, int NumApplPostSmoother, - int NumCycleSmoother); - - //! Visualizes the shape of the aggregates. - int VisualizeAggregates(); - - //! Visualizes the effect of smoothers on a random vector. - int VisualizeSmoothers(int NumPrecCycles = 1, - int NumPostCycles = 1); - - //! Visualizes the effect of the ML cycle on a random vector. - int VisualizeCycle(int NumCycles = 1); - -//@} - -private: - - //! Copy constructor (NOT DEFINED) - MultiLevelPreconditioner(const MultiLevelPreconditioner & rhs) - {}; - - //! operator = (NOT DEFINED) - MultiLevelPreconditioner & operator = (const MultiLevelPreconditioner & rhs) - { - return *this; - }; - - //@{ \name Internal setting functions - //! Initializes object with defauls values. - int Initialize(); - - //! Sets smoothers for non-Maxwell equations. - int SetSmoothers(); - - //! Sets smoothers for Maxwell equations. - int SetSmoothersMaxwell(); - - //! Sets coarse level solvers. - int SetCoarse(); - - //! Sets aggregation schemes. - int SetAggregation(); - - //! Sets preconditioner type (usually, V-cycle). - int SetPreconditioner(); - - //! Sets the null space for non-Maxwell problems. - int SetNullSpace(); - - //! Sets the null space for Maxwell equations. - int SetNullSpaceMaxwell(); - - //! Sets prolongator smoother parameters. - int SetSmoothingDamping(); - - //! Sets damping parameter for classical smoothed aggregation. - int SetSmoothingDampingClassic(); - - //! Creates label for this object (printed out by AztecOO) - int CreateLabel(); - -#define OLD_AUX -#ifdef OLD_AUX - int CreateAuxiliaryMatrixCrs(Epetra_FECrsMatrix * & FakeMatrix); - - int CreateAuxiliaryMatrixVbr(Epetra_VbrMatrix * & FakeMatrix); -#endif - - int SetupCoordinates(); - - void PrintMem(char *fmt, int size, int, int); - - void PrintMemoryUsage(); - - int SetFiltering(); - - void RandomAndZero(double *, double *, int); - - //! Checks whether the previously computed preconditioner is still valuable for the newly available linear system. - /*! Used only when \c "adaptive: enable" is \c true, and - * ComputePreconditioner(true) is called. */ - bool CheckPreconditionerKrylov(); - - void VectorNorms(double*, int, double*,double*); - - //@} - - //@{ \name Internal data - - //! Pointer to ML_Struct - ML* ml_; - //! ML communicator, convenient to have separately from ml_, - // ml_nodes_, one or all of which may be null. - ML_Comm* ml_comm_; - //! ML_Aggregate, contains aggregate information - ML_Aggregate* agg_; - //! Label for this object - char* Label_; - - //! pointer to linear system matrix - const Epetra_RowMatrix* RowMatrix_; - //! specifies whether a hierarchy already exists or not. - bool IsComputePreconditionerOK_; - - //! Number of levels - int NumLevels_; - //! Domain Map - const Epetra_Map* DomainMap_; - //! Range Map - const Epetra_Map* RangeMap_; - //! Epetra communicator object - const Epetra_Comm* Comm_; - bool ownership_; - //! proc_config for Aztec smoothers - int ProcConfig_[AZ_PROC_SIZE]; - //! options for Aztec smoothers - int SmootherOptions_[AZ_OPTIONS_SIZE]; - //! params for Aztec smoothers - double SmootherParams_[AZ_PARAMS_SIZE]; - //! status for Aztec smoothers - double SmootherStatus_[AZ_STATUS_SIZE]; - - //! List containing all input parameters. - Teuchos::ParameterList List_; - //! List containing all output parameters - Teuchos::ParameterList OutputList_; - - //! Maximum number of levels - int MaxLevels_; - - //! Number of applications of the ML cycle - int CycleApplications_; - - //! If \c true, zero starting solution is used in the application of the cycle. - bool ZeroStartingSolution_; - - //! Integer array used to easily handle ML_INCREASING and ML_DECREASING - /*! Integer array, of size MaxLevels_, that contain the ML level ID - for the first logical level, and so on for all levels. The ML level ID - of logical level L is LevelID_[L]. - In this interface, all levels move from 0 to MaxLevels-1. - ML's level for interface's level i is LevelID_[i] - */ - vector LevelID_; - - //! If not NULL, contains the allocated null space vector - double* NullSpaceToFree_; - - //! all cout's have this prefix (default'd in Initialize() ) - string PrintMsg_; - //! all cerr's have this prefix (default'd in Initialize() ) - char ErrorMsg_[80]; - //! true of information has to be printed on this process - bool verbose_; - //! Number of PDE equations. - int NumPDEEqns_; - - //@} - - //@{ \name Maxwell variables - - //! true if Maxwell equations are used - bool SolvingMaxwell_; - //! Main matrix for Maxwell - const Epetra_RowMatrix* EdgeMatrix_; - //! aux matrix for Maxwell - const Epetra_RowMatrix* NodeMatrix_; - bool CreatedNodeMatrix_; - //! Auxiliary matrix used in intermediate step - ML_Operator* ML_Kn_; - bool CreatedML_Kn_; - //! T matrix for Maxwell - const Epetra_RowMatrix* TMatrix_; - bool CreatedTMatrix_; - ML_Operator* TMatrixML_; - ML_Operator* TMatrixTransposeML_; - ML_Operator** Tmat_array, ** Tmat_trans_array; - //! ML structures for Maxwell - ML* ml_nodes_; - - void** nodal_args_,** edge_args_; - - //@} - - //@{ \name Variables for Timing - //! Number of applications - int NumApplications_; - //! CPU time for all applications of the preconditioner - double ApplicationTime_; - bool FirstApplication_; - //@ CPU time for first application - double FirstApplicationTime_; - //! Number of construction phases - int NumConstructions_; - //! CPU time for construction of the preconditioner. - double ConstructionTime_; - - //@} - - // other stuff for old ML's compatibility - Epetra_CrsMatrix* RowMatrixAllocated_; - - bool AnalyzeMemory_; - - int memory_[ML_MEM_SIZE]; - - // filtering stuff - vector flt_NullSpace_; - ML* flt_ml_; - ML_Aggregate* flt_agg_; - - // for reuse of preconditioning - double RateOfConvergence_; - -}; // class MultiLevelPreconditioner - -} // namespace ML_Epetra - -#endif /* defined HAVE_ML_EPETRA and HAVE_ML_TEUCHOS */ - -#endif /* define ML_MULTILEVELPRECONDITIONER_H */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_operatoragx.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_operatoragx.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_operatoragx.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_operatoragx.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,106 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Data structure to hold the grid transfer operator. */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : April, 1998 */ -/* ******************************************************************** */ - -#ifndef _MLOPERATORAGX_ -#define _MLOPERATORAGX_ - -/* ******************************************************************** */ -/* these include are for (1) memory allocation, (2) communication */ -/* buffer access, and (3) communication (recv, send) */ -/* -------------------------------------------------------------------- */ - -#include "ml_common.h" -#include "ml_memory.h" -#include "ml_comm.h" -#include "ml_comminfoagx.h" -#include "ml_struct.h" - -/* ******************************************************************** */ -/* Nlocal_rows, local_ia, local_ja, local_a : */ -/* variables and arrays (in CSR format) to store local operator */ -/* Nremote_rows, remote_ia, remote_ja, remote_a : */ -/* variables and arrays (in CSR format) to store remote operator */ -/* restrict_wgts : normalization factors for restriction */ -/* ext arrays : for temporary storage of interprocessor data */ -/* node_flag : for registering already processed fine nodes */ -/* com : processor communication pattern */ -/* -------------------------------------------------------------------- */ - -typedef struct ML_OperatorAGX_Struct -{ - int ML_id; - int proc_id, num_procs, step; - int Nlocal_rows, *local_ia, *local_ja; - int Nremote_rows, *remote_ia, *remote_ja; - double *local_a, *remote_a, *restrict_wgts, *remote_restrict_wgts; - int ext_cnt, *ext_ia, *ext_ja; - int ext2_cnt, *ext2_ptr, *ext2_index; - double *ext_a, *ext2_a; - int *fnode_flag, fnode_leng; - int *coarse_bdry_list, coarse_bdry_leng; - int AGX_stride; - ML_Comm *AGX_comm; - ML_CommInfoAGX *com; - -} ML_OperatorAGX; - - -/* ******************************************************************** */ -/* functions to manipulate the Operator structure */ -/* -------------------------------------------------------------------- */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif - -extern int ML_OperatorAGX_Clean_Getrows(ML_Operator **); -extern int ML_OperatorAGX_Create(ML_OperatorAGX **); -extern void ML_Operator2AGX_Destroy(void *); -extern int ML_OperatorAGX_Destroy(ML_OperatorAGX **); -extern int ML_OperatorAGX_Print(ML_OperatorAGX *); -extern int ML_OperatorAGX_Restrict(ML_Operator *,int,double *,int,double*); -extern int ML_OperatorAGX_Prolongate(ML_Operator *,int,double*,int,double*); -extern int ML_OperatorAGX_Getrows(ML_Operator *data, int N_requested_rows, - int requested_rows[], int allocated_space, int columns[], - double values[], int row_lengths[]); -extern int ML_OperatorAGX_Getcols(ML_Operator *data, int N_requested_rows, - int requested_rows[], int allocated_space, int columns[], - double values[], int row_lengths[]); -extern int ML_OperatorAGX_Gen_ComminfoOp(ML_OperatorAGX *vop, ML_Operator *Rmat, - ML_Operator *Pmat); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_operator_blockmat.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_operator_blockmat.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_operator_blockmat.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_operator_blockmat.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -#ifndef __MLOPERATOR_BLOCKMAT__ -#define __MLOPERATOR_BLOCKMAT__ - -#include "ml_common.h" -#include "ml_operator.h" -/*****************************************************************************/ -/* structure to wrap ML subblock matrices into a large ML matrix. */ -/*****************************************************************************/ - -struct ML_Operator_blockmat_data { - /* Ke functions for matvec & getrow */ - - int (*Ke_matvec)(ML_Operator *, int, double *, int, double *); - int (*Ke_getrow)(ML_Operator *,int,int*,int,int*,double*,int*); - void *Ke_matvec_data, *Ke_getrow_data, *Ke_comm_data; - double *Ke_diag; - - /* M functions for matvec, getrow. NOTE: it is assumed */ - /* that M's communication is identical to Ke's. */ - - int (*M_matvec)(ML_Operator *, int, double *, int, double *); - int (*M_getrow)(ML_Operator *,int,int*,int,int*,double*,int*); - void *M_matvec_data, *M_getrow_data; - double *M_diag; - ML_Operator *M_mat; - ML_Operator *Ke_mat; - int destroy_M_mat; - - int N_Ke, Nghost; - int *cols; /* work vectors for block matrix getrow */ - double *vals; -}; - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -extern int ML_Operator_blockmat_matvec(ML_Operator *, int , double *, int, double *); -extern int ML_Operator_blockmat_comm( double *x, void *data); -extern int ML_Operator_blockmat_getrow(ML_Operator *, int, int *, int, int *, - double *, int *); -extern int ML_Operator_Gen_blockmat(ML_Operator *blockmat, - ML_Operator *original1, - ML_Operator *original2); -extern void ML_Operator_blockmatdata_Destroy(void *data); -extern int ML_Operator_blockmat_set_M_mat_destroy(ML_Operator *blockmat, - int yes_or_no); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - - -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_operator.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_operator.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_operator.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_operator.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,346 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the ML_Operator structure */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : March, 1999 */ -/* ******************************************************************** */ - -#ifndef __MLOPERATOR__ -#define __MLOPERATOR__ - -/* ******************************************************************** */ -/* data structure type definition */ -/* ******************************************************************** */ - -typedef struct ML_Operator_Subspace_Struct ML_Operator_Subspace; -typedef struct ML_Operator_Struct ML_Operator; -typedef struct ML_Function_Struct ML_Function; -typedef struct ML_GetrowFunc_Struct ML_GetrowFunc; - -/* ******************************************************************** */ -/* local include files */ -/* ******************************************************************** */ - -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_memory.h" -#include "ml_bdrypts.h" -#include "ml_1level.h" -#include "ml_operatoragx.h" -#include "ml_vec.h" -#include "ml_gridagx.h" - -#ifdef WKC -#include -#include -#endif - -/* -------------------------------------------------------------------- */ -/* data structure used to store pointers to functions such as matvec - used by the operator class. */ -/* -------------------------------------------------------------------- */ - -struct ML_Function_Struct { - int ML_id; - int Nrows; - int (*func_ptr)(ML_Operator *, int, double *, int, double *); -}; - -/* -------------------------------------------------------------------- */ -/* This data structure stores all information pertaining to performing - the Getrow function on an operator object. */ -/* -------------------------------------------------------------------- */ - -struct ML_GetrowFunc_Struct { - int ML_id; - int Nrows; - ML_CommInfoOP *pre_comm; - ML_CommInfoOP *post_comm; - int (*func_ptr)(ML_Operator *,int,int*,int,int*,double*,int*); - void *data; - int use_loc_glob_map; - int *loc_glob_map; - int *row_map; -}; - -/* -------------------------------------------------------------------- */ -/* This data structure stores all information necessary to be able to - project out a subspace (e.g., a known nullspace). */ -/* -------------------------------------------------------------------- */ - -struct ML_Operator_Subspace_Struct { - double **basis_vectors; - int dimension; /** number of basis vectors */ - int vecleng; /** length of basis vectors */ - void (*data_destroy)(void *); - double *VAV; /** dimension by dimension system to solve */ - int *pivots; /** pivots for VAV factorization */ - int VAVdone; /** true if VAV is calculated already */ - double *res1,*res2,*vec1,*vec2; /* work vectors */ -}; - -typedef struct { - double threshold; - int (*aux_func_ptr)(ML_Operator *,int,int*,int,int*,double*,int*); - int enable; - int max_level; - int** filter; - int filter_size; -} ML_Aux_Data; - -void ML_Aux_Data_Create(ML_Aux_Data** ptr); - -void ML_Aux_Data_Destroy(ML_Aux_Data** ptr); - -ML_Aux_Data* ML_Aux_Data_Clone(ML_Aux_Data* original); - -/* -------------------------------------------------------------------- */ -/** This data structure defines an enriched operator class for the - specification of the discretization matrix, the restriction and the - prolongation operator. */ -/* -------------------------------------------------------------------- */ - -struct ML_Operator_Struct { - int ML_id; - ML_Comm *comm; - ML_1Level *to, *from; - int invec_leng, outvec_leng; - void *data; - void (*data_destroy)(void *); - ML_Function *matvec; - ML_GetrowFunc *getrow; - ML_DVector *diagonal; /** diagonal of matrix. */ - int N_nonzeros; - int max_nz_per_row; - int from_an_ml_operator; - ML_Operator *sub_matrix; - ML_BdryPts *bc; - double build_time, apply_time; - double apply_without_comm_time; - int ntimes, nflop; - char *label; - int num_PDEs, num_rigid; - double lambda_max, lambda_min, lambda_max_img; - int N_total_cols_est; - int halfclone; - ML_Operator_Subspace *subspace; - /* This is just a hook into modes that we want to project out - before (after) invoking a MG cycle. I couldn't think of - a more appropriate spot for these, especially as they need - to be available when ML is used as a preconditioner to a - Krylov method. */ - ML_Aux_Data *aux_data; - /*!< General container for auxiliary matrix */ -}; - - -/* -------------------------------------------------------------------- */ -/* This structure is used to implement both drop tolerances and matrix - amalgamation (used in ML_aggregateCoarsenMIS()). The idea is to wrap - the getrow() of the original matrix such that it handles the blocking - and the dropping. */ -/* -------------------------------------------------------------------- */ - -struct amalg_drop { - void *original_data; - struct ML_GetrowFunc_Struct *original_getrow; - double *scaled_diag; - int block_size; - double drop_tolerance; - ML_Operator *Amat; - int *blk_inds; - /* used by ML_Operator_AmalgamateAndDropWeak_VBlocks */ - void *vblock_data; /**< holds data structure aggr_vblock */ -}; - -/* -------------------------------------------------------------------- */ -/* This structure is used to implicitly scale a matrix. The idea is to wrap - the getrow() of the original matrix such that it handles the blocking - and the dropping. */ -/* -------------------------------------------------------------------- */ - -struct ml_matscale { - ML_Operator *Amat; - double scalar; - int destroy_child; -}; - -/* -------------------------------------------------------------------- */ -/* This structure is used to implicitly scale a matrix with a vector. * - * It extends ml_matscale. */ -/* -------------------------------------------------------------------- */ - -struct ml_matvscale { - ML_Operator *Amat; - double* scale; - int destroy_child; -}; - -/* ******************************************************************** */ -/* ******************************************************************** */ -/* User Interface Proto-types */ -/* ******************************************************************** */ -/* ******************************************************************** */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -extern int ML_Operator_BlockPartition(ML_Operator *matrix, int n, int *nblks, - int *pnode_part, ML_Partitioner which_partitioner, - double *x_coord, double *y_coord, double *z_coord); - -extern ML_Operator *ML_Operator_Create(ML_Comm *comm); -extern int ML_Operator_Destroy(ML_Operator **); - -extern ML_Operator *ML_Operator_halfClone( ML_Operator *original); -extern int ML_Operator_halfClone_Init(ML_Operator *mat, - ML_Operator *original); - -extern int ML_Operator_halfClone_Clean( ML_Operator *mat); -extern int ML_Operator_halfClone_Destroy( ML_Operator **mat); - - -extern int ML_Operator_Init(ML_Operator *, ML_Comm *comm); -extern int ML_Operator_Clean(ML_Operator *); -extern int ML_Operator_Dump(ML_Operator *Ke, double *, double *, - char *str, int); -extern int ML_hash_init(int hash_list[], int hash_length, int *hash_used); -extern int ML_hash_it( int new_val, int hash_list[], int hash_length, - int *hash_used); - -extern int ML_Operator_Set_Label(ML_Operator *, char *str); -extern int ML_Operator_Set_1Levels(ML_Operator *, ML_1Level*, ML_1Level*); -extern int ML_Operator_Set_BdryPts(ML_Operator *, ML_BdryPts *); -extern int ML_Operator_Set_ApplyFuncData(ML_Operator *, int, int, void*, - int,int (*func)(ML_Operator *,int,double*,int,double*),int); -extern int ML_Operator_Set_ApplyFunc(ML_Operator *, - int (*func)(ML_Operator *, int, double *, int, double *)); -extern int ML_Operator_Set_Diag(ML_Operator *, int, double *); -extern int ML_Operator_Set_Getrow(ML_Operator *, int, - int (*func)(ML_Operator *,int,int*,int,int*,double*,int*)); - -extern int ML_Operator_Getrow(ML_Operator *, int, int *, int, int *, - double *, int*); -extern int ML_Operator_Get_Diag(ML_Operator *Amat, int length, double **diag); - -extern int ML_Operator_Apply(ML_Operator *, int, double *, int, double *); - -#ifdef WKC -/* WKC -- ADDED HEADER */ -extern int ML_Operator_Apply(ML_Operator *, int, Epetra_MultiVector &, - int, Epetra_MultiVector & ); -#endif - - -extern int ML_Operator_ApplyAndResetBdryPts(ML_Operator *, int, double *, - int olen, double *); -extern int ML_Operator_Add(ML_Operator *A, ML_Operator *B, ML_Operator *C, - int matrix_type, double scalar); -#ifdef WKC -/* WKC -- ADDED HEADER */ -extern int ML_Operator_ApplyAndResetBdryPts(ML_Operator *, int, - Epetra_MultiVector &, int olen, Epetra_MultiVector &); -#endif -extern int ML_Operator_MoveFromHierarchyAndClean(ML_Operator *newmat, - ML_Operator *hier); - -extern int ML_Operator_Move2HierarchyAndDestroy(ML_Operator **newmat, - ML_Operator *hier); - -extern int ML_Operator_Transpose(ML_Operator *Amat, ML_Operator *Amat_trans ); - -extern int ML_Operator_Check_Getrow(ML_Operator *, int, char*); -extern double ML_Operator_MaxNorm(ML_Operator *matrix, int divide_diag); -extern int ML_Operator_Print(ML_Operator *matrix, const char label[]); -extern int ML_Operator_ComputeNumNzs(ML_Operator *matrix); -/* Operator Scaling */ -extern int ML_implicitscale_Getrow(ML_Operator *data, int N_requested_rows, - int requested_rows[], int allocated_space, - int columns[], double values[], - int row_lengths[]); -extern int ML_implicitscale_Matvec(ML_Operator *Amat_in, int ilen, double p[], - int olen, double ap[]); -extern ML_Operator *ML_Operator_ImplicitlyScale(ML_Operator *Amat, - double scalar, - int OnDestroy_FreeChild); -extern void ML_implicitscale_Destroy(void *data); -/* Operator Scaling with a vector */ -extern int ML_implicitvscale_Getrow(ML_Operator *data, int N_requested_rows, - int requested_rows[], int allocated_space, - int columns[], double values[], - int row_lengths[]); -extern int ML_implicitvscale_Matvec(ML_Operator *Amat_in, int ilen, double p[], - int olen, double ap[]); -extern ML_Operator *ML_Operator_ImplicitlyVScale(ML_Operator *Amat, - double* scale, - int OnDestroy_FreeChild); -extern void ML_implicitvscale_Destroy(void *data); -extern int ML_implicitvcscale_Getrow(ML_Operator *data, int N_requested_rows, - int requested_rows[], int allocated_space, - int columns[], double values[], - int row_lengths[]); -extern ML_Operator *ML_Operator_ImplicitlyVCScale(ML_Operator *Amat, - double* scale, - int OnDestroy_FreeChild); -/* amalagamation routines */ -extern int ML_Operator_AmalgamateAndDropWeak(ML_Operator *Amat, int block_size, - double drop_tolerance); - -extern int ML_Operator_UnAmalgamateAndDropWeak(ML_Operator *Amat, - int block_size, double drop_tolerance); - -extern int ML_amalg_drop_getrow(ML_Operator *data, int N_requested_rows, - int requested_rows[], int allocated_space, int columns[], - double values[], int row_lengths[]); - -extern int ML_Operator_GetDistributedDiagBlocks(ML_Operator *mat, int *blkinfo, - int **new_ja, double **new_aa); - -extern double ML_Operator_GetMaxEig(ML_Operator *Amat); - -extern ML_Operator **ML_Operator_ArrayCreate( int length); -extern int ML_Operator_ArrayDestroy( ML_Operator **array, int length); -extern int ML_Operator_SetSubspace(ML *ml, double **vectors, int numvecs, - int vecleng); -extern int ML_Operator_Amalgamate_Vec_Trans(ML_Operator *Amat, int *blocked, - int **unblocked, int *size); - /* define this here so we don't have to include ml_aztec_utils.h */ - /* in ml_struct.c and ml_smoother.c */ -int ML_Operator_GetFlops(ML_Operator *mat); -void ML_Operator_GetGlobalDimensions(ML_Operator *A,int *nrows,int *ncols); - - -#ifdef ML_WITH_EPETRA -extern int ML_Epetra_CRSinsert(ML_Operator *, int, int *, double *, int); -#endif - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_op_utils.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_op_utils.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_op_utils.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_op_utils.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,95 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the New stuff */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : March, 1999 */ -/* ******************************************************************** */ - -#ifndef __MLMATRIX__ -#define __MLMATRIX__ - -#include "ml_common.h" - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - - -extern int oldML_Mdfy_Prolongator_DirBdry(ML *, int , double *, double *); -extern int ML_Compute_Coarse_Bdry(ML *ml_handle, int level, int size, - int fine_size); -extern int ML_Mdfy_Prolongator_DirBdry(ML *ml_handle, int level2, int size, - int fine_size ); - -extern ML_Operator *ML_Operator_ExplicitlyScale(ML_Operator *matrix, - double scalar); - -extern int ML_Operator_ChangeToSinglePrecision(ML_Operator *matrix); -extern int ML_Operator_ChangeToChar(ML_Operator *matrix); -extern int ML_Operator_ImplicitTranspose(ML_Operator *Rmat, - ML_Operator *Pmat, - int PostCommAlreadySet); -extern int ML_Gen_Restrictor_TransP(ML *, int, int); -extern int ML_Gen_Prolongator_Getrow(ML *, int , int , int , int , - int (*)(void* , int , int *, int , int *, double *, int *), - int (*)(double *, void*), void *data, int); - /* -extern int ML_Operator_Transpose(ML_Operator *Amat, ML_Operator *Amat_trans ); - */ -extern int ML_Operator_ColPartition2RowPartition(ML_Operator *A, ML_Operator *Atrans); -extern int eye_getrows(ML_Operator *data, int N_requested_rows, int requested_rows[], - int allocated_space, int columns[], double values[], - int row_lengths[]); -extern int eye_matvec(ML_Operator *Amat_in, int ilen, double p[], int olen, double ap[]); -extern int ML_Operator_Transpose_byrow(ML_Operator *A, ML_Operator *Atrans); -extern int ML_Operator_Getrow_Diag(ML_Operator *Amat, double **diagonal); -extern int ML_build_overlapped_pre_comm(ML_Operator *tempA, ML_CommInfoOP - *old_comm, int max_per_proc, - int *hash_list, int hash_length, - int *hash_used, int old_Nrows, - int *Nexternal, int *external[], - int *Nexternal_allocated); -extern int ML_Operator_HashGlobalRcvList(ML_CommInfoOP *pre_comm, int Nrows, - int hash_list[], int hash_length, - int *hash_used, int Gid_assigned_to_proc[], - ML_Comm *comm, - int *Nexternal, int **external, - int *Nexternal_allocated); -extern int ML_overlap(ML_Operator *oldA, ML_Operator *newA, int overlap, - ML_CommInfoOP **nonOverlapped_2_Overlapped); -extern void ML_Operator_ReportStatistics(ML_Operator *mat, char *appendlabel, - int perfAndCommStats); -extern void ML_Operator_Profile(ML_Operator *A, char *appendlabel, int numits); -extern void ML_Operator_Profile_SetIterations(int numits); -extern int ML_Operator_Profile_GetIterations(); -extern int ML_Operator_Get_Nnz(ML_Operator *A); - -#ifndef ML_CPP -#ifdef __cplusplus - } -#endif -#endif - -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_pde.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_pde.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_pde.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_pde.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the ML_PDE functions */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) */ -/* Date : February, 2000 */ -/* ******************************************************************** */ - -#ifndef _MLPDE__ -#define _MLPDE__ - -#include "ml_common.h" -#include "mli_solver.h" - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -extern int ML_PDE_GenMat(MLI_Solver*,int); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_qr_fix.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_qr_fix.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_qr_fix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_qr_fix.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#ifndef ML_QR_FIX_H -#define ML_QR_FIX_H - -/* If we need more than 16 kernel components, define ML_QR_FIX_TYPE - * as unsigned int, otherwise use unsigned short int to conserve memory */ -#define ML_QR_FIX_TYPE unsigned int - -typedef struct ML_qr_fix { - - int level; - int numDeadNodDof; - /* -mb: can later replace the following two with a hash structure */ - int nDeadNodDof; - ML_QR_FIX_TYPE *xDeadNodDof; - -} ML_qr_fix; - -#ifdef __cplusplus -extern "C" { - int ML_qr_fix_Create(const int nCoarseNod); - - int ML_qr_fix_Destroy(void); - - int ML_qr_fix_Print(ML_qr_fix* ptr); - - int ML_qr_fix_NumDeadNodDof(void); - - ML_QR_FIX_TYPE ML_qr_fix_getDeadNod(const int inx); - - void ML_qr_fix_setNumDeadNod(int num); - - void ML_qr_fix_setDeadNod( const int inx, ML_QR_FIX_TYPE val); - - int ML_fixCoarseMtx( - ML_Operator *Cmat, /*-up- coarse operator in MSR format */ - const int CoarseMtxType /*-in- coarse-lev mtx storage type */ - ); - - int ML_qr_fix_Bitsize(void); -} -#else - -int ML_qr_fix_Create(const int nCoarseNod); - -int ML_qr_fix_Destroy(void); - -int ML_qr_fix_Print(ML_qr_fix* ptr); - -int ML_qr_fix_NumDeadNodDof(void); - -ML_QR_FIX_TYPE ML_qr_fix_getDeadNod(const int inx); - -void ML_qr_fix_setNumDeadNod(int num); - -void ML_qr_fix_setDeadNod( const int inx, ML_QR_FIX_TYPE val); - -int ML_fixCoarseMtx( - ML_Operator *Cmat, /*-up- coarse operator in MSR format */ - const int CoarseMtxType /*-in- coarse-lev mtx storage type */ - ); - -int ML_qr_fix_Bitsize(void); - -#endif -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_rap.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_rap.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_rap.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_rap.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,141 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the ML RAP data structure */ -/* ******************************************************************** */ -/* Author : Raymond Tuminaro (SNL) */ -/* Date : February, 1999 */ -/* ******************************************************************** */ - -#ifndef _MLRAP_ -#define _MLRAP_ - -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_struct.h" -#include "ml_comminfoagx.h" - -/* ******************************************************************** */ -/* external function proto-types */ -/* -------------------------------------------------------------------- */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -extern void ML_convert_data_org(ML_Operator *mat, int d_org[], int *rcv, - int *remap, int leng, int add_or_not); - -extern void ML_add_appended_rows(ML_CommInfoOP *comm_info, - ML_Operator *matrix, int orig_rows, - int total_rcvd, int appended_nzs); - -extern void ML_back_to_local(ML_Operator *imatrix, ML_Operator *omatrix, - int max_per_proc); - -extern void ML_back_to_csrlocal(ML_Operator *imatrix, ML_Operator *omatrix, - int max_per_proccomm); - -extern int ML_back_to_epetraCrs(ML_Operator *Mat1Mat2, ML_Operator *Result, - ML_Operator *Mat1, ML_Operator *Mat2); - /* code is in ml_epetra_utils.h. Put the */ - /* proto-type here to avoid c++ compiler on ml_rap.c */ - - -extern void ML_exchange_rows(ML_Operator *orig, ML_Operator **appended, - ML_CommInfoOP *comm_info); - -extern void ML_expand_accum(int accum_size, int **accum_col, - double **accum_val, int Ncols); - -extern void ML_get_matrix_row(ML_Operator *input_matrix,int N_requested_rows, - int requested_rows[], int *allocated_space, - int **columns, double **values, - int row_lengths[], int index); - -extern void ML_globalcsr2localcsr(ML_Operator *imatrix, int max_per_proc); - -extern void ML_matmat_mult(ML_Operator *Amat, ML_Operator *Bmat, - ML_Operator **Cmat); -extern void ML_2matmult(ML_Operator *Mat1, ML_Operator *Mat2, - ML_Operator *Result, int matrix_type); - -extern void ML_oldmatmat_mult(ML_Operator *Amatrix, ML_Operator *Bmatrix, - ML_Operator **Cmatrix); -extern void ML_get_matrow_CSR(ML_Operator *input_matrix, int N_requested_rows, - int requested_rows[], int *allocated_space, int **columns, - double **values, int row_lengths[], int index); -extern void ML_get_row_CSR_norow_map(ML_Operator *input_matrix, - int N_requested_rows, int requested_rows[], int *allocated_space, - int **columns, double **values, int row_lengths[], int index); - -extern void ML_getrow_matvec(ML_Operator *matrix, double *vec, - int Nvec, double *ovec, int *Novec); - -extern void ML_rap(ML_Operator *R2mat, ML_Operator *A2mat, - ML_Operator *P2mat, ML_Operator *Result, - int matrix_type); - -extern void ML_rap_check(ML *ml, ML_Operator *RAP, ML_Operator *R, - ML_Operator *A, ML_Operator *P, int iNvec, - int oNvec); - -extern void ML_CommInfoOP_GenUsingGIDExternals(int N_external, int external[], - int max_per_proc, ML_Operator *omatrix); - -extern void ML_sum_duplicates(int accum_col[],double accum_val[],int *Ncols); - -extern int ML_determine_Brows(int start, int *end, ML_Operator *Amatrix, - int *rows[], int *rows_length, int *NBrows, - int *rows_that_fit, - void (*Agetrow)(ML_Operator *,int,int *,int *,int **, - double **,int *,int)); - - - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#define ML_matrix_type 0 -#define ML_N_internal 1 -#define ML_N_border 2 -#define ML_N_external 3 -#define ML_N_int_blk 4 -#define ML_N_bord_blk 5 -#define ML_N_ext_blk 6 -#define ML_N_neigh 7 -#define ML_total_send 8 -#define ML_name 9 -#define ML_internal_use 10 -#define ML_N_rows 11 -#define ML_neighbors 12 -#define ML_rec_length (12 + ML_MAX_NEIGHBORS) -#define ML_send_length (12 + 2*ML_MAX_NEIGHBORS) -#define ML_send_list (12 + 3*ML_MAX_NEIGHBORS) -#define ML_FALSE 0 -#define ML_TRUE 1 - -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_rbm.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_rbm.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_rbm.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_rbm.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Miscellaneous functions for efficient searching and sorting */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : September, 1998 */ -/* ******************************************************************** */ - -#ifndef __MLRBMH__ -#define __MLRBMH__ - -#include "ml_common.h" - -#ifndef ML_CPP -#ifdef __cplusplus - extern "C" { -#endif -#endif - - - int ML_Coord2RBM(int Nnodes, double x[], double y[], double z[], - double rbm[], int Ndof); - - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_read_utils.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_read_utils.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_read_utils.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_read_utils.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - - -#ifndef _MLREADER_ -#define _MLREADER_ - -#include -#include "ml_common.h" -#include "ml_memory.h" - -struct reader_context { - int id; - int N_levels, nsmooth, maxcoarsesize, coarse_its; - int max_outer_its; - int N_dofPerNode; - double agg_thresh; - char smoother[80], agg_coarsen_scheme[80], coarse_solve[80], krylov[80]; - char partition_file[80]; - int output, output_level; - double tol, agg_damping; - char agg_spectral_norm[80]; - char subsmoother[80]; - char cycle[80]; -}; - -#define MAX_INPUT_STR_LN 101 -#define MAX_TOKENS 50 - - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif - -extern void ML_Reader_GetGeneralSpecs(FILE *ifp, - struct reader_context *context); -extern int ML_Reader_LookFor(FILE *ifp, char *string, char input[], - int ch_term); -extern int ML_Reader_ReadString(FILE *ifp, char string[], int); -extern void ML_Reader_Strip(char string[]); -extern void ML_Reader_GetSolutionSpecs(FILE *ifp, - struct reader_context *context); -extern void ML_Reader_GetAggregationSpecs(FILE *ifp, - struct reader_context *context); -extern void ML_Reader_InitContext(struct reader_context *context); -extern void ML_Reader_ReadInput(char *cmd_file_name, - struct reader_context **context); - -extern int ML_strcmp(char *input, char *string); - - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - - -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_RowMatrix.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_RowMatrix.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_RowMatrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_RowMatrix.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,385 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#ifndef ML_ROWMATRIX_H -#define ML_ROWMATRIX_H - -/*! \file ml_RowMatrix.h - * \brief Wrapper from ML_Operator to Epetra_RowMatrix - */ - -#include "ml_include.h" - -#if defined(HAVE_ML_EPETRA) - -#include -#ifdef HAVE_MPI -#include "Epetra_MpiComm.h" -#else -#include "Epetra_SerialComm.h" -#endif -#include "ml_epetra.h" -#include "Epetra_Operator.h" -class Epetra_MultiVector; -#include "Epetra_RowMatrix.h" -#include "Epetra_BlockMap.h" -#include "Epetra_Map.h" - -class Epetra_Vector; -class Epetra_Importer; - -namespace ML_Epetra { - -/*! - * \class RowMatrix - * - * \brief Basic wrappere fromo ML_Operator to Epetra_RowMatrix. - * - * \author Marzio Sala, SNL 9214. - * - * \date Last updated on 15-Mar-05. - */ - -class RowMatrix : public virtual Epetra_RowMatrix { - - public: - //@{ \name Constructor. - //! Constructor, constructs Comm object if not provided - RowMatrix(ML_Operator* Op, const Epetra_Comm* Comm = 0, - const bool cheap = false, const USR_COMM = -#ifdef HAVE_MPI - MPI_COMM_WORLD -#else - 0 -#endif - ); - - //@} - //@{ \name Destructor. - //! Destructor - virtual ~RowMatrix(); - - //@} - - //@{ \name Matrix data extraction routines - - //! Returns the number of nonzero entries in MyRow. - /*! - \param In - MyRow - Local row. - \param Out - NumEntries - Number of nonzero values present. - - \return Integer error code, set to 0 if successful. - */ - virtual int NumMyRowEntries(int MyRow, int & NumEntries) const; - - - //! Returns the maximum of NumMyRowEntries() over all rows. - virtual int MaxNumEntries() const; - - //! Returns a copy of the specified local row in user-provided arrays. - /*! - \param In - MyRow - Local row to extract. - \param In - Length - Length of Values and Indices. - \param Out - NumEntries - Number of nonzero entries extracted. - \param Out - Values - Extracted values for this row. - \param Out - Indices - Extracted global column indices for the corresponding values. - - \return Integer error code, set to 0 if successful. - */ - virtual int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const; - - //! Returns a copy of the main diagonal in a user-provided vector. - /*! - \param Out - Diagonal - Extracted main diagonal. - - \return Integer error code, set to 0 if successful. - */ - virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const; - //@} - - //@{ \name Mathematical functions. - - //! Returns the result of a Epetra_RowMatrix multiplied by a Epetra_MultiVector X in Y. - /*! - \param In - TransA -If true, multiply by the transpose of matrix, otherwise just use matrix. - \param In - X - A Epetra_MultiVector of dimension NumVectors to multiply with matrix. - \param Out - Y -A Epetra_MultiVector of dimension NumVectorscontaining result. - - \return Integer error code, set to 0 if successful. - */ - virtual int Multiply(bool TransA, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const; - - //! Returns result of a local-only solve using a triangular Epetra_RowMatrix with Epetra_MultiVectors X and Y. - /*! This method will perform a triangular solve independently on each processor of the parallel machine. - No communication is performed. - \param In - Upper -If true, solve Ux = y, otherwise solve Lx = y. - \param In - Trans -If true, solve transpose problem. - \param In - UnitDiagonal -If true, assume diagonal is unit (whether it's stored or not). - \param In - X - A Epetra_MultiVector of dimension NumVectors to solve for. - \param Out - Y -A Epetra_MultiVector of dimension NumVectors containing result. - - \return Integer error code, set to 0 if successful. - */ - virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector& X, - Epetra_MultiVector& Y) const - { - ML_RETURN(-1); // not implemented - } - - virtual int Apply(const Epetra_MultiVector& X, - Epetra_MultiVector& Y) const - { - ML_RETURN(Multiply(false,X,Y)); - } - - virtual int ApplyInverse(const Epetra_MultiVector& X, - Epetra_MultiVector& Y) const - { - ML_RETURN(-1); - } - //! Computes the sum of absolute values of the rows of the Epetra_RowMatrix, results returned in x. - /*! The vector x will return such that x[i] will contain the inverse of sum of the absolute values of the - \e this matrix will be scaled such that A(i,j) = x(i)*A(i,j) where i denotes the global row number of A - and j denotes the global column number of A. Using the resulting vector from this function as input to LeftScale() - will make the infinity norm of the resulting matrix exactly 1. - \param Out - x -A Epetra_Vector containing the row sums of the \e this matrix. - \warning It is assumed that the distribution of x is the same as the rows of \e this. - - \return Integer error code, set to 0 if successful. - */ - virtual int InvRowSums(Epetra_Vector& x) const - { - ML_RETURN(-1); // not implemented - } - - //! Scales the Epetra_RowMatrix on the left with a Epetra_Vector x. - /*! The \e this matrix will be scaled such that A(i,j) = x(i)*A(i,j) where i denotes the row number of A - and j denotes the column number of A. - \param In - x -A Epetra_Vector to solve for. - - \return Integer error code, set to 0 if successful. - */ - virtual int LeftScale(const Epetra_Vector& x) - { - ML_RETURN(-1); // not implemented - } - - //! Computes the sum of absolute values of the columns of the Epetra_RowMatrix, results returned in x. - /*! The vector x will return such that x[j] will contain the inverse of sum of the absolute values of the - \e this matrix will be sca such that A(i,j) = x(j)*A(i,j) where i denotes the global row number of A - and j denotes the global column number of A. Using the resulting vector from this function as input to - RighttScale() will make the one norm of the resulting matrix exactly 1. - \param Out - x -A Epetra_Vector containing the column sums of the \e this matrix. - \warning It is assumed that the distribution of x is the same as the rows of \e this. - - \return Integer error code, set to 0 if successful. - */ - virtual int InvColSums(Epetra_Vector& x) const - { - ML_RETURN(-1); // not implemented - } - - - //! Scales the Epetra_RowMatrix on the right with a Epetra_Vector x. - /*! The \e this matrix will be scaled such that A(i,j) = x(j)*A(i,j) where i denotes the global row number of A - and j denotes the global column number of A. - \param In - x -The Epetra_Vector used for scaling \e this. - - \return Integer error code, set to 0 if successful. - */ - virtual int RightScale(const Epetra_Vector& x) - { - ML_RETURN(-1); // not implemented - } - - //@} - - //@{ \name Atribute access functions - - //! If FillComplete() has been called, this query returns true, otherwise it returns false. - virtual bool Filled() const - { - return true; - } - - //! Returns the infinity norm of the global matrix. - /* Returns the quantity \f$ \| A \|_\infty\f$ such that - \f[\| A \|_\infty = \max_{1\lei\len} \sum_{i=1}^m |a_{ij}| \f]. - */ - virtual double NormInf() const; - - //! Returns the one norm of the global matrix. - /* Returns the quantity \f$ \| A \|_1\f$ such that - \f[\| A \|_1= \max_{1\lej\len} \sum_{j=1}^n |a_{ij}| \f]. - */ - virtual double NormOne() const - { - return(-1.0); - } - - //! Returns the number of nonzero entries in the global matrix. - virtual int NumGlobalNonzeros() const; - - //! Returns the number of global matrix rows. - virtual int NumGlobalRows() const; - - //! Returns the number of global matrix columns. - virtual int NumGlobalCols() const; - - //! Returns the number of global nonzero diagonal entries, based on global row/column index comparisons. - virtual int NumGlobalDiagonals() const; - - //! Returns the number of nonzero entries in the calling processor's portion of the matrix. - virtual int NumMyNonzeros() const; - - //! Returns the number of matrix rows owned by the calling processor. - virtual int NumMyRows() const; - - //! Returns the number of matrix columns owned by the calling processor. - virtual int NumMyCols() const; - - //! Returns the number of local nonzero diagonal entries, based on global row/column index comparisons. - virtual int NumMyDiagonals() const; - - //! If matrix is lower triangular in local index space, this query returns true, otherwise it returns false. - virtual bool LowerTriangular() const; - - //! If matrix is upper triangular in local index space, this query returns true, otherwise it returns false. - virtual bool UpperTriangular() const; - - //! Returns the Epetra_Map object associated with the rows of this matrix. - virtual const Epetra_Map & RowMatrixRowMap() const; - - //! Returns the Epetra_Map object associated with the columns of this matrix. - virtual const Epetra_Map & RowMatrixColMap() const; - - //! Returns the Epetra_Import object that contains the import operations for distributed operations. - virtual const Epetra_Import * RowMatrixImporter() const; - //@} - - // following functions are required to derive Epetra_RowMatrix objects. - - //! Sets ownership. - int SetOwnership(bool ownership){return(-1);}; - - //! Sets use transpose (not implemented). - int SetUseTranspose(bool UseTranspose){return(-1);} - - //! Returns the current UseTranspose setting. - bool UseTranspose() const {return(false);}; - - //! Returns true if the \e this object can provide an approximate Inf-norm, false otherwise. - bool HasNormInf() const{return(false);}; - - //! Returns a pointer to the Epetra_Comm communicator associated with this operator. - const Epetra_Comm & Comm() const{return(*Comm_);}; - - //! Returns the Epetra_Map object associated with the domain of this operator. - const Epetra_Map & OperatorDomainMap() const {return(*DomainMap_);}; - - //! Returns the Epetra_Map object associated with the range of this operator. - const Epetra_Map & OperatorRangeMap() const {return(*RangeMap_);}; - //@} - - void SetLabel(const char* label) - { - strcpy(Label_,label); - }; - - const char* Label() const{ - return(Label_); - }; - - //! Returns a reference to RowMatrix->Map(). - const Epetra_BlockMap & Map() const - { - return(*DomainMap_); - } - -private: - - //! Pointer to the ML_Operator structure that is wrapped. - ML_Operator* Op_; - //! Communicator object, given by the user or allocated here. - const Epetra_Comm* Comm_; - //! If \c true, the dtor will destroy the communicator. - bool FreeCommObject_; - //! Number of local rows. - int NumMyRows_; - //! Number of global rows. - int NumGlobalRows_; - //! Number of local columns. - int NumMyCols_; - //! Number of global columns.j - int NumGlobalCols_; - //! Map for row distribution. - Epetra_Map* DomainMap_; - //! Map for row distribution. - Epetra_Map* RangeMap_; - //! Map for column distribution. - Epetra_Map* ColMap_; - //! Maximum number of elements in a row. - int MaxNumEntries_; - //! Diagonal elements of the matrix. - vector Diagonal_; - //! Contains the nonzero elements in a local row. - vector NumMyRowEntries_; - //! Work vector for getrow(). - mutable int Allocated_; - //! Work vector for getrow(). - mutable vector Indices_; - //! Work vector for getrow(). - mutable vector Values_; - //! Contains the infinity norm of the matrix. - double NormInf_; - //! Number of local nonzeros. - int NumMyNonzeros_; - //! Number of global nonzeros. - int NumGlobalNonzeros_; - //! Number of nonzero local diagonal elements. - int NumMyDiagonals_; - //! Number of nonzero global diagonal elements. - int NumGlobalDiagonals_; - //! Importer. - Epetra_Import* Importer_; - //! Label of \c this object. - char* Label_; - -}; // class RowMatrix - -} // namespace ML_Epetra - -#endif /* HAVE_ML_EPETRA */ -#endif /* ML_ROWMATRIX_H */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_seg_precond.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_seg_precond.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_seg_precond.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_seg_precond.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,237 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* Declaration of the segregated structure */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : March, 1999 */ -/* ******************************************************************** */ - -#ifndef __SEGSTRUCT__ -#define __SEGSTRUCT__ - -/* ******************************************************************** */ -/* local include files */ -/* ******************************************************************** */ - -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_bdrypts.h" -#include "ml_mapper.h" -#include "ml_grid.h" -#include "ml_smoother.h" -#include "ml_comminfoop.h" -#include "ml_1level.h" -#include "ml_operator.h" -#include "ml_csolve.h" -#include "ml_operatoragx.h" -#include "ml_comm.h" -#include "ml_gridfunc.h" -#include "ml_vec.h" -#include "ml_rap.h" -#include "ml_utils.h" -#include "ml_mat_formats.h" -#include "ml_solver.h" -#include "az_aztec.h" -#include "az_aztec_defs.h" -#include - -#define ML_SEG_DIAGONAL 0 -#define ML_SEG_UPPER_TRIANGULAR 1 -#define ML_SEG_LOWER_TRIANGULAR 2 -#define ML_SEG_DIAG_ELT 0 -#define ML_SEG_OFFDIAG_ELT 1 - -/* ******************************************************************** */ -/* ******************************************************************** */ -/* data definition for the ML_SEG Class */ -/* ******************************************************************** */ -/* -------------------------------------------------------------------- */ -/* This is the primary data structure which users interact directly */ -/* with via the provided functions. */ -/* -------------------------------------------------------------------- */ - -struct ML_SEG_MATRIX_Struct -{ - AZ_MATRIX *Amat; - AZ_PRECOND *precond; - int *AZ_options; /* Aztec's options array for preconditioning */ - double *AZ_params; - struct AZ_SCALING *AZ_scale; - int Amat_changed; - int precond_changed; -}; - -struct SEG_Struct -{ - int SEG_nblocks; /* number of block rows/cols in the matrix */ - int SEG_noffdiags; /* number of off-diagonal blocks */ - int SEG_format; /* SEG_DIAG, SEG_UPPER, or SEG_LOWER */ - int **SEG_rowlists; /* lists of rows in each block */ - int *SEG_rowlist_lengs; /* lengths of each block row */ - int SEG_total_nrows; /* total number of rows in the matrix */ - struct ML_SEG_MATRIX_Struct **SEG_diag_list; /* matrices on the diagonal */ - struct ML_SEG_MATRIX_Struct **SEG_offdiag_list; /* matrices off the diagonal */ -}; - -typedef struct ML_SEG_Stuct ML_SEG; -typedef struct ML_SEG_MATRIX_Struct ML_SEG_MATRIX; - -/* ******************************************************************** */ -/* ******************************************************************** */ -/* User Interface Proto-types */ -/* ******************************************************************** */ -/* ******************************************************************** */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif -extern int ML_SEG_Create(struct ML_SEG_Struct **seg, AZ_MATRIX *Amat, - int nblocks, int **rowlist, int *rowlengs, - int format, int proc_config[]); -extern void ML_SEG_Destroy(struct ML_SEG_Struct **seg); -extern struct ML_SEG_MATRIX_Struct *ML_SEG_Matrix_Create(AZ_MATRIX *Amat, - int nrows, int *rowlist, int ncols, int *collist, - int format, int proc_config[]); -extern void ML_SEG_Matrix_Destroy(struct SEG_MATRIX_Struct **Smat); -extern void ML_SEG_Precondition(double ff[], int options[], int proc_config[], - double params[], AZ_MATRIX *mat, AZ_PRECOND *prec); -extern void AZ_Set_SEG_Preconditioner(AZ_PRECOND *Precond, struct SEG_Struct *seg, - int options[]); -extern void ML_SEG_Set_ML_Precond(struct ML_SEG_Struct *seg, ML *ml, int block_row, - double params[], int options[], int proc_config[]); -extern void ML_SEG_ML_Set_Amat(struct ML_SEG_Struct *seg, ML *ml, int level, - int block_row, int proc_config[]); -extern void ML_SEG_Replace_Submat(struct ML_SEG_Struct *seg, int block_row, - int block_col, AZ_MATRIX *newMat, int proc_config[]); -extern void ML_SEG_Set_AZ_Precond(struct ML_SEG_Struct *seg, int block_row, - double *params, int *options, int proc_config[]); - -/* -extern int ML_Set_ResidualOutputFrequency(ML *ml, int output_freq); -extern int ML_Set_Tolerance(ML *ml, double tolerance); - -extern int ML_Destroy(ML **ml); - -extern int ML_Init_Comm(ML *ml); -extern int ML_Set_Comm_MyRank(ML *ml, int myrank); -extern int ML_Set_Comm_Nprocs(ML *ml, int nprocs); -extern int ML_Set_Comm_Communicator(ML *ml, USR_COMM com); -extern int ML_Set_Comm_Send(ML *ml, int (*send)()); -extern int ML_Set_Comm_Recv(ML *ml, int (*recv)()); -extern int ML_Set_Comm_Wait(ML *ml, int (*wait)()); - -extern int ML_Set_Comm(ML *ml, ML_Comm *comm); - -extern int ML_Init_Grid(ML *, int nl, void *grid); -extern int ML_Set_Grid_GridFunc(ML *, int nl, ML_GridFunc *); -extern int ML_Set_Grid_MaxVertPerElmnt(ML *, int, int nvert); -extern int ML_Set_Grid_GetDimension(ML *, int nl, int (*func)()); -extern int ML_Set_Grid_GetNVert(ML *, int nl, int (*func)()); -extern int ML_Set_Grid_GetNElmnt(ML *, int nl, int (*func)()); -extern int ML_Set_Grid_GetElmntNVert(ML *, int nl, int (*func)()); -extern int ML_Set_Grid_GetElmntVertList(ML *, int nl, int (*func)()); -extern int ML_Set_Grid_GetVertGlobalNum(ML *, int nl, int (*func)()); -extern int ML_Set_Grid_GetElmntGlobalNum(ML *, int nl, ml_big_int (*func)()); -extern int ML_Set_Grid_GetVertCoordinate(ML *, int nl, int (*func)()); -extern int ML_Set_Grid_ComputeBasisCoef(ML *, int nl, int (*func)()); -extern int ML_Set_Grid_GetElmntVolume(ML *, int nl, int (*func)()); -extern int ML_Set_Grid_GetElmntMatrix(ML *, int nl, int (*func)()); -extern int ML_Set_Grid_GetElmntNullSpace(ML *, int, int (*func)()); - -extern int ML_Gen_GridXsferUsingFEBasis(ML *, int L1, int L2, int stride); -extern int ML_Gen_MGHierarchyVanek(ML *, int start, int increment_or_decrement); - -extern int ML_Set_Grid(ML *, int nl, void *grid, ML_GridFunc *); - -extern int ML_Init_Amatrix(ML *,int level,int ilen,int olen,void *data); -extern int ML_Set_Amatrix_Matvec(ML*,int, - int (*func)(void*,int,double*,int,double*)); - extern int ML_Set_Amatrix_Diag(ML*,int,int, double *); - extern int ML_Set_Amatrix_Getrow(ML *ml, int level, - int (*getrow)(void*,int,int*,int,int*,double*,int*), - int (*comm )(double *vec, void *data), int comm_vec_leng); - -extern int ML_Set_Amatrix_GetrowNeighbors(ML*,int,int N_neigh,int *nlist); -extern int ML_Set_Amatrix_GetrowCommInfo(ML *, int level, int neighbor, - int N_rcv, int *rcv_list, int N_send, int *send_list); -extern int ML_Set_Amatrix_NormalizationFactors(ML*,int,int n,double *fact); -extern int ML_Set_Amatrix_NullSpace(ML *, int, int, int, double *); - -extern void ML_setup_grid_xsfer_op( void *f_grid, ML_GridFunc *fgrid_fcns, - void *c_grid, ML_GridFunc *cgrid_fcns, void **xsfer, - ML_Comm *comm ); - -extern int ML_Init_Restrictor(ML*,int L1,int L2,int,int,void *data); -extern int ML_Set_Restrictor_Matvec(ML*,int, - int (*func)(void*,int,double*,int,double*)); - extern int ML_Set_Restrictor_Getrow(ML *ml, int level, - int (*getrow)(void*,int,int*,int,int*,double*,int*), - int (*comm )(double *vec, void *data), int comm_vec_leng); -extern int ML_Set_Restrictor_GetrowNeighbors(ML *ml,int level,int N_neigh, - int *neigh_list); -extern int ML_Set_Restrictor_GetrowCommInfo(ML *ml,int level,int neighbor, - int N_rcv, int *rcv_list, int N_send, int *send_list); - -extern int ML_Init_Prolongator(ML*,int L1,int L2,int,int,void *data); -extern int ML_Set_Prolongator_Matvec(ML *ml, int level, - int (*func) (void *, int, double *, int, double *)); -extern int ML_Set_Prolongator_Getrow(ML *ml, int level, - int (*getrow)(void*,int,int*,int,int*,double*,int*), - int (*comm )(double *vec, void *data), int comm_vec_leng); -extern int ML_Set_Prolongator_GetrowNeighbors(ML *ml,int level,int N_neigh, - int *neigh_list); -extern int ML_Set_Prolongator_GetrowCommInfo(ML *ml,int level,int neighbor, - int N_rcv, int *rcv_list, int N_send, int *send_list); - -extern int ML_Gen_CoarseSolverSuperLU(ML *ml_handle, int level); -extern int ML_Gen_SmootherJacobi( ML *, int nl, int pre_or_post, - int ntimes, double omega ); -extern int ML_Gen_SmootherGaussSeidel(ML*,int nl,int pre_post,int ntimes); -extern int ML_Gen_SmootherSymGaussSeidel(ML*,int nl,int pre_post,int ntimes, - double omega); -extern int ML_Gen_BGSInverses(ML *ml,int nl,int blocksize,ML_Sm_BGS_Data **data); -extern int ML_Gen_SmootherBlockGaussSeidel(ML*,int nl,int pre_post,int ntimes, - double omega, int blocksize); -extern int ML_Set_Smoother(ML *, int nl , int pre_post, void *obj, - int (*func)(void *, int, double *, int, double *)); -extern int ML_Set_CoarseSolver(ML *ml, int level, int leng, void *sol_obj, - void (*solve)()); - -extern int ML_Gen_AmatrixRAP(ML *ml, int to_level, int from_level); - -extern int ML_Set_EqnToridMapFunc(ML *ml, int level,int fleng,int tleng, - void (*func)() ); -extern int ML_Set_GridToqnMapFunc(ML *ml, int level,int fleng,int tleng, - void (*func)() ); -extern int ML_Set_BoundaryTypes(ML*,int level,int type,int n,int *data); - -extern int ML_Gen_Solver(ML *ml, int method, int finest_level, int); -extern int ML_Iterate(ML *ml, double *sol, double *rhs); -extern int ML_Solve_MGV( ML *ml , double *din, double *dout); -extern double ML_Cycle_MGV(ML_1Level *curr, double *sol, double *rhs, - int approx_all_zeros, ML_Comm *comm); -*/ -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif -#endif - - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_self.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_self.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_self.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_self.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ************************************************************************* */ -/* See the file COPYRIGHT for a complete copyright notice, contact person, */ -/* and disclaimer. */ -/* ************************************************************************* */ - -#ifndef ML_SELF_H -#define ML_SELF_H - -#include "ml_include.h" - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -#if defined(HAVE_ML_EPETRA) && defined(HAVE_ML_IFPACK) && defined(HAVE_ML_TEUCHOS) - -int ML_Smoother_Self(ML_Smoother *sm,int inlen,double x[],int outlen, - double rhs[]); - -void ML_Smoother_Clean_Self(void * Self_Handle); - -extern int ML_Self_Solve(void * Self_Handle, double * x, double * rhs); - -extern void ML_Self_Destroy(void * Self_Handle); - -#endif - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif /* #ifndef ML_SELF_H */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_self_wrap.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_self_wrap.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_self_wrap.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_self_wrap.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* Copyright (2004) Sandia Corportation. Under the terms of Contract - * DE-AC04-94AL85000, there is a non-exclusive license for use of this - * work by or on behalf of the U.S. Government. Export of this program - * may require a license from the United States Government. */ - - /* NOTICE: The United States Government is granted for itself and others - * acting on its behalf a paid-up, nonexclusive, irrevocable worldwide - * license in ths data to reproduce, prepare derivative works, and - * perform publicly and display publicly. Beginning five (5) years from - * July 25, 2001, the United States Government is granted for itself and - * others acting on its behalf a paid-up, nonexclusive, irrevocable - * worldwide license in this data to reproduce, prepare derivative works, - * distribute copies to the public, perform publicly and display - * publicly, and to permit others to do so. - * - * NEITHER THE UNITED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT - * OF ENERGY, NOR SANDIA CORPORATION, NOR ANY OF THEIR EMPLOYEES, MAKES - * ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR - * RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY - * INFORMATION, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS - * THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS. */ - -#ifndef ML_SELF_WRAP -#define ML_SELF_WRAP - -#include "ml_include.h" -#if defined(HAVE_ML_EPETRA) && defined(HAVE_ML_TEUCHOS) && defined(HAVE_ML_IFPACK) - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -namespace Teuchos { - class ParameterList; -} -class Epetra_Comm; - -int ML_Smoother_Self(ML_Smoother *sm,int inlen,double x[],int outlen, - double rhs[]); - -void ML_Smoother_Clean_Self(void * Self_Handle); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -int ML_Gen_Smoother_Self(ML *ml, int Overlap, int nl, int pre_or_post, - Teuchos::ParameterList& List, - const Epetra_Comm& Comm); - -#endif -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_setup.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_setup.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_setup.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_setup.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#ifndef __MLSETUP__ -#define __MLSETUP__ - - -/* ******************************************************************** */ -/* variable to pass to the local compute_basis_coefficients function */ -/* ******************************************************************** */ - -ML_GridFunc *gridfcns_basis=NULL; - -/* ******************************************************************** */ -/* definition of local subroutines */ -/* ******************************************************************** */ -#ifdef __cplusplus -extern "C" { -#endif - -#include "ml_common.h" - - -void ML_compose_global_grid( void *c_grid, - ML_GridFunc *cgrid_fcns, - ML_GridAGX **g_c_grid, - ML_Comm *comm); -void ML_construct_RP0( void *c_grid, - ML_GridFunc *cgrid_fcns, - void *f_grid, - ML_GridFunc *fgrid_fcns, - ML_GridAGX *g_c_grid, - ML_OperatorAGX **xsfer_op, - ML_Comm *comm); -int ML_remote_grid_candidates( void *f_grid, - ML_GridFunc *fgrid_fcns, - ML_GridFunc *cgrid_fcns, - ML_GridAGX *g_c_grid, - ML_IntList *cand_list, - ML_OperatorAGX *xsfer_op, - ML_Comm *comm); -void ML_exchange_candidates( ML_IntList *cand_list, - void *f_grid, - ML_GridFunc *fgrid_fcns, - ML_GridAGX *g_c_grid, - ML_CommInfoAGX *combuf, - ML_Comm *comm); -void ML_get_basis_functions_coef(ML_CommInfoAGX *combuf, - void *c_grid, - ML_GridFunc *cgrid_fcns, - ML_OperatorAGX *xsfer_op); -void ML_exchange_coefficients( void *c_grid, - ML_GridFunc *cgrid_fcns, - ML_CommInfoAGX *combuf, - ML_OperatorAGX *xsfer_op, - ML_Comm *comm); -void ML_construct_RP1( void *fgrid, - ML_GridFunc *fgrid_fcns, - void *cgrid, - ML_GridFunc *cgrid_fcns, - ML_GridAGX *g_c_grid, - ML_CommInfoAGX *combuf, - ML_OperatorAGX *xsfer_op, - ML_Comm *comm); - - - -#ifdef __cplusplus -} -#endif - -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_smoother.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_smoother.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_smoother.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_smoother.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,392 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the ML_Smoother structure */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : March, 1999 */ -/* ******************************************************************** */ - -#ifndef __MLSMOOTHER__ -#define __MLSMOOTHER__ - -/* ******************************************************************** */ -/* data structure type definition */ -/* ******************************************************************** */ - -typedef struct ML_SmootherFunc_Struct ML_SmootherFunc; -typedef struct ML_Smoother_Struct ML_Smoother; -typedef struct ML_Sm_BGS_Data_Struct ML_Sm_BGS_Data; -typedef struct ML_Sm_ILUT_Data_Struct ML_Sm_ILUT_Data; -typedef struct ML_Sm_Hiptmair_Data_Struct ML_Sm_Hiptmair_Data; -typedef struct ML_Sm_BlockHiptmair_Data_Struct ML_Sm_BlockHiptmair_Data; - -/* ******************************************************************** */ -/* local include files */ -/* ******************************************************************** */ - -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_memory.h" -#include "ml_1level.h" -#include "ml_operator.h" -#include "ml_comminfoop.h" -#include "ml_csolve.h" -#include "ml_struct.h" -#include - -#ifdef WKC -#include -#endif - -/* ******************************************************************** */ -/* data definition for the ML_Smoother Class */ -/* ******************************************************************** */ -/* -------------------------------------------------------------------- */ -/* These data structures define the smoother object. */ -/* -------------------------------------------------------------------- */ - -struct ML_SmootherFunc_Struct -{ - int ML_id; - int (*func_ptr)(ML_Smoother *, int, double *, int, double *); - void *data; -}; - -/******************************************************************************* - pre_or_post flag that the smoother toggles to determine whether it is - in pre or post smoothing phase - envelope message-passing information that is used in - ML_exchange_bdry -*******************************************************************************/ - -struct ML_Smoother_Struct -{ - int ML_id; - struct ML_1Level_Struct *my_level; - int ntimes; - int init_guess; - double omega; - double tol; - ML_SmootherFunc *smoother; - void (*data_destroy)(void *); - double build_time, apply_time; - int times_applied; - char *label; - int pre_or_post; - ML_Comm_Envelope *envelope; - int output_level; - int symmetric_sweep; - /* When block GS is used, 1 indicates symmetric */ - /* block Gauss-Seidel and 0 indicates standard */ - /* block Gauss-Seidel. */ -}; - -struct ML_Sm_BGS_Data_Struct -{ - double ** blockfacts; - int ** perms; - int blocksize; - int *blocklengths; - int *blockmap; - int Nblocks; -}; - -struct ML_Sm_ILUT_Data_Struct -{ - int Nrows; - int *mat_ia; - int *mat_ja; - double *mat_aa; - ML_CommInfoOP *getrow_comm; - int fillin; - double threshold; -}; -struct DinvA_widget { - int ML_id; - int (*func_ptr)(ML_Operator *, int, double *, int, double *); - void *data; - ML_Operator *Amat; -}; - -#ifdef out -#if defined(SUPERLU) -#include "dsp_defs.h" -#include "util.h" -#endif -#ifdef DSUPERLU -#include "mpi.h" -#include "superlu_ddefs.h" -#endif -typedef struct ML_Sm_Schwarz_Data_Struct ML_Sm_Schwarz_Data; - -struct ML_Sm_Schwarz_Data_Struct -{ - int Nrows; - int **bmat_ia; - int **bmat_ja; - double **bmat_aa; - int **aux_bmat_ia; - int **aux_bmat_ja; - double **aux_bmat_aa; - ML_CommInfoOP *getrow_comm; - int nblocks; - int *blk_info; - int *blk_size; - int **blk_indices; - int **perm_r; - int **perm_c; -#if defined(SUPERLU) - SuperMatrix **slu_Amat; - SuperMatrix **slu_Lmat; - SuperMatrix **slu_Umat; -#endif -}; -#endif - -/******************************************************************************* -Hiptmair Smoother data structure - sm_nodal pointer to nodal smoother structure - max_eig eigenvalue calculated for damping parameter - omega damping parameter for edge and/or nodal smoother inside - Hiptmair smoother -*******************************************************************************/ - -struct ML_Sm_Hiptmair_Data_Struct -{ - ML_Operator *Tmat; - ML_Operator *Tmat_trans; - ML_Operator *ATmat_trans; - double *TtAT_diag; - ML_Operator *TtATmat; - ML_Smoother *sm_nodal; - double max_eig; - double omega; - double output_level; - ML *ml_nodal; - ML *ml_edge; - int reduced_smoother; -}; - -#define FULL_HIPTMAIR 0 - /* smoothes on edges, nodes and then edges */ - -#define HALF_HIPTMAIR 1 - /* smoothes on edges then node for pre-smoothing */ - /* smoothes on nodes then edges fr post-smoothing */ - -/* for block hiptmair */ - -struct ML_Sm_BlockHiptmair_Data_Struct -{ - ML_Operator *Tmat; - ML_Operator *Tmat_trans; - ML_Operator *ATmat_trans; - double *TtAT_diag; - ML_Operator *TtATmat; - ML_Smoother *sm_nodal; - double *res_edge; - double *res_edge1; - double *res_edge2; - double *rhs_nodal1; - double *rhs_nodal2; - double *x_nodal1; - double *x_nodal2; - double *edge_update1; - double *edge_update2; - double max_eig; - double omega; - double output_level; - ML *ml_nodal; - ML *ml_edge; - int reduced_smoother; -}; - -/* ******************************************************************** */ -/* ******************************************************************** */ -/* User Interface Proto-types */ -/* ******************************************************************** */ -/* ******************************************************************** */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -extern int ML_Smoother_Create(ML_Smoother **, ML_1Level *level_ptr ); -extern int ML_Smoother_Init(ML_Smoother *, ML_1Level *level_ptr); -extern int ML_Smoother_Destroy(ML_Smoother **); -extern int ML_Smoother_Clean(ML_Smoother *); -extern int ML_Smoother_Set_Label( ML_Smoother *smoo, char *label); -extern int ML_Smoother_Apply(ML_Smoother *,int,double *,int,double*,int); - -#ifdef WKC -/* WKC Added proto for Epetra stuff! */ -extern int ML_Smoother_Apply(ML_Smoother *,int,Epetra_MultiVector &, - int,Epetra_MultiVector &,int); -#endif - - -extern int ML_Smoother_Set(ML_Smoother *, void *, - int (*func_ptr)(ML_Smoother*,int,double*,int,double *), - int, double, char *); -extern int ML_Smoother_Jacobi(ML_Smoother *, int, double *x, int, double *); -extern int ML_Smoother_GaussSeidel(ML_Smoother *, int, double *, int, double *); -extern int ML_Smoother_SGSSequential(ML_Smoother *, int,double *, int, double *); -extern int ML_Smoother_SGS(ML_Smoother *, int, double *, int, double *); -extern int ML_Smoother_BlockGS(ML_Smoother *, int, double *, int, double *); -extern int ML_BlockScaledApply(ML_Operator *Amat, int inlen, double in[], - int outlen, double out[]); - -extern int ML_Smoother_MLS_Apply(ML_Smoother *, int, double *, int, double *); -extern int ML_Cheby(ML_Smoother *sm, int inlen, double x[], int outlen, double rhs[]); - -#ifdef WKC -/* WKC -- double * are actually Epetra_MultiVectors */ -/*extern int ML_Cheby_WKC(ML_Smoother *sm, int inlen, double *x, int outlen, double *rhs);*/ -extern int ML_Cheby_WKC(void *sm, int inlen, double *x, int outlen, double *rhs); -#endif - -extern int ML_complex_Cheby(ML_Smoother *sm, int inlen, double x[], int outlen, - double rhs[]); -extern int ML_DiagScaled_1stepKrylov(ML_Smoother *sm, int inlen, double x[], - int outlen, double rhs[]); -extern int ML_Smoother_ParaSails(ML_Smoother *, int, double *, int, double *); -extern int ML_Smoother_ParaSailsSym(ML_Smoother *, int, double *, int, double *); -extern int ML_Smoother_ParaSailsTrans(ML_Smoother *, int, double *, int, double *); -extern int ML_Smoother_VBlockJacobi(ML_Smoother *,int,double *x,int, double *); -extern int ML_Smoother_VBlockKrylovJacobi(ML_Smoother *,int,double*,int,double*); -extern int ML_Smoother_VBlockSGS(ML_Smoother *, int, double *x, int, double *); -extern int ML_Smoother_VBlockSGSSequential(ML_Smoother*,int,double*,int,double*); -extern int ML_Smoother_OverlappedILUT(ML_Smoother *,int,double *x,int,double *); -extern int ML_Smoother_VBlockAdditiveSchwarz(ML_Smoother *,int,double*,int,double*); -extern int ML_Smoother_VBlockMultiplicativeSchwarz(ML_Smoother *,int,double*,int,double*); -extern int ML_Smoother_Hiptmair(ML_Smoother *, int, double *, int, double *); -extern int ML_Smoother_BlockHiptmair(ML_Smoother *, int, double *, int, double *); -extern int ML_Smoother_ApplySubdomainOverlap(ML_Smoother *sm, int inlen, - double x[],int outlen, double b[]); - -extern void ML_Smoother_DestroySubdomainOverlap(void *data); - -extern int ML_EyeMinusIterationOperator_Matvec(ML_Operator *Amat, int ilen, - double p[], int olen, double ap[]); - -extern int ML_Smoother_ComputeOmegaViaSpectralradius(ML_Operator *Amat, - int (*smoothing_function)(ML_Smoother *, int, double *, int, double *), - void *data, double *spectral_radius, double *omega); - - -/* ******************************************************************** */ -/* ******************************************************************** */ -/* private functions */ -/* ******************************************************************** */ -/* ******************************************************************** */ - -extern int ML_Smoother_Create_Hiptmair_Data(ML_Sm_Hiptmair_Data **data); -extern int ML_Smoother_Create_BlockHiptmair_Data(ML_Sm_BlockHiptmair_Data **data); -extern int ML_Smoother_Gen_Hiptmair_Data(ML_Sm_Hiptmair_Data**, - ML_Operator*, ML_Operator*, ML_Operator*, - ML_Operator*, int, int*, void *, void **, - void *, void **); -extern int ML_Smoother_Gen_BlockHiptmair_Data(ML_Sm_BlockHiptmair_Data**, - ML_Operator*, ML_Operator*, ML_Operator*, - ML_Operator*, int, int*, void *, void **, - void *, void **); -extern int ML_Smoother_HiptmairSubsmoother_Create(ML **ml_subproblem, - ML_Operator *Amat, void *smoother, - void **args, double default_omega); - -extern void ML_Smoother_Destroy_Hiptmair_Data(void *data); -extern void ML_Smoother_Destroy_BlockHiptmair_Data(void *data); -extern int ML_Smoother_Create_BGS_Data(ML_Sm_BGS_Data **data); -extern void ML_Smoother_Destroy_BGS_Data(void *data); -extern void ML_Smoother_Clean_BGS_Data(void *data); -extern int ML_Smoother_Create_ILUT_Data(ML_Sm_ILUT_Data **data); -extern void ML_Smoother_Destroy_ILUT_Data(void *data); -extern int ML_Smoother_Gen_BGSFacts(ML_Sm_BGS_Data **, ML_Operator *,int); -extern int ML_Smoother_Gen_VBGSFacts(ML_Sm_BGS_Data**,ML_Operator*,int,int*); -extern void ML_Smoother_Destroy_Schwarz_Data(void *data); -extern void ML_Smoother_Clean_ParaSails(void *data); -extern struct MLSthing *ML_Smoother_Create_MLS(void); -extern int ML_BlockDinv(ML_Sm_BGS_Data *BGS_Data, int outlen, double out[]); - -extern void ML_Smoother_Destroy_MLS(void *data); -extern void **ML_Smoother_Arglist_Create(int nargs); -extern int ML_Smoother_Arglist_Set(void **arglist, int which_arg, void *ptr); -extern void *ML_Smoother_Arglist_Get(void **arglist, int which_arg); -extern int ML_Smoother_Arglist_Delete(void ***arglist); -extern int ML_Smoother_Arglist_Nargs(void **arglist); - - - -extern int ML_Smoother_ILUTDecomposition(ML_Sm_ILUT_Data *, ML_Operator *, - ML_Comm *, int, int *,int*,double *,int *, int *,int); -#ifdef out -extern int ML_Smoother_Create_Schwarz_Data(ML_Sm_Schwarz_Data **data); -extern int ML_Smoother_VBlockSchwarzDecomposition(ML_Sm_Schwarz_Data *, - ML_Operator *, ML_Comm *, int, int *,int*,double *,int *, - int *,int); -#endif - -extern int ML_Smoother_GetOffProcRows(ML_CommInfoOP *, ML_Comm *, - ML_Operator *,int,int *,int,int *,int **,double **); -extern int ML_Smoother_GetRowLengths(ML_CommInfoOP *, ML_Comm *, - ML_Operator *, int *, int **); -extern int ML_Smoother_ComposeOverlappedMatrix(ML_Operator *, ML_Comm *, - int *, int **, int **, double **, int **, int **, int *); -extern ML *ML_Smoother_Get_Hiptmair_nodal(ML *ml, int level, int); -extern int ML_dgetrs_special(int blocksize, double *ablock, int *ipiv, - double *correc); -extern int ML_permute_for_dgetrs_special(double *Z[], int Nblocks, int blocksize); - - - -/* -------------------------------------------------------------------- */ -/* Ray's functions */ -/* -------------------------------------------------------------------- */ - -extern int ML_MSR_SGSextra(ML_Smoother *, int , double *, int , double *); -extern void ML_MSR_GSextra_Clean(void *data); -extern int ML_Smoother_BackGS(void *, int, double *, int, double *); -extern void ML_Smoother_Clean_OrderedSGS(void *data); -extern int ML_Smoother_Gen_Ordering(ML_Operator *Amat, int **data_ptr); -extern int ML_Smoother_OrderedSGS(ML_Smoother *sm,int inlen,double x[],int outlen, - double rhs[]); -extern int ML_Smoother_MSR_SGS(ML_Smoother *, int, double *, int, double *); -extern int ML_Smoother_MSR_SGSnodamping(ML_Smoother *,int ,double *,int , double *); -extern int ML_Smoother_MSR_GSforwardnodamping(void *sm,int inlen,double x[], - int outlen, double rhs[]); -extern int ML_Smoother_MSR_GSbackwardnodamping(void *sm,int inlen,double x[], - int outlen, double rhs[]); -extern int ML_Smoother_MSR_SGSdamping(void *,int ,double *,int , double *); -extern void ML_Smoother_Clean_MSR_GS(void *data); - -extern int DinvA(ML_Operator *data, int in, double p[], int out, double ap[]); - - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_solver.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_solver.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_solver.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_solver.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the ML structure */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : February, 1999 */ -/* ******************************************************************** */ - -#ifndef _MLSOLVER_ -#define _MLSOLVER_ - -/* #include */ -#include "ml_common.h" -#include "ml_defs.h" - -#ifdef DSUPERLU -#include "superlu_ddefs.h" -#endif - -typedef struct ML_Lugrid_Struct -{ -#ifdef DSUPERLU - gridinfo_t grid; -#endif - int count; -} ML_Lugrid; - -typedef struct ML_Solver_Struct -{ - int ML_id; /* ID for the Solver structure */ - int reuse_flag; /* flag for internal use */ - void (*func)(void); /* function to perform the solve */ - void *Mat1; /* primary matrix for the solver */ - void *Mat2; /* L matrix (for direct solver) */ - void *Mat3; /* U matrix (for direct solver) */ - int int_data; /* integer data for the solver */ - int int_data2; /* integer data for the solver */ - double dble_data; /* double data for the solver */ - int *int_params1; /* integer array for the solver */ - int *int_params2; /* integer array for the solver */ - double *dble_params1; /* double array for the solver */ - double *dble_params2; /* double array for the solver */ - void *void_params1; /* other data for the solver */ - void *void_params2; /* other data for the solver */ - void *LUspl; /* for direct solver */ - void *PERMspl; /* for direct solver */ - int ML_subgroup; - ML_Lugrid *gridtiles; -} ML_Solver; - -/* Changed void ML_subcomm to int ML_subgroup */ - -#ifdef __cplusplus -extern "C" { -#endif - -int ML_Solver_Create( ML_Solver **sol ); -int ML_Solver_Destroy( ML_Solver **sol ); -int ML_Solver_Check( ML_Solver *sol ); - -#ifdef __cplusplus -} -#endif -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_struct.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_struct.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_struct.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_struct.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,402 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Declaration of the ML structure */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : March, 1999 */ -/* ******************************************************************** */ - -#ifndef __MLSTRUCT__ -#define __MLSTRUCT__ - -/* ******************************************************************** */ -/* data structure type definition */ -/* ******************************************************************** */ - -typedef struct ML_Struct ML; - -/* ******************************************************************** */ -/* local include files */ -/* ******************************************************************** */ - -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_bdrypts.h" -#include "ml_mapper.h" -#include "ml_grid.h" -#include "ml_smoother.h" -#include "ml_comminfoop.h" -#include "ml_1level.h" -#include "ml_operator.h" -#include "ml_csolve.h" -#include "ml_operatoragx.h" -#include "ml_comm.h" -#include "ml_gridfunc.h" -#include "ml_vec.h" -#include "ml_rap.h" -#include "ml_utils.h" -#include "ml_mat_formats.h" -#include "ml_solver.h" -#include "ml_krylov.h" -#include "ml_mat_formats.h" -#include "ml_amg.h" -#include "ml_aggregate.h" -#include "ml_mls.h" -#include -#include "ml_qr_fix.h" - -#ifdef WKC -/* WKC -- added header(s) for the new datastructures */ -#include -#include -#endif - -/* ******************************************************************** */ -/* ******************************************************************** */ -/* data definition for the ML Class */ -/* ******************************************************************** */ -/* -------------------------------------------------------------------- */ -/** This is the primary data structure which users interact directly - with via the provided functions. - -------------------------------------------------------------------- */ - -struct ML_Struct { - int id; - char *label; /**< optional character label */ - int ML_init_flag; /**< indicate initialization done */ - int ML_scheme; /**< which ML scheme to pick */ - int ML_num_levels; /**< number of levels available */ - int ML_num_actual_levels; - /**< number of levels actually used */ - /**< by the multigrid method. */ - int ML_num_transfers;/**< number of transfers */ - int ML_finest_level, ML_coarsest_level; - int *LevelID; /* Same idea as MultiLevelPreconditioner(). - Logically, levels run from 0,...,L, where - 0 is the finest level and L is the - coarsest. Internally, the fine level's - array index is LevelID[0], and the coarse - level L's array index is LevelID[L]. */ - int symmetrize_matrix; - int output_level; - int res_output_freq; - int MinPerProc_repartition; - double LargestMinMaxRatio_repartition; - int use_repartitioning; /* turn repartitioning [off]/on */ - ML_Partitioner partitioner; /*which partitioner to use: zoltan,parmetis,jostle */ - double tolerance; - int max_iterations; - double *spectral_radius; - ML_Smoother *pre_smoother; - ML_Smoother *post_smoother; - ML_CSolve *csolve; - ML_Operator *Amat, *Rmat, *Pmat; - ML_Grid *Grid; - ML_BdryPts *BCs; - ML_Mapper *eqn2grid; - ML_Mapper *grid2eqn; - ML_1Level *SingleLevel; - ML_DVector *Amat_Normalization; - struct ML_Timing - *timing; /**< Used for timing information. */ - ML_Comm *comm; /**< communicator for ML */ - int *int_options; /**< optional integer parameters */ - double *dble_options; /**< optional double parameters */ - void *void_options; /**< optional other parameters */ - int (*func)(void); /**< optional function */ - -}; -struct ML_Timing { - double precond_apply_time; - double total_build_time; -}; - -/** ******************************************************************* * - * Control structure for the amount of information that ML prints. * - * ******************************************************************** */ - -typedef struct ML_PrintControl_Struct ML_PrintControl; - -struct ML_PrintControl_Struct { - int output_level; -}; - -extern ML_PrintControl ML_PrintLevel; - -/* ******************************************************************** */ -/* ******************************************************************** */ -/* User Interface Proto-types */ -/* ******************************************************************** */ -/* ******************************************************************** */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -extern int ML_Create(ML **ml, int Nlevels); -extern int ML_build_ggb( ML *ml, void *data); -extern void ML_build_ggb_cheap(ML *ml, void *data); -extern void ML_build_ggb_fat(ML *ml, void *data); -extern int ML_Set_Symmetrize(ML *ml, int true_or_false); -extern int ML_Set_OutputLevel(ML *ml, int output_level); -extern int ML_Set_PrintLevel(int); -extern int ML_Get_PrintLevel(void); -extern int ML_Set_ResidualOutputFrequency(ML *ml, int output_freq); -extern int ML_Set_Tolerance(ML *ml, double tolerance); -extern int ML_Set_MaxIterations(ML *ml, int iterations); -extern int ML_Print_Timing(ML *ml); - -extern int ML_Destroy(ML **ml); -#ifdef GREG -extern int ML_Destroy2(ML **ml); -#endif -extern void ML_Solve_SmootherDestroy(void *data); - -extern int ML_Init_Comm(ML *ml); -extern int ML_Set_Comm_MyRank(ML *ml, int myrank); -extern int ML_Set_Comm_Nprocs(ML *ml, int nprocs); -extern int ML_Set_Comm_Communicator(ML *ml, USR_COMM com); -extern int ML_Set_Comm_Send(ML *ml, int (*send)(void*,unsigned int,int,int,USR_COMM)); -extern int ML_Set_Comm_Recv(ML *ml, int (*recv)(void*,unsigned int,int*,int*,USR_COMM,USR_REQ*)); -extern int ML_Set_Comm_Wait(ML *ml, int (*wait)(void*,unsigned int,int*,int*,USR_COMM,USR_REQ*)); - -extern int ML_Set_Comm(ML *ml, ML_Comm *comm); - -extern int ML_Init_Grid(ML *, int nl, void *grid); -extern int ML_Set_Grid_GridFunc(ML *, int nl, ML_GridFunc *); -extern int ML_Set_Grid_MaxVertPerElmnt(ML *, int, int nvert); -extern int ML_Set_Grid_GetDimension(ML *, int nl, int (*func)(void *)); -extern int ML_Set_Grid_GetNVert(ML *, int nl, int (*func)(void *)); -extern int ML_Set_Grid_GetNElmnt(ML *, int nl, int (*func)(void *)); -extern int ML_Set_Grid_GetElmntNVert(ML *, int nl, int (*func)(void *, int)); -extern int ML_Set_Grid_GetElmntVertList(ML *, int nl, int (*func)(void *, int, int *)); -extern int ML_Set_Grid_GetVertGlobalNum(ML *, int nl, int (*func)(void *, int)); -extern int ML_Set_Grid_GetElmntGlobalNum(ML *, int nl, ml_big_int (*func)(void *, int)); -extern int ML_Set_Grid_GetVertCoordinate(ML *, int nl, int (*func)(void *, int, double *)); -extern int ML_Set_Grid_ComputeBasisCoef(ML *, int nl, int (*func)(void*,int,double*,int,double*,int*)); -extern int ML_Set_Grid_GetElmntVolume(ML *, int nl, int (*func)(void*,int,int*,double*)); -extern int ML_Set_Grid_GetElmntMatrix(ML *, int nl, int (*func)(void*,int,double**)); -extern int ML_Set_Grid_GetElmntNullSpace(ML *, int, int (*func)(void*,int,double*)); - - -extern int ML_Gen_GridXsferUsingFEBasis(ML *, int L1, int L2, int stride); -extern int ML_Gen_MGHierarchyVanek(ML *, int start, int increment_or_decrement); - -extern int ML_Set_Grid(ML *, int nl, void *grid, ML_GridFunc *); - -extern int ML_Init_Amatrix(ML *,int level,int ilen,int olen,void *data); -extern int ML_Get_Amatrix(ML *ml, int level, ML_Operator **matrix); -extern int ML_Set_Amatrix_Matvec(ML*,int, - int (*func)(ML_Operator*,int,double*,int,double*)); -extern int ML_Set_Amatrix_Diag(ML*,int,int, double *); -extern int ML_Set_Amatrix_Getrow(ML *ml, int level, - int (*getrow)(ML_Operator*,int,int*,int,int*,double*,int*), - int (*comm )(double *vec, void *data), int comm_vec_leng); -extern int ML_Set_Amatrix_GetrowNeighbors(ML*,int,int N_neigh,int *nlist); -extern int ML_Set_Amatrix_GetrowCommInfo(ML *, int level, int neighbor, - int N_rcv, int *rcv_list, int N_send, int *send_list); -extern int ML_Set_Amatrix_NormalizationFactors(ML*,int,int n,double *fact); -extern int ML_Set_Amatrix_NullSpace(ML *, int, int, int, double *); - -extern void ML_setup_grid_xsfer_op(void *, ML_GridFunc *, void *, - ML_GridFunc *, void **xsfer, ML_Comm *); - -extern int ML_Init_Restrictor(ML*,int L1,int L2,int,int,void *data); -extern int ML_Set_Restrictor_Matvec(ML*,int, - int (*func)(ML_Operator*,int,double*,int,double*)); -extern int ML_Set_Restrictor_Getrow(ML *ml, int level, - int (*getrow)(ML_Operator*,int,int*,int,int*,double*,int*), - int (*comm )(double *vec, void *data), int comm_vec_leng); -extern int ML_Set_Restrictor_GetrowNeighbors(ML *ml,int level,int N_neigh, - int *neigh_list); -extern int ML_Set_Restrictor_GetrowCommInfo(ML *ml,int level,int neighbor, - int N_rcv, int *rcv_list, int N_send, int *send_list); - -extern int ML_Init_Prolongator(ML*,int L1,int L2,int,int,void *data); -extern int ML_Set_Prolongator_Matvec(ML *ml, int level, - int (*func) (ML_Operator *,int, double *, int, double *)); -extern int ML_Set_Prolongator_Getrow(ML *ml, int level, - int (*getrow)(ML_Operator*,int,int*,int,int*,double*,int*), - int (*comm )(double *vec, void *data), int comm_vec_leng); -extern int ML_Set_Prolongator_GetrowNeighbors(ML *ml,int level,int N_neigh, - int *neigh_list); -extern int ML_Set_Prolongator_GetrowCommInfo(ML *ml,int level,int neighbor, - int N_rcv, int *rcv_list, int N_send, int *send_list); - -extern int ML_Gen_Blocks_Metis(ML *ml, int level, int *nblocks,int **block_list); - -extern int ML_Gen_Smoother_Jacobi( ML *, int nl, int pre_or_post, - int ntimes, double omega ); -extern int ML_Gen_Smoother_GaussSeidel(ML*,int nl,int pre_post,int ntimes,double); -extern int ML_Gen_Smoother_Hiptmair(ML*,int nl,int pre_post,int ntimes, - ML_Operator**, ML_Operator**, ML_Operator*, - void *, void **, - void *, void **, int); -extern int ML_Gen_Smoother_BlockHiptmair(ML*,int nl,int pre_post,int ntimes, - ML_Operator**, ML_Operator**, ML_Operator*, - void *, void **, - void *, void **, int); -extern int ML_Gen_Smoother_SymGaussSeidel(ML*,int nl,int pre_post,int ntimes, - double omega); -extern int ML_Gen_Smoother_SymGaussSeidelSequential(ML*,int nl,int pre_post, - int ntimes, double omega); -extern int ML_Gen_Smoother_MLS(ML*,int nl,int pre_post, double eig, - int degree); -extern int ML_Gen_Smoother_ERF_1StepKrylov(ML *ml, int nl, int pre_or_post); - -extern int ML_Gen_Smoother_SubdomainOverlap(ML *ml, int level, int overlap); - -extern int ML_Gimmie_Eigenvalues(ML_Operator *Amat, int scale_by_diag, - int matrix_is_nonsymmetric, int symmetrize_matrix); -extern int ML_Gen_Smoother_BlockDiagScaledCheby(ML *ml, int nl, - int pre_or_post, - double eig_ratio, int deg, - int nBlocks, int *blockIndices); -extern int ML_Gen_BlockScaledMatrix_with_Eigenvalues(ML_Operator *Amat, - int nBlocks, - int *blockIndices, - ML_Operator **blockMat, - struct MLSthing *widget); - -extern int ML_Gen_Smoother_OrderedSymGaussSeidel(ML *ml , int nl, int pre_or_post, - int ntimes, double omega); - -extern int ML_Gen_Smoother_ParaSails(ML *ml, int nl, int pre_or_post, int ntimes, - int sym, double thresh, int num_levels, double filter, int , int); - -extern int ML_Gen_Smoother_SymBlockGaussSeidel(ML*,int nl,int pre_post, - int ntimes, double omega, int blocksize); -extern int ML_Gen_Smoother_BlockGaussSeidel(ML*,int nl,int pre_post,int ntimes, - double omega, int blocksize); -extern void BGS_Clean(void *data); -extern int ML_Gen_Smoother_VBlockJacobi(ML*,int nl,int pre_post, int ntimes, - double omeg, int Nblocks, int *blockList); -extern int ML_Gen_Smoother_VBlockSymGaussSeidel(ML*,int nl,int pre_post, - int ntimes, double omega, int Nblocks, int *blockList); -extern int ML_Gen_Smoother_VBlockSymGaussSeidelSequential(ML*,int nl, int, - int ntimes,double omega,int Nblocks,int *blockList); -extern int ML_Gen_Smoother_VBlockKrylovJacobi(ML*,int nl,int pre_post, int ntimes, - double omeg, int Nblocks, int *blockList); -extern int ML_Gen_Smoother_OverlappedDDILUT(ML*,int nl,int pre_post); -extern int ML_Gen_Smoother_VBlockAdditiveSchwarz(ML *,int nl,int pre_or_post, - int ntimes, int length, int *blkinfo); -extern int ML_Gen_Smoother_VBlockMultiplicativeSchwarz(ML *,int nl, - int pre_or_post, int ntimes, int length, int *blkinfo); - -extern int ML_Gen_Smoother_GSextra( ML *ml , int nl, int pre_or_post, - int ntimes, double omega, int Nextra, int extra[]); -extern int ML_Set_Smoother(ML *, int nl , int pre_post, void *obj, - int (*func)(ML_Smoother *, int, double *, int, double *), - char *); - -extern int ML_Gen_CoarseSolverSuperLU(ML *ml_handle, int level); -extern int ML_Gen_CoarseSolverAggregation(ML *ml_handle, int level, - ML_Aggregate *ag); - -extern int ML_Gen_AmatrixRAP(ML *ml, int to_level, int from_level); -extern int ML_Gen_Amatrix_Global(ML_Matrix_DCSR *inmat, - ML_Matrix_DCSR *outmat, ML_Comm *comm, int *offset); - -extern int ML_Set_EqnToGridMapFunc(ML *, int,int fleng,int tleng, - int (*func)(void*,double*,double*)); -extern int ML_Set_GridToEqnMapFunc(ML *, int,int fleng,int tleng, - int (*func)(void*,double*,double*)); -extern int ML_Set_BoundaryTypes(ML*,int level,int type,int n,int *data); - -extern int ML_Setup(ML *ml, int method, int finest_level, int, void *); - -extern int ML_Gen_Solver(ML *ml, int method, int finest_level, int); -extern int ML_Iterate(ML *ml, double *sol, double *rhs); -extern int ML_Solve(ML *ml, int inlen, double *sol, int outlen, double *rhs); - -int ML_Solve_MGV( ML *ml , double *din, double *dout); - - - - -#ifdef WKC -/* WKC -- new prototype for V-cycle solve */ -int ML_Solve_MGV( ML *ml , const Epetra_MultiVector &in , - Epetra_MultiVector &out ); -#endif - -extern int ML_Solve_MGFull( ML *ml , double *din, double *dout); -extern int ML_Solve_Smoother(void *data, int isize, double *x, int osize, - double *rhs); - -extern double ML_Cycle_MG(ML_1Level *curr, double *sol, double *rhs, - int approx_all_zeros, ML_Comm *comm, int, ML *ml); - -extern int ML_Cycle_GGB(ML *ml_ggb, double *sol, double *rhs); - - -#ifdef WKC -/* WKC -- new prototype for V-cycle solve */ -extern double ML_Cycle_MG(ML_1Level *curr, Epetra_MultiVector &ep_sol, - Epetra_MultiVector &ep_rhs, - int approx_all_zeros, ML_Comm *comm, int, ML *ml); -#endif - -extern double ML_Cycle_MGFull(ML_1Level *curr, double *sol, double *rhs, - int approx_all_zeros, ML_Comm *comm, int, ML *ml); -extern int ML_Solve_AMGV( ML *ml , double *din, double *dout); -extern double ML_Cycle_AMGV(ML_1Level *curr, double *sol, double *rhs, - int approx_all_zeros, ML_Comm *comm); -extern int ML_Solve_ProjectedAMGV( ML *ml , double *din, double *dout); -extern int ML_Gen_SmootherGSextra( ML *ml , int nl, int pre_or_post, - int ntimes, double omega, int Nextra, - int extra[]); -extern int ML_MLS_Setup_Coef(void *sm, int deg, int symmetrize); -extern int ML_Seg_Solve( ML *ml , double *din, double *dout); -extern int ML_Clean_CSolveSuperLU( void *vsolver, ML_CSolveFunc *func); -extern int ML_Solver_SetScheme(ML *ml, int scheme); -extern int ML_Smoother_Reinit(ML *ml); - -extern void ML_Repartition_Set_LargestMinMaxRatio(ML*, double); -extern double ML_Repartition_Get_LargestMinMaxRatio(ML* ml); -extern void ML_Repartition_Set_MinPerProc(ML*, int); -extern int ML_Repartition_Get_MinPerProc(ML* ml); -extern void ML_Repartition_Set_Partitioner(ML*, ML_Partitioner); -extern ML_Partitioner ML_Repartition_Get_Partitioner(ML* ml); -extern void ML_Repartition_Activate(ML* ml); -extern void ML_Repartition_Deactivate(ML* ml); -extern int ML_Repartition_Status(ML* ml); -extern int ML_Use_LowMemory(); -extern void ML_Enable_LowMemory(); -extern void ML_Disable_LowMemory(); -extern void ML_Set_LevelID(ML *ml, int incr_or_decr); -extern int ML_Get_LevelID(ML *ml, int logical_level); -extern void ML_Set_Label( ML *ml, char *label); -extern int ML_Get_Label( ML *ml, char *label); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - - - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_superlu.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_superlu.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_superlu.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_superlu.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,88 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - - -/********************************************************************* */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/********************************************************************* */ -/* Utilities for Aztec/SuperLU users */ -/********************************************************************* */ - - -#ifndef __MLSUPERLU__ -#define __MLSUPERLU__ - -#include "ml_common.h" -#include "ml_solver.h" - -typedef struct ML_Sm_Schwarz_Data_Struct ML_Sm_Schwarz_Data; - -struct ML_Sm_Schwarz_Data_Struct -{ - int Nrows; - int **bmat_ia; - int **bmat_ja; - double **bmat_aa; - int **aux_bmat_ia; - int **aux_bmat_ja; - double **aux_bmat_aa; - ML_CommInfoOP *getrow_comm; - int nblocks; - int *blk_info; - int *blk_size; - int **blk_indices; - int **perm_r; - int **perm_c; -#if defined(SUPERLU) - SuperMatrix **slu_Amat; - SuperMatrix **slu_Lmat; - SuperMatrix **slu_Umat; -#endif -}; - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -extern int ML_SuperLU_Solve(ML_Solver *vsolver,int ilen,double *x,int olen, - double *rhs); - -#ifdef WKC -/* These double *'s are Epetra_MultiVector *'s in disguise */ -extern int ML_SuperLU_Solve_WKC(ML_Solver *vsolver,int ilen,double *x,int olen, - double *rhs); -#endif - -extern int ML_SuperLU_SolveLocal(void *vsolver, double *x, double *rhs); -extern int ML_CSolve_Clean_SuperLU( void *vsolver, ML_CSolveFunc *func); -extern int ML_Smoother_Create_Schwarz_Data(ML_Sm_Schwarz_Data **data); -extern int ML_Smoother_VBlockSchwarzDecomposition(ML_Sm_Schwarz_Data *, - ML_Operator *, ML_Comm *, int, int *,int*,double *,int *, - int *,int); -extern void ML_SuperLU_Set_Tile( int nprocs, int* tsz, int* stile, - int* mtile, int* ltile); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_superlu_lapack.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_superlu_lapack.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_superlu_lapack.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_superlu_lapack.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#if defined(SUPERLU) - -#include "ml_common.h" - -#ifdef SGI -#define ML_DLAMCH_FUNC -#define ML_DLAMC1_FUNC -#define ML_DLAMC2_FUNC -#define ML_DLAMC3_FUNC -#define ML_DLAMC4_FUNC -#define ML_DLAMC5_FUNC -#endif -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_twogrid_analysis.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_twogrid_analysis.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_twogrid_analysis.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_twogrid_analysis.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Some tools for two grid analysis. */ -/* ******************************************************************** */ -/* Author : Jonathan Hu (SNL) */ -/* Date : September, 2001 */ -/* ******************************************************************** */ - -#ifndef __MLTWOGRID__ -#define __MLTWOGRID__ - -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_struct.h" - -#ifndef ML_CPP -#ifdef __cplusplus - extern "C" { -#endif -#endif - -extern double ML_gdot_H0(ML_Operator *Amat, double *vec1, double *vec2); -extern double ML_gdot_H1(ML_Operator *Amat, double *vec1, double *vec2); -extern double ML_gdot_H2(ML_Operator *Amat, double *vec1, double *vec2); -extern double ML_GetCoarseGridConst(ML_Operator *Amat, ML_Operator *Rmat, - ML_Operator *Pmat, double *err_h); -extern double ML_GetSmoothingConst(ML_Operator *Amat, double *err_h, - ML_Smoother *sm); -/* -extern double ML_GetTwoLevelConvergenceFactor(ML_Operator *Amat, - ML_Operator *Rmat, ML_Operator *Pmat, - ML_Smoother *sm, - double *approx_soln, double *exact_soln); -*/ -double ML_GetTwoLevelConvergenceFactor(ML *ml, double *approx_soln, - double *exact_soln); - - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif /*ifdef __MLTWOGRID__*/ - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_utils.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_utils.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_utils.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_utils.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,165 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* Miscellaneous functions for efficient searching and sorting */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */ -/* Date : September, 1998 */ -/* ******************************************************************** */ - -#ifndef __MLUTILH__ -#define __MLUTILH__ - -#ifndef __cplusplus -#ifdef ICL -#include -#else -#include -#endif -#endif - -#ifndef ICL -#include -#endif - -/*#include "ml_struct.h"*/ -#include "ml_common.h" -#include "ml_defs.h" -#include "ml_comm.h" -#include "ml_operator.h" - -#define ML_dabs(x) (((x) > 0.) ? x : (-(x))) -#define ML_abs(x) (((x) > 0) ? x : (-(x))) -#define ML_min(a,b) (((a) <= (b)) ? (a) : (b)) -#define ML_max(x,y) (((x) > (y)) ? (x) : (y)) -#define ML_avoid_unused_param(x) ML_use_param(x,0) - - - -/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ -/* The following is included in the siesta SUN4 environment to solve */ -/* the random number generation problem */ -/* -------------------------------------------------------------------- */ -#if defined(SUN4) || defined(SUN5) - -#ifndef ML_CPP -#ifdef __cplusplus - extern "C" { -#endif -#endif - - double drand48(); - void srand48(long seedval); - -#ifndef ML_CPP -#ifdef __cplusplus - } -#endif -#endif - -#endif - - - - -#define million 0.1e7 - -#ifndef ML_CPP -#ifdef __cplusplus - extern "C" { -#endif -#endif - - int pr_error(char *fmt, ... ); - double GetClock(void); - void StartTimer(void); - void StopTimer(void); - double GetElapsedTime(void); - - int ML_crude_search( int, int, int * ); - int ML_sorted_search( int, int, int * ); - int ML_fastsorted_search( int, int, int * , int); - int ML_sorted_search2( int, int, int *, int, int ** ); - int ML_search_insert_sort( int, int *, int *, int * ); - int ML_split_dsort(double list[], int N, int *, int); - int ML_selection_dsort(double list[], int N, int *, int); - int ML_sort( int, int * ); - void ML_dsort2(double *, int N, int *); - - int ML_Check_Context( void * ); - int ML_randomize( int , int * ); - int ML_random_init(void); - void ML_random_vec(double u[], int N, ML_Comm *comm); - double ML_srandom1(int *seed); - - void ML_serial_start(ML_Comm *comm); - void ML_serial_end(ML_Comm *comm); - int ML_Coord2RBM(int Nnodes, double x[], double y[], double z[], - double rbm[], int Ndof); - void ML_az_dsort2(double dlist[], int N, int list2[]); - - /* these are functions used by Ray in his RAP thing */ - - void ML_az_sort(int list[], int N, int list2[], double list3[]); - void ML_az_dsort(double list[], int N); - void ML_gsum_scalar_int(int vals[], int vals2[], ML_Comm *comm); - void ML_gsum_vec_int(int *vals[], int *vals2[], int, ML_Comm *comm); - void ML_rm_duplicates(int array[], int *N); - void ML_splitup_big_msg(int, char *, char *, unsigned int, int *, - int *, int *, int *, int , int *, ML_Comm *); - double ML_gdot(int N, double r[], double z[], ML_Comm *comm); - double ML_gsum_double(double val, ML_Comm *comm); - void ML_gsum_vec_double(double *vals[], double *vals2[], int, ML_Comm *comm); - double ML_gmax_double(double val, ML_Comm *comm); - int ML_gmax_int(int val, ML_Comm *comm); - int ML_find_index(int key, int list[], int length); - void ML_use_param(void *data, int junk); - void ML_PauseForDebugger(ML_Comm *comm); - void ML_print_line (char *charstr, int ntimes); - - /*MS*/ - int ML_gsum_int(int val, ML_Comm *comm); - int ML_gmin_int(int val, ML_Comm *comm); - double ML_gmin_double(double val, ML_Comm *comm); - /*ms*/ - extern int ML_Operator_Print_UsingGlobalOrdering( ML_Operator *matrix, - const char label[], - int *, int *); - extern int ML_build_global_numbering( ML_Operator *Amat, - int **pglobal_numbering ); - - - int ML_Operator_Lump(ML_Operator *A, ML_Operator **B); - double ML_Global_Standard_Deviation(double sample, int n, - int activeflag, ML_Comm *comm); - - int ML_SetupCoordinates(ML *ml_ptr, int level, int NumPDEEqns, - double *in_x_coord, double *in_y_coord, - double *in_z_coord); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_vec.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_vec.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_vec.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_vec.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/* ******************************************************************** */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/* ******************************************************************** */ -/* local (to ML) data structure to hold vector information */ -/* ******************************************************************** */ -/* Author : Charles Tong (LLNL) */ -/* Date : August, 1997 */ -/* ******************************************************************** */ - -#ifndef __MLVEC__ -#define __MLVEC__ - -#include -/* #include */ -#include "ml_common.h" -#include "ml_memory.h" -#include "ml_comm.h" -#include "ml_defs.h" - -/* ******************************************************************** */ -/* definition of the grid structure */ -/* ML_id : identification for a vector */ -/* VecLength : length of vector */ -/* SetOrLoad : a flag to see if storage is allocated. */ -/* VecData : holder for data */ -/* -------------------------------------------------------------------- */ - -typedef struct ML_DVector_Struct -{ - int ML_id; - ML_Comm *comm; - int VecLength; - int SetOrLoad; - double *VecData; - -} ML_DVector; - -/* ******************************************************************** */ -/* functions to manipulate the vector structure */ -/* -------------------------------------------------------------------- */ - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" -{ -#endif -#endif - -extern int ML_DVector_Create( ML_DVector **, ML_Comm *com ); -extern int ML_DVector_Init(ML_DVector *vec); -extern int ML_DVector_Destroy( ML_DVector ** ); -extern int ML_DVector_Clean( ML_DVector *vec ); -extern int ML_DVector_LoadData( ML_DVector *, int, double * ); -extern int ML_DVector_SetData( ML_DVector *, int, double * ); -extern int ML_DVector_GetLength( ML_DVector * ); -extern int ML_DVector_GetData( ML_DVector *, int *, double * ); -extern int ML_DVector_GetDataPtr( ML_DVector *, double ** ); -extern int ML_DVector_Check( ML_DVector * ); -extern int ML_DVector_Scale( double, ML_DVector * ); -extern int ML_DVector_Copy( ML_DVector *, ML_DVector * ); -extern int ML_DVector_Axpy( double, ML_DVector *, ML_DVector * ); -extern int ML_DVector_Aypx( double, ML_DVector *, ML_DVector * ); -extern int ML_DVector_Print(int length, double *data, char *label, ML_Comm *comm); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_viz_opendx.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_viz_opendx.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_viz_opendx.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_viz_opendx.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/********************************************************************* */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -/********************************************************************* */ -/* visualization routines */ -/********************************************************************* */ - -#ifndef __MLVIZOPENDX__ -#define __MLVIZOPENDX__ - -#include "ml_viz_stats.h" - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - - extern int ML_Aggregate_VisualizeWithOpenDX( ML_Aggregate_Viz_Stats info, - char base_filename[], - ML_Comm * comm); - extern int ML_Aggregate_VisualizeXYZ( ML_Aggregate_Viz_Stats info, - char base_filename[], - ML_Comm * comm, double * vector); - - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif /* #ifndef __MLVIZOPENDX__ */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_viz_stats.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_viz_stats.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_viz_stats.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_viz_stats.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -/********************************************************************* */ -/* See the file COPYRIGHT for a complete copyright notice, contact */ -/* person and disclaimer. */ -/* ******************************************************************** */ - -#ifndef __MLVIZSTATS__ -#define __MLVIZSTATS__ - -/*MS*/ -#define ML_AGGREGATE_VIZ_STATS_ID 24680 - -typedef struct ML_Aggregate_Viz_Stats_Struct -{ - int id; - double *x; - double *y; - double *z; - int Ndim; - int *graph_decomposition; - int Nlocal; - int Naggregates; - int local_or_global; - int is_filled; - int MaxNodesPerAgg; - void *Amatrix; /* void * so that I do not have to include - ml_operator.h */ - -} ML_Aggregate_Viz_Stats; -/*ms*/ - -#endif /* #ifndef __MLAGGMETIS__ */ diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_viz_vtk.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_viz_vtk.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_viz_vtk.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_viz_vtk.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#ifndef ML_VIZ_VTK_H -#define ML_VIZ_VTK_H - -#include "ml_include.h" -#include "ml_viz_stats.h" - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -int ML_Aggregate_VisualizeVTK( ML_Aggregate_Viz_Stats info, - char base_filename[], ML_Comm *comm, double * vector); - -int ML_PlotVTK(int Npoints, double* x, double* y, double* z, - char base_filename[], USR_COMM comm, double * vector); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif /* #ifndef ML_VIZ_VTK_H */ - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_viz_xyz.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_viz_xyz.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_viz_xyz.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_viz_xyz.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#ifndef ML_VIZ_XYZ_H -#define ML_VIZ_XYZ_H - -#include "ml_include.h" -#include "ml_viz_stats.h" - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - -int ML_Aggregate_VisualizeXYZ( ML_Aggregate_Viz_Stats info, - char base_filename[], - ML_Comm *comm, - double * vector); - -int ML_PlotXYZ(int Npoints, double* x, double* y, double* z, - char base_filename[], - USR_COMM comm, double * vector); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif /* #ifndef ML_VIZ_XYZ_H */ - diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_xxt.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_xxt.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_xxt.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_xxt.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#ifndef __MLXYT__ -#define __MLXYT__ -#include "ml_common.h" -extern void setup_henry_xxt(ML *my_ml, int grid0, int **imapper, int **separator, - int **sep_size, int *Nseparators, int *Nlocal, int *Nghost, - ML_Operator **matvec_data); - -extern int CSR_submv(ML_Operator *Amat, double p[], double ap[], int mask); -int CSR_submatvec(ML_Operator *Amat, double p[], double ap[], int mask); -int ML_submv(ML_Operator *Amat, double p[], double ap[], int mask); -int ML_submatvec(ML_Operator *Amat, double p[], double ap[], int mask); - -extern int ML_Comm_subGappendInt(ML_Comm *com_ptr, int *vals, int *cur_length, - int total_length,int sub_mask); -extern void ML_subexchange_bdry(double x[], ML_CommInfoOP *comm_info, - int start_location, int total_send, ML_Comm *comm, - int mask); -#endif diff -Nru hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_xyt.h hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_xyt.h --- hypre-2.16.0/src/FEI_mv/ml/src/Include/ml_xyt.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/FEI_mv/ml/src/Include/ml_xyt.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - -#ifndef __MLXYT__ -#define __MLXYT__ - -#include "ml_common.h" -#include "ml_operator.h" - -#ifndef ML_CPP -#ifdef __cplusplus -extern "C" { -#endif -#endif - - - -extern void setup_henry(ML *my_ml, int grid0, int **imapper, int **separator, - int **sep_size, int *Nseparators, int *Nlocal, int *Nghost, - ML_Operator **matvec_data); - -int CSRxyt_submv(ML_Operator *Amat, double p[], double ap[]); -int CSR_submv(ML_Operator *Amat, double p[], double ap[]); -int CSR_xytsubmatvec(ML_Operator *Amat, double p[], double ap[], int mask); -int CSR_submatvec(ML_Operator *Amat, double p[], double ap[], int mask); -int ML_xytsubmv(ML_Operator *Amat, double p[], double ap[]); -int ML_submv(ML_Operator *Amat, double p[], double ap[]); -int ML_xytsubmatvec(ML_Operator *Amat, double p[], double ap[], int mask); -int ML_submatvec(ML_Operator *Amat, double p[], double ap[], int mask); -int ML_Gen_CoarseSolverXYT( ML *ml, int i); -void ML_XYTfree(void *temp); -void ML_xytsubexchange_bdry(double x[], ML_CommInfoOP *comm_info, - int start_location, int total_send, ML_Comm *comm, - int mask); -void ML_subexchange_bdry(double x[], ML_CommInfoOP *comm_info, - int start_location, int total_send, ML_Comm *comm, - int mask); - -extern int ML_xytComm_subGappendInt(ML_Comm *com_ptr, int *vals, int *cur_length, - int total_length,int sub_mask); -extern int ML_Comm_subGappendInt(ML_Comm *com_ptr, int *vals, int *cur_length, - int total_length,int sub_mask); - -#ifndef ML_CPP -#ifdef __cplusplus -} -#endif -#endif - -#endif diff -Nru hypre-2.16.0/src/HYPREf.h hypre-2.18.2/src/HYPREf.h --- hypre-2.16.0/src/HYPREf.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/HYPREf.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -! -*- fortran -*- -!BHEADER********************************************************************** -! Copyright (c) 2008, Lawrence Livermore National Security, LLC. -! Produced at the Lawrence Livermore National Laboratory. -! This file is part of HYPRE. See file COPYRIGHT for details. -! -! HYPRE is free software; you can redistribute it and/or modify it under the -! terms of the GNU Lesser General Public License (as published by the Free -! Software Foundation) version 2.1 dated February 1999. +! Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +! HYPRE Project Developers. See the top-level COPYRIGHT file for details. ! -! $Revision$ -!EHEADER********************************************************************** - +! SPDX-License-Identifier: (Apache-2.0 OR MIT) +! -*- fortran -*- !****************************************************************************** ! ! Header file for HYPRE library diff -Nru hypre-2.16.0/src/HYPRE.h hypre-2.18.2/src/HYPRE.h --- hypre-2.16.0/src/HYPRE.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/HYPRE.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/IJ_mv/aux_parcsr_matrix.c hypre-2.18.2/src/IJ_mv/aux_parcsr_matrix.c --- hypre-2.16.0/src/IJ_mv/aux_parcsr_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/aux_parcsr_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -25,14 +20,14 @@ HYPRE_Int hypre_AuxParCSRMatrixCreate( hypre_AuxParCSRMatrix **aux_matrix, - HYPRE_Int local_num_rows, - HYPRE_Int local_num_cols, - HYPRE_Int *sizes) + HYPRE_Int local_num_rows, + HYPRE_Int local_num_cols, + HYPRE_Int *sizes) { hypre_AuxParCSRMatrix *matrix; - + matrix = hypre_CTAlloc(hypre_AuxParCSRMatrix, 1, HYPRE_MEMORY_HOST); - + hypre_AuxParCSRMatrixLocalNumRows(matrix) = local_num_rows; hypre_AuxParCSRMatrixLocalNumCols(matrix) = local_num_cols; @@ -69,7 +64,7 @@ * hypre_AuxParCSRMatrixDestroy *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_AuxParCSRMatrixDestroy( hypre_AuxParCSRMatrix *matrix ) { HYPRE_Int ierr=0; @@ -86,25 +81,25 @@ if (hypre_AuxParCSRMatrixAuxJ(matrix)) { for (i=0; i < num_rows; i++) - hypre_TFree(hypre_AuxParCSRMatrixAuxJ(matrix)[i], HYPRE_MEMORY_HOST); - hypre_TFree(hypre_AuxParCSRMatrixAuxJ(matrix), HYPRE_MEMORY_HOST); + hypre_TFree(hypre_AuxParCSRMatrixAuxJ(matrix)[i], HYPRE_MEMORY_HOST); + hypre_TFree(hypre_AuxParCSRMatrixAuxJ(matrix), HYPRE_MEMORY_HOST); } if (hypre_AuxParCSRMatrixAuxData(matrix)) { for (i=0; i < num_rows; i++) hypre_TFree(hypre_AuxParCSRMatrixAuxData(matrix)[i], HYPRE_MEMORY_HOST); - hypre_TFree(hypre_AuxParCSRMatrixAuxData(matrix), HYPRE_MEMORY_HOST); + hypre_TFree(hypre_AuxParCSRMatrixAuxData(matrix), HYPRE_MEMORY_HOST); } if (hypre_AuxParCSRMatrixIndxDiag(matrix)) - hypre_TFree(hypre_AuxParCSRMatrixIndxDiag(matrix), HYPRE_MEMORY_HOST); + hypre_TFree(hypre_AuxParCSRMatrixIndxDiag(matrix), HYPRE_MEMORY_HOST); if (hypre_AuxParCSRMatrixIndxOffd(matrix)) - hypre_TFree(hypre_AuxParCSRMatrixIndxOffd(matrix), HYPRE_MEMORY_HOST); + hypre_TFree(hypre_AuxParCSRMatrixIndxOffd(matrix), HYPRE_MEMORY_HOST); if (hypre_AuxParCSRMatrixOffProcI(matrix)) - hypre_TFree(hypre_AuxParCSRMatrixOffProcI(matrix), HYPRE_MEMORY_HOST); + hypre_TFree(hypre_AuxParCSRMatrixOffProcI(matrix), HYPRE_MEMORY_HOST); if (hypre_AuxParCSRMatrixOffProcJ(matrix)) - hypre_TFree(hypre_AuxParCSRMatrixOffProcJ(matrix), HYPRE_MEMORY_HOST); + hypre_TFree(hypre_AuxParCSRMatrixOffProcJ(matrix), HYPRE_MEMORY_HOST); if (hypre_AuxParCSRMatrixOffProcData(matrix)) - hypre_TFree(hypre_AuxParCSRMatrixOffProcData(matrix), HYPRE_MEMORY_HOST); + hypre_TFree(hypre_AuxParCSRMatrixOffProcData(matrix), HYPRE_MEMORY_HOST); hypre_TFree(matrix, HYPRE_MEMORY_HOST); } @@ -115,7 +110,7 @@ * hypre_AuxParCSRMatrixInitialize *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_AuxParCSRMatrixInitialize( hypre_AuxParCSRMatrix *matrix ) { HYPRE_Int local_num_rows = hypre_AuxParCSRMatrixLocalNumRows(matrix); @@ -125,27 +120,27 @@ HYPRE_Complex **aux_data; HYPRE_Int i; - if (local_num_rows < 0) + if (local_num_rows < 0) return -1; - if (local_num_rows == 0) + if (local_num_rows == 0) return 0; /* allocate stash for setting or adding off processor values */ if (max_off_proc_elmts > 0) { - hypre_AuxParCSRMatrixOffProcI(matrix) = hypre_CTAlloc(HYPRE_BigInt, - 2*max_off_proc_elmts, HYPRE_MEMORY_HOST); - hypre_AuxParCSRMatrixOffProcJ(matrix) = hypre_CTAlloc(HYPRE_BigInt, - max_off_proc_elmts, HYPRE_MEMORY_HOST); - hypre_AuxParCSRMatrixOffProcData(matrix) = hypre_CTAlloc(HYPRE_Complex, - max_off_proc_elmts, HYPRE_MEMORY_HOST); + hypre_AuxParCSRMatrixOffProcI(matrix) = hypre_CTAlloc(HYPRE_BigInt, + 2*max_off_proc_elmts, HYPRE_MEMORY_HOST); + hypre_AuxParCSRMatrixOffProcJ(matrix) = hypre_CTAlloc(HYPRE_BigInt, + max_off_proc_elmts, HYPRE_MEMORY_HOST); + hypre_AuxParCSRMatrixOffProcData(matrix) = hypre_CTAlloc(HYPRE_Complex, + max_off_proc_elmts, HYPRE_MEMORY_HOST); } if (hypre_AuxParCSRMatrixNeedAux(matrix)) { aux_j = hypre_CTAlloc(HYPRE_BigInt *, local_num_rows, HYPRE_MEMORY_HOST); aux_data = hypre_CTAlloc(HYPRE_Complex *, local_num_rows, HYPRE_MEMORY_HOST); if (!hypre_AuxParCSRMatrixRowLength(matrix)) - hypre_AuxParCSRMatrixRowLength(matrix) = - hypre_CTAlloc(HYPRE_Int, local_num_rows, HYPRE_MEMORY_HOST); + hypre_AuxParCSRMatrixRowLength(matrix) = + hypre_CTAlloc(HYPRE_Int, local_num_rows, HYPRE_MEMORY_HOST); if (row_space) { for (i=0; i < local_num_rows; i++) @@ -181,9 +176,9 @@ * hypre_AuxParCSRMatrixSetMaxOffProcElmts *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_AuxParCSRMatrixSetMaxOffPRocElmts( hypre_AuxParCSRMatrix *matrix, - HYPRE_Int max_off_proc_elmts ) + HYPRE_Int max_off_proc_elmts ) { HYPRE_Int ierr = 0; hypre_AuxParCSRMatrixMaxOffProcElmts(matrix) = max_off_proc_elmts; diff -Nru hypre-2.16.0/src/IJ_mv/aux_parcsr_matrix.h hypre-2.18.2/src/IJ_mv/aux_parcsr_matrix.h --- hypre-2.16.0/src/IJ_mv/aux_parcsr_matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/aux_parcsr_matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/IJ_mv/aux_par_vector.c hypre-2.18.2/src/IJ_mv/aux_par_vector.c --- hypre-2.16.0/src/IJ_mv/aux_par_vector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/aux_par_vector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/IJ_mv/aux_par_vector.h hypre-2.18.2/src/IJ_mv/aux_par_vector.h --- hypre-2.16.0/src/IJ_mv/aux_par_vector.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/aux_par_vector.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/IJ_mv/CMakeLists.txt hypre-2.18.2/src/IJ_mv/CMakeLists.txt --- hypre-2.16.0/src/IJ_mv/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,32 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(HDRS + HYPRE_IJ_mv.h + _hypre_IJ_mv.h +) + +set(SRCS + aux_parcsr_matrix.c + aux_par_vector.c + F90_HYPRE_IJMatrix.c + F90_HYPRE_IJVector.c + F90_IJMatrix.c + HYPRE_IJMatrix.c + HYPRE_IJVector.c + IJ_assumed_part.c + IJMatrix.c + IJMatrix_parcsr.c + IJVector.c + IJVector_parcsr.c +) + +convert_filenames_to_full_paths(HDRS) +convert_filenames_to_full_paths(SRCS) + +set(HYPRE_HEADERS ${HYPRE_HEADERS} ${HDRS} PARENT_SCOPE) +set(HYPRE_SOURCES ${HYPRE_SOURCES} ${SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/IJ_mv/F90_HYPRE_IJMatrix.c hypre-2.18.2/src/IJ_mv/F90_HYPRE_IJMatrix.c --- hypre-2.16.0/src/IJ_mv/F90_HYPRE_IJMatrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/F90_HYPRE_IJMatrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/IJ_mv/F90_HYPRE_IJVector.c hypre-2.18.2/src/IJ_mv/F90_HYPRE_IJVector.c --- hypre-2.16.0/src/IJ_mv/F90_HYPRE_IJVector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/F90_HYPRE_IJVector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/IJ_mv/F90_IJMatrix.c hypre-2.18.2/src/IJ_mv/F90_IJMatrix.c --- hypre-2.16.0/src/IJ_mv/F90_IJMatrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/F90_IJMatrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/IJ_mv/headers hypre-2.18.2/src/IJ_mv/headers --- hypre-2.16.0/src/IJ_mv/headers 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/headers 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) INTERNAL_HEADER=_hypre_IJ_mv.h diff -Nru hypre-2.16.0/src/IJ_mv/HYPRE_IJMatrix.c hypre-2.18.2/src/IJ_mv/HYPRE_IJMatrix.c --- hypre-2.16.0/src/IJ_mv/HYPRE_IJMatrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/HYPRE_IJMatrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -344,38 +339,48 @@ nthreads = hypre_NumThreads(); bsize = (nvals + nthreads - 1) / nthreads; /* This distributes the remainder */ - /* Compute preliminary partial sums (in parallel) within each interval */ + if (nvals < nthreads || bsize == 1) + { + sums[0] = 0; + for (j=1; j < nvals; j++) + sums[j] += sums[j-1] + vals[j-1]; + } + else + { + + /* Compute preliminary partial sums (in parallel) within each interval */ #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(j) HYPRE_SMP_SCHEDULE #endif - for (j = 0; j < nvals; j += bsize) - { - HYPRE_Int i, n = hypre_min((j+bsize), nvals); - - sums[0] = 0; - for (i = j+1; i < n; i++) + for (j = 0; j < nvals; j += bsize) { - sums[i] = sums[i-1] + vals[i-1]; + HYPRE_Int i, n = hypre_min((j+bsize), nvals); + + sums[0] = 0; + for (i = j+1; i < n; i++) + { + sums[i] = sums[i-1] + vals[i-1]; + } } - } - - /* Compute final partial sums (in serial) for the first entry of every interval */ - for (j = bsize; j < nvals; j += bsize) - { - sums[j] = sums[j-bsize] + sums[j-1] + vals[j-1]; - } - - /* Compute final partial sums (in parallel) for the remaining entries */ + + /* Compute final partial sums (in serial) for the first entry of every interval */ + for (j = bsize; j < nvals; j += bsize) + { + sums[j] = sums[j-bsize] + sums[j-1] + vals[j-1]; + } + + /* Compute final partial sums (in parallel) for the remaining entries */ #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(j) HYPRE_SMP_SCHEDULE #endif - for (j = bsize; j < nvals; j += bsize) - { - HYPRE_Int i, n = hypre_min((j+bsize), nvals); - - for (i = j+1; i < n; i++) + for (j = bsize; j < nvals; j += bsize) { - sums[i] += sums[j]; + HYPRE_Int i, n = hypre_min((j+bsize), nvals); + + for (i = j+1; i < n; i++) + { + sums[i] += sums[j]; + } } } diff -Nru hypre-2.16.0/src/IJ_mv/_hypre_IJ_mv.h hypre-2.18.2/src/IJ_mv/_hypre_IJ_mv.h --- hypre-2.16.0/src/IJ_mv/_hypre_IJ_mv.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/_hypre_IJ_mv.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + #include @@ -13,18 +20,6 @@ extern "C" { #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - /****************************************************************************** * * Header info for Auxiliary Parallel CSR Matrix data structures @@ -99,18 +94,6 @@ #define hypre_AuxParCSRMatrixOffProcData(matrix) ((matrix) -> off_proc_data) #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - /****************************************************************************** * * Header info for Auxiliary Parallel Vector data structures @@ -145,21 +128,6 @@ #define hypre_AuxParVectorOffProcData(matrix) ((matrix) -> off_proc_data) #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - /****************************************************************************** * * Header info for the hypre_IJMatrix structures @@ -238,21 +206,6 @@ #endif #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - /****************************************************************************** * * Header info for the hypre_IJMatrix structures diff -Nru hypre-2.16.0/src/IJ_mv/HYPRE_IJ_mv.h hypre-2.18.2/src/IJ_mv/HYPRE_IJ_mv.h --- hypre-2.16.0/src/IJ_mv/HYPRE_IJ_mv.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/HYPRE_IJ_mv.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef HYPRE_IJ_MV_HEADER #define HYPRE_IJ_MV_HEADER diff -Nru hypre-2.16.0/src/IJ_mv/HYPRE_IJVector.c hypre-2.18.2/src/IJ_mv/HYPRE_IJVector.c --- hypre-2.16.0/src/IJ_mv/HYPRE_IJVector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/HYPRE_IJVector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/IJ_mv/IJ_assumed_part.c hypre-2.18.2/src/IJ_mv/IJ_assumed_part.c --- hypre-2.16.0/src/IJ_mv/IJ_assumed_part.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/IJ_assumed_part.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*---------------------------------------------------- * Functions for the IJ assumed partition fir IJ_Matrix diff -Nru hypre-2.16.0/src/IJ_mv/IJMatrix.c hypre-2.18.2/src/IJ_mv/IJMatrix.c --- hypre-2.16.0/src/IJ_mv/IJMatrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/IJMatrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -28,7 +20,7 @@ *--------------------------------------------------------------------------*/ /** -Returns a pointer to the row partitioning +Returns a pointer to the row partitioning @return integer error code @param IJMatrix [IN] @@ -37,7 +29,7 @@ HYPRE_Int hypre_IJMatrixGetRowPartitioning( HYPRE_IJMatrix matrix , - HYPRE_BigInt **row_partitioning ) + HYPRE_BigInt **row_partitioning ) { hypre_IJMatrix *ijmatrix = (hypre_IJMatrix *) matrix; @@ -71,7 +63,7 @@ HYPRE_Int hypre_IJMatrixGetColPartitioning( HYPRE_IJMatrix matrix , - HYPRE_BigInt **col_partitioning ) + HYPRE_BigInt **col_partitioning ) { hypre_IJMatrix *ijmatrix = (hypre_IJMatrix *) matrix; @@ -95,8 +87,8 @@ * hypre_IJMatrixSetObject *--------------------------------------------------------------------------*/ -HYPRE_Int -hypre_IJMatrixSetObject( HYPRE_IJMatrix matrix, +HYPRE_Int +hypre_IJMatrixSetObject( HYPRE_IJMatrix matrix, void *object ) { hypre_IJMatrix *ijmatrix = (hypre_IJMatrix *) matrix; diff -Nru hypre-2.16.0/src/IJ_mv/IJ_matrix.h hypre-2.18.2/src/IJ_mv/IJ_matrix.h --- hypre-2.16.0/src/IJ_mv/IJ_matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/IJ_matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -35,16 +27,17 @@ HYPRE_Int object_type; /* Indicates the type of "object" */ void *object; /* Structure for storing local portion */ - void *translator; /* optional storage_type specfic structure - for holding additional local info */ - void *assumed_part; /* IJMatrix assumed partition */ - HYPRE_Int assemble_flag; /* indicates whether matrix has been - assembled */ - - HYPRE_BigInt global_first_row; /* these for data items are necessary */ - HYPRE_BigInt global_first_col; /* to be able to avoind using the global */ - HYPRE_BigInt global_num_rows; /* global partition */ + void *translator; /* optional storage_type specific structure + for holding additional local info */ + void *assumed_part; /* IJMatrix assumed partition */ + HYPRE_Int assemble_flag; /* indicates whether matrix has been + assembled */ + + HYPRE_BigInt global_first_row; /* these four data items are necessary */ + HYPRE_BigInt global_first_col; /* to be able to avoid using the global */ + HYPRE_BigInt global_num_rows; /* global partition */ HYPRE_BigInt global_num_cols; + HYPRE_Int omp_flag; HYPRE_Int print_level; @@ -83,7 +76,7 @@ HYPRE_Int hypre_GetIJMatrixParCSRMatrix( HYPRE_IJMatrix IJmatrix, Mat *reference ) #endif - + #ifdef ISIS_AVAILABLE /* IJMatrix_isis.c */ HYPRE_Int diff -Nru hypre-2.16.0/src/IJ_mv/IJMatrix_isis.c hypre-2.18.2/src/IJ_mv/IJMatrix_isis.c --- hypre-2.16.0/src/IJ_mv/IJMatrix_isis.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/IJMatrix_isis.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/IJ_mv/IJMatrix_parcsr.c hypre-2.18.2/src/IJ_mv/IJMatrix_parcsr.c --- hypre-2.16.0/src/IJ_mv/IJMatrix_parcsr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/IJMatrix_parcsr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -161,7 +156,7 @@ local_num_rows = (HYPRE_Int)(row_partitioning[my_id+1]-row_partitioning[my_id]); local_num_cols = (HYPRE_Int)(col_partitioning[my_id+1]-col_partitioning[my_id]); #endif - aux_matrix = (hypre_AuxParCSRMatrix *)hypre_IJMatrixTranslator(matrix); + aux_matrix = (hypre_AuxParCSRMatrix *) hypre_IJMatrixTranslator(matrix); row_space = NULL; if (aux_matrix) { @@ -169,7 +164,7 @@ } if (!row_space) { - row_space = hypre_CTAlloc(HYPRE_Int, local_num_rows, HYPRE_MEMORY_HOST); + row_space = hypre_CTAlloc(HYPRE_Int, local_num_rows, HYPRE_MEMORY_HOST); } for (i = 0; i < local_num_rows; i++) { @@ -220,7 +215,7 @@ local_num_rows = hypre_CSRMatrixNumRows(diag); if (!diag_i) { - diag_i = hypre_CTAlloc(HYPRE_Int, local_num_rows+1, HYPRE_MEMORY_SHARED); + diag_i = hypre_CTAlloc(HYPRE_Int, local_num_rows+1, hypre_CSRMatrixMemoryLocation(diag)); } for (i = 0; i < local_num_rows; i++) { @@ -232,7 +227,7 @@ offd_i = hypre_CSRMatrixI(offd); if (!offd_i) { - offd_i = hypre_CTAlloc(HYPRE_Int, local_num_rows+1, HYPRE_MEMORY_SHARED); + offd_i = hypre_CTAlloc(HYPRE_Int, local_num_rows+1, hypre_CSRMatrixMemoryLocation(offd)); } for (i = 0; i < local_num_rows; i++) { @@ -249,7 +244,6 @@ hypre_AuxParCSRMatrixNeedAux(aux_matrix) = 0; return hypre_error_flag; - } /****************************************************************************** @@ -322,13 +316,12 @@ hypre_ParCSRMatrixInitialize(par_matrix); hypre_AuxParCSRMatrixInitialize(aux_matrix); - if (! hypre_AuxParCSRMatrixNeedAux(aux_matrix)) + if (!hypre_AuxParCSRMatrixNeedAux(aux_matrix)) { HYPRE_Int i, *indx_diag, *indx_offd, *diag_i, *offd_i; diag_i = hypre_CSRMatrixI(hypre_ParCSRMatrixDiag(par_matrix)); offd_i = hypre_CSRMatrixI(hypre_ParCSRMatrixOffd(par_matrix)); indx_diag = hypre_AuxParCSRMatrixIndxDiag(aux_matrix); - indx_offd = hypre_AuxParCSRMatrixIndxOffd(aux_matrix); #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE @@ -629,7 +622,6 @@ } return hypre_error_flag; - } /****************************************************************************** @@ -754,9 +746,9 @@ size = diag_i[row_local+1] - diag_i[row_local] + offd_i[row_local+1] - offd_i[row_local]; - if (n > size) /* >>>>> Should we change this and allow this? - This could be same column index, i.e. only last - value is set, previous ones overwritten. <<<< */ + if (n > size) /* Should we change this and allow this? + This could be same column index, i.e. only last + value is set, previous ones overwritten. */ { hypre_error(HYPRE_ERROR_GENERIC); if (print_level) @@ -967,9 +959,10 @@ { big_offd_j = hypre_CSRMatrixBigJ(offd); offd_data = hypre_CSRMatrixData(offd); - if (!big_offd_j) + if (!big_offd_j) { - big_offd_j = hypre_CTAlloc(HYPRE_BigInt, offd_i[hypre_CSRMatrixNumRows(offd)], HYPRE_MEMORY_HOST); + big_offd_j = hypre_CTAlloc(HYPRE_BigInt, offd_i[hypre_CSRMatrixNumRows(offd)], + hypre_CSRMatrixMemoryLocation(offd)); hypre_CSRMatrixBigJ(offd) = big_offd_j; } } @@ -1015,9 +1008,9 @@ } else /* insert into diag */ { + col_j = (HYPRE_Int)(cols[indx]-col_0); for (j=diag_i[row_local]; j < diag_indx; j++) { - col_j = (HYPRE_Int)(cols[indx]-col_0); if (diag_j[j] == col_j) { diag_data[j] = values[indx]; @@ -1222,12 +1215,12 @@ offd_j = hypre_CSRMatrixJ(offd); offd_data = hypre_CSRMatrixData(offd); } - size = diag_i[row_local+1] - diag_i[row_local] + + size = diag_i[row_local+1] - diag_i[row_local] + offd_i[row_local+1] - offd_i[row_local]; - if (n > size) /* >>>>> Should we change this and allow this? - This could be same column index, i.e. only last - value is set, previous ones overwritten. <<<< */ + if (n > size) /* Should we change this and allow this? + This could be same column index, i.e. only last + value is set, previous ones overwritten. */ { hypre_error(HYPRE_ERROR_GENERIC); if (print_level) @@ -1499,9 +1492,10 @@ { big_offd_j = hypre_CSRMatrixBigJ(offd); offd_data = hypre_CSRMatrixData(offd); - if (!big_offd_j) + if (!big_offd_j) { - big_offd_j = hypre_CTAlloc(HYPRE_BigInt, offd_i[hypre_CSRMatrixNumRows(offd)], HYPRE_MEMORY_HOST); + big_offd_j = hypre_CTAlloc(HYPRE_BigInt, offd_i[hypre_CSRMatrixNumRows(offd)], + hypre_CSRMatrixMemoryLocation(offd)); hypre_CSRMatrixBigJ(offd) = big_offd_j; } } @@ -1547,10 +1541,9 @@ } else /* insert into diag */ { - HYPRE_Int col_j; + HYPRE_Int col_j = (HYPRE_Int)( cols[indx] - col_0); for (j=diag_i[row_local]; j < diag_indx; j++) { - col_j = (HYPRE_Int)( cols[indx] - col_0); if (diag_j[j] == col_j) { diag_data[j] += values[indx]; @@ -2424,7 +2417,7 @@ recv_data_ptr = (void *) ((char *)recv_data_ptr + obj_size_bytes); indx++; - /* col indices */ /* Need to check this again !!!! >>>>>>> */ + /* col indices */ /* Need to check this again !!!! */ if (big_int_size == obj_size_bytes) { col_ptr = (HYPRE_BigInt *) recv_data_ptr; @@ -2665,12 +2658,12 @@ * have one, but other procs do */ aux_flag = 0; aux_flag_global = 0; - if(aux_matrix) + if (aux_matrix) { aux_flag = 1; } hypre_MPI_Allreduce(&aux_flag, &aux_flag_global, 1, HYPRE_MPI_INT, hypre_MPI_SUM, comm); - if(aux_flag_global && (!aux_flag)) + if (aux_flag_global && (!aux_flag)) { hypre_MPI_Comm_rank(comm, &my_id); num_rows = (HYPRE_Int)(row_partitioning[my_id+1] - row_partitioning[my_id]); @@ -2758,8 +2751,8 @@ if (hypre_AuxParCSRMatrixNeedAux(aux_matrix)) { HYPRE_Int *diag_array, *offd_array; - diag_array = hypre_CTAlloc(HYPRE_Int, max_num_threads, HYPRE_MEMORY_HOST); - offd_array = hypre_CTAlloc(HYPRE_Int, max_num_threads, HYPRE_MEMORY_HOST); + diag_array = hypre_CTAlloc(HYPRE_Int, max_num_threads, HYPRE_MEMORY_HOST); + offd_array = hypre_CTAlloc(HYPRE_Int, max_num_threads, HYPRE_MEMORY_HOST); aux_j = hypre_AuxParCSRMatrixAuxJ(aux_matrix); aux_data = hypre_AuxParCSRMatrixAuxData(aux_matrix); row_length = hypre_AuxParCSRMatrixRowLength(aux_matrix); @@ -2832,30 +2825,18 @@ } diag_i[num_rows] = i_diag; offd_i[num_rows] = i_offd; - if (hypre_CSRMatrixJ(diag)) - { - hypre_TFree(hypre_CSRMatrixJ(diag), HYPRE_MEMORY_HOST); - } - if (hypre_CSRMatrixData(diag)) - { - hypre_TFree(hypre_CSRMatrixData(diag), HYPRE_MEMORY_HOST); - } - if (hypre_CSRMatrixJ(offd)) - { - hypre_TFree(hypre_CSRMatrixJ(offd), HYPRE_MEMORY_HOST); - } - if (hypre_CSRMatrixData(offd)) - { - hypre_TFree(hypre_CSRMatrixData(offd), HYPRE_MEMORY_HOST); - } - diag_j = hypre_CTAlloc(HYPRE_Int, i_diag, HYPRE_MEMORY_SHARED); - diag_data = hypre_CTAlloc(HYPRE_Complex, i_diag, HYPRE_MEMORY_SHARED); - if (i_offd > 0) - { - offd_j = hypre_CTAlloc(HYPRE_Int, i_offd, HYPRE_MEMORY_SHARED); - offd_data = hypre_CTAlloc(HYPRE_Complex, i_offd, HYPRE_MEMORY_SHARED); - big_offd_j = hypre_CTAlloc(HYPRE_BigInt, i_offd, HYPRE_MEMORY_SHARED); - } + + hypre_TFree(hypre_CSRMatrixJ(diag), hypre_CSRMatrixMemoryLocation(diag)); + hypre_TFree(hypre_CSRMatrixData(diag), hypre_CSRMatrixMemoryLocation(diag)); + hypre_TFree(hypre_CSRMatrixJ(offd), hypre_CSRMatrixMemoryLocation(offd)); + hypre_TFree(hypre_CSRMatrixData(offd), hypre_CSRMatrixMemoryLocation(offd)); + hypre_TFree(hypre_CSRMatrixBigJ(offd), hypre_CSRMatrixMemoryLocation(offd)); + + diag_j = hypre_CTAlloc(HYPRE_Int, i_diag, hypre_CSRMatrixMemoryLocation(diag)); + diag_data = hypre_CTAlloc(HYPRE_Complex, i_diag, hypre_CSRMatrixMemoryLocation(diag)); + offd_j = hypre_CTAlloc(HYPRE_Int, i_offd, hypre_CSRMatrixMemoryLocation(offd)); + offd_data = hypre_CTAlloc(HYPRE_Complex, i_offd, hypre_CSRMatrixMemoryLocation(offd)); + big_offd_j = hypre_CTAlloc(HYPRE_BigInt, i_offd, hypre_CSRMatrixMemoryLocation(offd)); } #ifdef HYPRE_USING_OPENMP #pragma omp barrier @@ -2915,14 +2896,13 @@ else { /* move diagonal element into first space */ - big_offd_j = hypre_CSRMatrixBigJ(offd); diag_j = hypre_CSRMatrixJ(diag); diag_data = hypre_CSRMatrixData(diag); #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private (i,j,j0,temp) #endif - for (i=0; i < num_rows; i++) + for (i = 0; i < num_rows; i++) { j0 = diag_i[i]; for (j=j0; j < diag_i[i+1]; j++) @@ -2942,13 +2922,12 @@ offd_j = hypre_CSRMatrixJ(offd); if (!offd_j && offd_i[num_rows]) { - offd_j = hypre_CTAlloc(HYPRE_Int, offd_i[num_rows], HYPRE_MEMORY_SHARED); + offd_j = hypre_CTAlloc(HYPRE_Int, offd_i[num_rows], hypre_CSRMatrixMemoryLocation(offd)); hypre_CSRMatrixJ(offd) = offd_j; } } /* generate the nonzero rows inside offd and diag by calling */ - hypre_CSRMatrixSetRownnz(diag); hypre_CSRMatrixSetRownnz(offd); @@ -2993,6 +2972,8 @@ hypre_ParCSRMatrixColMapOffd(par_matrix) = col_map_offd; hypre_CSRMatrixNumCols(offd) = num_cols_offd; hypre_TFree(tmp_j, HYPRE_MEMORY_HOST); + hypre_TFree(big_offd_j, hypre_CSRMatrixMemoryLocation(offd)); + hypre_CSRMatrixBigJ(offd) = NULL; } hypre_IJMatrixAssembleFlag(matrix) = 1; } @@ -3003,18 +2984,6 @@ return hypre_error_flag; } -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - /****************************************************************************** * * IJMatrix_ParCSR interface @@ -3386,9 +3355,10 @@ { offd_data = hypre_CSRMatrixData(offd); big_offd_j = hypre_CSRMatrixBigJ(offd); - if (!big_offd_j) + if (!big_offd_j) { - big_offd_j = hypre_CTAlloc(HYPRE_BigInt, offd_i[hypre_CSRMatrixNumRows(offd)], HYPRE_MEMORY_HOST); + big_offd_j = hypre_CTAlloc(HYPRE_BigInt, offd_i[hypre_CSRMatrixNumRows(offd)], + hypre_CSRMatrixMemoryLocation(offd)); hypre_CSRMatrixBigJ(offd) = big_offd_j; } } @@ -4003,9 +3973,10 @@ { big_offd_j = hypre_CSRMatrixBigJ(offd); offd_data = hypre_CSRMatrixData(offd); - if (!big_offd_j) + if (!big_offd_j) { - big_offd_j = hypre_CTAlloc(HYPRE_BigInt, offd_i[hypre_CSRMatrixNumRows(offd)], HYPRE_MEMORY_HOST); + big_offd_j = hypre_CTAlloc(HYPRE_BigInt, offd_i[hypre_CSRMatrixNumRows(offd)], + hypre_CSRMatrixMemoryLocation(offd)); hypre_CSRMatrixBigJ(offd) = big_offd_j; } } diff -Nru hypre-2.16.0/src/IJ_mv/IJMatrix_petsc.c hypre-2.18.2/src/IJ_mv/IJMatrix_petsc.c --- hypre-2.16.0/src/IJ_mv/IJMatrix_petsc.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/IJMatrix_petsc.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/IJ_mv/IJVector.c hypre-2.18.2/src/IJ_mv/IJVector.c --- hypre-2.16.0/src/IJ_mv/IJVector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/IJVector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/IJ_mv/IJ_vector.h hypre-2.18.2/src/IJ_mv/IJ_vector.h --- hypre-2.16.0/src/IJ_mv/IJ_vector.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/IJ_vector.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/IJ_mv/IJVector_parcsr.c hypre-2.18.2/src/IJ_mv/IJVector_parcsr.c --- hypre-2.16.0/src/IJ_mv/IJVector_parcsr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/IJVector_parcsr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/IJ_mv/Makefile hypre-2.18.2/src/IJ_mv/Makefile --- hypre-2.16.0/src/IJ_mv/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/IJ_mv/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config diff -Nru hypre-2.16.0/src/krylov/bicgstab.c hypre-2.18.2/src/krylov/bicgstab.c --- hypre-2.16.0/src/krylov/bicgstab.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/bicgstab.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/bicgstab.h hypre-2.18.2/src/krylov/bicgstab.h --- hypre-2.16.0/src/krylov/bicgstab.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/bicgstab.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/cgnr.c hypre-2.18.2/src/krylov/cgnr.c --- hypre-2.16.0/src/krylov/cgnr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/cgnr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/cgnr.h hypre-2.18.2/src/krylov/cgnr.h --- hypre-2.16.0/src/krylov/cgnr.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/cgnr.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/CMakeLists.txt hypre-2.18.2/src/krylov/CMakeLists.txt --- hypre-2.16.0/src/krylov/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/krylov/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,39 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(HDRS + HYPRE_krylov.h + HYPRE_lobpcg.h + HYPRE_MatvecFunctions.h + krylov.h + lobpcg.h +) + +set(SRCS + bicgstab.c + cgnr.c + cogmres.c + gmres.c + flexgmres.c + lgmres.c + HYPRE_bicgstab.c + HYPRE_cgnr.c + HYPRE_gmres.c + HYPRE_cogmres.c + HYPRE_lgmres.c + HYPRE_flexgmres.c + HYPRE_pcg.c + pcg.c + HYPRE_lobpcg.c + lobpcg.c +) + +convert_filenames_to_full_paths(HDRS) +convert_filenames_to_full_paths(SRCS) + +set(HYPRE_HEADERS ${HYPRE_HEADERS} ${HDRS} PARENT_SCOPE) +set(HYPRE_SOURCES ${HYPRE_SOURCES} ${SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/krylov/cogmres.c hypre-2.18.2/src/krylov/cogmres.c --- hypre-2.16.0/src/krylov/cogmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/cogmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - * implemented in NREL for ExaWind project - * communication optimal GMRES requires less synchronizations - * +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/cogmres.h hypre-2.18.2/src/krylov/cogmres.h --- hypre-2.16.0/src/krylov/cogmres.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/cogmres.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/flexgmres.c hypre-2.18.2/src/krylov/flexgmres.c --- hypre-2.16.0/src/krylov/flexgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/flexgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/flexgmres.h hypre-2.18.2/src/krylov/flexgmres.h --- hypre-2.16.0/src/krylov/flexgmres.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/flexgmres.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/gmres.c hypre-2.18.2/src/krylov/gmres.c --- hypre-2.16.0/src/krylov/gmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/gmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -116,7 +111,7 @@ HYPRE_Int hypre_GMRESDestroy( void *gmres_vdata ) { - hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; + hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; HYPRE_Int i; if (gmres_data) @@ -144,7 +139,9 @@ for (i = 0; i < (gmres_data -> k_dim+1); i++) { if ( (gmres_data -> p)[i] != NULL ) - (*(gmres_functions->DestroyVector))( (gmres_data -> p) [i]); + { + (*(gmres_functions->DestroyVector))( (gmres_data -> p) [i]); + } } hypre_TFreeF( gmres_data->p, gmres_functions ); } @@ -200,7 +197,7 @@ *--------------------------------------------------*/ if ((gmres_data -> p) == NULL) - (gmres_data -> p) = (void**)(*(gmres_functions->CreateVectorArray))(k_dim+1,x); + (gmres_data -> p) = (void**)(*(gmres_functions->CreateVectorArray))(k_dim+1,x); if ((gmres_data -> r) == NULL) (gmres_data -> r) = (*(gmres_functions->CreateVector))(b); if ((gmres_data -> w) == NULL) @@ -226,11 +223,14 @@ { if ((gmres_data -> norms) != NULL) hypre_TFreeF(gmres_data -> norms,gmres_functions); - (gmres_data -> norms) = hypre_CTAllocF(HYPRE_Real, max_iter + 1,gmres_functions, HYPRE_MEMORY_HOST); + (gmres_data -> norms) = hypre_CTAllocF(HYPRE_Real, max_iter + 1,gmres_functions, HYPRE_MEMORY_HOST); } - if ( (gmres_data->print_level) > 0 ) { + if ( (gmres_data->print_level) > 0 ) + { if ((gmres_data -> log_file_name) == NULL) - (gmres_data -> log_file_name) = (char*)"gmres.out.log"; + { + (gmres_data -> log_file_name) = (char*)"gmres.out.log"; + } } return hypre_error_flag; @@ -244,41 +244,40 @@ hypre_GMRESSolve(void *gmres_vdata, void *A, void *b, - void *x) + void *x) { - hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; - hypre_GMRESFunctions *gmres_functions = gmres_data->functions; - HYPRE_Int k_dim = (gmres_data -> k_dim); - HYPRE_Int min_iter = (gmres_data -> min_iter); - HYPRE_Int max_iter = (gmres_data -> max_iter); - HYPRE_Int rel_change = (gmres_data -> rel_change); - HYPRE_Int skip_real_r_check = (gmres_data -> skip_real_r_check); - HYPRE_Int hybrid = (gmres_data -> hybrid); - HYPRE_Real r_tol = (gmres_data -> tol); - HYPRE_Real cf_tol = (gmres_data -> cf_tol); - HYPRE_Real a_tol = (gmres_data -> a_tol); - void *matvec_data = (gmres_data -> matvec_data); - - void *r = (gmres_data -> r); - void *w = (gmres_data -> w); + hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; + hypre_GMRESFunctions *gmres_functions = gmres_data->functions; + HYPRE_Int k_dim = (gmres_data -> k_dim); + HYPRE_Int min_iter = (gmres_data -> min_iter); + HYPRE_Int max_iter = (gmres_data -> max_iter); + HYPRE_Int rel_change = (gmres_data -> rel_change); + HYPRE_Int skip_real_r_check = (gmres_data -> skip_real_r_check); + HYPRE_Int hybrid = (gmres_data -> hybrid); + HYPRE_Real r_tol = (gmres_data -> tol); + HYPRE_Real cf_tol = (gmres_data -> cf_tol); + HYPRE_Real a_tol = (gmres_data -> a_tol); + void *matvec_data = (gmres_data -> matvec_data); + void *r = (gmres_data -> r); + void *w = (gmres_data -> w); /* note: w_2 is only allocated if rel_change = 1 */ - void *w_2 = (gmres_data -> w_2); + void *w_2 = (gmres_data -> w_2); - void **p = (gmres_data -> p); + void **p = (gmres_data -> p); - HYPRE_Int (*precond)(void*,void*,void*,void*) = (gmres_functions -> precond); - HYPRE_Int *precond_data = (HYPRE_Int*)(gmres_data -> precond_data); + HYPRE_Int (*precond)(void*,void*,void*,void*) = (gmres_functions -> precond); + HYPRE_Int *precond_data = (HYPRE_Int*) (gmres_data -> precond_data); - HYPRE_Int print_level = (gmres_data -> print_level); - HYPRE_Int logging = (gmres_data -> logging); + HYPRE_Int print_level = (gmres_data -> print_level); + HYPRE_Int logging = (gmres_data -> logging); - HYPRE_Real *norms = (gmres_data -> norms); + HYPRE_Real *norms = (gmres_data -> norms); /* not used yet char *log_file_name = (gmres_data -> log_file_name);*/ /* FILE *fp; */ - + HYPRE_Int break_value = 0; - HYPRE_Int i, j, k; + HYPRE_Int i, j, k; HYPRE_Real *rs, **hh, *c, *s, *rs_2; HYPRE_Int iter; HYPRE_Int my_id, num_procs; @@ -311,21 +310,21 @@ (*(gmres_functions->CommInfo))(A,&my_id,&num_procs); if ( logging>0 || print_level>0 ) { - norms = (gmres_data -> norms); + norms = (gmres_data -> norms); } /* initialize work arrays */ rs = hypre_CTAllocF(HYPRE_Real,k_dim+1,gmres_functions, HYPRE_MEMORY_HOST); c = hypre_CTAllocF(HYPRE_Real,k_dim,gmres_functions, HYPRE_MEMORY_HOST); s = hypre_CTAllocF(HYPRE_Real,k_dim,gmres_functions, HYPRE_MEMORY_HOST); - if (rel_change) rs_2 = hypre_CTAllocF(HYPRE_Real,k_dim+1,gmres_functions, HYPRE_MEMORY_HOST); - - - + if (rel_change) + { + rs_2 = hypre_CTAllocF(HYPRE_Real,k_dim+1,gmres_functions, HYPRE_MEMORY_HOST); + } hh = hypre_CTAllocF(HYPRE_Real*,k_dim+1,gmres_functions, HYPRE_MEMORY_HOST); for (i=0; i < k_dim+1; i++) - { - hh[i] = hypre_CTAllocF(HYPRE_Real,k_dim,gmres_functions, HYPRE_MEMORY_HOST); + { + hh[i] = hypre_CTAllocF(HYPRE_Real,k_dim,gmres_functions, HYPRE_MEMORY_HOST); } (*(gmres_functions->CopyVector))(b,p[0]); @@ -338,7 +337,10 @@ /* Since it is does not diminish performance, attempt to return an error flag and notify users when they supply bad input. */ - if (b_norm != 0.) ieee_check = b_norm/b_norm; /* INF -> NaN conversion */ + if (b_norm != 0.) + { + ieee_check = b_norm/b_norm; /* INF -> NaN conversion */ + } if (ieee_check != ieee_check) { /* ...INFs or NaNs in input can make ieee_check a NaN. This test @@ -348,11 +350,11 @@ found at http://HTTP.CS.Berkeley.EDU/~wkahan/ieee754status/IEEE754.PDF */ if (logging > 0 || print_level > 0) { - hypre_printf("\n\nERROR detected by Hypre ... BEGIN\n"); - hypre_printf("ERROR -- hypre_GMRESSolve: INFs and/or NaNs detected in input.\n"); - hypre_printf("User probably placed non-numerics in supplied b.\n"); - hypre_printf("Returning error flag += 101. Program not terminated.\n"); - hypre_printf("ERROR detected by Hypre ... END\n\n\n"); + hypre_printf("\n\nERROR detected by Hypre ... BEGIN\n"); + hypre_printf("ERROR -- hypre_GMRESSolve: INFs and/or NaNs detected in input.\n"); + hypre_printf("User probably placed non-numerics in supplied b.\n"); + hypre_printf("Returning error flag += 101. Program not terminated.\n"); + hypre_printf("ERROR detected by Hypre ... END\n\n\n"); } hypre_error(HYPRE_ERROR_GENERIC); return hypre_error_flag; @@ -363,7 +365,10 @@ /* Since it is does not diminish performance, attempt to return an error flag and notify users when they supply bad input. */ - if (r_norm != 0.) ieee_check = r_norm/r_norm; /* INF -> NaN conversion */ + if (r_norm != 0.) + { + ieee_check = r_norm/r_norm; /* INF -> NaN conversion */ + } if (ieee_check != ieee_check) { /* ...INFs or NaNs in input can make ieee_check a NaN. This test @@ -373,11 +378,11 @@ found at http://HTTP.CS.Berkeley.EDU/~wkahan/ieee754status/IEEE754.PDF */ if (logging > 0 || print_level > 0) { - hypre_printf("\n\nERROR detected by Hypre ... BEGIN\n"); - hypre_printf("ERROR -- hypre_GMRESSolve: INFs and/or NaNs detected in input.\n"); - hypre_printf("User probably placed non-numerics in supplied A or x_0.\n"); - hypre_printf("Returning error flag += 101. Program not terminated.\n"); - hypre_printf("ERROR detected by Hypre ... END\n\n\n"); + hypre_printf("\n\nERROR detected by Hypre ... BEGIN\n"); + hypre_printf("ERROR -- hypre_GMRESSolve: INFs and/or NaNs detected in input.\n"); + hypre_printf("User probably placed non-numerics in supplied A or x_0.\n"); + hypre_printf("Returning error flag += 101. Program not terminated.\n"); + hypre_printf("ERROR detected by Hypre ... END\n\n\n"); } hypre_error(HYPRE_ERROR_GENERIC); return hypre_error_flag; @@ -388,25 +393,26 @@ norms[0] = r_norm; if ( print_level>1 && my_id == 0 ) { - hypre_printf("L2 norm of b: %e\n", b_norm); + hypre_printf("L2 norm of b: %e\n", b_norm); if (b_norm == 0.0) + { hypre_printf("Rel_resid_norm actually contains the residual norm\n"); + } hypre_printf("Initial L2 norm of residual: %e\n", r_norm); - } } iter = 0; if (b_norm > 0.0) { - /* convergence criterion |r_i|/|b| <= accuracy if |b| > 0 */ - den_norm= b_norm; + /* convergence criterion |r_i|/|b| <= accuracy if |b| > 0 */ + den_norm= b_norm; } else { - /* convergence criterion |r_i|/|r0| <= accuracy if |b| = 0 */ - den_norm= r_norm; - }; + /* convergence criterion |r_i|/|r0| <= accuracy if |b| = 0 */ + den_norm= r_norm; + } /* convergence criteria: |r_i| <= max( a_tol, r_tol * den_norm) @@ -426,154 +432,158 @@ hypre_printf("=============================================\n\n"); hypre_printf("Iters resid.norm conv.rate rel.res.norm\n"); hypre_printf("----- ------------ ---------- ------------\n"); - } else { hypre_printf("=============================================\n\n"); hypre_printf("Iters resid.norm conv.rate\n"); hypre_printf("----- ------------ ----------\n"); - - }; + } } - /* once the rel. change check has passed, we do not want to check it again */ rel_change_passed = 0; - /* outer iteration cycle */ while (iter < max_iter) { - /* initialize first term of hessenberg system */ + /* initialize first term of hessenberg system */ - rs[0] = r_norm; - if (r_norm == 0.0) - { - hypre_TFreeF(c,gmres_functions); - hypre_TFreeF(s,gmres_functions); - hypre_TFreeF(rs,gmres_functions); - if (rel_change) hypre_TFreeF(rs_2,gmres_functions); - for (i=0; i < k_dim+1; i++) hypre_TFreeF(hh[i],gmres_functions); - hypre_TFreeF(hh,gmres_functions); - return hypre_error_flag; - - } - - /* see if we are already converged and - should print the final norm and exit */ - if (r_norm <= epsilon && iter >= min_iter) - { - if (!rel_change) /* shouldn't exit after no iterations if - * relative change is on*/ - { - (*(gmres_functions->CopyVector))(b,r); - (*(gmres_functions->Matvec))(matvec_data,-1.0,A,x,1.0,r); - r_norm = sqrt((*(gmres_functions->InnerProd))(r,r)); - if (r_norm <= epsilon) - { - if ( print_level>1 && my_id == 0) - { - hypre_printf("\n\n"); - hypre_printf("Final L2 norm of residual: %e\n\n", r_norm); - } - break; - } - else - if ( print_level>0 && my_id == 0) - hypre_printf("false convergence 1\n"); - } - } + rs[0] = r_norm; + if (r_norm == 0.0) + { + hypre_TFreeF(c,gmres_functions); + hypre_TFreeF(s,gmres_functions); + hypre_TFreeF(rs,gmres_functions); + if (rel_change) hypre_TFreeF(rs_2,gmres_functions); + for (i=0; i < k_dim+1; i++) hypre_TFreeF(hh[i],gmres_functions); + hypre_TFreeF(hh,gmres_functions); + return hypre_error_flag; + } - - - t = 1.0 / r_norm; - (*(gmres_functions->ScaleVector))(t,p[0]); - i = 0; - - /***RESTART CYCLE (right-preconditioning) ***/ - while (i < k_dim && iter < max_iter) - { - i++; - iter++; - (*(gmres_functions->ClearVector))(r); - precond(precond_data, A, p[i-1], r); - (*(gmres_functions->Matvec))(matvec_data, 1.0, A, r, 0.0, p[i]); - /* modified Gram_Schmidt */ - for (j=0; j < i; j++) - { - hh[j][i-1] = (*(gmres_functions->InnerProd))(p[j],p[i]); - (*(gmres_functions->Axpy))(-hh[j][i-1],p[j],p[i]); - } - t = sqrt((*(gmres_functions->InnerProd))(p[i],p[i])); - hh[i][i-1] = t; - if (t != 0.0) - { - t = 1.0/t; - (*(gmres_functions->ScaleVector))(t,p[i]); - } - /* done with modified Gram_schmidt and Arnoldi step. - update factorization of hh */ - for (j = 1; j < i; j++) - { - t = hh[j-1][i-1]; - hh[j-1][i-1] = s[j-1]*hh[j][i-1] + c[j-1]*t; - hh[j][i-1] = -s[j-1]*t + c[j-1]*hh[j][i-1]; - } - t= hh[i][i-1]*hh[i][i-1]; - t+= hh[i-1][i-1]*hh[i-1][i-1]; - gamma = sqrt(t); - if (gamma == 0.0) gamma = epsmac; - c[i-1] = hh[i-1][i-1]/gamma; - s[i-1] = hh[i][i-1]/gamma; - rs[i] = -hh[i][i-1]*rs[i-1]; - rs[i]/= gamma; - rs[i-1] = c[i-1]*rs[i-1]; - /* determine residual norm */ - hh[i-1][i-1] = s[i-1]*hh[i][i-1] + c[i-1]*hh[i-1][i-1]; - r_norm = fabs(rs[i]); - - /* print ? */ - if ( print_level>0 ) - { - norms[iter] = r_norm; - if ( print_level>1 && my_id == 0 ) - { - if (b_norm > 0.0) - hypre_printf("% 5d %e %f %e\n", iter, - norms[iter],norms[iter]/norms[iter-1], - norms[iter]/b_norm); - else - hypre_printf("% 5d %e %f\n", iter, norms[iter], - norms[iter]/norms[iter-1]); - } - } - /*convergence factor tolerance */ - if (cf_tol > 0.0) - { - cf_ave_0 = cf_ave_1; - cf_ave_1 = pow( r_norm / r_norm_0, 1.0/(2.0*iter)); - - weight = fabs(cf_ave_1 - cf_ave_0); - weight = weight / hypre_max(cf_ave_1, cf_ave_0); - weight = 1.0 - weight; + /* see if we are already converged and + should print the final norm and exit */ + if (r_norm <= epsilon && iter >= min_iter) + { + if (!rel_change) /* shouldn't exit after no iterations if + * relative change is on*/ + { + (*(gmres_functions->CopyVector))(b,r); + (*(gmres_functions->Matvec))(matvec_data,-1.0,A,x,1.0,r); + r_norm = sqrt((*(gmres_functions->InnerProd))(r,r)); + if (r_norm <= epsilon) + { + if ( print_level>1 && my_id == 0) + { + hypre_printf("\n\n"); + hypre_printf("Final L2 norm of residual: %e\n\n", r_norm); + } + break; + } + else + { + if ( print_level>0 && my_id == 0) + { + hypre_printf("false convergence 1\n"); + } + } + } + } + + t = 1.0 / r_norm; + (*(gmres_functions->ScaleVector))(t,p[0]); + i = 0; + + /***RESTART CYCLE (right-preconditioning) ***/ + while (i < k_dim && iter < max_iter) + { + i++; + iter++; + (*(gmres_functions->ClearVector))(r); + precond(precond_data, A, p[i-1], r); + (*(gmres_functions->Matvec))(matvec_data, 1.0, A, r, 0.0, p[i]); + /* modified Gram_Schmidt */ + for (j=0; j < i; j++) + { + hh[j][i-1] = (*(gmres_functions->InnerProd))(p[j],p[i]); + (*(gmres_functions->Axpy))(-hh[j][i-1],p[j],p[i]); + } + t = sqrt((*(gmres_functions->InnerProd))(p[i],p[i])); + hh[i][i-1] = t; + if (t != 0.0) + { + t = 1.0/t; + (*(gmres_functions->ScaleVector))(t,p[i]); + } + /* done with modified Gram_schmidt and Arnoldi step. + update factorization of hh */ + for (j = 1; j < i; j++) + { + t = hh[j-1][i-1]; + hh[j-1][i-1] = s[j-1]*hh[j][i-1] + c[j-1]*t; + hh[j][i-1] = -s[j-1]*t + c[j-1]*hh[j][i-1]; + } + t= hh[i][i-1]*hh[i][i-1]; + t+= hh[i-1][i-1]*hh[i-1][i-1]; + gamma = sqrt(t); + if (gamma == 0.0) + { + gamma = epsmac; + } + c[i-1] = hh[i-1][i-1]/gamma; + s[i-1] = hh[i][i-1]/gamma; + rs[i] = -hh[i][i-1]*rs[i-1]; + rs[i]/= gamma; + rs[i-1] = c[i-1]*rs[i-1]; + /* determine residual norm */ + hh[i-1][i-1] = s[i-1]*hh[i][i-1] + c[i-1]*hh[i-1][i-1]; + r_norm = fabs(rs[i]); + + /* print ? */ + if ( print_level>0 ) + { + norms[iter] = r_norm; + if ( print_level>1 && my_id == 0 ) + { + if (b_norm > 0.0) + { + hypre_printf("% 5d %e %f %e\n", iter, + norms[iter],norms[iter]/norms[iter-1], + norms[iter]/b_norm); + } + else + { + hypre_printf("% 5d %e %f\n", iter, norms[iter], + norms[iter]/norms[iter-1]); + } + } + } + /*convergence factor tolerance */ + if (cf_tol > 0.0) + { + cf_ave_0 = cf_ave_1; + cf_ave_1 = pow( r_norm / r_norm_0, 1.0/(2.0*iter)); + + weight = fabs(cf_ave_1 - cf_ave_0); + weight = weight / hypre_max(cf_ave_1, cf_ave_0); + weight = 1.0 - weight; #if 0 - hypre_printf("I = %d: cf_new = %e, cf_old = %e, weight = %e\n", - i, cf_ave_1, cf_ave_0, weight ); + hypre_printf("I = %d: cf_new = %e, cf_old = %e, weight = %e\n", + i, cf_ave_1, cf_ave_0, weight ); #endif - if (weight * cf_ave_1 > cf_tol) - { - break_value = 1; - break; - } - } - /* should we exit the restart cycle? (conv. check) */ - if (r_norm <= epsilon && iter >= min_iter) - { - if (rel_change && !rel_change_passed) - { - - /* To decide whether to break here: to actually + if (weight * cf_ave_1 > cf_tol) + { + break_value = 1; + break; + } + } + /* should we exit the restart cycle? (conv. check) */ + if (r_norm <= epsilon && iter >= min_iter) + { + if (rel_change && !rel_change_passed) + { + + /* To decide whether to break here: to actually determine the relative change requires the approx solution (so a triangular solve) and a precond. solve - so if we have to do this many @@ -585,269 +595,288 @@ and check the relative change outside the cycle. Here we will check the relative here as we don't want to exit the restart cycle prematurely */ - - for (k=0; k= 0; k--) - { - t = 0.0; - for (j = k+1; j < i; j++) - { - t -= hh[k][j]*rs_2[j]; - } - t+= rs_2[k]; - rs_2[k] = t/hh[k][k]; - } - - (*(gmres_functions->CopyVector))(p[i-1],w); - (*(gmres_functions->ScaleVector))(rs_2[i-1],w); - for (j = i-2; j >=0; j--) - (*(gmres_functions->Axpy))(rs_2[j], p[j], w); - - (*(gmres_functions->ClearVector))(r); - /* find correction (in r) */ - precond(precond_data, A, w, r); - /* copy current solution (x) to w (don't want to over-write x)*/ - (*(gmres_functions->CopyVector))(x,w); - - /* add the correction */ - (*(gmres_functions->Axpy))(1.0,r,w); - - /* now w is the approx solution - get the norm*/ - x_norm = sqrt( (*(gmres_functions->InnerProd))(w,w) ); - - if ( !(x_norm <= guard_zero_residual )) - /* don't divide by zero */ - { /* now get x_i - x_i-1 */ - - if (num_rel_change_check) - { - /* have already checked once so we can avoid another precond. - solve */ - (*(gmres_functions->CopyVector))(w, r); - (*(gmres_functions->Axpy))(-1.0, w_2, r); - /* now r contains x_i - x_i-1*/ - - /* save current soln w in w_2 for next time */ - (*(gmres_functions->CopyVector))(w, w_2); - } - else - { - /* first time to check rel change*/ - - /* first save current soln w in w_2 for next time */ - (*(gmres_functions->CopyVector))(w, w_2); - - /* for relative change take x_(i-1) to be - x + M^{-1}[sum{j=0..i-2} rs_j p_j ]. - Now - x_i - x_{i-1}= {x + M^{-1}[sum{j=0..i-1} rs_j p_j ]} - - {x + M^{-1}[sum{j=0..i-2} rs_j p_j ]} - = M^{-1} rs_{i-1}{p_{i-1}} */ - - (*(gmres_functions->ClearVector))(w); - (*(gmres_functions->Axpy))(rs_2[i-1], p[i-1], w); - (*(gmres_functions->ClearVector))(r); - /* apply the preconditioner */ - precond(precond_data, A, w, r); - /* now r contains x_i - x_i-1 */ - } - /* find the norm of x_i - x_i-1 */ - w_norm = sqrt( (*(gmres_functions->InnerProd))(r,r) ); - relative_error = w_norm/x_norm; - if (relative_error <= r_tol) - { - rel_change_passed = 1; - break; - } - } - else - { - rel_change_passed = 1; - break; - - } - num_rel_change_check++; - } - else /* no relative change */ - { - break; - } - } - - - } /*** end of restart cycle ***/ - - /* now compute solution, first solve upper triangular system */ - - if (break_value) break; - - rs[i-1] = rs[i-1]/hh[i-1][i-1]; - for (k = i-2; k >= 0; k--) - { - t = 0.0; - for (j = k+1; j < i; j++) - { - t -= hh[k][j]*rs[j]; - } - t+= rs[k]; - rs[k] = t/hh[k][k]; - } - - (*(gmres_functions->CopyVector))(p[i-1],w); - (*(gmres_functions->ScaleVector))(rs[i-1],w); - for (j = i-2; j >=0; j--) - (*(gmres_functions->Axpy))(rs[j], p[j], w); - - (*(gmres_functions->ClearVector))(r); - /* find correction (in r) */ - precond(precond_data, A, w, r); - - /* update current solution x (in x) */ - (*(gmres_functions->Axpy))(1.0,r,x); - - - /* check for convergence by evaluating the actual residual */ - if (r_norm <= epsilon && iter >= min_iter) - { - if (skip_real_r_check) - { - (gmres_data -> converged) = 1; - break; - } - - /* calculate actual residual norm*/ - (*(gmres_functions->CopyVector))(b,r); - (*(gmres_functions->Matvec))(matvec_data,-1.0,A,x,1.0,r); - real_r_norm_new = r_norm = sqrt( (*(gmres_functions->InnerProd))(r,r) ); - - if (r_norm <= epsilon) - { - if (rel_change && !rel_change_passed) /* calculate the relative change */ - { - - /* calculate the norm of the solution */ - x_norm = sqrt( (*(gmres_functions->InnerProd))(x,x) ); - - if ( !(x_norm <= guard_zero_residual )) - /* don't divide by zero */ - { - - /* for relative change take x_(i-1) to be - x + M^{-1}[sum{j=0..i-2} rs_j p_j ]. - Now - x_i - x_{i-1}= {x + M^{-1}[sum{j=0..i-1} rs_j p_j ]} - - {x + M^{-1}[sum{j=0..i-2} rs_j p_j ]} - = M^{-1} rs_{i-1}{p_{i-1}} */ - (*(gmres_functions->ClearVector))(w); - (*(gmres_functions->Axpy))(rs[i-1], p[i-1], w); - (*(gmres_functions->ClearVector))(r); - /* apply the preconditioner */ - precond(precond_data, A, w, r); - /* find the norm of x_i - x_i-1 */ - w_norm = sqrt( (*(gmres_functions->InnerProd))(r,r) ); - relative_error= w_norm/x_norm; - if ( relative_error < r_tol ) - { - (gmres_data -> converged) = 1; - if ( print_level>1 && my_id == 0 ) - { - hypre_printf("\n\n"); - hypre_printf("Final L2 norm of residual: %e\n\n", r_norm); - } - break; - } - } - else - { - (gmres_data -> converged) = 1; - if ( print_level>1 && my_id == 0 ) - { - hypre_printf("\n\n"); - hypre_printf("Final L2 norm of residual: %e\n\n", r_norm); - } - break; - } - - } - else /* don't need to check rel. change */ - { - if ( print_level>1 && my_id == 0 ) - { - hypre_printf("\n\n"); - hypre_printf("Final L2 norm of residual: %e\n\n", r_norm); - } - (gmres_data -> converged) = 1; - break; - } - } - else /* conv. has not occurred, according to true residual */ - { - /* exit if the real residual norm has not decreased */ - if (real_r_norm_new >= real_r_norm_old) - { - if (print_level > 1 && my_id == 0) - { - hypre_printf("\n\n"); - hypre_printf("Final L2 norm of residual: %e\n\n", r_norm); - } - (gmres_data -> converged) = 1; - break; - } - - /* report discrepancy between real/GMRES residuals and restart */ - if ( print_level>0 && my_id == 0) - hypre_printf("false convergence 2, L2 norm of residual: %e\n", r_norm); - (*(gmres_functions->CopyVector))(r,p[0]); - i = 0; - real_r_norm_old = real_r_norm_new; - } - } /* end of convergence check */ - - /* compute residual vector and continue loop */ - for (j=i ; j > 0; j--) - { - rs[j-1] = -s[j-1]*rs[j]; - rs[j] = c[j-1]*rs[j]; - } - - if (i) (*(gmres_functions->Axpy))(rs[i]-1.0,p[i],p[i]); - for (j=i-1 ; j > 0; j--) - (*(gmres_functions->Axpy))(rs[j],p[j],p[i]); - - if (i) - { - (*(gmres_functions->Axpy))(rs[0]-1.0,p[0],p[0]); - (*(gmres_functions->Axpy))(1.0,p[i],p[0]); - } + + for (k=0; k= 0; k--) + { + t = 0.0; + for (j = k+1; j < i; j++) + { + t -= hh[k][j]*rs_2[j]; + } + t+= rs_2[k]; + rs_2[k] = t/hh[k][k]; + } + + (*(gmres_functions->CopyVector))(p[i-1],w); + (*(gmres_functions->ScaleVector))(rs_2[i-1],w); + for (j = i-2; j >=0; j--) + { + (*(gmres_functions->Axpy))(rs_2[j], p[j], w); + } + (*(gmres_functions->ClearVector))(r); + /* find correction (in r) */ + precond(precond_data, A, w, r); + /* copy current solution (x) to w (don't want to over-write x)*/ + (*(gmres_functions->CopyVector))(x,w); + + /* add the correction */ + (*(gmres_functions->Axpy))(1.0,r,w); + + /* now w is the approx solution - get the norm*/ + x_norm = sqrt( (*(gmres_functions->InnerProd))(w,w) ); + + if ( !(x_norm <= guard_zero_residual )) + /* don't divide by zero */ + { /* now get x_i - x_i-1 */ + + if (num_rel_change_check) + { + /* have already checked once so we can avoid another precond. + solve */ + (*(gmres_functions->CopyVector))(w, r); + (*(gmres_functions->Axpy))(-1.0, w_2, r); + /* now r contains x_i - x_i-1*/ + + /* save current soln w in w_2 for next time */ + (*(gmres_functions->CopyVector))(w, w_2); + } + else + { + /* first time to check rel change*/ + + /* first save current soln w in w_2 for next time */ + (*(gmres_functions->CopyVector))(w, w_2); + + /* for relative change take x_(i-1) to be + x + M^{-1}[sum{j=0..i-2} rs_j p_j ]. + Now + x_i - x_{i-1}= {x + M^{-1}[sum{j=0..i-1} rs_j p_j ]} + - {x + M^{-1}[sum{j=0..i-2} rs_j p_j ]} + = M^{-1} rs_{i-1}{p_{i-1}} */ + + (*(gmres_functions->ClearVector))(w); + (*(gmres_functions->Axpy))(rs_2[i-1], p[i-1], w); + (*(gmres_functions->ClearVector))(r); + /* apply the preconditioner */ + precond(precond_data, A, w, r); + /* now r contains x_i - x_i-1 */ + } + /* find the norm of x_i - x_i-1 */ + w_norm = sqrt( (*(gmres_functions->InnerProd))(r,r) ); + relative_error = w_norm/x_norm; + if (relative_error <= r_tol) + { + rel_change_passed = 1; + break; + } + } + else + { + rel_change_passed = 1; + break; + + } + num_rel_change_check++; + } + else /* no relative change */ + { + break; + } + } + } /*** end of restart cycle ***/ + + /* now compute solution, first solve upper triangular system */ + + if (break_value) + { + break; + } + + rs[i-1] = rs[i-1]/hh[i-1][i-1]; + for (k = i-2; k >= 0; k--) + { + t = 0.0; + for (j = k+1; j < i; j++) + { + t -= hh[k][j]*rs[j]; + } + t += rs[k]; + rs[k] = t/hh[k][k]; + } + + (*(gmres_functions->CopyVector))(p[i-1],w); + (*(gmres_functions->ScaleVector))(rs[i-1],w); + for (j = i-2; j >=0; j--) + (*(gmres_functions->Axpy))(rs[j], p[j], w); + + (*(gmres_functions->ClearVector))(r); + /* find correction (in r) */ + precond(precond_data, A, w, r); + + /* update current solution x (in x) */ + (*(gmres_functions->Axpy))(1.0,r,x); + + /* check for convergence by evaluating the actual residual */ + if (r_norm <= epsilon && iter >= min_iter) + { + if (skip_real_r_check) + { + (gmres_data -> converged) = 1; + break; + } + + /* calculate actual residual norm*/ + (*(gmres_functions->CopyVector))(b,r); + (*(gmres_functions->Matvec))(matvec_data,-1.0,A,x,1.0,r); + real_r_norm_new = r_norm = sqrt( (*(gmres_functions->InnerProd))(r,r) ); + + if (r_norm <= epsilon) + { + if (rel_change && !rel_change_passed) /* calculate the relative change */ + { + /* calculate the norm of the solution */ + x_norm = sqrt( (*(gmres_functions->InnerProd))(x,x) ); + + if ( !(x_norm <= guard_zero_residual )) + /* don't divide by zero */ + { + /* for relative change take x_(i-1) to be + x + M^{-1}[sum{j=0..i-2} rs_j p_j ]. + Now + x_i - x_{i-1}= {x + M^{-1}[sum{j=0..i-1} rs_j p_j ]} + - {x + M^{-1}[sum{j=0..i-2} rs_j p_j ]} + = M^{-1} rs_{i-1}{p_{i-1}} */ + (*(gmres_functions->ClearVector))(w); + (*(gmres_functions->Axpy))(rs[i-1], p[i-1], w); + (*(gmres_functions->ClearVector))(r); + /* apply the preconditioner */ + precond(precond_data, A, w, r); + /* find the norm of x_i - x_i-1 */ + w_norm = sqrt( (*(gmres_functions->InnerProd))(r,r) ); + relative_error= w_norm/x_norm; + if ( relative_error < r_tol ) + { + (gmres_data -> converged) = 1; + if ( print_level>1 && my_id == 0 ) + { + hypre_printf("\n\n"); + hypre_printf("Final L2 norm of residual: %e\n\n", r_norm); + } + break; + } + } + else + { + (gmres_data -> converged) = 1; + if ( print_level>1 && my_id == 0 ) + { + hypre_printf("\n\n"); + hypre_printf("Final L2 norm of residual: %e\n\n", r_norm); + } + break; + } + + } + else /* don't need to check rel. change */ + { + if ( print_level>1 && my_id == 0 ) + { + hypre_printf("\n\n"); + hypre_printf("Final L2 norm of residual: %e\n\n", r_norm); + } + (gmres_data -> converged) = 1; + break; + } + } + else /* conv. has not occurred, according to true residual */ + { + /* exit if the real residual norm has not decreased */ + if (real_r_norm_new >= real_r_norm_old) + { + if (print_level > 1 && my_id == 0) + { + hypre_printf("\n\n"); + hypre_printf("Final L2 norm of residual: %e\n\n", r_norm); + } + (gmres_data -> converged) = 1; + break; + } + + /* report discrepancy between real/GMRES residuals and restart */ + if ( print_level>0 && my_id == 0) + { + hypre_printf("false convergence 2, L2 norm of residual: %e\n", r_norm); + } + (*(gmres_functions->CopyVector))(r,p[0]); + i = 0; + real_r_norm_old = real_r_norm_new; + } + } /* end of convergence check */ + + /* compute residual vector and continue loop */ + for (j=i ; j > 0; j--) + { + rs[j-1] = -s[j-1]*rs[j]; + rs[j] = c[j-1]*rs[j]; + } + + if (i) (*(gmres_functions->Axpy))(rs[i]-1.0,p[i],p[i]); + for (j=i-1 ; j > 0; j--) + (*(gmres_functions->Axpy))(rs[j],p[j],p[i]); + + if (i) + { + (*(gmres_functions->Axpy))(rs[0]-1.0,p[0],p[0]); + (*(gmres_functions->Axpy))(1.0,p[i],p[0]); + } } /* END of iteration while loop */ if ( print_level>1 && my_id == 0 ) - hypre_printf("\n\n"); + { + hypre_printf("\n\n"); + } (gmres_data -> num_iterations) = iter; + if (b_norm > 0.0) + { (gmres_data -> rel_residual_norm) = r_norm/b_norm; + } + if (b_norm == 0.0) + { (gmres_data -> rel_residual_norm) = r_norm; + } - if (iter >= max_iter && r_norm > epsilon && epsilon > 0 && hybrid != -1) hypre_error(HYPRE_ERROR_CONV); + if (iter >= max_iter && r_norm > epsilon && epsilon > 0 && hybrid != -1) + { + hypre_error(HYPRE_ERROR_CONV); + } - hypre_TFreeF(c,gmres_functions); - hypre_TFreeF(s,gmres_functions); - hypre_TFreeF(rs,gmres_functions); - if (rel_change) hypre_TFreeF(rs_2,gmres_functions); + hypre_TFreeF(c, gmres_functions); + hypre_TFreeF(s, gmres_functions); + hypre_TFreeF(rs, gmres_functions); + + if (rel_change) + { + hypre_TFreeF(rs_2,gmres_functions); + } for (i=0; i < k_dim+1; i++) - { - hypre_TFreeF(hh[i],gmres_functions); + { + hypre_TFreeF(hh[i],gmres_functions); } - hypre_TFreeF(hh,gmres_functions); + + hypre_TFreeF(hh, gmres_functions); return hypre_error_flag; } @@ -857,10 +886,10 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_GMRESSetKDim( void *gmres_vdata, - HYPRE_Int k_dim ) +hypre_GMRESSetKDim( void *gmres_vdata, + HYPRE_Int k_dim ) { - hypre_GMRESData *gmres_data =(hypre_GMRESData *) gmres_vdata; + hypre_GMRESData *gmres_data =(hypre_GMRESData *) gmres_vdata; (gmres_data -> k_dim) = k_dim; @@ -870,8 +899,8 @@ } HYPRE_Int -hypre_GMRESGetKDim( void *gmres_vdata, - HYPRE_Int * k_dim ) +hypre_GMRESGetKDim( void *gmres_vdata, + HYPRE_Int *k_dim ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -886,8 +915,8 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_GMRESSetTol( void *gmres_vdata, - HYPRE_Real tol ) +hypre_GMRESSetTol( void *gmres_vdata, + HYPRE_Real tol ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -898,8 +927,8 @@ } HYPRE_Int -hypre_GMRESGetTol( void *gmres_vdata, - HYPRE_Real * tol ) +hypre_GMRESGetTol( void *gmres_vdata, + HYPRE_Real *tol ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -913,8 +942,8 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_GMRESSetAbsoluteTol( void *gmres_vdata, - HYPRE_Real a_tol ) +hypre_GMRESSetAbsoluteTol( void *gmres_vdata, + HYPRE_Real a_tol ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -925,8 +954,8 @@ } HYPRE_Int -hypre_GMRESGetAbsoluteTol( void *gmres_vdata, - HYPRE_Real * a_tol ) +hypre_GMRESGetAbsoluteTol( void *gmres_vdata, + HYPRE_Real *a_tol ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -940,8 +969,8 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_GMRESSetConvergenceFactorTol( void *gmres_vdata, - HYPRE_Real cf_tol ) +hypre_GMRESSetConvergenceFactorTol( void *gmres_vdata, + HYPRE_Real cf_tol ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -952,8 +981,8 @@ } HYPRE_Int -hypre_GMRESGetConvergenceFactorTol( void *gmres_vdata, - HYPRE_Real * cf_tol ) +hypre_GMRESGetConvergenceFactorTol( void *gmres_vdata, + HYPRE_Real *cf_tol ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -968,8 +997,8 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_GMRESSetMinIter( void *gmres_vdata, - HYPRE_Int min_iter ) +hypre_GMRESSetMinIter( void *gmres_vdata, + HYPRE_Int min_iter ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -980,8 +1009,8 @@ } HYPRE_Int -hypre_GMRESGetMinIter( void *gmres_vdata, - HYPRE_Int * min_iter ) +hypre_GMRESGetMinIter( void *gmres_vdata, + HYPRE_Int *min_iter ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -996,8 +1025,8 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_GMRESSetMaxIter( void *gmres_vdata, - HYPRE_Int max_iter ) +hypre_GMRESSetMaxIter( void *gmres_vdata, + HYPRE_Int max_iter ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -1008,8 +1037,8 @@ } HYPRE_Int -hypre_GMRESGetMaxIter( void *gmres_vdata, - HYPRE_Int * max_iter ) +hypre_GMRESGetMaxIter( void *gmres_vdata, + HYPRE_Int *max_iter ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -1024,8 +1053,8 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_GMRESSetRelChange( void *gmres_vdata, - HYPRE_Int rel_change ) +hypre_GMRESSetRelChange( void *gmres_vdata, + HYPRE_Int rel_change ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -1036,8 +1065,8 @@ } HYPRE_Int -hypre_GMRESGetRelChange( void *gmres_vdata, - HYPRE_Int * rel_change ) +hypre_GMRESGetRelChange( void *gmres_vdata, + HYPRE_Int *rel_change ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -1052,7 +1081,7 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_GMRESSetSkipRealResidualCheck( void *gmres_vdata, +hypre_GMRESSetSkipRealResidualCheck( void *gmres_vdata, HYPRE_Int skip_real_r_check ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -1063,7 +1092,7 @@ } HYPRE_Int -hypre_GMRESGetSkipRealResidualCheck( void *gmres_vdata, +hypre_GMRESGetSkipRealResidualCheck( void *gmres_vdata, HYPRE_Int *skip_real_r_check) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -1080,8 +1109,8 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_GMRESSetStopCrit( void *gmres_vdata, - HYPRE_Int stop_crit ) +hypre_GMRESSetStopCrit( void *gmres_vdata, + HYPRE_Int stop_crit ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -1092,8 +1121,8 @@ } HYPRE_Int -hypre_GMRESGetStopCrit( void *gmres_vdata, - HYPRE_Int * stop_crit ) +hypre_GMRESGetStopCrit( void *gmres_vdata, + HYPRE_Int *stop_crit ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -1119,7 +1148,7 @@ (gmres_functions -> precond) = precond; (gmres_functions -> precond_setup) = precond_setup; - (gmres_data -> precond_data) = precond_data; + (gmres_data -> precond_data) = precond_data; return hypre_error_flag; } @@ -1145,8 +1174,8 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_GMRESSetPrintLevel( void *gmres_vdata, - HYPRE_Int level) +hypre_GMRESSetPrintLevel( void *gmres_vdata, + HYPRE_Int level) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -1157,8 +1186,8 @@ } HYPRE_Int -hypre_GMRESGetPrintLevel( void *gmres_vdata, - HYPRE_Int * level) +hypre_GMRESGetPrintLevel( void *gmres_vdata, + HYPRE_Int *level) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -1173,22 +1202,22 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_GMRESSetLogging( void *gmres_vdata, - HYPRE_Int level) +hypre_GMRESSetLogging( void *gmres_vdata, + HYPRE_Int level) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; - + (gmres_data -> logging) = level; return hypre_error_flag; } HYPRE_Int -hypre_GMRESGetLogging( void *gmres_vdata, - HYPRE_Int * level) +hypre_GMRESGetLogging( void *gmres_vdata, + HYPRE_Int *level) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; - + *level = (gmres_data -> logging); return hypre_error_flag; @@ -1210,8 +1239,8 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_GMRESGetNumIterations( void *gmres_vdata, - HYPRE_Int *num_iterations ) +hypre_GMRESGetNumIterations( void *gmres_vdata, + HYPRE_Int *num_iterations ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -1226,8 +1255,8 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_GMRESGetConverged( void *gmres_vdata, - HYPRE_Int *converged ) +hypre_GMRESGetConverged( void *gmres_vdata, + HYPRE_Int *converged ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; @@ -1242,7 +1271,7 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_GMRESGetFinalRelativeResidualNorm( void *gmres_vdata, +hypre_GMRESGetFinalRelativeResidualNorm( void *gmres_vdata, HYPRE_Real *relative_residual_norm ) { hypre_GMRESData *gmres_data = (hypre_GMRESData *)gmres_vdata; diff -Nru hypre-2.16.0/src/krylov/gmres.h hypre-2.18.2/src/krylov/gmres.h --- hypre-2.16.0/src/krylov/gmres.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/gmres.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/headers hypre-2.18.2/src/krylov/headers --- hypre-2.16.0/src/krylov/headers 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/headers 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) INTERNAL_HEADER=krylov.h diff -Nru hypre-2.16.0/src/krylov/HYPRE_bicgstab.c hypre-2.18.2/src/krylov/HYPRE_bicgstab.c --- hypre-2.16.0/src/krylov/HYPRE_bicgstab.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/HYPRE_bicgstab.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/HYPRE_cgnr.c hypre-2.18.2/src/krylov/HYPRE_cgnr.c --- hypre-2.16.0/src/krylov/HYPRE_cgnr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/HYPRE_cgnr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/HYPRE_cogmres.c hypre-2.18.2/src/krylov/HYPRE_cogmres.c --- hypre-2.16.0/src/krylov/HYPRE_cogmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/HYPRE_cogmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/HYPRE_flexgmres.c hypre-2.18.2/src/krylov/HYPRE_flexgmres.c --- hypre-2.16.0/src/krylov/HYPRE_flexgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/HYPRE_flexgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/HYPRE_gmres.c hypre-2.18.2/src/krylov/HYPRE_gmres.c --- hypre-2.16.0/src/krylov/HYPRE_gmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/HYPRE_gmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -39,9 +30,9 @@ HYPRE_Int HYPRE_GMRESSetup( HYPRE_Solver solver, - HYPRE_Matrix A, - HYPRE_Vector b, - HYPRE_Vector x ) + HYPRE_Matrix A, + HYPRE_Vector b, + HYPRE_Vector x ) { return( hypre_GMRESSetup( solver, A, @@ -55,9 +46,9 @@ HYPRE_Int HYPRE_GMRESSolve( HYPRE_Solver solver, - HYPRE_Matrix A, - HYPRE_Vector b, - HYPRE_Vector x ) + HYPRE_Matrix A, + HYPRE_Vector b, + HYPRE_Vector x ) { return( hypre_GMRESSolve( solver, A, @@ -232,9 +223,9 @@ HYPRE_Int HYPRE_GMRESSetPrecond( HYPRE_Solver solver, - HYPRE_PtrToSolverFcn precond, - HYPRE_PtrToSolverFcn precond_setup, - HYPRE_Solver precond_solver ) + HYPRE_PtrToSolverFcn precond, + HYPRE_PtrToSolverFcn precond_setup, + HYPRE_Solver precond_solver ) { return( hypre_GMRESSetPrecond( (void *) solver, (HYPRE_Int (*)(void*, void*, void*, void*))precond, diff -Nru hypre-2.16.0/src/krylov/HYPRE_krylov.h hypre-2.18.2/src/krylov/HYPRE_krylov.h --- hypre-2.16.0/src/krylov/HYPRE_krylov.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/HYPRE_krylov.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef HYPRE_KRYLOV_HEADER #define HYPRE_KRYLOV_HEADER diff -Nru hypre-2.16.0/src/krylov/HYPRE_lgmres.c hypre-2.18.2/src/krylov/HYPRE_lgmres.c --- hypre-2.16.0/src/krylov/HYPRE_lgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/HYPRE_lgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/HYPRE_lobpcg.c hypre-2.18.2/src/krylov/HYPRE_lobpcg.c --- hypre-2.16.0/src/krylov/HYPRE_lobpcg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/HYPRE_lobpcg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/HYPRE_lobpcg.h hypre-2.18.2/src/krylov/HYPRE_lobpcg.h --- hypre-2.16.0/src/krylov/HYPRE_lobpcg.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/HYPRE_lobpcg.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_LOBPCG_SOLVER #define hypre_LOBPCG_SOLVER diff -Nru hypre-2.16.0/src/krylov/HYPRE_MatvecFunctions.h hypre-2.18.2/src/krylov/HYPRE_MatvecFunctions.h --- hypre-2.16.0/src/krylov/HYPRE_MatvecFunctions.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/HYPRE_MatvecFunctions.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef HYPRE_MATVEC_FUNCTIONS #define HYPRE_MATVEC_FUNCTIONS diff -Nru hypre-2.16.0/src/krylov/HYPRE_pcg.c hypre-2.18.2/src/krylov/HYPRE_pcg.c --- hypre-2.16.0/src/krylov/HYPRE_pcg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/HYPRE_pcg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/krylov.h hypre-2.18.2/src/krylov/krylov.h --- hypre-2.16.0/src/krylov/krylov.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/krylov.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "HYPRE_krylov.h" @@ -30,18 +25,6 @@ extern "C" { #endif - /*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - /****************************************************************************** * * BiCGSTAB bicgstab @@ -218,18 +201,6 @@ #endif - /*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - /****************************************************************************** * * cgnr (conjugate gradient on the normal equations A^TAx = A^Tb) functions @@ -381,18 +352,6 @@ #endif - /*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - /****************************************************************************** * * GMRES gmres @@ -553,18 +512,6 @@ #endif #endif - /*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - /***********KS code ****************/ /****************************************************************************** * @@ -899,18 +846,6 @@ #endif #endif - /*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - /****************************************************************************** * * FLEXGMRES flexible gmres @@ -1068,18 +1003,6 @@ #endif #endif - /*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - /****************************************************************************** * * Preconditioned conjugate gradient (Omin) headers diff -Nru hypre-2.16.0/src/krylov/lgmres.c hypre-2.18.2/src/krylov/lgmres.c --- hypre-2.16.0/src/krylov/lgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/lgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/lgmres.h hypre-2.18.2/src/krylov/lgmres.h --- hypre-2.16.0/src/krylov/lgmres.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/lgmres.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/lobpcg.c hypre-2.18.2/src/krylov/lobpcg.c --- hypre-2.16.0/src/krylov/lobpcg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/lobpcg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/lobpcg.h hypre-2.18.2/src/krylov/lobpcg.h --- hypre-2.16.0/src/krylov/lobpcg.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/lobpcg.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "multivector.h" diff -Nru hypre-2.16.0/src/krylov/Makefile hypre-2.18.2/src/krylov/Makefile --- hypre-2.16.0/src/krylov/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config diff -Nru hypre-2.16.0/src/krylov/pcg.c hypre-2.18.2/src/krylov/pcg.c --- hypre-2.16.0/src/krylov/pcg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/pcg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/krylov/pcg.h hypre-2.18.2/src/krylov/pcg.h --- hypre-2.16.0/src/krylov/pcg.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/krylov/pcg.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/lapack/CMakeLists.txt hypre-2.18.2/src/lapack/CMakeLists.txt --- hypre-2.16.0/src/lapack/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/lapack/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,92 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(SRCS + dbdsqr.c + dgebd2.c + dgebrd.c + dgelq2.c + dgelqf.c + dgels.c + dgeqr2.c + dgeqrf.c + dgesvd.c + dgetrf.c + dgetri.c + dgetrs.c + dgetf2.c + dlabad.c + dlabrd.c + dlacpy.c + dlae2.c + dlaev2.c + dlamch.c + dlange.c + dlanst.c + dlansy.c + dlapy2.c + dlarfb.c + dlarf.c + dlarfg.c + dlarft.c + dlartg.c + dlas2.c + dlascl.c + dlaset.c + dlasq1.c + dlasq2.c + dlasq3.c + dlasq4.c + dlasq5.c + dlasq6.c + dlasr.c + dlasrt.c + dlassq.c + dlaswp.c + dlasv2.c + dlatrd.c + dorg2l.c + dorg2r.c + dorgbr.c + dorgl2.c + dorglq.c + dorgql.c + dorgqr.c + dorgtr.c + dorm2r.c + dormbr.c + dorml2.c + dormlq.c + dormqr.c + dpotf2.c + dpotrf.c + dpotrs.c + dsteqr.c + dsterf.c + dsyev.c + dsygs2.c + dsygst.c + dsygv.c + dsytd2.c + dsytrd.c + dtrti2.c + dtrtri.c + ieeeck.c + ilaenv.c + lsame.c + xerbla.c +) + +convert_filenames_to_full_paths(SRCS) + +set(HYPRE_SOURCES ${HYPRE_SOURCES} ${SRCS} PARENT_SCOPE) + +# Turn optimization off for this file +if (MSVC) + set_source_files_properties (dlamch.c PROPERTIES COMPILE_FLAGS /Od) +else () + set_source_files_properties (dlamch.c PROPERTIES COMPILE_FLAGS -O0) +endif () + diff -Nru hypre-2.16.0/src/lapack/COPYING hypre-2.18.2/src/lapack/COPYING --- hypre-2.16.0/src/lapack/COPYING 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/lapack/COPYING 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,36 @@ +Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + +$COPYRIGHT$ + +Additional copyrights may follow + +$HEADER$ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +- Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer listed + in this license in the documentation and/or other materials + provided with the distribution. + +- Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff -Nru hypre-2.16.0/src/lapack/dbdsqr.c hypre-2.18.2/src/lapack/dbdsqr.c --- hypre-2.16.0/src/lapack/dbdsqr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dbdsqr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dgebd2.c hypre-2.18.2/src/lapack/dgebd2.c --- hypre-2.16.0/src/lapack/dgebd2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dgebd2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dgebrd.c hypre-2.18.2/src/lapack/dgebrd.c --- hypre-2.16.0/src/lapack/dgebrd.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dgebrd.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dgelq2.c hypre-2.18.2/src/lapack/dgelq2.c --- hypre-2.16.0/src/lapack/dgelq2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dgelq2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dgelqf.c hypre-2.18.2/src/lapack/dgelqf.c --- hypre-2.16.0/src/lapack/dgelqf.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dgelqf.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dgels.c hypre-2.18.2/src/lapack/dgels.c --- hypre-2.16.0/src/lapack/dgels.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dgels.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dgeqr2.c hypre-2.18.2/src/lapack/dgeqr2.c --- hypre-2.16.0/src/lapack/dgeqr2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dgeqr2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dgeqrf.c hypre-2.18.2/src/lapack/dgeqrf.c --- hypre-2.16.0/src/lapack/dgeqrf.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dgeqrf.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dgesvd.c hypre-2.18.2/src/lapack/dgesvd.c --- hypre-2.16.0/src/lapack/dgesvd.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dgesvd.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dgetf2.c hypre-2.18.2/src/lapack/dgetf2.c --- hypre-2.16.0/src/lapack/dgetf2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dgetf2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dgetrf.c hypre-2.18.2/src/lapack/dgetrf.c --- hypre-2.16.0/src/lapack/dgetrf.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dgetrf.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dgetri.c hypre-2.18.2/src/lapack/dgetri.c --- hypre-2.16.0/src/lapack/dgetri.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dgetri.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dgetrs.c hypre-2.18.2/src/lapack/dgetrs.c --- hypre-2.16.0/src/lapack/dgetrs.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dgetrs.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlabad.c hypre-2.18.2/src/lapack/dlabad.c --- hypre-2.16.0/src/lapack/dlabad.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlabad.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlabrd.c hypre-2.18.2/src/lapack/dlabrd.c --- hypre-2.16.0/src/lapack/dlabrd.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlabrd.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlacpy.c hypre-2.18.2/src/lapack/dlacpy.c --- hypre-2.16.0/src/lapack/dlacpy.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlacpy.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlae2.c hypre-2.18.2/src/lapack/dlae2.c --- hypre-2.16.0/src/lapack/dlae2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlae2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlaev2.c hypre-2.18.2/src/lapack/dlaev2.c --- hypre-2.16.0/src/lapack/dlaev2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlaev2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlamch.c hypre-2.18.2/src/lapack/dlamch.c --- hypre-2.16.0/src/lapack/dlamch.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlamch.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlange.c hypre-2.18.2/src/lapack/dlange.c --- hypre-2.16.0/src/lapack/dlange.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlange.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlanst.c hypre-2.18.2/src/lapack/dlanst.c --- hypre-2.16.0/src/lapack/dlanst.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlanst.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlansy.c hypre-2.18.2/src/lapack/dlansy.c --- hypre-2.16.0/src/lapack/dlansy.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlansy.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlapy2.c hypre-2.18.2/src/lapack/dlapy2.c --- hypre-2.16.0/src/lapack/dlapy2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlapy2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlarfb.c hypre-2.18.2/src/lapack/dlarfb.c --- hypre-2.16.0/src/lapack/dlarfb.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlarfb.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlarf.c hypre-2.18.2/src/lapack/dlarf.c --- hypre-2.16.0/src/lapack/dlarf.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlarf.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlarfg.c hypre-2.18.2/src/lapack/dlarfg.c --- hypre-2.16.0/src/lapack/dlarfg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlarfg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlarft.c hypre-2.18.2/src/lapack/dlarft.c --- hypre-2.16.0/src/lapack/dlarft.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlarft.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlartg.c hypre-2.18.2/src/lapack/dlartg.c --- hypre-2.16.0/src/lapack/dlartg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlartg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlas2.c hypre-2.18.2/src/lapack/dlas2.c --- hypre-2.16.0/src/lapack/dlas2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlas2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlascl.c hypre-2.18.2/src/lapack/dlascl.c --- hypre-2.16.0/src/lapack/dlascl.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlascl.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlaset.c hypre-2.18.2/src/lapack/dlaset.c --- hypre-2.16.0/src/lapack/dlaset.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlaset.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlasq1.c hypre-2.18.2/src/lapack/dlasq1.c --- hypre-2.16.0/src/lapack/dlasq1.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlasq1.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlasq2.c hypre-2.18.2/src/lapack/dlasq2.c --- hypre-2.16.0/src/lapack/dlasq2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlasq2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlasq3.c hypre-2.18.2/src/lapack/dlasq3.c --- hypre-2.16.0/src/lapack/dlasq3.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlasq3.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlasq4.c hypre-2.18.2/src/lapack/dlasq4.c --- hypre-2.16.0/src/lapack/dlasq4.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlasq4.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlasq5.c hypre-2.18.2/src/lapack/dlasq5.c --- hypre-2.16.0/src/lapack/dlasq5.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlasq5.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlasq6.c hypre-2.18.2/src/lapack/dlasq6.c --- hypre-2.16.0/src/lapack/dlasq6.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlasq6.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlasr.c hypre-2.18.2/src/lapack/dlasr.c --- hypre-2.16.0/src/lapack/dlasr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlasr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlasrt.c hypre-2.18.2/src/lapack/dlasrt.c --- hypre-2.16.0/src/lapack/dlasrt.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlasrt.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlassq.c hypre-2.18.2/src/lapack/dlassq.c --- hypre-2.16.0/src/lapack/dlassq.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlassq.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlasv2.c hypre-2.18.2/src/lapack/dlasv2.c --- hypre-2.16.0/src/lapack/dlasv2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlasv2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlaswp.c hypre-2.18.2/src/lapack/dlaswp.c --- hypre-2.16.0/src/lapack/dlaswp.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlaswp.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dlatrd.c hypre-2.18.2/src/lapack/dlatrd.c --- hypre-2.16.0/src/lapack/dlatrd.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dlatrd.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dorg2l.c hypre-2.18.2/src/lapack/dorg2l.c --- hypre-2.16.0/src/lapack/dorg2l.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dorg2l.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dorg2r.c hypre-2.18.2/src/lapack/dorg2r.c --- hypre-2.16.0/src/lapack/dorg2r.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dorg2r.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dorgbr.c hypre-2.18.2/src/lapack/dorgbr.c --- hypre-2.16.0/src/lapack/dorgbr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dorgbr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dorgl2.c hypre-2.18.2/src/lapack/dorgl2.c --- hypre-2.16.0/src/lapack/dorgl2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dorgl2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dorglq.c hypre-2.18.2/src/lapack/dorglq.c --- hypre-2.16.0/src/lapack/dorglq.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dorglq.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dorgql.c hypre-2.18.2/src/lapack/dorgql.c --- hypre-2.16.0/src/lapack/dorgql.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dorgql.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dorgqr.c hypre-2.18.2/src/lapack/dorgqr.c --- hypre-2.16.0/src/lapack/dorgqr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dorgqr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dorgtr.c hypre-2.18.2/src/lapack/dorgtr.c --- hypre-2.16.0/src/lapack/dorgtr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dorgtr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dorm2r.c hypre-2.18.2/src/lapack/dorm2r.c --- hypre-2.16.0/src/lapack/dorm2r.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dorm2r.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dormbr.c hypre-2.18.2/src/lapack/dormbr.c --- hypre-2.16.0/src/lapack/dormbr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dormbr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dorml2.c hypre-2.18.2/src/lapack/dorml2.c --- hypre-2.16.0/src/lapack/dorml2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dorml2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dormlq.c hypre-2.18.2/src/lapack/dormlq.c --- hypre-2.16.0/src/lapack/dormlq.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dormlq.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dormqr.c hypre-2.18.2/src/lapack/dormqr.c --- hypre-2.16.0/src/lapack/dormqr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dormqr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dpotf2.c hypre-2.18.2/src/lapack/dpotf2.c --- hypre-2.16.0/src/lapack/dpotf2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dpotf2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dpotrf.c hypre-2.18.2/src/lapack/dpotrf.c --- hypre-2.16.0/src/lapack/dpotrf.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dpotrf.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dpotrs.c hypre-2.18.2/src/lapack/dpotrs.c --- hypre-2.16.0/src/lapack/dpotrs.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dpotrs.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dsteqr.c hypre-2.18.2/src/lapack/dsteqr.c --- hypre-2.16.0/src/lapack/dsteqr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dsteqr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dsterf.c hypre-2.18.2/src/lapack/dsterf.c --- hypre-2.16.0/src/lapack/dsterf.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dsterf.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dsyev.c hypre-2.18.2/src/lapack/dsyev.c --- hypre-2.16.0/src/lapack/dsyev.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dsyev.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dsygs2.c hypre-2.18.2/src/lapack/dsygs2.c --- hypre-2.16.0/src/lapack/dsygs2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dsygs2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dsygst.c hypre-2.18.2/src/lapack/dsygst.c --- hypre-2.16.0/src/lapack/dsygst.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dsygst.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dsygv.c hypre-2.18.2/src/lapack/dsygv.c --- hypre-2.16.0/src/lapack/dsygv.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dsygv.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dsytd2.c hypre-2.18.2/src/lapack/dsytd2.c --- hypre-2.16.0/src/lapack/dsytd2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dsytd2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dsytrd.c hypre-2.18.2/src/lapack/dsytrd.c --- hypre-2.16.0/src/lapack/dsytrd.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dsytrd.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dtrti2.c hypre-2.18.2/src/lapack/dtrti2.c --- hypre-2.16.0/src/lapack/dtrti2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dtrti2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/dtrtri.c hypre-2.18.2/src/lapack/dtrtri.c --- hypre-2.16.0/src/lapack/dtrtri.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/dtrtri.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,5 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ #ifdef __cplusplus extern "C" { diff -Nru hypre-2.16.0/src/lapack/f2c.h hypre-2.18.2/src/lapack/f2c.h --- hypre-2.16.0/src/lapack/f2c.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/f2c.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* f2c.h -- Standard Fortran to C header file */ diff -Nru hypre-2.16.0/src/lapack/_hypre_lapack.h hypre-2.18.2/src/lapack/_hypre_lapack.h --- hypre-2.16.0/src/lapack/_hypre_lapack.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/_hypre_lapack.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/lapack/hypre_lapack.h hypre-2.18.2/src/lapack/hypre_lapack.h --- hypre-2.16.0/src/lapack/hypre_lapack.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/hypre_lapack.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /***** DO NOT use this file outside of the LAPACK directory *****/ diff -Nru hypre-2.16.0/src/lapack/ieeeck.c hypre-2.18.2/src/lapack/ieeeck.c --- hypre-2.16.0/src/lapack/ieeeck.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/ieeeck.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/ilaenv.c hypre-2.18.2/src/lapack/ilaenv.c --- hypre-2.16.0/src/lapack/ilaenv.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/ilaenv.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/lsame.c hypre-2.18.2/src/lapack/lsame.c --- hypre-2.16.0/src/lapack/lsame.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/lsame.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lapack/Makefile hypre-2.18.2/src/lapack/Makefile --- hypre-2.16.0/src/lapack/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) ### the inclusion of these routines based on the configure options. diff -Nru hypre-2.16.0/src/lapack/README hypre-2.18.2/src/lapack/README --- hypre-2.16.0/src/lapack/README 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/README 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + HYPRE LAPACK README file diff -Nru hypre-2.16.0/src/lapack/xerbla.c hypre-2.18.2/src/lapack/xerbla.c --- hypre-2.16.0/src/lapack/xerbla.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lapack/xerbla.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,6 @@ +/* Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. + * See file COPYING in this directory for details. */ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/lib/Makefile hypre-2.18.2/src/lib/Makefile --- hypre-2.16.0/src/lib/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/lib/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config @@ -58,7 +51,7 @@ $(LAPACKFILES) SONAME = libHYPRE-${HYPRE_RELEASE_VERSION}${HYPRE_LIB_SUFFIX} -SOLIBS = ${MPILIBDIRS} ${MPILIBS} ${LAPACKLIBDIRS} ${LAPACKLIBS}\ +SOLIBS = ${DSUPERLU_LIBS} ${MPILIBDIRS} ${MPILIBS} ${LAPACKLIBDIRS} ${LAPACKLIBS}\ ${BLASLIBDIRS} ${BLASLIBS} ${LIBS} ${FLIBS} diff -Nru hypre-2.16.0/src/Makefile hypre-2.18.2/src/Makefile --- hypre-2.16.0/src/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) default: all diff -Nru hypre-2.16.0/src/matrix_matrix/CMakeLists.txt hypre-2.18.2/src/matrix_matrix/CMakeLists.txt --- hypre-2.16.0/src/matrix_matrix/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/matrix_matrix/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,21 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(HDRS + HYPRE_matrix_matrix_protos.h +) + +set(SRCS + HYPRE_ConvertParCSRMatrixToDistributedMatrix.c + HYPRE_ConvertPETScMatrixToDistributedMatrix.c +) + +convert_filenames_to_full_paths(HDRS) +convert_filenames_to_full_paths(SRCS) + +set(HYPRE_HEADERS ${HYPRE_HEADERS} ${HDRS} PARENT_SCOPE) +set(HYPRE_SOURCES ${HYPRE_SOURCES} ${SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/matrix_matrix/HYPRE_BuildIJMatrixFromDistributedMatrix.c hypre-2.18.2/src/matrix_matrix/HYPRE_BuildIJMatrixFromDistributedMatrix.c --- hypre-2.16.0/src/matrix_matrix/HYPRE_BuildIJMatrixFromDistributedMatrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/matrix_matrix/HYPRE_BuildIJMatrixFromDistributedMatrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/matrix_matrix/HYPRE_ConvertParCSRMatrixToDistributedMatrix.c hypre-2.18.2/src/matrix_matrix/HYPRE_ConvertParCSRMatrixToDistributedMatrix.c --- hypre-2.16.0/src/matrix_matrix/HYPRE_ConvertParCSRMatrixToDistributedMatrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/matrix_matrix/HYPRE_ConvertParCSRMatrixToDistributedMatrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -22,7 +17,7 @@ #include -#include "general.h" +#include "hypre_general.h" #include "_hypre_utilities.h" #include "HYPRE.h" @@ -38,8 +33,8 @@ * HYPRE_ConvertParCSRMatrixToDistributedMatrix *--------------------------------------------------------------------------*/ -HYPRE_Int -HYPRE_ConvertParCSRMatrixToDistributedMatrix( +HYPRE_Int +HYPRE_ConvertParCSRMatrixToDistributedMatrix( HYPRE_ParCSRMatrix parcsr_matrix, HYPRE_DistributedMatrix *DistributedMatrix ) { @@ -56,7 +51,7 @@ if (!parcsr_matrix) { hypre_error(HYPRE_ERROR_ARG); - return hypre_error_flag; + return hypre_error_flag; } HYPRE_ParCSRMatrixGetComm( parcsr_matrix, &comm); @@ -68,7 +63,7 @@ HYPRE_DistributedMatrixInitialize( *DistributedMatrix ); HYPRE_DistributedMatrixSetLocalStorage( *DistributedMatrix, parcsr_matrix ); - + HYPRE_ParCSRMatrixGetDims( parcsr_matrix, &M, &N); HYPRE_DistributedMatrixSetDims( *DistributedMatrix, M, N); @@ -80,6 +75,6 @@ /* hypre_FinalizeTiming( timer ); */ #endif - return hypre_error_flag; + return hypre_error_flag; } diff -Nru hypre-2.16.0/src/matrix_matrix/HYPRE_ConvertPETScMatrixToDistributedMatrix.c hypre-2.18.2/src/matrix_matrix/HYPRE_ConvertPETScMatrixToDistributedMatrix.c --- hypre-2.16.0/src/matrix_matrix/HYPRE_ConvertPETScMatrixToDistributedMatrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/matrix_matrix/HYPRE_ConvertPETScMatrixToDistributedMatrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -25,7 +17,7 @@ #include -#include "general.h" +#include "hypre_general.h" #include "HYPRE.h" #include "HYPRE_utilities.h" @@ -42,8 +34,8 @@ * HYPRE_ConvertPETScMatrixToDistributedMatrix *--------------------------------------------------------------------------*/ -HYPRE_Int -HYPRE_ConvertPETScMatrixToDistributedMatrix( +HYPRE_Int +HYPRE_ConvertPETScMatrixToDistributedMatrix( Mat PETSc_matrix, HYPRE_DistributedMatrix *DistributedMatrix ) { diff -Nru hypre-2.16.0/src/matrix_matrix/HYPRE_matrix_matrix_protos.h hypre-2.18.2/src/matrix_matrix/HYPRE_matrix_matrix_protos.h --- hypre-2.16.0/src/matrix_matrix/HYPRE_matrix_matrix_protos.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/matrix_matrix/HYPRE_matrix_matrix_protos.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "HYPRE_distributed_matrix_types.h" diff -Nru hypre-2.16.0/src/matrix_matrix/internal_protos.h hypre-2.18.2/src/matrix_matrix/internal_protos.h --- hypre-2.16.0/src/matrix_matrix/internal_protos.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/matrix_matrix/internal_protos.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* HYPRE_ConvertPETScMatrixToDistributedMatrix.c */ HYPRE_Int HYPRE_ConvertPETScMatrixToDistributedMatrix (Mat PETSc_matrix , HYPRE_DistributedMatrix *DistributedMatrix ); diff -Nru hypre-2.16.0/src/matrix_matrix/Makefile hypre-2.18.2/src/matrix_matrix/Makefile --- hypre-2.16.0/src/matrix_matrix/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/matrix_matrix/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config diff -Nru hypre-2.16.0/src/multivector/backup.c hypre-2.18.2/src/multivector/backup.c --- hypre-2.16.0/src/multivector/backup.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/backup.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/multivector/CMakeLists.txt hypre-2.18.2/src/multivector/CMakeLists.txt --- hypre-2.16.0/src/multivector/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/multivector/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,28 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(HDRS + csr_matmultivec.h + interpreter.h + multivector.h + par_csr_matmultivec.h + par_csr_pmvcomm.h + par_multivector.h + seq_multivector.h + temp_multivector.h +) + +set(SRCS + multivector.c + temp_multivector.c +) + +convert_filenames_to_full_paths(HDRS) +convert_filenames_to_full_paths(SRCS) + +set(HYPRE_HEADERS ${HYPRE_HEADERS} ${HDRS} PARENT_SCOPE) +set(HYPRE_SOURCES ${HYPRE_SOURCES} ${SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/multivector/csr_matmultivec.c hypre-2.18.2/src/multivector/csr_matmultivec.c --- hypre-2.16.0/src/multivector/csr_matmultivec.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/csr_matmultivec.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/multivector/csr_matmultivec.h hypre-2.18.2/src/multivector/csr_matmultivec.h --- hypre-2.16.0/src/multivector/csr_matmultivec.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/csr_matmultivec.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef CSR_MULTIMATVEC_H #define CSR_MULTIMATVEC_H diff -Nru hypre-2.16.0/src/multivector/interpreter.h hypre-2.18.2/src/multivector/interpreter.h --- hypre-2.16.0/src/multivector/interpreter.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/interpreter.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef LOBPCG_INTERFACE_INTERPRETER #define LOBPCG_INTERFACE_INTERPRETER diff -Nru hypre-2.16.0/src/multivector/Makefile hypre-2.18.2/src/multivector/Makefile --- hypre-2.16.0/src/multivector/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config diff -Nru hypre-2.16.0/src/multivector/multivector.c hypre-2.18.2/src/multivector/multivector.c --- hypre-2.16.0/src/multivector/multivector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/multivector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/multivector/multivector.h hypre-2.18.2/src/multivector/multivector.h --- hypre-2.16.0/src/multivector/multivector.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/multivector.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef MULTIVECTOR_FUNCTION_PROTOTYPES #define MULTIVECTOR_FUNCTION_PROTOTYPES diff -Nru hypre-2.16.0/src/multivector/par_csr_matmultivec.c hypre-2.18.2/src/multivector/par_csr_matmultivec.c --- hypre-2.16.0/src/multivector/par_csr_matmultivec.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/par_csr_matmultivec.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/multivector/par_csr_matmultivec.h hypre-2.18.2/src/multivector/par_csr_matmultivec.h --- hypre-2.16.0/src/multivector/par_csr_matmultivec.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/par_csr_matmultivec.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/multivector/par_csr_pmvcomm.c hypre-2.18.2/src/multivector/par_csr_pmvcomm.c --- hypre-2.16.0/src/multivector/par_csr_pmvcomm.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/par_csr_pmvcomm.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "par_csr_pmvcomm.h" diff -Nru hypre-2.16.0/src/multivector/par_csr_pmvcomm.h hypre-2.18.2/src/multivector/par_csr_pmvcomm.h --- hypre-2.16.0/src/multivector/par_csr_pmvcomm.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/par_csr_pmvcomm.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef HYPRE_PAR_CSR_PMVCOMM_HEADER #define HYPRE_PAR_CSR_PMVCOMM_HEADER diff -Nru hypre-2.16.0/src/multivector/par_multivector.c hypre-2.18.2/src/multivector/par_multivector.c --- hypre-2.16.0/src/multivector/par_multivector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/par_multivector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/multivector/par_multivector.h hypre-2.18.2/src/multivector/par_multivector.h --- hypre-2.16.0/src/multivector/par_multivector.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/par_multivector.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/multivector/.psrc hypre-2.18.2/src/multivector/.psrc --- hypre-2.16.0/src/multivector/.psrc 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/.psrc 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -insure++.file_ignore temp_multivector.c diff -Nru hypre-2.16.0/src/multivector/seq_multivector.c hypre-2.18.2/src/multivector/seq_multivector.c --- hypre-2.16.0/src/multivector/seq_multivector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/seq_multivector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/multivector/seq_multivector.h hypre-2.18.2/src/multivector/seq_multivector.h --- hypre-2.16.0/src/multivector/seq_multivector.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/seq_multivector.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/multivector/temp_multivector.c hypre-2.18.2/src/multivector/temp_multivector.c --- hypre-2.16.0/src/multivector/temp_multivector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/temp_multivector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/multivector/temp_multivector.h hypre-2.18.2/src/multivector/temp_multivector.h --- hypre-2.16.0/src/multivector/temp_multivector.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/multivector/temp_multivector.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef TEMPORARY_MULTIVECTOR_FUNCTION_PROTOTYPES #define TEMPORARY_MULTIVECTOR_FUNCTION_PROTOTYPES diff -Nru hypre-2.16.0/src/parcsr_block_mv/CMakeLists.txt hypre-2.18.2/src/parcsr_block_mv/CMakeLists.txt --- hypre-2.16.0/src/parcsr_block_mv/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/parcsr_block_mv/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,30 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(HDRS + par_csr_block_matrix.h + csr_block_matrix.h +) + +set(SRCS + csr_block_matrix.c + csr_block_matvec.c + par_csr_block_matrix.c + par_csr_block_matvec.c + par_csr_block_comm.c + par_csr_block_rap.c + par_csr_block_rap_communication.c + par_csr_block_interp.c + par_csr_block_relax.c + par_block_nodal_systems.c +) + +convert_filenames_to_full_paths(HDRS) +convert_filenames_to_full_paths(SRCS) + +set(HYPRE_HEADERS ${HYPRE_HEADERS} ${HDRS} PARENT_SCOPE) +set(HYPRE_SOURCES ${HYPRE_SOURCES} ${SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/parcsr_block_mv/csr_block_matop.c hypre-2.18.2/src/parcsr_block_mv/csr_block_matop.c --- hypre-2.16.0/src/parcsr_block_mv/csr_block_matop.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_block_mv/csr_block_matop.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_block_mv/csr_block_matrix.c hypre-2.18.2/src/parcsr_block_mv/csr_block_matrix.c --- hypre-2.16.0/src/parcsr_block_mv/csr_block_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_block_mv/csr_block_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_block_mv/csr_block_matrix.h hypre-2.18.2/src/parcsr_block_mv/csr_block_matrix.h --- hypre-2.16.0/src/parcsr_block_mv/csr_block_matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_block_mv/csr_block_matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_block_mv/csr_block_matvec.c hypre-2.18.2/src/parcsr_block_mv/csr_block_matvec.c --- hypre-2.16.0/src/parcsr_block_mv/csr_block_matvec.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_block_mv/csr_block_matvec.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_block_mv/driver_matvec.c hypre-2.18.2/src/parcsr_block_mv/driver_matvec.c --- hypre-2.16.0/src/parcsr_block_mv/driver_matvec.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_block_mv/driver_matvec.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "../utilities/_hypre_utilities.h" #include "../seq_mv/seq_mv.h" diff -Nru hypre-2.16.0/src/parcsr_block_mv/_hypre_parcsr_block_mv.h hypre-2.18.2/src/parcsr_block_mv/_hypre_parcsr_block_mv.h --- hypre-2.16.0/src/parcsr_block_mv/_hypre_parcsr_block_mv.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_block_mv/_hypre_parcsr_block_mv.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/parcsr_block_mv/Makefile hypre-2.18.2/src/parcsr_block_mv/Makefile --- hypre-2.16.0/src/parcsr_block_mv/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_block_mv/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config diff -Nru hypre-2.16.0/src/parcsr_block_mv/par_block_nodal_systems.c hypre-2.18.2/src/parcsr_block_mv/par_block_nodal_systems.c --- hypre-2.16.0/src/parcsr_block_mv/par_block_nodal_systems.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_block_mv/par_block_nodal_systems.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_block_mv.h" @@ -52,20 +47,20 @@ HYPRE_Int num_nonzeros_diag; HYPRE_Int num_nonzeros_offd = 0; HYPRE_Int num_cols_offd = 0; - + hypre_ParCSRMatrix *AN; hypre_CSRMatrix *AN_diag; HYPRE_Int *AN_diag_i; HYPRE_Int *AN_diag_j=NULL; - HYPRE_Real *AN_diag_data = NULL; + HYPRE_Real *AN_diag_data = NULL; hypre_CSRMatrix *AN_offd; HYPRE_Int *AN_offd_i; HYPRE_Int *AN_offd_j = NULL; - HYPRE_Real *AN_offd_data = NULL; + HYPRE_Real *AN_offd_data = NULL; HYPRE_BigInt *col_map_offd_AN = NULL; HYPRE_BigInt *row_starts_AN; - + hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRBlockMatrixCommPkg(A); HYPRE_Int num_sends; HYPRE_Int num_recvs; @@ -83,7 +78,7 @@ HYPRE_Int *recv_vec_starts_AN = NULL; HYPRE_Int i; - + HYPRE_Int ierr = 0; HYPRE_Int num_procs; @@ -94,7 +89,7 @@ HYPRE_Int num_nodes; HYPRE_Int index, k; - + HYPRE_Real tmp; HYPRE_Real sum; @@ -139,8 +134,8 @@ AN_diag_i[i] = A_diag_i[i]; } - AN_diag_j = hypre_CTAlloc(HYPRE_Int, num_nonzeros_diag, HYPRE_MEMORY_HOST); - AN_diag_data = hypre_CTAlloc(HYPRE_Real, num_nonzeros_diag, HYPRE_MEMORY_HOST); + AN_diag_j = hypre_CTAlloc(HYPRE_Int, num_nonzeros_diag, HYPRE_MEMORY_HOST); + AN_diag_data = hypre_CTAlloc(HYPRE_Real, num_nonzeros_diag, HYPRE_MEMORY_HOST); AN_diag = hypre_CSRMatrixCreate(num_nodes, num_nodes, num_nonzeros_diag); @@ -151,11 +146,11 @@ for (i=0; i< num_nonzeros_diag; i++) { AN_diag_j[i] = A_diag_j[i]; - hypre_CSRBlockMatrixBlockNorm(norm_type, &A_diag_data[i*bnnz], + hypre_CSRBlockMatrixBlockNorm(norm_type, &A_diag_data[i*bnnz], &tmp, block_size); AN_diag_data[i] = tmp; } - + if (diag_option ==1 ) { @@ -164,24 +159,24 @@ /* the diagonal is the first element listed in each row - */ for (i=0; i < num_nodes; i++) { - index = AN_diag_i[i]; + index = AN_diag_i[i]; sum = 0.0; for (k = AN_diag_i[i]+1; k < AN_diag_i[i+1]; k++) { sum += AN_diag_data[k]; - + } AN_diag_data[index] = -sum; } - + } else if (diag_option == 2) { - + /* make all diagonal entries negative */ /* the diagonal is the first element listed in each row - */ - + for (i=0; i < num_nodes; i++) { index = AN_diag_i[i]; @@ -204,7 +199,7 @@ send_procs = hypre_ParCSRCommPkgSendProcs(comm_pkg); send_map_starts = hypre_ParCSRCommPkgSendMapStarts(comm_pkg); send_map_elmts = hypre_ParCSRCommPkgSendMapElmts(comm_pkg); - if (num_sends) + if (num_sends) { send_procs_AN = hypre_CTAlloc(HYPRE_Int, num_sends, HYPRE_MEMORY_HOST); send_map_elmts_AN = hypre_CTAlloc(HYPRE_Int, send_map_starts[num_sends], HYPRE_MEMORY_HOST); @@ -235,7 +230,7 @@ { recv_procs_AN[i] = recv_procs[i]; recv_vec_starts_AN[i+1] = recv_vec_starts[i+1]; - + } hypre_ParCSRCommPkgRecvProcs(comm_pkg_AN) = recv_procs_AN; hypre_ParCSRCommPkgRecvVecStarts(comm_pkg_AN) = recv_vec_starts_AN; @@ -257,24 +252,24 @@ { AN_offd_i[i] = A_offd_i[i]; } - - AN_offd_j = hypre_CTAlloc(HYPRE_Int, num_nonzeros_offd, HYPRE_MEMORY_HOST); + + AN_offd_j = hypre_CTAlloc(HYPRE_Int, num_nonzeros_offd, HYPRE_MEMORY_HOST); AN_offd_data = hypre_CTAlloc(HYPRE_Real, num_nonzeros_offd, HYPRE_MEMORY_HOST); for (i=0; i< num_nonzeros_offd; i++) { AN_offd_j[i] = A_offd_j[i]; - hypre_CSRBlockMatrixBlockNorm(norm_type, &A_offd_data[i*bnnz], + hypre_CSRBlockMatrixBlockNorm(norm_type, &A_offd_data[i*bnnz], &tmp, block_size); AN_offd_data[i] = tmp; } - + AN_offd = hypre_CSRMatrixCreate(num_nodes, num_cols_offd, num_nonzeros_offd); - + hypre_CSRMatrixI(AN_offd) = AN_offd_i; hypre_CSRMatrixJ(AN_offd) = AN_offd_j; hypre_CSRMatrixData(AN_offd) = AN_offd_data; - + if (diag_option ==1 ) { /* make the diag entry the negative of the sum of off-diag entries (here @@ -286,16 +281,16 @@ for (k = AN_offd_i[i]; k < AN_offd_i[i+1]; k++) { sum += AN_offd_data[k]; - + } - index = AN_diag_i[i];/* location of diag entry in data */ + index = AN_diag_i[i];/* location of diag entry in data */ AN_diag_data[index] -= sum; /* subtract from current value */ } - + } - /* now create AN */ - + /* now create AN */ + AN = hypre_ParCSRMatrixCreate(comm, global_num_nodes, global_num_nodes, row_starts_AN, row_starts_AN, num_cols_offd, num_nonzeros_diag, num_nonzeros_offd); @@ -307,6 +302,8 @@ hypre_ParCSRMatrixDiag(AN) = AN_diag; hypre_ParCSRMatrixOffd(AN) = AN_offd; + hypre_CSRMatrixMemoryLocation(AN_diag) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixMemoryLocation(AN_offd) = HYPRE_MEMORY_HOST; hypre_ParCSRMatrixColMapOffd(AN) = col_map_offd_AN; hypre_ParCSRMatrixCommPkg(AN) = comm_pkg_AN; @@ -315,3 +312,4 @@ return (ierr); } + diff -Nru hypre-2.16.0/src/parcsr_block_mv/par_csr_block_comm.c hypre-2.18.2/src/parcsr_block_mv/par_csr_block_comm.c --- hypre-2.16.0/src/parcsr_block_mv/par_csr_block_comm.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_block_mv/par_csr_block_comm.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_block_mv.h" #include "_hypre_utilities.h" @@ -34,21 +29,21 @@ HYPRE_Int i, j, my_id, num_procs, ip, vec_start, vec_len; HYPRE_Complex *d_send_data = (HYPRE_Complex *) send_data; HYPRE_Complex *d_recv_data = (HYPRE_Complex *) recv_data; - + /*--------------------------------------------------------------------------- * job = 1 : is used to initialize communication exchange for the parts - * of vector needed to perform a Matvec, it requires send_data - * and recv_data to be doubles, recv_vec_starts and + * of vector needed to perform a Matvec, it requires send_data + * and recv_data to be doubles, recv_vec_starts and * send_map_starts need to be set in comm_pkg. * job = 2 : is used to initialize communication exchange for the parts - * of vector needed to perform a MatvecT, it requires send_data - * and recv_data to be doubles, recv_vec_starts and + * of vector needed to perform a MatvecT, it requires send_data + * and recv_data to be doubles, recv_vec_starts and * send_map_starts need to be set in comm_pkg. *------------------------------------------------------------------------*/ num_requests = num_sends + num_recvs; requests = hypre_CTAlloc(hypre_MPI_Request, num_requests, HYPRE_MEMORY_HOST); - + hypre_MPI_Comm_size(comm,&num_procs); hypre_MPI_Comm_rank(comm,&my_id); @@ -60,7 +55,7 @@ { for (i = 0; i < num_recvs; i++) { - ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); + ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i); vec_len = (hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i+1)-vec_start)*bnnz; @@ -72,7 +67,7 @@ vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); vec_len = (hypre_ParCSRCommPkgSendMapStart(comm_pkg,i+1)-vec_start)*bnnz; - ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); + ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); hypre_MPI_Isend(&d_send_data[vec_start*bnnz], vec_len, HYPRE_MPI_COMPLEX, ip, 0, comm, &requests[j++]); } @@ -86,13 +81,13 @@ vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); vec_len = (hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1) - vec_start)*bnnz; - ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); + ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); hypre_MPI_Irecv(&d_recv_data[vec_start*bnnz], vec_len, HYPRE_MPI_COMPLEX, ip, 0, comm, &requests[j++]); } for (i = 0; i < num_recvs; i++) { - ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); + ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i); vec_len = (hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i+1)-vec_start)*bnnz; @@ -130,7 +125,7 @@ if (hypre_ParCSRCommHandleNumRequests(comm_handle)) { - status0 = hypre_CTAlloc(hypre_MPI_Status, + status0 = hypre_CTAlloc(hypre_MPI_Status, hypre_ParCSRCommHandleNumRequests(comm_handle), HYPRE_MEMORY_HOST); hypre_MPI_Waitall(hypre_ParCSRCommHandleNumRequests(comm_handle), hypre_ParCSRCommHandleRequests(comm_handle), status0); @@ -145,26 +140,26 @@ /*-------------------------------------------------------------------- * hypre_ParCSRBlockMatrixCreateAssumedPartition - - * Each proc gets it own range. Then + * Each proc gets it own range. Then * each needs to reconcile its actual range with its assumed * range - the result is essentila a partition of its assumed range - - * this is the assumed partition. + * this is the assumed partition. *--------------------------------------------------------------------*/ HYPRE_Int -hypre_ParCSRBlockMatrixCreateAssumedPartition( hypre_ParCSRBlockMatrix *matrix) +hypre_ParCSRBlockMatrixCreateAssumedPartition( hypre_ParCSRBlockMatrix *matrix) { HYPRE_BigInt global_num_cols; HYPRE_Int myid; HYPRE_BigInt col_start = 0, col_end = 0; MPI_Comm comm; - + hypre_IJAssumedPart *apart; - global_num_cols = hypre_ParCSRBlockMatrixGlobalNumCols(matrix); + global_num_cols = hypre_ParCSRBlockMatrixGlobalNumCols(matrix); comm = hypre_ParCSRBlockMatrixComm(matrix); - + /* find out my actualy range of rows and columns */ col_start = hypre_ParCSRBlockMatrixFirstColDiag(matrix); col_end = hypre_ParCSRBlockMatrixLastColDiag(matrix); @@ -181,8 +176,8 @@ /*allocate some space for the partition of the assumed partition */ apart->length = 0; - /*room for 10 owners of the assumed partition*/ - apart->storage_length = 10; /*need to be >=1 */ + /*room for 10 owners of the assumed partition*/ + apart->storage_length = 10; /*need to be >=1 */ apart->proc_list = hypre_TAlloc(HYPRE_Int, apart->storage_length, HYPRE_MEMORY_HOST); apart->row_start_list = hypre_TAlloc(HYPRE_BigInt, apart->storage_length, HYPRE_MEMORY_HOST); apart->row_end_list = hypre_TAlloc(HYPRE_BigInt, apart->storage_length, HYPRE_MEMORY_HOST); @@ -194,24 +189,24 @@ /* this partition will be saved in the matrix data structure until the matrix * is destroyed */ hypre_ParCSRBlockMatrixAssumedPartition(matrix) = apart; - + return hypre_error_flag; - + } /*-------------------------------------------------------------------- * hypre_ParCSRMatrixDestroyAssumedPartition *--------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_ParCSRBlockMatrixDestroyAssumedPartition( hypre_ParCSRBlockMatrix *matrix ) { hypre_IJAssumedPart *apart; - + apart = hypre_ParCSRMatrixAssumedPartition(matrix); - - if(apart->storage_length > 0) - { + + if(apart->storage_length > 0) + { hypre_TFree(apart->proc_list, HYPRE_MEMORY_HOST); hypre_TFree(apart->row_start_list, HYPRE_MEMORY_HOST); hypre_TFree(apart->row_end_list, HYPRE_MEMORY_HOST); diff -Nru hypre-2.16.0/src/parcsr_block_mv/par_csr_block_interp.c hypre-2.18.2/src/parcsr_block_mv/par_csr_block_interp.c --- hypre-2.16.0/src/parcsr_block_mv/par_csr_block_interp.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_block_mv/par_csr_block_interp.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_block_mv.h" diff -Nru hypre-2.16.0/src/parcsr_block_mv/par_csr_block_matrix.c hypre-2.18.2/src/parcsr_block_mv/par_csr_block_matrix.c --- hypre-2.16.0/src/parcsr_block_mv/par_csr_block_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_block_mv/par_csr_block_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_block_mv/par_csr_block_matrix.h hypre-2.18.2/src/parcsr_block_mv/par_csr_block_matrix.h --- hypre-2.16.0/src/parcsr_block_mv/par_csr_block_matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_block_mv/par_csr_block_matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_block_mv/par_csr_block_matvec.c hypre-2.18.2/src/parcsr_block_mv/par_csr_block_matvec.c --- hypre-2.16.0/src/parcsr_block_mv/par_csr_block_matvec.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_block_mv/par_csr_block_matvec.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_block_mv/par_csr_block_rap.c hypre-2.18.2/src/parcsr_block_mv/par_csr_block_rap.c --- hypre-2.16.0/src/parcsr_block_mv/par_csr_block_rap.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_block_mv/par_csr_block_rap.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include "_hypre_utilities.h" diff -Nru hypre-2.16.0/src/parcsr_block_mv/par_csr_block_rap_communication.c hypre-2.18.2/src/parcsr_block_mv/par_csr_block_rap_communication.c --- hypre-2.16.0/src/parcsr_block_mv/par_csr_block_rap_communication.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_block_mv/par_csr_block_rap_communication.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_block_mv.h" diff -Nru hypre-2.16.0/src/parcsr_block_mv/par_csr_block_relax.c hypre-2.18.2/src/parcsr_block_mv/par_csr_block_relax.c --- hypre-2.16.0/src/parcsr_block_mv/par_csr_block_relax.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_block_mv/par_csr_block_relax.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_block_mv.h" diff -Nru hypre-2.16.0/src/parcsr_ls/ads.c hypre-2.18.2/src/parcsr_ls/ads.c --- hypre-2.16.0/src/parcsr_ls/ads.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/ads.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" #include "float.h" diff -Nru hypre-2.16.0/src/parcsr_ls/ads.h hypre-2.18.2/src/parcsr_ls/ads.h --- hypre-2.16.0/src/parcsr_ls/ads.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/ads.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_ADS_DATA_HEADER #define hypre_ADS_DATA_HEADER diff -Nru hypre-2.16.0/src/parcsr_ls/ame.c hypre-2.18.2/src/parcsr_ls/ame.c --- hypre-2.16.0/src/parcsr_ls/ame.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/ame.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" #include "float.h" @@ -295,7 +290,7 @@ } } - hypre_ParCSRMatrixTranspose(ams_data -> G, &Gt, 1); + hypre_ParCSRMatrixTranspose(ams_data->G, &Gt, 1); /* Use a Matvec communication to find which of the edges connected to local vertices are on the boundary */ @@ -311,9 +306,10 @@ comm_pkg = hypre_ParCSRMatrixCommPkg(Gt); num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - int_buf_data = hypre_CTAlloc(HYPRE_Int, - hypre_ParCSRCommPkgSendMapStart(comm_pkg, - num_sends), HYPRE_MEMORY_HOST); + int_buf_data = hypre_CTAlloc( + HYPRE_Int, + hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + HYPRE_MEMORY_HOST ); index = 0; for (i = 0; i < num_sends; i++) { diff -Nru hypre-2.16.0/src/parcsr_ls/ame.h hypre-2.18.2/src/parcsr_ls/ame.h --- hypre-2.16.0/src/parcsr_ls/ame.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/ame.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_AME_HEADER #define hypre_AME_HEADER diff -Nru hypre-2.16.0/src/parcsr_ls/amg_hybrid.c hypre-2.18.2/src/parcsr_ls/amg_hybrid.c --- hypre-2.16.0/src/parcsr_ls/amg_hybrid.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/amg_hybrid.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -26,7 +18,6 @@ typedef struct { - HYPRE_Real tol; HYPRE_Real a_tol; HYPRE_Real cf_tol; @@ -35,6 +26,8 @@ HYPRE_Int two_norm; HYPRE_Int stop_crit; HYPRE_Int rel_change; + HYPRE_Int recompute_residual; + HYPRE_Int recompute_residual_p; HYPRE_Int solver_type; HYPRE_Int k_dim; @@ -52,34 +45,34 @@ /* additional information (place-holder currently used to print norms) */ HYPRE_Int logging; - HYPRE_Int print_level; + HYPRE_Int print_level; /* info for BoomerAMG */ - HYPRE_Real strong_threshold; - HYPRE_Real max_row_sum; - HYPRE_Real trunc_factor; + HYPRE_Real strong_threshold; + HYPRE_Real max_row_sum; + HYPRE_Real trunc_factor; HYPRE_Int pmax; HYPRE_Int setup_type; - HYPRE_Int max_levels; - HYPRE_Int measure_type; - HYPRE_Int coarsen_type; - HYPRE_Int interp_type; - HYPRE_Int cycle_type; - HYPRE_Int relax_order; - HYPRE_Int keepT; - HYPRE_Int max_coarse_size; - HYPRE_Int min_coarse_size; - HYPRE_Int seq_threshold; - HYPRE_Int *num_grid_sweeps; - HYPRE_Int *grid_relax_type; - HYPRE_Int **grid_relax_points; - HYPRE_Real *relax_weight; - HYPRE_Real *omega; - HYPRE_Int num_paths; - HYPRE_Int agg_num_levels; - HYPRE_Int num_functions; - HYPRE_Int nodal; - HYPRE_Int *dof_func; + HYPRE_Int max_levels; + HYPRE_Int measure_type; + HYPRE_Int coarsen_type; + HYPRE_Int interp_type; + HYPRE_Int cycle_type; + HYPRE_Int relax_order; + HYPRE_Int keepT; + HYPRE_Int max_coarse_size; + HYPRE_Int min_coarse_size; + HYPRE_Int seq_threshold; + HYPRE_Int *num_grid_sweeps; + HYPRE_Int *grid_relax_type; + HYPRE_Int **grid_relax_points; + HYPRE_Real *relax_weight; + HYPRE_Real *omega; + HYPRE_Int num_paths; + HYPRE_Int agg_num_levels; + HYPRE_Int num_functions; + HYPRE_Int nodal; + HYPRE_Int *dof_func; /* data needed for non-Galerkin option */ HYPRE_Int nongalerk_num_tol; @@ -113,14 +106,14 @@ (AMGhybrid_data -> pcg_precond_solve) = NULL; (AMGhybrid_data -> pcg_precond_setup) = NULL; (AMGhybrid_data -> pcg_precond) = NULL; - (AMGhybrid_data -> pcg_solver) = NULL; - - /* initialize */ - (AMGhybrid_data -> dscg_num_its) = 0; - (AMGhybrid_data -> pcg_num_its) = 0; - (AMGhybrid_data -> logging) = 0; - (AMGhybrid_data -> print_level) = 0; - (AMGhybrid_data -> k_dim) = 5; + (AMGhybrid_data -> pcg_solver) = NULL; + + /* initialize */ + (AMGhybrid_data -> dscg_num_its) = 0; + (AMGhybrid_data -> pcg_num_its) = 0; + (AMGhybrid_data -> logging) = 0; + (AMGhybrid_data -> print_level) = 0; + (AMGhybrid_data -> k_dim) = 5; /* BoomerAMG info */ (AMGhybrid_data -> setup_type) = 1; @@ -151,17 +144,17 @@ (AMGhybrid_data -> nongalerk_num_tol) = 0; (AMGhybrid_data -> nongalerkin_tol) = NULL; - return (void *) AMGhybrid_data; + return (void *) AMGhybrid_data; } /*-------------------------------------------------------------------------- * - hypre_AMGHybridDestroy -*--------------------------------------------------------------------------*/ + hypre_AMGHybridDestroy + *--------------------------------------------------------------------------*/ HYPRE_Int hypre_AMGHybridDestroy( void *AMGhybrid_vdata ) { - hypre_AMGHybridData *AMGhybrid_data = (hypre_AMGHybridData *)AMGhybrid_vdata; + hypre_AMGHybridData *AMGhybrid_data = (hypre_AMGHybridData *)AMGhybrid_vdata; HYPRE_Int i; if (AMGhybrid_data) @@ -170,40 +163,42 @@ /*HYPRE_Int pcg_default = (AMGhybrid_data -> pcg_default);*/ void *pcg_solver = (AMGhybrid_data -> pcg_solver); void *pcg_precond = (AMGhybrid_data -> pcg_precond); - + if (pcg_precond) hypre_BoomerAMGDestroy(pcg_precond); if (solver_type == 1) hypre_PCGDestroy(pcg_solver); if (solver_type == 2) hypre_GMRESDestroy(pcg_solver); if (solver_type == 3) hypre_BiCGSTABDestroy(pcg_solver); - - if (AMGhybrid_data -> num_grid_sweeps) + + if (AMGhybrid_data -> num_grid_sweeps) { hypre_TFree( (AMGhybrid_data -> num_grid_sweeps) , HYPRE_MEMORY_HOST); (AMGhybrid_data -> num_grid_sweeps) = NULL; } - if (AMGhybrid_data -> grid_relax_type) + if (AMGhybrid_data -> grid_relax_type) { hypre_TFree( (AMGhybrid_data -> grid_relax_type) , HYPRE_MEMORY_HOST); (AMGhybrid_data -> grid_relax_type) = NULL; } - if (AMGhybrid_data -> grid_relax_points) + if (AMGhybrid_data -> grid_relax_points) { for (i=0; i < 4; i++) + { hypre_TFree( (AMGhybrid_data -> grid_relax_points)[i] , HYPRE_MEMORY_HOST); + } hypre_TFree( (AMGhybrid_data -> grid_relax_points) , HYPRE_MEMORY_HOST); (AMGhybrid_data -> grid_relax_points) = NULL; } - if (AMGhybrid_data -> relax_weight) + if (AMGhybrid_data -> relax_weight) { hypre_TFree( (AMGhybrid_data -> relax_weight) , HYPRE_MEMORY_HOST); (AMGhybrid_data -> relax_weight) = NULL; } - if (AMGhybrid_data -> omega) + if (AMGhybrid_data -> omega) { hypre_TFree( (AMGhybrid_data -> omega) , HYPRE_MEMORY_HOST); (AMGhybrid_data -> omega) = NULL; } - if (AMGhybrid_data -> dof_func) + if (AMGhybrid_data -> dof_func) { hypre_TFree( (AMGhybrid_data -> dof_func) , HYPRE_MEMORY_HOST); (AMGhybrid_data -> dof_func) = NULL; @@ -220,7 +215,7 @@ HYPRE_Int hypre_AMGHybridSetTol( void *AMGhybrid_vdata, - HYPRE_Real tol ) + HYPRE_Real tol ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; @@ -244,7 +239,7 @@ HYPRE_Int hypre_AMGHybridSetAbsoluteTol( void *AMGhybrid_vdata, - HYPRE_Real a_tol ) + HYPRE_Real a_tol ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; @@ -268,7 +263,7 @@ HYPRE_Int hypre_AMGHybridSetConvergenceTol( void *AMGhybrid_vdata, - HYPRE_Real cf_tol ) + HYPRE_Real cf_tol ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -293,8 +288,8 @@ HYPRE_Int hypre_AMGHybridSetNonGalerkinTol( void *AMGhybrid_vdata, - HYPRE_Int nongalerk_num_tol, - HYPRE_Real *nongalerkin_tol ) + HYPRE_Int nongalerk_num_tol, + HYPRE_Real *nongalerkin_tol ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -320,7 +315,7 @@ HYPRE_Int hypre_AMGHybridSetDSCGMaxIter( void *AMGhybrid_vdata, - HYPRE_Int dscg_max_its ) + HYPRE_Int dscg_max_its ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -345,7 +340,7 @@ HYPRE_Int hypre_AMGHybridSetPCGMaxIter( void *AMGhybrid_vdata, - HYPRE_Int pcg_max_its ) + HYPRE_Int pcg_max_its ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -370,7 +365,7 @@ HYPRE_Int hypre_AMGHybridSetSetupType( void *AMGhybrid_vdata, - HYPRE_Int setup_type ) + HYPRE_Int setup_type ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -390,7 +385,7 @@ HYPRE_Int hypre_AMGHybridSetSolverType( void *AMGhybrid_vdata, - HYPRE_Int solver_type ) + HYPRE_Int solver_type ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -405,12 +400,84 @@ } /*-------------------------------------------------------------------------- + * hypre_AMGHybridSetRecomputeResidual + *--------------------------------------------------------------------------*/ + +HYPRE_Int +hypre_AMGHybridSetRecomputeResidual( void *AMGhybrid_vdata, + HYPRE_Int recompute_residual ) +{ + hypre_AMGHybridData *AMGhybrid_data = (hypre_AMGHybridData *)AMGhybrid_vdata; + if (!AMGhybrid_data) + { + hypre_error_in_arg(1); + return hypre_error_flag; + } + + (AMGhybrid_data -> recompute_residual) = recompute_residual; + + return hypre_error_flag; +} + +HYPRE_Int +hypre_AMGHybridGetRecomputeResidual( void *AMGhybrid_vdata, + HYPRE_Int *recompute_residual ) +{ + hypre_AMGHybridData *AMGhybrid_data = (hypre_AMGHybridData *)AMGhybrid_vdata; + if (!AMGhybrid_data) + { + hypre_error_in_arg(1); + return hypre_error_flag; + } + + *recompute_residual = (AMGhybrid_data -> recompute_residual); + + return hypre_error_flag; +} + +/*-------------------------------------------------------------------------- + * hypre_AMGHybridSetRecomputeResidualP + *--------------------------------------------------------------------------*/ + +HYPRE_Int +hypre_AMGHybridSetRecomputeResidualP( void *AMGhybrid_vdata, + HYPRE_Int recompute_residual_p ) +{ + hypre_AMGHybridData *AMGhybrid_data = (hypre_AMGHybridData *)AMGhybrid_vdata; + if (!AMGhybrid_data) + { + hypre_error_in_arg(1); + return hypre_error_flag; + } + + (AMGhybrid_data -> recompute_residual_p) = recompute_residual_p; + + return hypre_error_flag; +} + +HYPRE_Int +hypre_AMGHybridGetRecomputeResidualP( void *AMGhybrid_vdata, + HYPRE_Int *recompute_residual_p ) +{ + hypre_AMGHybridData *AMGhybrid_data = (hypre_AMGHybridData *)AMGhybrid_vdata; + if (!AMGhybrid_data) + { + hypre_error_in_arg(1); + return hypre_error_flag; + } + + *recompute_residual_p = (AMGhybrid_data -> recompute_residual_p); + + return hypre_error_flag; +} + +/*-------------------------------------------------------------------------- * hypre_AMGHybridSetKDim *--------------------------------------------------------------------------*/ HYPRE_Int hypre_AMGHybridSetKDim( void *AMGhybrid_vdata, - HYPRE_Int k_dim ) + HYPRE_Int k_dim ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -435,7 +502,7 @@ HYPRE_Int hypre_AMGHybridSetStopCrit( void *AMGhybrid_vdata, - HYPRE_Int stop_crit ) + HYPRE_Int stop_crit ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -455,7 +522,7 @@ HYPRE_Int hypre_AMGHybridSetTwoNorm( void *AMGhybrid_vdata, - HYPRE_Int two_norm ) + HYPRE_Int two_norm ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -475,7 +542,7 @@ HYPRE_Int hypre_AMGHybridSetRelChange( void *AMGhybrid_vdata, - HYPRE_Int rel_change ) + HYPRE_Int rel_change ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -495,9 +562,9 @@ HYPRE_Int hypre_AMGHybridSetPrecond( void *pcg_vdata, - HYPRE_Int (*pcg_precond_solve)(void*,void*,void*,void*), - HYPRE_Int (*pcg_precond_setup)(void*,void*,void*,void*), - void *pcg_precond ) + HYPRE_Int (*pcg_precond_solve)(void*,void*,void*,void*), + HYPRE_Int (*pcg_precond_setup)(void*,void*,void*,void*), + void *pcg_precond ) { hypre_AMGHybridData *pcg_data =(hypre_AMGHybridData *) pcg_vdata; if (!pcg_data) @@ -505,12 +572,12 @@ hypre_error_in_arg(1); return hypre_error_flag; } - + (pcg_data -> pcg_default) = 0; (pcg_data -> pcg_precond_solve) = pcg_precond_solve; (pcg_data -> pcg_precond_setup) = pcg_precond_setup; (pcg_data -> pcg_precond) = pcg_precond; - + return hypre_error_flag; } @@ -520,7 +587,7 @@ HYPRE_Int hypre_AMGHybridSetLogging( void *AMGhybrid_vdata, - HYPRE_Int logging ) + HYPRE_Int logging ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -540,7 +607,7 @@ HYPRE_Int hypre_AMGHybridSetPrintLevel( void *AMGhybrid_vdata, - HYPRE_Int print_level ) + HYPRE_Int print_level ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -560,7 +627,7 @@ HYPRE_Int hypre_AMGHybridSetStrongThreshold( void *AMGhybrid_vdata, - HYPRE_Real strong_threshold) + HYPRE_Real strong_threshold) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -585,7 +652,7 @@ HYPRE_Int hypre_AMGHybridSetMaxRowSum( void *AMGhybrid_vdata, - HYPRE_Real max_row_sum ) + HYPRE_Real max_row_sum ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -610,7 +677,7 @@ HYPRE_Int hypre_AMGHybridSetTruncFactor( void *AMGhybrid_vdata, - HYPRE_Real trunc_factor ) + HYPRE_Real trunc_factor ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -651,21 +718,18 @@ return hypre_error_flag; } - (AMGhybrid_data -> pmax) = P_max_elmts; + (AMGhybrid_data -> pmax) = P_max_elmts; return hypre_error_flag; } - - - /*-------------------------------------------------------------------------- * hypre_AMGHybridSetMaxLevels *--------------------------------------------------------------------------*/ HYPRE_Int hypre_AMGHybridSetMaxLevels( void *AMGhybrid_vdata, - HYPRE_Int max_levels ) + HYPRE_Int max_levels ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -690,7 +754,7 @@ HYPRE_Int hypre_AMGHybridSetMeasureType( void *AMGhybrid_vdata, - HYPRE_Int measure_type ) + HYPRE_Int measure_type ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -710,7 +774,7 @@ HYPRE_Int hypre_AMGHybridSetCoarsenType( void *AMGhybrid_vdata, - HYPRE_Int coarsen_type ) + HYPRE_Int coarsen_type ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -730,7 +794,7 @@ HYPRE_Int hypre_AMGHybridSetInterpType( void *AMGhybrid_vdata, - HYPRE_Int interp_type ) + HYPRE_Int interp_type ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -755,7 +819,7 @@ HYPRE_Int hypre_AMGHybridSetCycleType( void *AMGhybrid_vdata, - HYPRE_Int cycle_type ) + HYPRE_Int cycle_type ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -780,7 +844,7 @@ HYPRE_Int hypre_AMGHybridSetNumSweeps( void *AMGhybrid_vdata, - HYPRE_Int num_sweeps ) + HYPRE_Int num_sweeps ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; HYPRE_Int *num_grid_sweeps; @@ -797,7 +861,9 @@ } if ((AMGhybrid_data -> num_grid_sweeps) == NULL) + { (AMGhybrid_data -> num_grid_sweeps) = hypre_CTAlloc(HYPRE_Int, 4, HYPRE_MEMORY_HOST); + } num_grid_sweeps = (AMGhybrid_data -> num_grid_sweeps); for (i=0; i < 3; i++) { @@ -832,8 +898,10 @@ } if (k < 1 || k > 3) { - if (AMGhybrid_data -> print_level) + if (AMGhybrid_data -> print_level) + { hypre_printf (" Warning! Invalid cycle! num_sweeps not set!\n"); + } hypre_error_in_arg(3); return hypre_error_flag; } @@ -845,7 +913,7 @@ num_grid_sweeps = (AMGhybrid_data -> num_grid_sweeps); for (i=0; i < 4; i++) { - num_grid_sweeps[i] = 1; + num_grid_sweeps[i] = 1; } } num_grid_sweeps[k] = num_sweeps; @@ -858,7 +926,7 @@ HYPRE_Int hypre_AMGHybridSetRelaxType( void *AMGhybrid_vdata, - HYPRE_Int relax_type ) + HYPRE_Int relax_type ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; HYPRE_Int *grid_relax_type; @@ -870,10 +938,14 @@ } if ((AMGhybrid_data -> grid_relax_type) == NULL ) + { (AMGhybrid_data -> grid_relax_type) = hypre_CTAlloc(HYPRE_Int, 4, HYPRE_MEMORY_HOST); + } grid_relax_type = (AMGhybrid_data -> grid_relax_type); for (i=0; i < 3; i++) + { grid_relax_type[i] = relax_type; + } grid_relax_type[3] = 9; return hypre_error_flag; @@ -899,8 +971,10 @@ if (k<1 || k > 3) { - if (AMGhybrid_data -> print_level) + if (AMGhybrid_data -> print_level) + { hypre_printf (" Warning! Invalid cycle! Relax type not set!\n"); + } hypre_error_in_arg(3); return hypre_error_flag; } @@ -911,7 +985,9 @@ (AMGhybrid_data -> grid_relax_type) = hypre_CTAlloc(HYPRE_Int, 4, HYPRE_MEMORY_HOST); grid_relax_type = (AMGhybrid_data -> grid_relax_type); for (i=0; i < 3; i++) + { grid_relax_type[i] = 3; + } grid_relax_type[3] = 9; } grid_relax_type[k] = relax_type; @@ -945,7 +1021,7 @@ HYPRE_Int hypre_AMGHybridSetKeepTranspose( void *AMGhybrid_vdata, - HYPRE_Int keepT ) + HYPRE_Int keepT ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -965,7 +1041,7 @@ HYPRE_Int hypre_AMGHybridSetMaxCoarseSize( void *AMGhybrid_vdata, - HYPRE_Int max_coarse_size ) + HYPRE_Int max_coarse_size ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -990,7 +1066,7 @@ HYPRE_Int hypre_AMGHybridSetMinCoarseSize( void *AMGhybrid_vdata, - HYPRE_Int min_coarse_size ) + HYPRE_Int min_coarse_size ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -1015,7 +1091,7 @@ HYPRE_Int hypre_AMGHybridSetSeqThreshold( void *AMGhybrid_vdata, - HYPRE_Int seq_threshold ) + HYPRE_Int seq_threshold ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -1040,7 +1116,7 @@ HYPRE_Int hypre_AMGHybridSetNumGridSweeps( void *AMGhybrid_vdata, - HYPRE_Int *num_grid_sweeps ) + HYPRE_Int *num_grid_sweeps ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -1055,7 +1131,9 @@ } if ((AMGhybrid_data -> num_grid_sweeps) != NULL) + { hypre_TFree((AMGhybrid_data -> num_grid_sweeps), HYPRE_MEMORY_HOST); + } (AMGhybrid_data -> num_grid_sweeps) = num_grid_sweeps; return hypre_error_flag; @@ -1067,7 +1145,7 @@ HYPRE_Int hypre_AMGHybridSetGridRelaxType( void *AMGhybrid_vdata, - HYPRE_Int *grid_relax_type ) + HYPRE_Int *grid_relax_type ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -1082,7 +1160,9 @@ } if ((AMGhybrid_data -> grid_relax_type) != NULL ) + { hypre_TFree((AMGhybrid_data -> grid_relax_type), HYPRE_MEMORY_HOST); + } (AMGhybrid_data -> grid_relax_type) = grid_relax_type; return hypre_error_flag; @@ -1094,7 +1174,7 @@ HYPRE_Int hypre_AMGHybridSetGridRelaxPoints( void *AMGhybrid_vdata, - HYPRE_Int **grid_relax_points ) + HYPRE_Int **grid_relax_points ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -1109,7 +1189,9 @@ } if ((AMGhybrid_data -> grid_relax_points) != NULL ) + { hypre_TFree((AMGhybrid_data -> grid_relax_points), HYPRE_MEMORY_HOST); + } (AMGhybrid_data -> grid_relax_points) = grid_relax_points; return hypre_error_flag; @@ -1121,7 +1203,7 @@ HYPRE_Int hypre_AMGHybridSetRelaxWeight( void *AMGhybrid_vdata, - HYPRE_Real *relax_weight ) + HYPRE_Real *relax_weight ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -1136,7 +1218,9 @@ } if ((AMGhybrid_data -> relax_weight) != NULL ) + { hypre_TFree((AMGhybrid_data -> relax_weight), HYPRE_MEMORY_HOST); + } (AMGhybrid_data -> relax_weight) = relax_weight; return hypre_error_flag; @@ -1148,7 +1232,7 @@ HYPRE_Int hypre_AMGHybridSetOmega( void *AMGhybrid_vdata, - HYPRE_Real *omega ) + HYPRE_Real *omega ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -1163,7 +1247,9 @@ } if ((AMGhybrid_data -> omega) != NULL ) + { hypre_TFree((AMGhybrid_data -> omega), HYPRE_MEMORY_HOST); + } (AMGhybrid_data -> omega) = omega; return hypre_error_flag; @@ -1175,11 +1261,11 @@ HYPRE_Int hypre_AMGHybridSetRelaxWt( void *AMGhybrid_vdata, - HYPRE_Real relax_wt ) + HYPRE_Real relax_wt ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; HYPRE_Int i , num_levels; - HYPRE_Real *relax_wt_array; + HYPRE_Real *relax_wt_array; if (!AMGhybrid_data) { hypre_error_in_arg(1); @@ -1194,7 +1280,9 @@ (AMGhybrid_data -> relax_weight) = relax_wt_array; } for (i=0; i < num_levels; i++) + { relax_wt_array[i] = relax_wt; + } return hypre_error_flag; } @@ -1210,7 +1298,7 @@ { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; HYPRE_Int i , num_levels; - HYPRE_Real *relax_wt_array; + HYPRE_Real *relax_wt_array; if (!AMGhybrid_data) { hypre_error_in_arg(1); @@ -1218,10 +1306,12 @@ } num_levels = (AMGhybrid_data -> max_levels); - if (level > num_levels-1) + if (level > num_levels-1) { - if (AMGhybrid_data -> print_level) + if (AMGhybrid_data -> print_level) + { hypre_printf (" Warning! Invalid level! Relax weight not set!\n"); + } hypre_error_in_arg(3); return hypre_error_flag; } @@ -1230,7 +1320,9 @@ { relax_wt_array = hypre_CTAlloc(HYPRE_Real, num_levels, HYPRE_MEMORY_HOST); for (i=0; i < num_levels; i++) + { relax_wt_array[i] = 1.0; + } (AMGhybrid_data -> relax_weight) = relax_wt_array; } relax_wt_array[level] = relax_wt; @@ -1244,11 +1336,11 @@ HYPRE_Int hypre_AMGHybridSetOuterWt( void *AMGhybrid_vdata, - HYPRE_Real outer_wt ) + HYPRE_Real outer_wt ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; HYPRE_Int i , num_levels; - HYPRE_Real *outer_wt_array; + HYPRE_Real *outer_wt_array; if (!AMGhybrid_data) { hypre_error_in_arg(1); @@ -1263,7 +1355,9 @@ (AMGhybrid_data -> omega) = outer_wt_array; } for (i=0; i < num_levels; i++) + { outer_wt_array[i] = outer_wt; + } return hypre_error_flag; } @@ -1279,7 +1373,7 @@ { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; HYPRE_Int i , num_levels; - HYPRE_Real *outer_wt_array; + HYPRE_Real *outer_wt_array; if (!AMGhybrid_data) { hypre_error_in_arg(1); @@ -1287,10 +1381,12 @@ } num_levels = (AMGhybrid_data -> max_levels); - if (level > num_levels-1) + if (level > num_levels-1) { - if (AMGhybrid_data -> print_level) + if (AMGhybrid_data -> print_level) + { hypre_printf (" Warning! Invalid level! Outer weight not set!\n"); + } hypre_error_in_arg(3); return hypre_error_flag; } @@ -1299,7 +1395,9 @@ { outer_wt_array = hypre_CTAlloc(HYPRE_Real, num_levels, HYPRE_MEMORY_HOST); for (i=0; i < num_levels; i++) + { outer_wt_array[i] = 1.0; + } (AMGhybrid_data -> omega) = outer_wt_array; } outer_wt_array[level] = outer_wt; @@ -1310,10 +1408,10 @@ /*-------------------------------------------------------------------------- * hypre_AMGHybridSetNumPaths *--------------------------------------------------------------------------*/ - + HYPRE_Int hypre_AMGHybridSetNumPaths( void *AMGhybrid_vdata, - HYPRE_Int num_paths ) + HYPRE_Int num_paths ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -1331,14 +1429,14 @@ return hypre_error_flag; } - + /*-------------------------------------------------------------------------- * hypre_AMGHybridSetDofFunc *--------------------------------------------------------------------------*/ - + HYPRE_Int hypre_AMGHybridSetDofFunc( void *AMGhybrid_vdata, - HYPRE_Int *dof_func ) + HYPRE_Int *dof_func ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -1353,7 +1451,9 @@ } if ((AMGhybrid_data -> dof_func) != NULL ) + { hypre_TFree((AMGhybrid_data -> dof_func), HYPRE_MEMORY_HOST); + } (AMGhybrid_data -> dof_func) = dof_func; return hypre_error_flag; @@ -1361,10 +1461,10 @@ /*-------------------------------------------------------------------------- * hypre_AMGHybridSetAggNumLevels *--------------------------------------------------------------------------*/ - + HYPRE_Int hypre_AMGHybridSetAggNumLevels( void *AMGhybrid_vdata, - HYPRE_Int agg_num_levels ) + HYPRE_Int agg_num_levels ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -1377,19 +1477,19 @@ hypre_error_in_arg(2); return hypre_error_flag; } - + (AMGhybrid_data -> agg_num_levels) = agg_num_levels; - + return hypre_error_flag; } - + /*-------------------------------------------------------------------------- * hypre_AMGHybridSetNumFunctions *--------------------------------------------------------------------------*/ - + HYPRE_Int hypre_AMGHybridSetNumFunctions( void *AMGhybrid_vdata, - HYPRE_Int num_functions ) + HYPRE_Int num_functions ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -1402,19 +1502,19 @@ hypre_error_in_arg(2); return hypre_error_flag; } - + (AMGhybrid_data -> num_functions) = num_functions; - + return hypre_error_flag; } - + /*-------------------------------------------------------------------------- * hypre_AMGHybridSetNodal *--------------------------------------------------------------------------*/ - + HYPRE_Int hypre_AMGHybridSetNodal( void *AMGhybrid_vdata, - HYPRE_Int nodal ) + HYPRE_Int nodal ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -1422,19 +1522,19 @@ hypre_error_in_arg(1); return hypre_error_flag; } - + (AMGhybrid_data -> nodal) = nodal; - + return hypre_error_flag; } - + /*-------------------------------------------------------------------------- * hypre_AMGHybridGetNumIterations *--------------------------------------------------------------------------*/ HYPRE_Int hypre_AMGHybridGetNumIterations( void *AMGhybrid_vdata, - HYPRE_Int *num_its ) + HYPRE_Int *num_its ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -1454,7 +1554,7 @@ HYPRE_Int hypre_AMGHybridGetDSCGNumIterations( void *AMGhybrid_vdata, - HYPRE_Int *dscg_num_its ) + HYPRE_Int *dscg_num_its ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -1474,7 +1574,7 @@ HYPRE_Int hypre_AMGHybridGetPCGNumIterations( void *AMGhybrid_vdata, - HYPRE_Int *pcg_num_its ) + HYPRE_Int *pcg_num_its ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -1494,7 +1594,7 @@ HYPRE_Int hypre_AMGHybridGetFinalRelativeResidualNorm( void *AMGhybrid_vdata, - HYPRE_Real *final_rel_res_norm ) + HYPRE_Real *final_rel_res_norm ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -1514,9 +1614,9 @@ HYPRE_Int hypre_AMGHybridSetup( void *AMGhybrid_vdata, - hypre_ParCSRMatrix *A, - hypre_ParVector *b, - hypre_ParVector *x ) + hypre_ParCSRMatrix *A, + hypre_ParVector *b, + hypre_ParVector *x ) { hypre_AMGHybridData *AMGhybrid_data =(hypre_AMGHybridData *) AMGhybrid_vdata; if (!AMGhybrid_data) @@ -1555,38 +1655,40 @@ HYPRE_Int two_norm; HYPRE_Int stop_crit; HYPRE_Int rel_change; + HYPRE_Int recompute_residual; + HYPRE_Int recompute_residual_p; HYPRE_Int logging; HYPRE_Int print_level; HYPRE_Int setup_type; HYPRE_Int solver_type; HYPRE_Int k_dim; /* BoomerAMG info */ - HYPRE_Real strong_threshold; - HYPRE_Real max_row_sum; - HYPRE_Real trunc_factor; + HYPRE_Real strong_threshold; + HYPRE_Real max_row_sum; + HYPRE_Real trunc_factor; HYPRE_Int pmax; - HYPRE_Int max_levels; - HYPRE_Int measure_type; - HYPRE_Int coarsen_type; - HYPRE_Int interp_type; - HYPRE_Int cycle_type; - HYPRE_Int num_paths; - HYPRE_Int agg_num_levels; - HYPRE_Int num_functions; - HYPRE_Int nodal; - HYPRE_Int relax_order; - HYPRE_Int keepT; - HYPRE_Int *num_grid_sweeps; - HYPRE_Int *grid_relax_type; - HYPRE_Int **grid_relax_points; + HYPRE_Int max_levels; + HYPRE_Int measure_type; + HYPRE_Int coarsen_type; + HYPRE_Int interp_type; + HYPRE_Int cycle_type; + HYPRE_Int num_paths; + HYPRE_Int agg_num_levels; + HYPRE_Int num_functions; + HYPRE_Int nodal; + HYPRE_Int relax_order; + HYPRE_Int keepT; + HYPRE_Int *num_grid_sweeps; + HYPRE_Int *grid_relax_type; + HYPRE_Int **grid_relax_points; HYPRE_Real *relax_weight; HYPRE_Real *omega; HYPRE_Int *dof_func; - HYPRE_Int *boom_ngs; - HYPRE_Int *boom_grt; + HYPRE_Int *boom_ngs; + HYPRE_Int *boom_grt; HYPRE_Int *boom_dof_func; - HYPRE_Int **boom_grp; + HYPRE_Int **boom_grp; HYPRE_Real *boom_rlxw; HYPRE_Real *boom_omega; @@ -1599,7 +1701,7 @@ hypre_PCGFunctions *pcg_functions; hypre_GMRESFunctions *gmres_functions; hypre_BiCGSTABFunctions *bicgstab_functions; - + HYPRE_Int dscg_num_its=0; HYPRE_Int pcg_num_its=0; HYPRE_Int converged=0; @@ -1607,27 +1709,22 @@ HYPRE_Real res_norm; HYPRE_Int i, j; - HYPRE_Int sol_print_level; /* print_level for solver */ - HYPRE_Int pre_print_level; /* print_level for preconditioner */ - HYPRE_Int max_coarse_size, seq_threshold; - HYPRE_Int min_coarse_size; - HYPRE_Int nongalerk_num_tol; - HYPRE_Real *nongalerkin_tol; + HYPRE_Int sol_print_level; /* print_level for solver */ + HYPRE_Int pre_print_level; /* print_level for preconditioner */ + HYPRE_Int max_coarse_size, seq_threshold; + HYPRE_Int min_coarse_size; + HYPRE_Int nongalerk_num_tol; + HYPRE_Real *nongalerkin_tol; if (!AMGhybrid_data) { hypre_error_in_arg(1); return hypre_error_flag; } + /*----------------------------------------------------------------------- * Setup diagonal scaled solver *-----------------------------------------------------------------------*/ - - if (!AMGhybrid_data) - { - hypre_error_in_arg(1); - return hypre_error_flag; - } tol = (AMGhybrid_data -> tol); a_tol = (AMGhybrid_data -> a_tol); cf_tol = (AMGhybrid_data -> cf_tol); @@ -1636,6 +1733,8 @@ two_norm = (AMGhybrid_data -> two_norm); stop_crit = (AMGhybrid_data -> stop_crit); rel_change = (AMGhybrid_data -> rel_change); + recompute_residual = (AMGhybrid_data -> recompute_residual); + recompute_residual_p = (AMGhybrid_data -> recompute_residual_p); logging = (AMGhybrid_data -> logging); print_level = (AMGhybrid_data -> print_level); setup_type = (AMGhybrid_data -> setup_type); @@ -1684,193 +1783,197 @@ hypre_error_in_arg(4); return hypre_error_flag; } - -/* print_level definitions: xy, sol_print_level = y, pre_print_level = x */ + + /* print_level definitions: xy, sol_print_level = y, pre_print_level = x */ pre_print_level = print_level/10; sol_print_level = print_level - pre_print_level*10; - + pcg_solver = (AMGhybrid_data -> pcg_solver); pcg_precond = (AMGhybrid_data -> pcg_precond); (AMGhybrid_data -> dscg_num_its) = 0; (AMGhybrid_data -> pcg_num_its) = 0; - + if (setup_type || pcg_precond == NULL) { - if (pcg_precond) - { - hypre_BoomerAMGDestroy(pcg_precond); - pcg_precond = NULL; - (AMGhybrid_data -> pcg_precond) = NULL; - } - if (solver_type == 1) - { - if (pcg_solver == NULL) - { - pcg_functions = - hypre_PCGFunctionsCreate( - hypre_CAlloc, hypre_ParKrylovFree, - hypre_ParKrylovCommInfo, - hypre_ParKrylovCreateVector, - hypre_ParKrylovDestroyVector, hypre_ParKrylovMatvecCreate, - hypre_ParKrylovMatvec, - hypre_ParKrylovMatvecDestroy, - hypre_ParKrylovInnerProd, hypre_ParKrylovCopyVector, - hypre_ParKrylovClearVector, - hypre_ParKrylovScaleVector, hypre_ParKrylovAxpy, - hypre_ParKrylovIdentitySetup, hypre_ParKrylovIdentity ); - pcg_solver = hypre_PCGCreate( pcg_functions ); - - hypre_PCGSetMaxIter(pcg_solver, dscg_max_its); - hypre_PCGSetTol(pcg_solver, tol); - hypre_PCGSetAbsoluteTol(pcg_solver, a_tol); - hypre_PCGSetTwoNorm(pcg_solver, two_norm); - hypre_PCGSetStopCrit(pcg_solver, stop_crit); - hypre_PCGSetRelChange(pcg_solver, rel_change); - hypre_PCGSetLogging(pcg_solver, logging); - hypre_PCGSetPrintLevel(pcg_solver, sol_print_level); - hypre_PCGSetHybrid(pcg_solver,-1); - - pcg_precond = NULL; - } - - hypre_PCGSetConvergenceFactorTol(pcg_solver, cf_tol); - hypre_PCGSetPrecond((void*) pcg_solver, - (HYPRE_Int (*)(void*, void*, void*, void*)) HYPRE_ParCSRDiagScale, - (HYPRE_Int (*)(void*, void*, void*, void*)) HYPRE_ParCSRDiagScaleSetup, - (void*) pcg_precond); - hypre_PCGSetup(pcg_solver, (void*) A, (void*) b, (void*) x); - (AMGhybrid_data -> pcg_solver) = pcg_solver; - - /*--------------------------------------------------------------------- - * Solve with DSCG. - *---------------------------------------------------------------------*/ - hypre_PCGSolve(pcg_solver, (void*) A, (void*) b, (void*) x); - - /*--------------------------------------------------------------------- - * Get information for DSCG. - *---------------------------------------------------------------------*/ - hypre_PCGGetNumIterations(pcg_solver, &dscg_num_its); - (AMGhybrid_data -> dscg_num_its) = dscg_num_its; - hypre_PCGGetFinalRelativeResidualNorm(pcg_solver, &res_norm); - - hypre_PCGGetConverged(pcg_solver, &converged); - - } - else if (solver_type == 2) - { - if (pcg_solver == NULL) - { - gmres_functions = - hypre_GMRESFunctionsCreate( - hypre_CAlloc, hypre_ParKrylovFree, - hypre_ParKrylovCommInfo, - hypre_ParKrylovCreateVector, - hypre_ParKrylovCreateVectorArray, - hypre_ParKrylovDestroyVector, hypre_ParKrylovMatvecCreate, - hypre_ParKrylovMatvec, - hypre_ParKrylovMatvecDestroy, - hypre_ParKrylovInnerProd, hypre_ParKrylovCopyVector, - hypre_ParKrylovClearVector, - hypre_ParKrylovScaleVector, hypre_ParKrylovAxpy, - hypre_ParKrylovIdentitySetup, hypre_ParKrylovIdentity ); - pcg_solver = hypre_GMRESCreate( gmres_functions ); - - hypre_GMRESSetMaxIter(pcg_solver, dscg_max_its); - hypre_GMRESSetTol(pcg_solver, tol); - hypre_GMRESSetAbsoluteTol(pcg_solver, a_tol); - hypre_GMRESSetKDim(pcg_solver, k_dim); - hypre_GMRESSetStopCrit(pcg_solver, stop_crit); - hypre_GMRESSetRelChange(pcg_solver, rel_change); - hypre_GMRESSetLogging(pcg_solver, logging); - hypre_GMRESSetPrintLevel(pcg_solver, sol_print_level); - hypre_GMRESSetHybrid(pcg_solver,-1); - - pcg_precond = NULL; - } - - hypre_GMRESSetConvergenceFactorTol(pcg_solver, cf_tol); - hypre_GMRESSetPrecond((void*) pcg_solver, - (HYPRE_Int (*)(void*, void*, void*, void*)) HYPRE_ParCSRDiagScale, - (HYPRE_Int (*)(void*, void*, void*, void*)) HYPRE_ParCSRDiagScaleSetup, - (void*) pcg_precond); - hypre_GMRESSetup(pcg_solver, (void*) A, (void*) b, (void*) x); - (AMGhybrid_data -> pcg_solver) = pcg_solver; - - /*--------------------------------------------------------------------- - * Solve with diagonal scaled GMRES - *---------------------------------------------------------------------*/ - hypre_GMRESSolve(pcg_solver, (void*) A, (void*) b, (void*) x); - - /*--------------------------------------------------------------------- - * Get information for GMRES - *---------------------------------------------------------------------*/ - hypre_GMRESGetNumIterations(pcg_solver, &dscg_num_its); - (AMGhybrid_data -> dscg_num_its) = dscg_num_its; - hypre_GMRESGetFinalRelativeResidualNorm(pcg_solver, &res_norm); - - hypre_GMRESGetConverged(pcg_solver, &converged); - - } - else if (solver_type == 3) - { - if (pcg_solver == NULL) - { - bicgstab_functions = - hypre_BiCGSTABFunctionsCreate( - hypre_ParKrylovCreateVector, - hypre_ParKrylovDestroyVector, hypre_ParKrylovMatvecCreate, - hypre_ParKrylovMatvec, - hypre_ParKrylovMatvecDestroy, - hypre_ParKrylovInnerProd, hypre_ParKrylovCopyVector, - hypre_ParKrylovClearVector, - hypre_ParKrylovScaleVector, hypre_ParKrylovAxpy, - hypre_ParKrylovCommInfo, - hypre_ParKrylovIdentitySetup, hypre_ParKrylovIdentity ); - pcg_solver = hypre_BiCGSTABCreate( bicgstab_functions ); - - hypre_BiCGSTABSetMaxIter(pcg_solver, dscg_max_its); - hypre_BiCGSTABSetTol(pcg_solver, tol); - hypre_BiCGSTABSetAbsoluteTol(pcg_solver, a_tol); - hypre_BiCGSTABSetStopCrit(pcg_solver, stop_crit); - hypre_BiCGSTABSetLogging(pcg_solver, logging); - hypre_BiCGSTABSetPrintLevel(pcg_solver, sol_print_level); - hypre_BiCGSTABSetHybrid(pcg_solver,-1); - - pcg_precond = NULL; - } - - hypre_BiCGSTABSetConvergenceFactorTol(pcg_solver, cf_tol); - hypre_BiCGSTABSetPrecond((void*) pcg_solver, - (HYPRE_Int (*)(void*, void*, void*, void*)) HYPRE_ParCSRDiagScale, - (HYPRE_Int (*)(void*, void*, void*, void*)) HYPRE_ParCSRDiagScaleSetup, - (void*) pcg_precond); - hypre_BiCGSTABSetup(pcg_solver, (void*) A, (void*) b, (void*) x); - (AMGhybrid_data -> pcg_solver) = pcg_solver; - - /*--------------------------------------------------------------------- - * Solve with diagonal scaled BiCGSTAB - *---------------------------------------------------------------------*/ - hypre_BiCGSTABSolve(pcg_solver, (void*) A, (void*) b, (void*) x); - - /*--------------------------------------------------------------------- - * Get information for BiCGSTAB - *---------------------------------------------------------------------*/ - hypre_BiCGSTABGetNumIterations(pcg_solver, &dscg_num_its); - (AMGhybrid_data -> dscg_num_its) = dscg_num_its; - hypre_BiCGSTABGetFinalRelativeResidualNorm(pcg_solver, &res_norm); + if (pcg_precond) + { + hypre_BoomerAMGDestroy(pcg_precond); + pcg_precond = NULL; + (AMGhybrid_data -> pcg_precond) = NULL; + } + if (solver_type == 1) + { + if (pcg_solver == NULL) + { + pcg_functions = + hypre_PCGFunctionsCreate( + hypre_CAlloc, hypre_ParKrylovFree, + hypre_ParKrylovCommInfo, + hypre_ParKrylovCreateVector, + hypre_ParKrylovDestroyVector, hypre_ParKrylovMatvecCreate, + hypre_ParKrylovMatvec, + hypre_ParKrylovMatvecDestroy, + hypre_ParKrylovInnerProd, hypre_ParKrylovCopyVector, + hypre_ParKrylovClearVector, + hypre_ParKrylovScaleVector, hypre_ParKrylovAxpy, + hypre_ParKrylovIdentitySetup, hypre_ParKrylovIdentity ); + pcg_solver = hypre_PCGCreate( pcg_functions ); + + hypre_PCGSetTol(pcg_solver, tol); + hypre_PCGSetAbsoluteTol(pcg_solver, a_tol); + hypre_PCGSetTwoNorm(pcg_solver, two_norm); + hypre_PCGSetStopCrit(pcg_solver, stop_crit); + hypre_PCGSetRelChange(pcg_solver, rel_change); + hypre_PCGSetRecomputeResidual(pcg_solver, recompute_residual); + hypre_PCGSetRecomputeResidualP(pcg_solver, recompute_residual_p); + hypre_PCGSetLogging(pcg_solver, logging); + hypre_PCGSetPrintLevel(pcg_solver, sol_print_level); + hypre_PCGSetHybrid(pcg_solver,-1); + + pcg_precond = NULL; + } + + hypre_PCGSetMaxIter(pcg_solver, dscg_max_its); + hypre_PCGSetConvergenceFactorTol(pcg_solver, cf_tol); + hypre_PCGSetPrecond((void*) pcg_solver, + (HYPRE_Int (*)(void*, void*, void*, void*)) HYPRE_ParCSRDiagScale, + (HYPRE_Int (*)(void*, void*, void*, void*)) HYPRE_ParCSRDiagScaleSetup, + (void*) pcg_precond); + hypre_PCGSetup(pcg_solver, (void*) A, (void*) b, (void*) x); + (AMGhybrid_data -> pcg_solver) = pcg_solver; + + /*--------------------------------------------------------------------- + * Solve with DSCG. + *---------------------------------------------------------------------*/ + hypre_PCGSolve(pcg_solver, (void*) A, (void*) b, (void*) x); + + /*--------------------------------------------------------------------- + * Get information for DSCG. + *---------------------------------------------------------------------*/ + hypre_PCGGetNumIterations(pcg_solver, &dscg_num_its); + (AMGhybrid_data -> dscg_num_its) = dscg_num_its; + hypre_PCGGetFinalRelativeResidualNorm(pcg_solver, &res_norm); + + hypre_PCGGetConverged(pcg_solver, &converged); + + } + else if (solver_type == 2) + { + if (pcg_solver == NULL) + { + gmres_functions = + hypre_GMRESFunctionsCreate( + hypre_CAlloc, hypre_ParKrylovFree, + hypre_ParKrylovCommInfo, + hypre_ParKrylovCreateVector, + hypre_ParKrylovCreateVectorArray, + hypre_ParKrylovDestroyVector, hypre_ParKrylovMatvecCreate, + hypre_ParKrylovMatvec, + hypre_ParKrylovMatvecDestroy, + hypre_ParKrylovInnerProd, hypre_ParKrylovCopyVector, + hypre_ParKrylovClearVector, + hypre_ParKrylovScaleVector, hypre_ParKrylovAxpy, + hypre_ParKrylovIdentitySetup, hypre_ParKrylovIdentity ); + pcg_solver = hypre_GMRESCreate( gmres_functions ); + + hypre_GMRESSetTol(pcg_solver, tol); + hypre_GMRESSetAbsoluteTol(pcg_solver, a_tol); + hypre_GMRESSetKDim(pcg_solver, k_dim); + hypre_GMRESSetStopCrit(pcg_solver, stop_crit); + hypre_GMRESSetRelChange(pcg_solver, rel_change); + hypre_GMRESSetLogging(pcg_solver, logging); + hypre_GMRESSetPrintLevel(pcg_solver, sol_print_level); + hypre_GMRESSetHybrid(pcg_solver,-1); + + pcg_precond = NULL; + } + + hypre_GMRESSetMaxIter(pcg_solver, dscg_max_its); + hypre_GMRESSetConvergenceFactorTol(pcg_solver, cf_tol); + hypre_GMRESSetPrecond((void*) pcg_solver, + (HYPRE_Int (*)(void*, void*, void*, void*)) HYPRE_ParCSRDiagScale, + (HYPRE_Int (*)(void*, void*, void*, void*)) HYPRE_ParCSRDiagScaleSetup, + (void*) pcg_precond); + hypre_GMRESSetup(pcg_solver, (void*) A, (void*) b, (void*) x); + (AMGhybrid_data -> pcg_solver) = pcg_solver; + + /*--------------------------------------------------------------------- + * Solve with diagonal scaled GMRES + *---------------------------------------------------------------------*/ + hypre_GMRESSolve(pcg_solver, (void*) A, (void*) b, (void*) x); + + /*--------------------------------------------------------------------- + * Get information for GMRES + *---------------------------------------------------------------------*/ + hypre_GMRESGetNumIterations(pcg_solver, &dscg_num_its); + (AMGhybrid_data -> dscg_num_its) = dscg_num_its; + hypre_GMRESGetFinalRelativeResidualNorm(pcg_solver, &res_norm); + + hypre_GMRESGetConverged(pcg_solver, &converged); + + } + else if (solver_type == 3) + { + if (pcg_solver == NULL) + { + bicgstab_functions = + hypre_BiCGSTABFunctionsCreate( + hypre_ParKrylovCreateVector, + hypre_ParKrylovDestroyVector, hypre_ParKrylovMatvecCreate, + hypre_ParKrylovMatvec, + hypre_ParKrylovMatvecDestroy, + hypre_ParKrylovInnerProd, hypre_ParKrylovCopyVector, + hypre_ParKrylovClearVector, + hypre_ParKrylovScaleVector, hypre_ParKrylovAxpy, + hypre_ParKrylovCommInfo, + hypre_ParKrylovIdentitySetup, hypre_ParKrylovIdentity ); + pcg_solver = hypre_BiCGSTABCreate( bicgstab_functions ); + + hypre_BiCGSTABSetTol(pcg_solver, tol); + hypre_BiCGSTABSetAbsoluteTol(pcg_solver, a_tol); + hypre_BiCGSTABSetStopCrit(pcg_solver, stop_crit); + hypre_BiCGSTABSetLogging(pcg_solver, logging); + hypre_BiCGSTABSetPrintLevel(pcg_solver, sol_print_level); + hypre_BiCGSTABSetHybrid(pcg_solver,-1); - hypre_BiCGSTABGetConverged(pcg_solver, &converged); + pcg_precond = NULL; + } + + hypre_BiCGSTABSetMaxIter(pcg_solver, dscg_max_its); + hypre_BiCGSTABSetConvergenceFactorTol(pcg_solver, cf_tol); + hypre_BiCGSTABSetPrecond((void*) pcg_solver, + (HYPRE_Int (*)(void*, void*, void*, void*)) HYPRE_ParCSRDiagScale, + (HYPRE_Int (*)(void*, void*, void*, void*)) HYPRE_ParCSRDiagScaleSetup, + (void*) pcg_precond); + hypre_BiCGSTABSetup(pcg_solver, (void*) A, (void*) b, (void*) x); + (AMGhybrid_data -> pcg_solver) = pcg_solver; + + /*--------------------------------------------------------------------- + * Solve with diagonal scaled BiCGSTAB + *---------------------------------------------------------------------*/ + hypre_BiCGSTABSolve(pcg_solver, (void*) A, (void*) b, (void*) x); + + /*--------------------------------------------------------------------- + * Get information for BiCGSTAB + *---------------------------------------------------------------------*/ + hypre_BiCGSTABGetNumIterations(pcg_solver, &dscg_num_its); + (AMGhybrid_data -> dscg_num_its) = dscg_num_its; + hypre_BiCGSTABGetFinalRelativeResidualNorm(pcg_solver, &res_norm); - } + hypre_BiCGSTABGetConverged(pcg_solver, &converged); + + } } /*--------------------------------------------------------------------- - * If converged, done... + * If converged, done... *---------------------------------------------------------------------*/ if (converged) { if (logging) + { (AMGhybrid_data -> final_rel_res_norm) = res_norm; + } } /*----------------------------------------------------------------------- * ... otherwise, use AMG+solver @@ -1926,59 +2029,59 @@ hypre_BoomerAMGSetRelaxOrder(pcg_precond, relax_order); hypre_BoomerAMGSetKeepTranspose(pcg_precond, keepT); hypre_BoomerAMGSetNonGalerkTol(pcg_precond, nongalerk_num_tol, nongalerkin_tol); - if (grid_relax_type) + if (grid_relax_type) { - boom_grt = hypre_CTAlloc(HYPRE_Int, 4, HYPRE_MEMORY_HOST); - for (i=0; i < 4; i++) - boom_grt[i] = grid_relax_type[i]; - hypre_BoomerAMGSetGridRelaxType(pcg_precond, boom_grt); + boom_grt = hypre_CTAlloc(HYPRE_Int, 4, HYPRE_MEMORY_HOST); + for (i=0; i < 4; i++) + boom_grt[i] = grid_relax_type[i]; + hypre_BoomerAMGSetGridRelaxType(pcg_precond, boom_grt); } - else + else { - boom_grt = hypre_CTAlloc(HYPRE_Int, 4, HYPRE_MEMORY_HOST); - boom_grt[0] = 3; - boom_grt[1] = 13; - boom_grt[2] = 14; - boom_grt[3] = 9; - hypre_BoomerAMGSetGridRelaxType(pcg_precond, boom_grt); + boom_grt = hypre_CTAlloc(HYPRE_Int, 4, HYPRE_MEMORY_HOST); + boom_grt[0] = 3; + boom_grt[1] = 13; + boom_grt[2] = 14; + boom_grt[3] = 9; + hypre_BoomerAMGSetGridRelaxType(pcg_precond, boom_grt); } - if (relax_weight) + if (relax_weight) { - boom_rlxw = hypre_CTAlloc(HYPRE_Real, max_levels, HYPRE_MEMORY_HOST); - for (i=0; i < max_levels; i++) - boom_rlxw[i] = relax_weight[i]; + boom_rlxw = hypre_CTAlloc(HYPRE_Real, max_levels, HYPRE_MEMORY_HOST); + for (i=0; i < max_levels; i++) + boom_rlxw[i] = relax_weight[i]; hypre_BoomerAMGSetRelaxWeight(pcg_precond, boom_rlxw); } - if (omega) + if (omega) { - boom_omega = hypre_CTAlloc(HYPRE_Real, max_levels, HYPRE_MEMORY_HOST); - for (i=0; i < max_levels; i++) - boom_omega[i] = omega[i]; + boom_omega = hypre_CTAlloc(HYPRE_Real, max_levels, HYPRE_MEMORY_HOST); + for (i=0; i < max_levels; i++) + boom_omega[i] = omega[i]; hypre_BoomerAMGSetOmega(pcg_precond, boom_omega); } - if (num_grid_sweeps) - { - boom_ngs = hypre_CTAlloc(HYPRE_Int, 4, HYPRE_MEMORY_HOST); - for (i=0; i < 4; i++) - boom_ngs[i] = num_grid_sweeps[i]; + if (num_grid_sweeps) + { + boom_ngs = hypre_CTAlloc(HYPRE_Int, 4, HYPRE_MEMORY_HOST); + for (i=0; i < 4; i++) + boom_ngs[i] = num_grid_sweeps[i]; hypre_BoomerAMGSetNumGridSweeps(pcg_precond, boom_ngs); - if (grid_relax_points) + if (grid_relax_points) { - boom_grp = hypre_CTAlloc(HYPRE_Int*, 4, HYPRE_MEMORY_HOST); - for (i=0; i < 4; i++) - { - boom_grp[i] = hypre_CTAlloc(HYPRE_Int, num_grid_sweeps[i], HYPRE_MEMORY_HOST); - for (j=0; j < num_grid_sweeps[i]; j++) - boom_grp[i][j] = grid_relax_points[i][j]; - } + boom_grp = hypre_CTAlloc(HYPRE_Int*, 4, HYPRE_MEMORY_HOST); + for (i=0; i < 4; i++) + { + boom_grp[i] = hypre_CTAlloc(HYPRE_Int, num_grid_sweeps[i], HYPRE_MEMORY_HOST); + for (j=0; j < num_grid_sweeps[i]; j++) + boom_grp[i][j] = grid_relax_points[i][j]; + } hypre_BoomerAMGSetGridRelaxPoints(pcg_precond, boom_grp); } } - if (dof_func) + if (dof_func) { - boom_dof_func = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); - for (i=0; i < num_variables; i++) - boom_dof_func[i] = dof_func[i]; + boom_dof_func = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); + for (i=0; i < num_variables; i++) + boom_dof_func[i] = dof_func[i]; hypre_BoomerAMGSetDofFunc(pcg_precond, boom_dof_func); } pcg_precond_solve = (HYPRE_Int (*)(void*, void*, void*, void*)) hypre_BoomerAMGSolve; @@ -2001,9 +2104,9 @@ if (solver_type == 1) { hypre_PCGSetPrecond((void*) pcg_solver, - (HYPRE_Int (*)(void*, void*, void*, void*)) pcg_precond_solve, - (HYPRE_Int (*)(void*, void*, void*, void*)) pcg_precond_setup, - (void*) pcg_precond); + (HYPRE_Int (*)(void*, void*, void*, void*)) pcg_precond_solve, + (HYPRE_Int (*)(void*, void*, void*, void*)) pcg_precond_setup, + (void*) pcg_precond); hypre_PCGSetup(pcg_solver, (void*) A, (void*) b, (void*) x); /* Solve */ @@ -2021,9 +2124,9 @@ else if (solver_type == 2) { hypre_GMRESSetPrecond((void*) pcg_solver, - (HYPRE_Int (*)(void*, void*, void*, void*)) pcg_precond_solve, - (HYPRE_Int (*)(void*, void*, void*, void*)) pcg_precond_setup, - (void*) pcg_precond); + (HYPRE_Int (*)(void*, void*, void*, void*)) pcg_precond_solve, + (HYPRE_Int (*)(void*, void*, void*, void*)) pcg_precond_setup, + (void*) pcg_precond); hypre_GMRESSetup(pcg_solver, (void*) A, (void*) b, (void*) x); /* Solve */ @@ -2040,10 +2143,10 @@ } else if (solver_type == 3) { - hypre_BiCGSTABSetPrecond((void*) pcg_solver, - (HYPRE_Int (*)(void*, void*, void*, void*)) pcg_precond_solve, - (HYPRE_Int (*)(void*, void*, void*, void*)) pcg_precond_setup, - (void*) pcg_precond); + hypre_BiCGSTABSetPrecond((void*) pcg_solver, + (HYPRE_Int (*)(void*, void*, void*, void*)) pcg_precond_solve, + (HYPRE_Int (*)(void*, void*, void*, void*)) pcg_precond_setup, + (void*) pcg_precond); hypre_BiCGSTABSetup(pcg_solver, (void*) A, (void*) b, (void*) x); /* Solve */ @@ -2054,7 +2157,7 @@ (AMGhybrid_data -> pcg_num_its) = pcg_num_its; if (logging) { - hypre_BiCGSTABGetFinalRelativeResidualNorm(pcg_solver, &res_norm); + hypre_BiCGSTABGetFinalRelativeResidualNorm(pcg_solver, &res_norm); (AMGhybrid_data -> final_rel_res_norm) = res_norm; } } diff -Nru hypre-2.16.0/src/parcsr_ls/ams.c hypre-2.18.2/src/parcsr_ls/ams.c --- hypre-2.16.0/src/parcsr_ls/ams.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/ams.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" #include "float.h" @@ -61,62 +56,43 @@ HYPRE_Real *u_data = hypre_VectorData(hypre_ParVectorLocalVector(u)); HYPRE_Real *f_data = hypre_VectorData(hypre_ParVectorLocalVector(f)); HYPRE_Real *v_data = hypre_VectorData(hypre_ParVectorLocalVector(v)); - //printRC(hypre_ParVectorLocalVector(u),"STarting...."); + for (sweep = 0; sweep < relax_times; sweep++) { if (relax_type == 1) /* l1-scaled Jacobi */ { - PUSH_RANGE_PAYLOAD("RELAX",4,sweep); HYPRE_Int num_rows = hypre_ParCSRMatrixNumRows(A); #ifdef HYPRE_USING_UNIFIED_MEMORY - if (sweep==0) + if (sweep == 0) { - hypre_SeqVectorPrefetchToDevice(hypre_ParVectorLocalVector(v)); - hypre_SeqVectorPrefetchToDevice(hypre_ParVectorLocalVector(f)); + /* prefetch l1 norms */ + hypre_TMemcpy(l1_norms, l1_norms, HYPRE_Real, num_rows, + HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_SHARED); } #endif - //SyncVectorToHost(hypre_ParVectorLocalVector(v)); - //SyncVectorToHost(hypre_ParVectorLocalVector(f)); -#if defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) - VecCopy(v_data,f_data,hypre_VectorSize(hypre_ParVectorLocalVector(v)),HYPRE_STREAM(4)); -#else - //printRC(hypre_ParVectorLocalVector(v),"Pre-COPY V"); - //printRC(hypre_ParVectorLocalVector(f),"Pre-COPY F"); - hypre_ParVectorCopy(f,v); -#endif -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - SyncVectorToDevice(hypre_ParVectorLocalVector(v)); -#endif + hypre_HandleCudaComputeStreamSyncPush(hypre_handle, 0); + + hypre_ParVectorCopy(f, v); + hypre_ParCSRMatrixMatvec(-relax_weight, A, u, relax_weight, v); - //SyncVectorToHost(hypre_ParVectorLocalVector(v)); - //SyncVectorToHost(hypre_ParVectorLocalVector(u)); - PUSH_RANGE_PAYLOAD("VECSCALE-RELAX",5,num_rows); -#if defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) - VecScale(u_data,v_data,l1_norms,num_rows,HYPRE_STREAM(4)); -#else +#if defined(HYPRE_USING_CUDA) + hypreDevice_IVAXPY(num_rows, l1_norms, v_data, u_data); +#else /* #if defined(HYPRE_USING_CUDA) */ HYPRE_Int i; /* u += w D^{-1}(f - A u), where D_ii = ||A(i,:)||_1 */ -#if defined(HYPRE_USING_OPENMP_OFFLOAD) - HYPRE_Int num_teams = (num_rows+num_rows%1024)/1024; - //printf("AMS.C %d = %d \n",num_rows,num_teams*1024); - //printf("Ptypes %d %d %d \n",PointerAttributes(u_data),PointerAttributes(v_data),PointerAttributes(l1_norms)); -#pragma omp target teams distribute parallel for private(i) num_teams(num_teams) thread_limit(1024) is_device_ptr(u_data,v_data,l1_norms) -#elif defined(HYPRE_USING_MAPPED_OPENMP_OFFLOAD) - HYPRE_Int num_teams = (num_rows+num_rows%1024)/1024; -#pragma omp target teams distribute parallel for private(i) num_teams(num_teams) thread_limit(1024) +#if defined(HYPRE_USING_DEVICE_OPENMP) +#pragma omp target teams distribute parallel for private(i) is_device_ptr(u_data,v_data,l1_norms) #endif for (i = 0; i < num_rows; i++) { u_data[i] += v_data[i] / l1_norms[i]; } -#endif -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - UpdateDRC(hypre_ParVectorLocalVector(u)); -#endif - //printf("AMS.C DONE %d = %d \n",num_rows,num_teams*1024); - POP_RANGE; - POP_RANGE; +#endif /* #if defined(HYPRE_USING_CUDA) */ + + hypre_HandleCudaComputeStreamSyncPop(hypre_handle); + + hypre_SyncCudaComputeStream(hypre_handle); } else if (relax_type == 2 || relax_type == 4) /* offd-l1-scaled block GS */ { @@ -773,9 +749,7 @@ hypre_TFree(cf_marker_offd, HYPRE_MEMORY_HOST); *l1_norm_ptr = l1_norm; -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD -#pragma omp target enter data map(to:l1_norm[0:num_rows]) if (num_rows>0) -#endif + return hypre_error_flag; } @@ -2080,9 +2054,30 @@ hypre_ParCSRMatrix *A = hypre_ParMatmul(ams_data -> G0, G0t); hypre_ParCSRMatrix *B = Aorig; hypre_ParCSRMatrix **C_ptr = &ams_data -> A; - hypre_ParCSRMatrix *C; - hypre_CSRMatrix *A_local, *B_local, *C_local, *C_tmp; + HYPRE_Real factor, lfactor; + /* scale (penalize) G0 G0^T before adding it to the matrix */ + { + HYPRE_Int i; + HYPRE_Int B_num_rows = hypre_CSRMatrixNumRows(hypre_ParCSRMatrixDiag(B)); + HYPRE_Real *B_diag_data = hypre_CSRMatrixData(hypre_ParCSRMatrixDiag(B)); + HYPRE_Real *B_offd_data = hypre_CSRMatrixData(hypre_ParCSRMatrixOffd(B)); + HYPRE_Int *B_diag_i = hypre_CSRMatrixI(hypre_ParCSRMatrixDiag(B)); + HYPRE_Int *B_offd_i = hypre_CSRMatrixI(hypre_ParCSRMatrixOffd(B)); + lfactor = -1; + for (i = 0; i < B_diag_i[B_num_rows]; i++) + if (fabs(B_diag_data[i]) > lfactor) + lfactor = fabs(B_diag_data[i]); + for (i = 0; i < B_offd_i[B_num_rows]; i++) + if (fabs(B_offd_data[i]) > lfactor) + lfactor = fabs(B_offd_data[i]); + lfactor *= 1e-10; /* scaling factor: max|A_ij|*1e-10 */ + hypre_MPI_Allreduce(&lfactor, &factor, 1, HYPRE_MPI_REAL, hypre_MPI_MAX, + hypre_ParCSRMatrixComm(A)); + } + hypre_ParcsrAdd(factor, A, 1.0, B, &C); + + /*hypre_CSRMatrix *A_local, *B_local, *C_local, *C_tmp; MPI_Comm comm = hypre_ParCSRMatrixComm(A); HYPRE_BigInt global_num_rows = hypre_ParCSRMatrixGlobalNumRows(A); @@ -2097,9 +2092,9 @@ HYPRE_Int B_num_nonzeros_offd = hypre_CSRMatrixNumNonzeros(hypre_ParCSRMatrixOffd(B)); A_local = hypre_MergeDiagAndOffd(A); - B_local = hypre_MergeDiagAndOffd(B); + B_local = hypre_MergeDiagAndOffd(B);*/ /* scale (penalize) G0 G0^T before adding it to the matrix */ - { + /*{ HYPRE_Int i, nnz = hypre_CSRMatrixNumNonzeros(A_local); HYPRE_Real *data = hypre_CSRMatrixData(A_local); HYPRE_Real *dataB = hypre_CSRMatrixData(B_local); @@ -2109,15 +2104,14 @@ for (i = 0; i < nnzB; i++) if (fabs(dataB[i]) > lfactor) lfactor = fabs(dataB[i]); - lfactor *= 1e-10; /* scaling factor: max|A_ij|*1e-10 */ + lfactor *= 1e-10; hypre_MPI_Allreduce(&lfactor, &factor, 1, HYPRE_MPI_REAL, hypre_MPI_MAX, hypre_ParCSRMatrixComm(A)); for (i = 0; i < nnz; i++) data[i] *= factor; } C_tmp = hypre_CSRMatrixBigAdd(A_local, B_local); - hypre_CSRMatrixBigJtoJ(C_tmp); - C_local = hypre_CSRMatrixDeleteZeros(C_tmp,0.0); + C_local = hypre_CSRMatrixBigDeleteZeros(C_tmp,0.0); if (C_local) hypre_CSRMatrixDestroy(C_tmp); else @@ -2141,6 +2135,7 @@ hypre_CSRMatrixDestroy(A_local); hypre_CSRMatrixDestroy(B_local); hypre_CSRMatrixDestroy(C_local); + */ hypre_ParCSRMatrixDestroy(A); @@ -2509,7 +2504,8 @@ hypre_ParCSRMatrixDestroy(Gt); /* hypre_ParCSRMatrixAdd(GGt, A, &ams_data -> A); */ - { + hypre_ParcsrAdd(1.0, GGt, 1.0, ams_data -> A, &ApGGt); + /*{ hypre_ParCSRMatrix *A = GGt; hypre_ParCSRMatrix *B = ams_data -> A; hypre_ParCSRMatrix **C_ptr = &ApGGt; @@ -2531,7 +2527,8 @@ A_local = hypre_MergeDiagAndOffd(A); B_local = hypre_MergeDiagAndOffd(B); - C_local = hypre_CSRMatrixAdd(A_local, B_local); + C_local = hypre_CSRMatrixBigAdd(A_local, B_local); + hypre_CSRMatrixBigJtoJ(C_local); C = hypre_ParCSRMatrixCreate (comm, global_num_rows, @@ -2552,7 +2549,7 @@ hypre_CSRMatrixDestroy(C_local); *C_ptr = C; - } + }*/ hypre_ParCSRMatrixDestroy(GGt); @@ -3045,7 +3042,7 @@ HYPRE_Int hypre_AMSConstructDiscreteGradient(hypre_ParCSRMatrix *A, hypre_ParVector *x_coord, - HYPRE_Int *edge_vertex, + HYPRE_BigInt *edge_vertex, HYPRE_Int edge_orientation, hypre_ParCSRMatrix **G_ptr) { @@ -3100,7 +3097,7 @@ hypre_CSRMatrixI(local) = I; - hypre_CSRMatrixJ(local) = edge_vertex; + hypre_CSRMatrixBigJ(local) = edge_vertex; hypre_CSRMatrixData(local) = data; hypre_CSRMatrixRownnz(local) = NULL; @@ -3130,6 +3127,7 @@ hypre_ParCSRMatrixOwnsRowStarts(G) = 1; hypre_ParCSRMatrixOwnsColStarts(G) = 1; + hypre_CSRMatrixBigJtoJ(local); GenerateDiagAndOffd(local, G, hypre_ParVectorFirstIndex(x_coord), hypre_ParVectorLastIndex(x_coord)); @@ -3143,7 +3141,6 @@ } /* Free the local matrix */ - hypre_CSRMatrixJ(local) = NULL; hypre_CSRMatrixDestroy(local); } @@ -3185,7 +3182,7 @@ HYPRE_BigInt *vert_number, HYPRE_Real *vert_coord, HYPRE_Int num_edges, - HYPRE_Int *edge_vertex) + HYPRE_BigInt *edge_vertex) { hypre_AMSData *ams_data = (hypre_AMSData *) solver; @@ -3199,7 +3196,6 @@ HYPRE_BigInt *vert_part, num_global_vert; HYPRE_BigInt vert_start, vert_end; HYPRE_BigInt big_local_vert = (HYPRE_BigInt) num_local_vert; - HYPRE_BigInt *big_edge_vertex; /* Find the processor partitioning of the vertices */ #ifdef HYPRE_NO_GLOBAL_PARTITION @@ -3253,9 +3249,8 @@ } /* Change vertex numbers from local to global */ - big_edge_vertex = hypre_CTAlloc(HYPRE_BigInt, 2*num_edges, HYPRE_MEMORY_HOST); for (i = 0; i < 2*num_edges; i++) - big_edge_vertex[i] = vert_number[edge_vertex[i]]; + edge_vertex[i] = vert_number[edge_vertex[i]]; /* Construct the local part of G based on edge_vertex */ { @@ -3277,7 +3272,7 @@ } hypre_CSRMatrixI(local) = I; - hypre_CSRMatrixBigJ(local) = big_edge_vertex; + hypre_CSRMatrixBigJ(local) = edge_vertex; hypre_CSRMatrixData(local) = data; hypre_CSRMatrixRownnz(local) = NULL; @@ -3293,14 +3288,13 @@ hypre_ParCSRMatrixOwnsRowStarts(G) = 0; hypre_ParCSRMatrixOwnsColStarts(G) = 1; + hypre_CSRMatrixBigJtoJ(local); GenerateDiagAndOffd(local, G, vert_start, vert_end); - hypre_CSRMatrixJ(local) = NULL; + //hypre_CSRMatrixJ(local) = NULL; hypre_CSRMatrixDestroy(local); } - hypre_TFree(big_edge_vertex, HYPRE_MEMORY_HOST); - ams_data -> G = G; ams_data -> x = x_coord; @@ -3599,9 +3593,6 @@ *l1_norm_ptr = l1_norm; -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD -#pragma omp target enter data map(to:l1_norm[0:num_rows]) -#endif return hypre_error_flag; } diff -Nru hypre-2.16.0/src/parcsr_ls/ams.h hypre-2.18.2/src/parcsr_ls/ams.h --- hypre-2.16.0/src/parcsr_ls/ams.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/ams.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_AMS_DATA_HEADER #define hypre_AMS_DATA_HEADER diff -Nru hypre-2.16.0/src/parcsr_ls/aux_interp.c hypre-2.18.2/src/parcsr_ls/aux_interp.c --- hypre-2.16.0/src/parcsr_ls/aux_interp.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/aux_interp.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" #include "aux_interp.h" @@ -23,31 +16,31 @@ /* AHB 11/06: Modification of the above original - takes two communication packages and inserts nodes to position expected for OUT_marker - - offd nodes from comm_pkg take up first chunk of CF_marker_offd, offd - nodes from extend_comm_pkg take up the second chunk 0f CF_marker_offd. */ + offd nodes from comm_pkg take up first chunk of CF_marker_offd, offd + nodes from extend_comm_pkg take up the second chunk of CF_marker_offd. */ -HYPRE_Int hypre_alt_insert_new_nodes(hypre_ParCSRCommPkg *comm_pkg, + +HYPRE_Int hypre_alt_insert_new_nodes(hypre_ParCSRCommPkg *comm_pkg, hypre_ParCSRCommPkg *extend_comm_pkg, - HYPRE_Int *IN_marker, + HYPRE_Int *IN_marker, HYPRE_Int full_off_procNodes, HYPRE_Int *OUT_marker) -{ +{ hypre_ParCSRCommHandle *comm_handle; HYPRE_Int i, index, shift; HYPRE_Int num_sends, num_recvs; - + HYPRE_Int *recv_vec_starts; HYPRE_Int e_num_sends; HYPRE_Int *int_buf_data; HYPRE_Int *e_out_marker; - + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); num_recvs = hypre_ParCSRCommPkgNumRecvs(comm_pkg); @@ -63,29 +56,29 @@ /* orig commpkg data*/ index = 0; - + HYPRE_Int begin = hypre_ParCSRCommPkgSendMapStart(comm_pkg, 0); HYPRE_Int end = hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends); #ifdef HYPRE_USING_OPENMP #pragma omp parallel for HYPRE_SMP_SCHEDULE #endif for (i = begin; i < end; ++i) { - int_buf_data[i - begin] = + int_buf_data[i - begin] = IN_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg, i)]; } - - comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, + + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, OUT_marker); - + hypre_ParCSRCommHandleDestroy(comm_handle); comm_handle = NULL; - + /* now do the extend commpkg */ /* first we need to shift our position in the OUT_marker */ shift = recv_vec_starts[num_recvs]; e_out_marker = OUT_marker + shift; - + index = 0; begin = hypre_ParCSRCommPkgSendMapStart(extend_comm_pkg, 0); @@ -97,17 +90,17 @@ int_buf_data[i - begin] = IN_marker[hypre_ParCSRCommPkgSendMapElmt(extend_comm_pkg, i)]; } - - comm_handle = hypre_ParCSRCommHandleCreate( 11, extend_comm_pkg, int_buf_data, + + comm_handle = hypre_ParCSRCommHandleCreate( 11, extend_comm_pkg, int_buf_data, e_out_marker); - + hypre_ParCSRCommHandleDestroy(comm_handle); comm_handle = NULL; - + hypre_TFree(int_buf_data, HYPRE_MEMORY_HOST); - + return hypre_error_flag; -} +} HYPRE_Int hypre_big_insert_new_nodes(hypre_ParCSRCommPkg *comm_pkg, hypre_ParCSRCommPkg *extend_comm_pkg, @@ -193,9 +186,9 @@ /* sort for non-ordered arrays */ HYPRE_Int hypre_ssort(HYPRE_BigInt *data, HYPRE_Int n) { - HYPRE_Int i,si; + HYPRE_Int i,si; HYPRE_Int change = 0; - + if(n > 0) for(i = n-1; i > 0; i--){ si = hypre_index_of_minimum(data,i+1); @@ -204,7 +197,7 @@ hypre_swap_int(data, i, si); change = 1; } - } + } return change; } @@ -213,19 +206,19 @@ { HYPRE_Int answer; HYPRE_Int i; - + answer = 0; for(i = 1; i < n; i++) if(data[answer] < data[i]) answer = i; - + return answer; } - + void hypre_swap_int(HYPRE_BigInt *data, HYPRE_Int a, HYPRE_Int b) { HYPRE_BigInt temp; - + temp = data[a]; data[a] = data[b]; data[b] = temp; @@ -259,7 +252,7 @@ #pragma omp parallel for HYPRE_SMP_SCHEDULE #endif for(i = offd_n; i < diag_n; i++) - { + { diag_ftc[i] = -1; if(diag_pm != NULL) { diag_pm[i] = -1; } @@ -284,7 +277,7 @@ #pragma omp parallel for HYPRE_SMP_SCHEDULE #endif for(i = diag_n; i < offd_n; i++) - { + { offd_ftc[i] = -1; tmp_CF[i] = -1; if(offd_pm != NULL) @@ -323,7 +316,7 @@ hypre_UnorderedBigIntMapPutIfAbsent(&col_map_offd_inverse, col_map_offd[i], i); } - /* Find nodes that will be added to the off diag list */ + /* Find nodes that will be added to the off diag list */ HYPRE_Int size_offP = A_ext_i[num_cols_A_offd]; hypre_UnorderedBigIntSet set; hypre_UnorderedBigIntSetCreate(&set, size_offP, 16*hypre_NumThreads()); @@ -399,7 +392,7 @@ { big_k1 = Sop_j[kk]; if(big_k1 > -1 && (big_k1 < col_1 || big_k1 >= col_n)) - { + { got_loc = hypre_UnorderedBigIntMapGet(&tmp_found_inverse, big_k1); loc_col = got_loc + num_cols_A_offd; Sop_j[kk] = (HYPRE_BigInt)(-loc_col - 1); @@ -431,7 +424,7 @@ size_offP = A_ext_i[num_cols_A_offd]+Sop_i[num_cols_A_offd]; tmp_found = hypre_CTAlloc(HYPRE_BigInt, size_offP, HYPRE_MEMORY_HOST); - /* Find nodes that will be added to the off diag list */ + /* Find nodes that will be added to the off diag list */ for (i = 0; i < num_cols_A_offd; i++) { if (CF_marker_offd[i] < 0) @@ -499,7 +492,7 @@ { big_k1 = Sop_j[kk]; if(big_k1 > -1 && (big_k1 < col_1 || big_k1 >= col_n)) - { + { got_loc = hypre_BigBinarySearch(tmp_found,big_k1,newoff); if(got_loc > -1) loc_col = got_loc + num_cols_A_offd; @@ -525,14 +518,14 @@ #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_RENUMBER_COLIDX] += hypre_MPI_Wtime(); #endif - + return newoff; } HYPRE_Int hypre_exchange_marker(hypre_ParCSRCommPkg *comm_pkg, - HYPRE_Int *IN_marker, + HYPRE_Int *IN_marker, HYPRE_Int *OUT_marker) -{ +{ HYPRE_Int num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); HYPRE_Int begin = hypre_ParCSRCommPkgSendMapStart(comm_pkg, 0); HYPRE_Int end = hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends); @@ -546,15 +539,15 @@ int_buf_data[i - begin] = IN_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg, i)]; } - - hypre_ParCSRCommHandle *comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, + + hypre_ParCSRCommHandle *comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, OUT_marker); - + hypre_ParCSRCommHandleDestroy(comm_handle); hypre_TFree(int_buf_data, HYPRE_MEMORY_HOST); - + return hypre_error_flag; -} +} HYPRE_Int hypre_exchange_interp_data( HYPRE_Int **CF_marker_offd, @@ -563,7 +556,7 @@ HYPRE_Int *full_off_procNodes, hypre_CSRMatrix **Sop, hypre_ParCSRCommPkg **extend_comm_pkg, - hypre_ParCSRMatrix *A, + hypre_ParCSRMatrix *A, HYPRE_Int *CF_marker, hypre_ParCSRMatrix *S, HYPRE_Int num_functions, @@ -575,8 +568,8 @@ #endif hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); - hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); - hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); HYPRE_Int num_cols_A_offd = hypre_CSRMatrixNumCols(A_offd); HYPRE_BigInt *col_map_offd = hypre_ParCSRMatrixColMapOffd(A); HYPRE_BigInt col_1 = hypre_ParCSRMatrixFirstRowIndex(A); @@ -585,7 +578,7 @@ HYPRE_BigInt *found = NULL; /*---------------------------------------------------------------------- - * Get the off processors rows for A and S, associated with columns in + * Get the off processors rows for A and S, associated with columns in * A_offd and S_offd. *---------------------------------------------------------------------*/ *CF_marker_offd = hypre_TAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); @@ -615,8 +608,8 @@ #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_EXCHANGE_INTERP_DATA] += hypre_MPI_Wtime(); #endif - HYPRE_Int newoff = hypre_new_offd_nodes(&found, A_ext_rows, A_ext_i, A_ext_j, - Soprows, col_map_offd, col_1, col_n, + HYPRE_Int newoff = hypre_new_offd_nodes(&found, A_ext_rows, A_ext_i, A_ext_j, + Soprows, col_map_offd, col_1, col_n, Sop_i, Sop_j, *CF_marker_offd); #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_EXCHANGE_INTERP_DATA] -= hypre_MPI_Wtime(); @@ -633,7 +626,15 @@ /* AHB - create a new comm package just for extended info - this will work better with the assumed partition*/ - hypre_ParCSRFindExtendCommPkg(A, newoff, found, extend_comm_pkg); + hypre_ParCSRFindExtendCommPkg(hypre_ParCSRMatrixComm(A), + hypre_ParCSRMatrixGlobalNumCols(A), + hypre_ParCSRMatrixFirstColDiag(A), + hypre_CSRMatrixNumCols(A_diag), + hypre_ParCSRMatrixColStarts(A), + hypre_ParCSRMatrixAssumedPartition(A), + newoff, + found, + extend_comm_pkg); *CF_marker_offd = hypre_TReAlloc(*CF_marker_offd, HYPRE_Int, *full_off_procNodes, HYPRE_MEMORY_HOST); hypre_exchange_marker(*extend_comm_pkg, CF_marker, *CF_marker_offd + A_ext_rows); @@ -643,7 +644,7 @@ if (*full_off_procNodes > 0) *dof_func_offd = hypre_CTAlloc(HYPRE_Int, *full_off_procNodes, HYPRE_MEMORY_HOST); - hypre_alt_insert_new_nodes(comm_pkg, *extend_comm_pkg, dof_func, + hypre_alt_insert_new_nodes(comm_pkg, *extend_comm_pkg, dof_func, *full_off_procNodes, *dof_func_offd); } @@ -678,13 +679,13 @@ if (full_off_procNodes) P_marker = hypre_TAlloc(HYPRE_Int, full_off_procNodes, HYPRE_MEMORY_HOST); - + #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif for (i=0; i < full_off_procNodes; i++) P_marker[i] = 0; - + #ifdef HYPRE_CONCURRENT_HOPSCOTCH /* These two loops set P_marker[i] to 1 if it appears in P_offd_j and if @@ -761,7 +762,7 @@ } } } - + if (num_cols_P_offd) { HYPRE_Int *tmp_map_offd = hypre_CTAlloc(HYPRE_Int, num_cols_P_offd, HYPRE_MEMORY_HOST); @@ -807,7 +808,7 @@ } #endif /* HYPRE_CONCURRENT_HOPSCOTCH */ - hypre_TFree(P_marker, HYPRE_MEMORY_HOST); + hypre_TFree(P_marker, HYPRE_MEMORY_HOST); if (num_cols_P_offd) { diff -Nru hypre-2.16.0/src/parcsr_ls/aux_interp.h hypre-2.18.2/src/parcsr_ls/aux_interp.h --- hypre-2.16.0/src/parcsr_ls/aux_interp.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/aux_interp.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifdef __cplusplus extern "C" { diff -Nru hypre-2.16.0/src/parcsr_ls/block_tridiag.c hypre-2.18.2/src/parcsr_ls/block_tridiag.c --- hypre-2.16.0/src/parcsr_ls/block_tridiag.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/block_tridiag.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/block_tridiag.h hypre-2.18.2/src/parcsr_ls/block_tridiag.h --- hypre-2.16.0/src/parcsr_ls/block_tridiag.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/block_tridiag.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_BLOCKTRIDIAG_HEADER #define hypre_BLOCKTRIDIAG_HEADER diff -Nru hypre-2.16.0/src/parcsr_ls/CMakeLists.txt hypre-2.18.2/src/parcsr_ls/CMakeLists.txt --- hypre-2.16.0/src/parcsr_ls/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,115 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(HDRS + HYPRE_parcsr_ls.h + _hypre_parcsr_ls.h +) + +set(SRCS + amg_hybrid.c + aux_interp.c + F90_hypre_laplace.c + F90_HYPRE_parcsr_amg.c + F90_HYPRE_parcsr_bicgstab.c + F90_HYPRE_parcsr_block.c + F90_HYPRE_parcsr_cgnr.c + F90_HYPRE_parcsr_Euclid.c + F90_HYPRE_parcsr_gmres.c + F90_HYPRE_parcsr_cogmres.c + F90_HYPRE_parcsr_flexgmres.c + F90_HYPRE_parcsr_lgmres.c + F90_HYPRE_parcsr_hybrid.c + F90_HYPRE_parcsr_int.c + F90_HYPRE_parcsr_ParaSails.c + F90_HYPRE_parcsr_pcg.c + F90_HYPRE_parcsr_pilut.c + F90_HYPRE_parcsr_schwarz.c + F90_HYPRE_ams.c + gen_redcs_mat.c + HYPRE_parcsr_amg.c + HYPRE_parcsr_bicgstab.c + HYPRE_parcsr_block.c + HYPRE_parcsr_cgnr.c + HYPRE_parcsr_Euclid.c + HYPRE_parcsr_gmres.c + HYPRE_parcsr_cogmres.c + HYPRE_parcsr_flexgmres.c + HYPRE_parcsr_lgmres.c + HYPRE_parcsr_hybrid.c + HYPRE_parcsr_int.c + HYPRE_parcsr_mgr.c + HYPRE_parcsr_ParaSails.c + HYPRE_parcsr_pcg.c + HYPRE_parcsr_pilut.c + HYPRE_parcsr_schwarz.c + HYPRE_ams.c + HYPRE_ads.c + HYPRE_ame.c + par_amg.c + par_amg_setup.c + par_amg_solve.c + par_amg_solveT.c + par_cg_relax_wt.c + par_coarsen.c + par_cgc_coarsen.c + par_cheby.c + par_coarse_parms.c + par_coordinates.c + par_cr.c + par_cycle.c + par_add_cycle.c + par_difconv.c + par_gauss_elim.c + par_gsmg.c + par_indepset.c + par_interp.c + par_jacobi_interp.c + par_multi_interp.c + par_laplace_27pt.c + par_laplace_9pt.c + par_laplace.c + par_lr_interp.c + par_mgr.c + par_mgr_setup.c + par_mgr_solve.c + par_nongalerkin.c + par_nodal_systems.c + par_rap.c + par_rap_communication.c + par_rotate_7pt.c + par_vardifconv.c + par_vardifconv_rs.c + par_relax.c + par_relax_more.c + par_relax_interface.c + par_scaled_matnorm.c + par_schwarz.c + par_stats.c + par_strength.c + par_sv_interp.c + par_sv_interp_ln.c + partial.c + pcg_par.c + schwarz.c + block_tridiag.c + ams.c + ads.c + ame.c + par_restr.c + par_lr_restr.c +) + +if (HYPRE_USING_DSUPERLU) + list(APPEND SRCS superlu.c) +endif() + +convert_filenames_to_full_paths(HDRS) +convert_filenames_to_full_paths(SRCS) + +set(HYPRE_HEADERS ${HYPRE_HEADERS} ${HDRS} PARENT_SCOPE) +set(HYPRE_SOURCES ${HYPRE_SOURCES} ${SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/parcsr_ls/Common.h hypre-2.18.2/src/parcsr_ls/Common.h --- hypre-2.16.0/src/parcsr_ls/Common.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/Common.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/csr_block_matrix.h hypre-2.18.2/src/parcsr_ls/csr_block_matrix.h --- hypre-2.16.0/src/parcsr_ls/csr_block_matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/csr_block_matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/driver.c hypre-2.18.2/src/parcsr_ls/driver.c --- hypre-2.16.0/src/parcsr_ls/driver.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/driver.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" diff -Nru hypre-2.16.0/src/parcsr_ls/F90_HYPRE_ams.c hypre-2.18.2/src/parcsr_ls/F90_HYPRE_ams.c --- hypre-2.16.0/src/parcsr_ls/F90_HYPRE_ams.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/F90_HYPRE_ams.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -375,7 +370,7 @@ hypre_F90_IFACE(hypre_amsconstructdiscretegradient, HYPRE_AMSCONSTRUCTDISCRETEGRADIENT) ( hypre_F90_Obj *A, hypre_F90_Obj *x_coord, - hypre_F90_IntArray *edge_vertex, + hypre_F90_BigIntArray *edge_vertex, hypre_F90_Int *edge_orientation, hypre_F90_Obj *G, hypre_F90_Int *ierr) @@ -384,7 +379,7 @@ ( HYPRE_AMSConstructDiscreteGradient( hypre_F90_PassObj (HYPRE_ParCSRMatrix, A), hypre_F90_PassObj (HYPRE_ParVector, x_coord), - hypre_F90_PassIntArray (edge_vertex), + hypre_F90_PassBigIntArray (edge_vertex), hypre_F90_PassInt (edge_orientation), hypre_F90_PassObjRef (HYPRE_ParCSRMatrix, G) ) ); } diff -Nru hypre-2.16.0/src/parcsr_ls/F90_hypre_laplace.c hypre-2.18.2/src/parcsr_ls/F90_hypre_laplace.c --- hypre-2.16.0/src/parcsr_ls/F90_hypre_laplace.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/F90_hypre_laplace.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /***************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_amg.c hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_amg.c --- hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_amg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_amg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -22,7 +17,7 @@ #ifdef __cplusplus extern "C" { #endif - + /*-------------------------------------------------------------------------- * HYPRE_BoomerAMGCreate *--------------------------------------------------------------------------*/ @@ -41,7 +36,7 @@ * HYPRE_BoomerAMGDestroy *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_boomeramgdestroy, HYPRE_BOOMERAMGDESTROY) ( hypre_F90_Obj *solver, hypre_F90_Int *ierr ) @@ -55,7 +50,7 @@ * HYPRE_BoomerAMGSetup *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_boomeramgsetup, HYPRE_BOOMERAMGSETUP) ( hypre_F90_Obj *solver, hypre_F90_Obj *A, @@ -75,7 +70,7 @@ * HYPRE_BoomerAMGSolve *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_boomeramgsolve, HYPRE_BOOMERAMGSOLVE) ( hypre_F90_Obj *solver, hypre_F90_Obj *A, @@ -95,7 +90,7 @@ * HYPRE_BoomerAMGSolveT *--------------------------------------------------------------------------*/ -void +void hypre_F90_IFACE(hypre_boomeramgsolvet, HYPRE_BOOMERAMGSOLVET) ( hypre_F90_Obj *solver, hypre_F90_Obj *A, @@ -917,7 +912,7 @@ hypre_F90_IFACE(hypre_boomeramgsetlevelouterwt, HYPRE_BOOMERAMGSETLEVELOUTERWT) ( hypre_F90_Obj *solver, hypre_F90_Real *outer_wt, - hypre_F90_Int *level, + hypre_F90_Int *level, hypre_F90_Int *ierr ) { *ierr = (hypre_F90_Int) @@ -2002,7 +1997,7 @@ hypre_F90_PassInt (seq_th) ) ); } -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU /*-------------------------------------------------------------------------- * HYPRE_BoomerAMGSetDSLUThreshold *--------------------------------------------------------------------------*/ @@ -2105,7 +2100,7 @@ /*-------------------------------------------------------------------------- * HYPRE_BoomerAMGSetCGCIts *--------------------------------------------------------------------------*/ - + void hypre_F90_IFACE(hypre_boomeramgsetcgcits, HYPRE_BOOMERAMGSETCGCITS) ( hypre_F90_Obj *solver, diff -Nru hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_bicgstab.c hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_bicgstab.c --- hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_bicgstab.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_bicgstab.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_block.c hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_block.c --- hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_block.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_block.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_cgnr.c hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_cgnr.c --- hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_cgnr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_cgnr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_cogmres.c hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_cogmres.c --- hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_cogmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_cogmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_Euclid.c hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_Euclid.c --- hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_Euclid.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_Euclid.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_flexgmres.c hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_flexgmres.c --- hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_flexgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_flexgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_gmres.c hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_gmres.c --- hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_gmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_gmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_hybrid.c hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_hybrid.c --- hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_hybrid.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_hybrid.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -390,6 +385,22 @@ } /*-------------------------------------------------------------------------- + * HYPRE_ParCSRHybridSetPMaxElmts + *--------------------------------------------------------------------------*/ + +void +hypre_F90_IFACE(hypre_parcsrhybridsetpmaxelmts, HYPRE_PARCSRHYBRIDSETPMAXELMTS) + (hypre_F90_Obj *solver, + hypre_F90_Int *p_max_elmts, + hypre_F90_Int *ierr) +{ + *ierr = (hypre_F90_Int) + (HYPRE_ParCSRHybridSetPMaxElmts( + hypre_F90_PassObj (HYPRE_Solver, solver), + hypre_F90_PassInt (p_max_elmts) )); +} + +/*-------------------------------------------------------------------------- * HYPRE_ParCSRHybridSetMaxLevels *--------------------------------------------------------------------------*/ @@ -438,6 +449,22 @@ } /*-------------------------------------------------------------------------- + * HYPRE_ParCSRHybridSetInterpType + *--------------------------------------------------------------------------*/ + +void +hypre_F90_IFACE(hypre_parcsrhybridsetinterptyp, HYPRE_PARCSRHYBRIDSETINTERPTYP) + (hypre_F90_Obj *solver, + hypre_F90_Int *interp_type, + hypre_F90_Int *ierr) +{ + *ierr = (hypre_F90_Int) + (HYPRE_ParCSRHybridSetCoarsenType( + hypre_F90_PassObj (HYPRE_Solver, solver), + hypre_F90_PassInt (interp_type) )); +} + +/*-------------------------------------------------------------------------- * HYPRE_ParCSRHybridSetCycleType *--------------------------------------------------------------------------*/ @@ -469,7 +496,7 @@ hypre_F90_PassIntArray (num_grid_sweeps) )); } -/*-------------------------------------------------------------------------- +/*------------------------------------------------------------------------ * HYPRE_ParCSRHybridSetGridRelaxType *--------------------------------------------------------------------------*/ diff -Nru hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_int.c hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_int.c --- hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_int.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_int.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_lgmres.c hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_lgmres.c --- hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_lgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_lgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_ParaSails.c hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_ParaSails.c --- hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_ParaSails.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_ParaSails.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_pcg.c hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_pcg.c --- hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_pcg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_pcg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_pilut.c hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_pilut.c --- hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_pilut.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_pilut.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_schwarz.c hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_schwarz.c --- hypre-2.16.0/src/parcsr_ls/F90_HYPRE_parcsr_schwarz.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/F90_HYPRE_parcsr_schwarz.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/gen_redcs_mat.c hypre-2.18.2/src/parcsr_ls/gen_redcs_mat.c --- hypre-2.16.0/src/parcsr_ls/gen_redcs_mat.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/gen_redcs_mat.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + #include "_hypre_parcsr_ls.h" #include "par_amg.h" @@ -17,18 +24,18 @@ /* Par Data Structure variables */ hypre_ParCSRMatrix **Par_A_array = hypre_ParAMGDataAArray(amg_data); - MPI_Comm comm = hypre_ParCSRMatrixComm(Par_A_array[0]); - MPI_Comm new_comm, seq_comm; + MPI_Comm comm = hypre_ParCSRMatrixComm(Par_A_array[0]); + MPI_Comm new_comm, seq_comm; hypre_ParCSRMatrix *A_seq = NULL; hypre_CSRMatrix *A_seq_diag; hypre_CSRMatrix *A_seq_offd; hypre_ParVector *F_seq = NULL; hypre_ParVector *U_seq = NULL; - + hypre_ParCSRMatrix *A; - HYPRE_Int **dof_func_array; + HYPRE_Int **dof_func_array; HYPRE_Int num_procs, my_id; HYPRE_Int level; @@ -43,11 +50,11 @@ redundant = hypre_ParAMGDataRedundant(amg_data); /*MPI Stuff */ - hypre_MPI_Comm_size(comm, &num_procs); - + hypre_MPI_Comm_size(comm, &num_procs); + /*initial */ level = p_level; - + /* convert A at this level to sequential */ A = Par_A_array[level]; @@ -66,7 +73,7 @@ HYPRE_Int *displs = NULL; HYPRE_Int *displs2 = NULL; HYPRE_Int i, j, size, num_nonzeros, total_nnz, cnt; - + hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); HYPRE_BigInt *col_map_offd = hypre_ParCSRMatrixColMapOffd(A); @@ -81,10 +88,10 @@ HYPRE_Int new_num_procs; HYPRE_BigInt *row_starts; - hypre_GenerateSubComm(comm, num_rows, &new_comm); + hypre_GenerateSubComm(comm, num_rows, &new_comm); - /*hypre_MPI_Group orig_group, new_group; + /*hypre_MPI_Group orig_group, new_group; HYPRE_Int *ranks, new_num_procs, *row_starts; info = hypre_CTAlloc(HYPRE_Int, num_procs, HYPRE_MEMORY_HOST); @@ -95,7 +102,7 @@ new_num_procs = 0; for (i=0; i < num_procs; i++) - if (info[i]) + if (info[i]) { ranks[new_num_procs] = i; info[new_num_procs++] = info[i]; @@ -110,7 +117,7 @@ if (num_rows) { hypre_ParAMGDataParticipate(amg_data) = 1; - hypre_MPI_Comm_size(new_comm, &new_num_procs); + hypre_MPI_Comm_size(new_comm, &new_num_procs); hypre_MPI_Comm_rank(new_comm, &my_id); info = hypre_CTAlloc(HYPRE_Int, new_num_procs, HYPRE_MEMORY_HOST); @@ -124,31 +131,31 @@ { HYPRE_BoomerAMGCreate(&coarse_solver); HYPRE_BoomerAMGSetMaxRowSum(coarse_solver, - hypre_ParAMGDataMaxRowSum(amg_data)); + hypre_ParAMGDataMaxRowSum(amg_data)); HYPRE_BoomerAMGSetStrongThreshold(coarse_solver, - hypre_ParAMGDataStrongThreshold(amg_data)); + hypre_ParAMGDataStrongThreshold(amg_data)); HYPRE_BoomerAMGSetCoarsenType(coarse_solver, - hypre_ParAMGDataCoarsenType(amg_data)); + hypre_ParAMGDataCoarsenType(amg_data)); HYPRE_BoomerAMGSetInterpType(coarse_solver, - hypre_ParAMGDataInterpType(amg_data)); - HYPRE_BoomerAMGSetTruncFactor(coarse_solver, - hypre_ParAMGDataTruncFactor(amg_data)); - HYPRE_BoomerAMGSetPMaxElmts(coarse_solver, - hypre_ParAMGDataPMaxElmts(amg_data)); - if (hypre_ParAMGDataUserRelaxType(amg_data) > -1) - HYPRE_BoomerAMGSetRelaxType(coarse_solver, - hypre_ParAMGDataUserRelaxType(amg_data)); - HYPRE_BoomerAMGSetRelaxOrder(coarse_solver, - hypre_ParAMGDataRelaxOrder(amg_data)); - HYPRE_BoomerAMGSetRelaxWt(coarse_solver, - hypre_ParAMGDataUserRelaxWeight(amg_data)); - if (hypre_ParAMGDataUserNumSweeps(amg_data) > -1) - HYPRE_BoomerAMGSetNumSweeps(coarse_solver, - hypre_ParAMGDataUserNumSweeps(amg_data)); - HYPRE_BoomerAMGSetNumFunctions(coarse_solver, - num_functions); - HYPRE_BoomerAMGSetMaxIter(coarse_solver, 1); - HYPRE_BoomerAMGSetTol(coarse_solver, 0); + hypre_ParAMGDataInterpType(amg_data)); + HYPRE_BoomerAMGSetTruncFactor(coarse_solver, + hypre_ParAMGDataTruncFactor(amg_data)); + HYPRE_BoomerAMGSetPMaxElmts(coarse_solver, + hypre_ParAMGDataPMaxElmts(amg_data)); + if (hypre_ParAMGDataUserRelaxType(amg_data) > -1) + HYPRE_BoomerAMGSetRelaxType(coarse_solver, + hypre_ParAMGDataUserRelaxType(amg_data)); + HYPRE_BoomerAMGSetRelaxOrder(coarse_solver, + hypre_ParAMGDataRelaxOrder(amg_data)); + HYPRE_BoomerAMGSetRelaxWt(coarse_solver, + hypre_ParAMGDataUserRelaxWeight(amg_data)); + if (hypre_ParAMGDataUserNumSweeps(amg_data) > -1) + HYPRE_BoomerAMGSetNumSweeps(coarse_solver, + hypre_ParAMGDataUserNumSweeps(amg_data)); + HYPRE_BoomerAMGSetNumFunctions(coarse_solver, + num_functions); + HYPRE_BoomerAMGSetMaxIter(coarse_solver, 1); + HYPRE_BoomerAMGSetTol(coarse_solver, 0); } /* Create CSR Matrix, will be Diag part of new matrix */ @@ -167,15 +174,15 @@ for (i=0; i < num_rows; i++) { for (j=A_diag_i[i]; j < A_diag_i[i+1]; j++) - { - A_tmp_j[cnt] = A_diag_j[j]+(HYPRE_Int)first_row_index; - A_tmp_data[cnt++] = A_diag_data[j]; - } + { + A_tmp_j[cnt] = A_diag_j[j]+(HYPRE_Int)first_row_index; + A_tmp_data[cnt++] = A_diag_data[j]; + } for (j=A_offd_i[i]; j < A_offd_i[i+1]; j++) - { - A_tmp_j[cnt] = (HYPRE_Int)col_map_offd[A_offd_j[j]]; - A_tmp_data[cnt++] = A_offd_data[j]; - } + { + A_tmp_j[cnt] = (HYPRE_Int)col_map_offd[A_offd_j[j]]; + A_tmp_data[cnt++] = A_offd_data[j]; + } } displs = hypre_CTAlloc(HYPRE_Int, new_num_procs+1, HYPRE_MEMORY_HOST); @@ -183,7 +190,7 @@ for (i=1; i < new_num_procs+1; i++) displs[i] = displs[i-1]+info[i-1]; size = displs[new_num_procs]; - + if (redundant || my_id == 0) { A_seq_i = hypre_CTAlloc(HYPRE_Int, size+1, HYPRE_MEMORY_SHARED); @@ -197,24 +204,24 @@ displs, HYPRE_MPI_INT, new_comm ); if (num_functions > 1) { - hypre_MPI_Allgatherv ( dof_func_array[level], num_rows, HYPRE_MPI_INT, - seq_dof_func, info, displs, HYPRE_MPI_INT, new_comm ); - HYPRE_BoomerAMGSetDofFunc(coarse_solver, seq_dof_func); + hypre_MPI_Allgatherv ( dof_func_array[level], num_rows, HYPRE_MPI_INT, + seq_dof_func, info, displs, HYPRE_MPI_INT, new_comm ); + HYPRE_BoomerAMGSetDofFunc(coarse_solver, seq_dof_func); } } else { - if (A_seq_i) - hypre_MPI_Gatherv ( &A_tmp_i[1], num_rows, HYPRE_MPI_INT, &A_seq_i[1], info, + if (A_seq_i) + hypre_MPI_Gatherv ( &A_tmp_i[1], num_rows, HYPRE_MPI_INT, &A_seq_i[1], info, displs, HYPRE_MPI_INT, 0, new_comm ); else - hypre_MPI_Gatherv ( &A_tmp_i[1], num_rows, HYPRE_MPI_INT, A_seq_i, info, + hypre_MPI_Gatherv ( &A_tmp_i[1], num_rows, HYPRE_MPI_INT, A_seq_i, info, displs, HYPRE_MPI_INT, 0, new_comm ); if (num_functions > 1) { - hypre_MPI_Gatherv ( dof_func_array[level], num_rows, HYPRE_MPI_INT, - seq_dof_func, info, displs, HYPRE_MPI_INT, 0, new_comm ); - if (my_id == 0) HYPRE_BoomerAMGSetDofFunc(coarse_solver, seq_dof_func); + hypre_MPI_Gatherv ( dof_func_array[level], num_rows, HYPRE_MPI_INT, + seq_dof_func, info, displs, HYPRE_MPI_INT, 0, new_comm ); + if (my_id == 0) HYPRE_BoomerAMGSetDofFunc(coarse_solver, seq_dof_func); } } @@ -275,17 +282,17 @@ if (redundant || my_id == 0) { hypre_TFree(displs2, HYPRE_MEMORY_HOST); - + row_starts = hypre_CTAlloc(HYPRE_BigInt, 2, HYPRE_MEMORY_HOST); - row_starts[0] = 0; + row_starts[0] = 0; row_starts[1] = size; - + /* Create 1 proc communicator */ seq_comm = hypre_MPI_COMM_SELF; A_seq = hypre_ParCSRMatrixCreate(seq_comm,size,size, - row_starts, row_starts, - 0,total_nnz,0); + row_starts, row_starts, + 0,total_nnz,0); A_seq_diag = hypre_ParCSRMatrixDiag(A_seq); A_seq_offd = hypre_ParCSRMatrixOffd(A_seq); @@ -327,7 +334,7 @@ hypre_ParVector **Par_F_array, hypre_ParVector **Par_U_array ) { - + hypre_ParVector *Aux_U; hypre_ParVector *Aux_F; @@ -337,12 +344,12 @@ HYPRE_Int n; HYPRE_Int i; - + hypre_Vector *u_local; HYPRE_Real *u_data; - - HYPRE_Int first_index; - + + HYPRE_Int first_index; + /* Acquire seq data */ MPI_Comm new_comm = hypre_ParAMGDataNewComm(amg_data); HYPRE_Solver coarse_solver = hypre_ParAMGDataCoarseSolver(amg_data); @@ -366,14 +373,14 @@ HYPRE_Real *f_data; hypre_Vector *f_local; hypre_Vector *tmp_vec; - + HYPRE_Int nf; HYPRE_Int local_info; HYPRE_Real *recv_buf = NULL; HYPRE_Int *displs = NULL; HYPRE_Int *info = NULL; HYPRE_Int new_num_procs, my_id; - + hypre_MPI_Comm_size(new_comm, &new_num_procs); hypre_MPI_Comm_rank(new_comm, &my_id); @@ -394,9 +401,9 @@ displs = hypre_CTAlloc(HYPRE_Int, new_num_procs+1, HYPRE_MEMORY_HOST); displs[0] = 0; for (i=1; i < new_num_procs+1; i++) - displs[i] = displs[i-1]+info[i-1]; - - if (F_coarse) + displs[i] = displs[i-1]+info[i-1]; + + if (F_coarse) { tmp_vec = hypre_ParVectorLocalVector(F_coarse); recv_buf = hypre_VectorData(tmp_vec); @@ -417,7 +424,7 @@ tmp_vec = hypre_ParVectorLocalVector(U_coarse); recv_buf = hypre_VectorData(tmp_vec); } - + /*then u */ if (redundant) { @@ -431,7 +438,7 @@ hypre_MPI_Gatherv ( u_data, n, HYPRE_MPI_REAL, recv_buf, info, displs, HYPRE_MPI_REAL, 0, new_comm ); - + /* clean up */ if (redundant || my_id ==0) { @@ -473,20 +480,24 @@ /* generate sub communicator, which contains no idle processors */ -HYPRE_Int hypre_GenerateSubComm(MPI_Comm comm, HYPRE_Int participate, MPI_Comm *new_comm_ptr) +HYPRE_Int hypre_GenerateSubComm(MPI_Comm comm, HYPRE_Int participate, MPI_Comm *new_comm_ptr) { MPI_Comm new_comm; - hypre_MPI_Group orig_group, new_group; + hypre_MPI_Group orig_group, new_group; hypre_MPI_Op hypre_MPI_MERGE; HYPRE_Int *info, *ranks, new_num_procs, my_info, my_id, num_procs; HYPRE_Int *list_len; - hypre_MPI_Comm_rank(comm,&my_id); + hypre_MPI_Comm_rank(comm, &my_id); - if (participate) + if (participate) + { my_info = 1; + } else + { my_info = 0; + } hypre_MPI_Allreduce(&my_info, &new_num_procs, 1, HYPRE_MPI_INT, hypre_MPI_SUM, comm); @@ -496,26 +507,32 @@ *new_comm_ptr = new_comm; return 0; } - ranks = hypre_CTAlloc(HYPRE_Int, new_num_procs+2, HYPRE_MEMORY_HOST); + + ranks = hypre_CTAlloc(HYPRE_Int, new_num_procs+2, HYPRE_MEMORY_HOST); + if (new_num_procs == 1) { - if (participate) my_info = my_id; + if (participate) + { + my_info = my_id; + } hypre_MPI_Allreduce(&my_info, &ranks[2], 1, HYPRE_MPI_INT, hypre_MPI_SUM, comm); } else { - info = hypre_CTAlloc(HYPRE_Int, new_num_procs+2, HYPRE_MEMORY_HOST); - list_len = hypre_CTAlloc(HYPRE_Int, 1, HYPRE_MEMORY_HOST); - + info = hypre_CTAlloc(HYPRE_Int, new_num_procs+2, HYPRE_MEMORY_HOST); + list_len = hypre_CTAlloc(HYPRE_Int, 1, HYPRE_MEMORY_HOST); - if (participate) + if (participate) { info[0] = 1; info[1] = 1; info[2] = my_id; } else + { info[0] = 0; + } list_len[0] = new_num_procs + 2; @@ -525,20 +542,21 @@ hypre_MPI_Op_free (&hypre_MPI_MERGE); - hypre_TFree(list_len, HYPRE_MEMORY_HOST); - hypre_TFree(info, HYPRE_MEMORY_HOST); + hypre_TFree(list_len, HYPRE_MEMORY_HOST); + hypre_TFree(info, HYPRE_MEMORY_HOST); } - hypre_MPI_Comm_size(comm,&num_procs); + + hypre_MPI_Comm_size(comm, &num_procs); hypre_MPI_Comm_group(comm, &orig_group); hypre_MPI_Group_incl(orig_group, new_num_procs, &ranks[2], &new_group); hypre_MPI_Comm_create(comm, new_group, &new_comm); hypre_MPI_Group_free(&new_group); hypre_MPI_Group_free(&orig_group); - hypre_TFree(ranks, HYPRE_MEMORY_HOST); - + hypre_TFree(ranks, HYPRE_MEMORY_HOST); + *new_comm_ptr = new_comm; - + return 0; } @@ -547,7 +565,7 @@ { HYPRE_Int i, len1, len2, indx1, indx2; - if (list1[0] == 0 || (list2[0] == 0 && list1[0] == 0)) + if (list1[0] == 0) { return; } @@ -557,12 +575,15 @@ len1 = list1[1]; len2 = list2[1]; list2[1] = len1+len2; - if ((hypre_int)(list2[1]) > *np1+2) printf("segfault in MPI User function merge_list\n"); + if ((hypre_int)(list2[1]) > *np1+2) // RL:??? + { + printf("segfault in MPI User function merge_list\n"); + } indx1 = len1+1; indx2 = len2+1; for (i=len1+len2+1; i > 1; i--) { - if (indx2 > 1 && indx1 > 1 && list1[indx1] > list2[indx2]) + if (indx2 > 1 && indx1 > 1 && list1[indx1] > list2[indx2]) { list2[i] = list1[indx1]; indx1--; diff -Nru hypre-2.16.0/src/parcsr_ls/headers hypre-2.18.2/src/parcsr_ls/headers --- hypre-2.16.0/src/parcsr_ls/headers 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/headers 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) INTERNAL_HEADER=_hypre_parcsr_ls.h diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_ads.c hypre-2.18.2/src/parcsr_ls/HYPRE_ads.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_ads.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_ads.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_ame.c hypre-2.18.2/src/parcsr_ls/HYPRE_ame.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_ame.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_ame.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_ams.c hypre-2.18.2/src/parcsr_ls/HYPRE_ams.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_ams.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_ams.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" @@ -350,7 +341,7 @@ HYPRE_Int HYPRE_AMSConstructDiscreteGradient(HYPRE_ParCSRMatrix A, HYPRE_ParVector x_coord, - HYPRE_Int *edge_vertex, + HYPRE_BigInt *edge_vertex, HYPRE_Int edge_orientation, HYPRE_ParCSRMatrix *G) { @@ -369,7 +360,7 @@ HYPRE_ParCSRMatrix A, HYPRE_ParVector b, HYPRE_ParVector x, - HYPRE_Int *EdgeNodeList_, + HYPRE_BigInt *EdgeNodeList_, HYPRE_BigInt *NodeNumbers_, HYPRE_Int numEdges_, HYPRE_Int numLocalNodes_, diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_amg.c hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_amg.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_amg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_amg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" @@ -33,7 +28,7 @@ * HYPRE_BoomerAMGDestroy *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int HYPRE_BoomerAMGDestroy( HYPRE_Solver solver ) { return( hypre_BoomerAMGDestroy( (void *) solver ) ); @@ -43,7 +38,7 @@ * HYPRE_BoomerAMGSetup *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int HYPRE_BoomerAMGSetup( HYPRE_Solver solver, HYPRE_ParCSRMatrix A, HYPRE_ParVector b, @@ -59,7 +54,7 @@ * HYPRE_BoomerAMGSolve *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int HYPRE_BoomerAMGSolve( HYPRE_Solver solver, HYPRE_ParCSRMatrix A, HYPRE_ParVector b, @@ -77,7 +72,7 @@ * HYPRE_BoomerAMGSolveT *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int HYPRE_BoomerAMGSolveT( HYPRE_Solver solver, HYPRE_ParCSRMatrix A, HYPRE_ParVector b, @@ -97,12 +92,34 @@ HYPRE_Int HYPRE_BoomerAMGSetRestriction( HYPRE_Solver solver, - HYPRE_Int restr_par ) + HYPRE_Int restr_par ) { return( hypre_BoomerAMGSetRestriction( (void *) solver, restr_par ) ); } /*-------------------------------------------------------------------------- + * HYPRE_BoomerAMGSetIsTriangular + *--------------------------------------------------------------------------*/ + +HYPRE_Int +HYPRE_BoomerAMGSetIsTriangular( HYPRE_Solver solver, + HYPRE_Int is_triangular ) +{ + return( hypre_BoomerAMGSetIsTriangular( (void *) solver, is_triangular ) ); +} + +/*-------------------------------------------------------------------------- + * HYPRE_BoomerAMGSetGMRESSwitchR + *--------------------------------------------------------------------------*/ + +HYPRE_Int +HYPRE_BoomerAMGSetGMRESSwitchR( HYPRE_Solver solver, + HYPRE_Int gmres_switch ) +{ + return( hypre_BoomerAMGSetGMRESSwitchR( (void *) solver, gmres_switch ) ); +} + +/*-------------------------------------------------------------------------- * HYPRE_BoomerAMGSetMaxLevels, HYPRE_BoomerAMGGetMaxLevels *--------------------------------------------------------------------------*/ @@ -212,6 +229,47 @@ strong_threshold ) ); } +HYPRE_Int +HYPRE_BoomerAMGSetStrongThresholdR( HYPRE_Solver solver, + HYPRE_Real strong_threshold ) +{ + return( hypre_BoomerAMGSetStrongThresholdR( (void *) solver, + strong_threshold ) ); +} + +HYPRE_Int +HYPRE_BoomerAMGGetStrongThresholdR( HYPRE_Solver solver, + HYPRE_Real * strong_threshold ) +{ + return( hypre_BoomerAMGGetStrongThresholdR( (void *) solver, + strong_threshold ) ); +} + +HYPRE_Int +HYPRE_BoomerAMGSetFilterThresholdR( HYPRE_Solver solver, + HYPRE_Real filter_threshold ) +{ + return( hypre_BoomerAMGSetFilterThresholdR( (void *) solver, + filter_threshold ) ); +} + +HYPRE_Int +HYPRE_BoomerAMGGetFilterThresholdR( HYPRE_Solver solver, + HYPRE_Real * filter_threshold ) +{ + return( hypre_BoomerAMGGetFilterThresholdR( (void *) solver, + filter_threshold ) ); +} + + +HYPRE_Int +HYPRE_BoomerAMGSetSabs( HYPRE_Solver solver, + HYPRE_Int Sabs ) +{ + return( hypre_BoomerAMGSetSabs( (void *) solver, + Sabs ) ); +} + /*-------------------------------------------------------------------------- * HYPRE_BoomerAMGSetMaxRowSum, HYPRE_BoomerAMGGetMaxRowSum *--------------------------------------------------------------------------*/ @@ -457,6 +515,24 @@ } /*-------------------------------------------------------------------------- + * HYPRE_BoomerAMGSetFCycle, HYPRE_BoomerAMGGetFCycle + *--------------------------------------------------------------------------*/ + +HYPRE_Int +HYPRE_BoomerAMGSetFCycle( HYPRE_Solver solver, + HYPRE_Int fcycle ) +{ + return( hypre_BoomerAMGSetFCycle( (void *) solver, fcycle ) ); +} + +HYPRE_Int +HYPRE_BoomerAMGGetFCycle( HYPRE_Solver solver, + HYPRE_Int *fcycle ) +{ + return( hypre_BoomerAMGGetFCycle( (void *) solver, fcycle ) ); +} + +/*-------------------------------------------------------------------------- * HYPRE_BoomerAMGSetConvergeType, HYPRE_BoomerAMGGetConvergeType *--------------------------------------------------------------------------*/ @@ -592,21 +668,21 @@ grid_relax_points[2][3] = -1; } else - { + { /* fine grid */ num_grid_sweeps[0] = 2; grid_relax_type[0] = 3; grid_relax_points[0] = hypre_CTAlloc(HYPRE_Int, 2, HYPRE_MEMORY_HOST); grid_relax_points[0][0] = 1; grid_relax_points[0][1] = -1; - + /* down cycle */ num_grid_sweeps[1] = 2; grid_relax_type[1] = 3; grid_relax_points[1] = hypre_CTAlloc(HYPRE_Int, 2, HYPRE_MEMORY_HOST); grid_relax_points[1][0] = 1; grid_relax_points[1][1] = -1; - + /* up cycle */ num_grid_sweeps[2] = 2; grid_relax_type[2] = 3; @@ -725,7 +801,7 @@ HYPRE_Int HYPRE_BoomerAMGSetLevelRelaxWt( HYPRE_Solver solver, - HYPRE_Real relax_wt, + HYPRE_Real relax_wt, HYPRE_Int level ) { return( hypre_BoomerAMGSetLevelRelaxWt( (void *) solver, relax_wt, level ) ); @@ -759,7 +835,7 @@ HYPRE_Int HYPRE_BoomerAMGSetLevelOuterWt( HYPRE_Solver solver, - HYPRE_Real outer_wt, + HYPRE_Real outer_wt, HYPRE_Int level ) { return( hypre_BoomerAMGSetLevelOuterWt( (void *) solver, outer_wt, level ) ); @@ -922,7 +998,7 @@ return hypre_BoomerAMGGetResidual( (void *) solver, (hypre_ParVector **) residual ); } - + /*-------------------------------------------------------------------------- * HYPRE_BoomerAMGGetFinalRelativeResidualNorm @@ -997,7 +1073,7 @@ HYPRE_BoomerAMGSetSchwarzRlxWeight( HYPRE_Solver solver, HYPRE_Real schwarz_rlx_weight) { - return( hypre_BoomerAMGSetSchwarzRlxWeight( (void *) solver, + return( hypre_BoomerAMGSetSchwarzRlxWeight( (void *) solver, schwarz_rlx_weight ) ); } @@ -1005,7 +1081,7 @@ HYPRE_BoomerAMGGetSchwarzRlxWeight( HYPRE_Solver solver, HYPRE_Real * schwarz_rlx_weight) { - return( hypre_BoomerAMGGetSchwarzRlxWeight( (void *) solver, + return( hypre_BoomerAMGGetSchwarzRlxWeight( (void *) solver, schwarz_rlx_weight ) ); } /*-------------------------------------------------------------------------- @@ -1016,7 +1092,7 @@ HYPRE_BoomerAMGSetSchwarzUseNonSymm( HYPRE_Solver solver, HYPRE_Int use_nonsymm) { - return( hypre_BoomerAMGSetSchwarzUseNonSymm( (void *) solver, + return( hypre_BoomerAMGSetSchwarzUseNonSymm( (void *) solver, use_nonsymm ) ); } /*-------------------------------------------------------------------------- @@ -1372,10 +1448,17 @@ HYPRE_Int HYPRE_BoomerAMGSetADropTol( HYPRE_Solver solver, - HYPRE_Real A_drop_tol ) + HYPRE_Real A_drop_tol ) { return( hypre_BoomerAMGSetADropTol( (void *) solver, A_drop_tol ) ); } + +HYPRE_Int +HYPRE_BoomerAMGSetADropType( HYPRE_Solver solver, + HYPRE_Int A_drop_type ) +{ + return( hypre_BoomerAMGSetADropType( (void *) solver, A_drop_type ) ); +} /*-------------------------------------------------------------------------- * HYPRE_BoomerAMGSetISType *--------------------------------------------------------------------------*/ @@ -1420,58 +1503,58 @@ return( hypre_BoomerAMGSetNumSamples( (void *) solver, gsmg ) ); } /* BM Aug 25, 2006 */ - + /*-------------------------------------------------------------------------- * HYPRE_BoomerAMGSetCGCIts *--------------------------------------------------------------------------*/ - + HYPRE_Int HYPRE_BoomerAMGSetCGCIts (HYPRE_Solver solver, HYPRE_Int its) { return (hypre_BoomerAMGSetCGCIts ( (void *) solver, its ) ); } - + /* BM Oct 23, 2006 */ /*-------------------------------------------------------------------------- * HYPRE_BoomerAMGSetPlotGrids *--------------------------------------------------------------------------*/ - + HYPRE_Int HYPRE_BoomerAMGSetPlotGrids (HYPRE_Solver solver, HYPRE_Int plotgrids) { return (hypre_BoomerAMGSetPlotGrids ( (void *) solver, plotgrids ) ); } - + /*-------------------------------------------------------------------------- * HYPRE_BoomerAMGSetPlotFileName *--------------------------------------------------------------------------*/ - + HYPRE_Int HYPRE_BoomerAMGSetPlotFileName (HYPRE_Solver solver, const char *plotfilename) { return (hypre_BoomerAMGSetPlotFileName ( (void *) solver, plotfilename ) ); } - + /* BM Oct 17, 2006 */ - + /*-------------------------------------------------------------------------- * HYPRE_BoomerAMGSetCoordDim *--------------------------------------------------------------------------*/ - + HYPRE_Int HYPRE_BoomerAMGSetCoordDim (HYPRE_Solver solver, HYPRE_Int coorddim) { return (hypre_BoomerAMGSetCoordDim ( (void *) solver, coorddim ) ); } - + /*-------------------------------------------------------------------------- * HYPRE_BoomerAMGSetCoordinates *--------------------------------------------------------------------------*/ - + HYPRE_Int HYPRE_BoomerAMGSetCoordinates (HYPRE_Solver solver, float *coordinates) @@ -1532,7 +1615,7 @@ { return( hypre_BoomerAMGSetChebyEigEst( (void *) solver, eig_est ) ); } - + /*-------------------------------------------------------------------------- * HYPRE_BoomerAMGSetInterpVectors *--------------------------------------------------------------------------*/ @@ -1540,17 +1623,17 @@ HYPRE_BoomerAMGSetInterpVectors (HYPRE_Solver solver, HYPRE_Int num_vectors, HYPRE_ParVector *vectors) { - return (hypre_BoomerAMGSetInterpVectors ( (void *) solver, - num_vectors, + return (hypre_BoomerAMGSetInterpVectors ( (void *) solver, + num_vectors, (hypre_ParVector **) vectors ) ); } /*-------------------------------------------------------------------------- * HYPRE_BoomerAMGSetInterpVecVariant *--------------------------------------------------------------------------*/ - + HYPRE_Int HYPRE_BoomerAMGSetInterpVecVariant(HYPRE_Solver solver, HYPRE_Int num) - + { return (hypre_BoomerAMGSetInterpVecVariant ( (void *) solver, num ) ); } @@ -1581,7 +1664,7 @@ *--------------------------------------------------------------------------*/ HYPRE_Int HYPRE_BoomerAMGSetSmoothInterpVectors( HYPRE_Solver solver, - HYPRE_Int smooth_interp_vectors ) + HYPRE_Int smooth_interp_vectors ) { return( hypre_BoomerAMGSetSmoothInterpVectors( (void *) solver, smooth_interp_vectors) ); @@ -1591,7 +1674,7 @@ *--------------------------------------------------------------------------*/ HYPRE_Int HYPRE_BoomerAMGSetInterpRefine( HYPRE_Solver solver, - HYPRE_Int num_refine ) + HYPRE_Int num_refine ) { return( hypre_BoomerAMGSetInterpRefine( (void *) solver, num_refine ) ); @@ -1601,7 +1684,7 @@ *--------------------------------------------------------------------------*/ HYPRE_Int HYPRE_BoomerAMGSetInterpVecFirstLevel( HYPRE_Solver solver, - HYPRE_Int level ) + HYPRE_Int level ) { return( hypre_BoomerAMGSetInterpVecFirstLevel( (void *) solver, level ) ); @@ -1612,14 +1695,14 @@ HYPRE_Int HYPRE_BoomerAMGSetAdditive( HYPRE_Solver solver, - HYPRE_Int additive ) + HYPRE_Int additive ) { return( hypre_BoomerAMGSetAdditive( (void *) solver, additive ) ); } HYPRE_Int HYPRE_BoomerAMGGetAdditive( HYPRE_Solver solver, - HYPRE_Int * additive ) + HYPRE_Int * additive ) { return( hypre_BoomerAMGGetAdditive( (void *) solver, additive ) ); } @@ -1630,14 +1713,14 @@ HYPRE_Int HYPRE_BoomerAMGSetMultAdditive( HYPRE_Solver solver, - HYPRE_Int mult_additive ) + HYPRE_Int mult_additive ) { return( hypre_BoomerAMGSetMultAdditive( (void *) solver, mult_additive ) ); } HYPRE_Int HYPRE_BoomerAMGGetMultAdditive( HYPRE_Solver solver, - HYPRE_Int * mult_additive ) + HYPRE_Int *mult_additive ) { return( hypre_BoomerAMGGetMultAdditive( (void *) solver, mult_additive ) ); } @@ -1648,14 +1731,14 @@ HYPRE_Int HYPRE_BoomerAMGSetSimple( HYPRE_Solver solver, - HYPRE_Int simple ) + HYPRE_Int simple ) { return( hypre_BoomerAMGSetSimple( (void *) solver, simple ) ); } HYPRE_Int HYPRE_BoomerAMGGetSimple( HYPRE_Solver solver, - HYPRE_Int * simple ) + HYPRE_Int *simple ) { return( hypre_BoomerAMGGetSimple( (void *) solver, simple ) ); } @@ -1666,7 +1749,7 @@ HYPRE_Int HYPRE_BoomerAMGSetAddLastLvl( HYPRE_Solver solver, - HYPRE_Int add_last_lvl ) + HYPRE_Int add_last_lvl ) { return( hypre_BoomerAMGSetAddLastLvl( (void *) solver, add_last_lvl ) ); } @@ -1677,7 +1760,7 @@ HYPRE_Int HYPRE_BoomerAMGSetNonGalerkinTol (HYPRE_Solver solver, - HYPRE_Real nongalerkin_tol) + HYPRE_Real nongalerkin_tol) { return (hypre_BoomerAMGSetNonGalerkinTol ( (void *) solver, nongalerkin_tol ) ); } @@ -1688,8 +1771,8 @@ HYPRE_Int HYPRE_BoomerAMGSetLevelNonGalerkinTol (HYPRE_Solver solver, - HYPRE_Real nongalerkin_tol, - HYPRE_Int level) + HYPRE_Real nongalerkin_tol, + HYPRE_Int level) { return (hypre_BoomerAMGSetLevelNonGalerkinTol ( (void *) solver, nongalerkin_tol , level ) ); } @@ -1712,30 +1795,41 @@ HYPRE_Int HYPRE_BoomerAMGSetRAP2 (HYPRE_Solver solver, - HYPRE_Int rap2) + HYPRE_Int rap2) { return (hypre_BoomerAMGSetRAP2 ( (void *) solver, rap2 ) ); } /*-------------------------------------------------------------------------- + * HYPRE_BoomerAMGSetModuleRAP2 + *--------------------------------------------------------------------------*/ + +HYPRE_Int +HYPRE_BoomerAMGSetModuleRAP2 (HYPRE_Solver solver, + HYPRE_Int mod_rap2) +{ + return (hypre_BoomerAMGSetModuleRAP2 ( (void *) solver, mod_rap2 ) ); +} + +/*-------------------------------------------------------------------------- * HYPRE_BoomerAMGSetKeepTranspose *--------------------------------------------------------------------------*/ HYPRE_Int HYPRE_BoomerAMGSetKeepTranspose (HYPRE_Solver solver, - HYPRE_Int keepTranspose) + HYPRE_Int keepTranspose) { return (hypre_BoomerAMGSetKeepTranspose ( (void *) solver, keepTranspose ) ); } -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU /*-------------------------------------------------------------------------- * HYPRE_BoomerAMGSetDSLUThreshold *--------------------------------------------------------------------------*/ HYPRE_Int HYPRE_BoomerAMGSetDSLUThreshold (HYPRE_Solver solver, - HYPRE_Int slu_threshold) + HYPRE_Int slu_threshold) { return (hypre_BoomerAMGSetDSLUThreshold ( (void *) solver, slu_threshold ) ); } @@ -1743,9 +1837,9 @@ HYPRE_Int HYPRE_BoomerAMGSetCpointsToKeep(HYPRE_Solver solver, - HYPRE_Int cpt_coarse_level, - HYPRE_Int num_cpt_coarse, - HYPRE_Int *cpt_coarse_index) + HYPRE_Int cpt_coarse_level, + HYPRE_Int num_cpt_coarse, + HYPRE_Int *cpt_coarse_index) { return (hypre_BoomerAMGSetCpointsToKeep( (void *) solver, cpt_coarse_level, num_cpt_coarse, cpt_coarse_index)); } diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_bicgstab.c hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_bicgstab.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_bicgstab.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_bicgstab.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_block.c hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_block.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_block.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_block.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_cgnr.c hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_cgnr.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_cgnr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_cgnr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_cogmres.c hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_cogmres.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_cogmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_cogmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_Euclid.c hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_Euclid.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_Euclid.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_Euclid.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "./HYPRE_parcsr_ls.h" #include "../matrix_matrix/HYPRE_matrix_matrix_protos.h" diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_flexgmres.c hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_flexgmres.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_flexgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_flexgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_gmres.c hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_gmres.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_gmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_gmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" @@ -46,7 +41,7 @@ * HYPRE_ParCSRGMRESDestroy *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int HYPRE_ParCSRGMRESDestroy( HYPRE_Solver solver ) { return( hypre_GMRESDestroy( (void *) solver ) ); @@ -56,7 +51,7 @@ * HYPRE_ParCSRGMRESSetup *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int HYPRE_ParCSRGMRESSetup( HYPRE_Solver solver, HYPRE_ParCSRMatrix A, HYPRE_ParVector b, @@ -72,7 +67,7 @@ * HYPRE_ParCSRGMRESSolve *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int HYPRE_ParCSRGMRESSolve( HYPRE_Solver solver, HYPRE_ParCSRMatrix A, HYPRE_ParVector b, @@ -225,8 +220,52 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -HYPRE_ParCSRGMRESGetResidual( HYPRE_Solver solver, +HYPRE_ParCSRGMRESGetResidual( HYPRE_Solver solver, HYPRE_ParVector *residual ) { return( HYPRE_GMRESGetResidual( solver, (void *) residual ) ); } + +/*-------------------------------------------------------------------------- + * Setup routine for on-processor triangular solve as preconditioning. + *--------------------------------------------------------------------------*/ +HYPRE_Int HYPRE_ParCSROnProcTriSetup(HYPRE_Solver solver, + HYPRE_ParCSRMatrix HA, + HYPRE_ParVector Hy, + HYPRE_ParVector Hx) +{ + hypre_ParCSRMatrix *A = (hypre_ParCSRMatrix *) HA; + + // Check for and get topological ordering of matrix + if (!hypre_ParCSRMatrixProcOrdering(A)) + { + hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); + HYPRE_Real *A_diag_data = hypre_CSRMatrixData(A_diag); + HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); + HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); + HYPRE_Int n = hypre_CSRMatrixNumRows(A_diag); + HYPRE_Int *proc_ordering = hypre_TAlloc(HYPRE_Int, n, HYPRE_MEMORY_HOST); + hypre_topo_sort(A_diag_i, A_diag_j, A_diag_data, proc_ordering, n); + hypre_ParCSRMatrixProcOrdering(A) = proc_ordering; + } + + return 0; +} + + +/*-------------------------------------------------------------------------- + * Solve routine for on-processor triangular solve as preconditioning. + *--------------------------------------------------------------------------*/ +HYPRE_Int HYPRE_ParCSROnProcTriSolve(HYPRE_Solver solver, + HYPRE_ParCSRMatrix HA, + HYPRE_ParVector Hy, + HYPRE_ParVector Hx) +{ + hypre_ParCSRMatrix *A = (hypre_ParCSRMatrix *) HA; + hypre_ParVector *y = (hypre_ParVector *) Hy; + hypre_ParVector *x = (hypre_ParVector *) Hx; + HYPRE_Int ierr = 0; + ierr = hypre_BoomerAMGRelax(A,y,NULL,10,0,1,1,NULL,x,NULL,NULL); + return ierr; +} + diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_hybrid.c hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_hybrid.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_hybrid.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_hybrid.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" @@ -147,6 +142,40 @@ } /*-------------------------------------------------------------------------- + *--------------------------------------------------------------------------*/ + +HYPRE_Int +HYPRE_ParCSRHybridSetRecomputeResidual( HYPRE_Solver solver, + HYPRE_Int recompute_residual ) +{ + return( hypre_AMGHybridSetRecomputeResidual( (void *) solver, recompute_residual ) ); +} + +HYPRE_Int +HYPRE_ParCSRHybridGetRecomputeResidual( HYPRE_Solver solver, + HYPRE_Int *recompute_residual ) +{ + return( hypre_AMGHybridGetRecomputeResidual( (void *) solver, recompute_residual ) ); +} + +/*-------------------------------------------------------------------------- + *--------------------------------------------------------------------------*/ + +HYPRE_Int +HYPRE_ParCSRHybridSetRecomputeResidualP( HYPRE_Solver solver, + HYPRE_Int recompute_residual_p ) +{ + return( hypre_AMGHybridSetRecomputeResidualP( (void *) solver, recompute_residual_p ) ); +} + +HYPRE_Int +HYPRE_ParCSRHybridGetRecomputeResidualP( HYPRE_Solver solver, + HYPRE_Int *recompute_residual_p ) +{ + return( hypre_AMGHybridGetRecomputeResidualP( (void *) solver, recompute_residual_p ) ); +} + +/*-------------------------------------------------------------------------- * HYPRE_ParCSRHybridSetKDim *--------------------------------------------------------------------------*/ diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_int.c hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_int.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_int.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_int.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_lgmres.c hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_lgmres.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_lgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_lgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" diff -Nru hypre-2.16.0/src/parcsr_ls/_hypre_parcsr_ls.h hypre-2.18.2/src/parcsr_ls/_hypre_parcsr_ls.h --- hypre-2.16.0/src/parcsr_ls/_hypre_parcsr_ls.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/_hypre_parcsr_ls.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include @@ -29,21 +24,6 @@ typedef struct { HYPRE_Int prev; HYPRE_Int next; } Link; -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - #ifndef hypre_ParAMG_DATA_HEADER #define hypre_ParAMG_DATA_HEADER @@ -62,6 +42,8 @@ /* setup params */ HYPRE_Int max_levels; HYPRE_Real strong_threshold; + HYPRE_Real strong_thresholdR; /* theta for build R: defines strong F neighbors */ + HYPRE_Real filter_thresholdR; /* theta for filtering R */ HYPRE_Real max_row_sum; HYPRE_Real trunc_factor; HYPRE_Real agg_trunc_factor; @@ -71,6 +53,7 @@ HYPRE_Real CR_rate; HYPRE_Real CR_strong_th; HYPRE_Real A_drop_tol; + HYPRE_Int A_drop_type; HYPRE_Int measure_type; HYPRE_Int setup_type; HYPRE_Int coarsen_type; @@ -81,6 +64,8 @@ HYPRE_Int agg_P_max_elmts; HYPRE_Int agg_P12_max_elmts; HYPRE_Int restr_par; + HYPRE_Int is_triangular; + HYPRE_Int gmres_switch; HYPRE_Int agg_num_levels; HYPRE_Int num_paths; HYPRE_Int post_interp_type; @@ -93,24 +78,26 @@ HYPRE_Int seq_threshold; HYPRE_Int redundant; HYPRE_Int participate; + HYPRE_Int Sabs; /* solve params */ HYPRE_Int max_iter; HYPRE_Int min_iter; - HYPRE_Int cycle_type; - HYPRE_Int *num_grid_sweeps; - HYPRE_Int *grid_relax_type; + HYPRE_Int fcycle; + HYPRE_Int cycle_type; + HYPRE_Int *num_grid_sweeps; + HYPRE_Int *grid_relax_type; HYPRE_Int **grid_relax_points; HYPRE_Int relax_order; - HYPRE_Int user_coarse_relax_type; - HYPRE_Int user_relax_type; - HYPRE_Int user_num_sweeps; - HYPRE_Real user_relax_weight; + HYPRE_Int user_coarse_relax_type; + HYPRE_Int user_relax_type; + HYPRE_Int user_num_sweeps; + HYPRE_Real user_relax_weight; HYPRE_Real outer_wt; - HYPRE_Real *relax_weight; - HYPRE_Real *omega; - HYPRE_Int converge_type; - HYPRE_Real tol; + HYPRE_Real *relax_weight; + HYPRE_Real *omega; + HYPRE_Int converge_type; + HYPRE_Real tol; /* problem data */ hypre_ParCSRMatrix *A; @@ -121,7 +108,7 @@ HYPRE_Int nodal_diag; HYPRE_Int num_points; HYPRE_Int *dof_func; - HYPRE_Int *dof_point; + HYPRE_Int *dof_point; HYPRE_Int *point_dof_map; /* data generated in the setup phase */ @@ -137,7 +124,6 @@ HYPRE_Int num_levels; HYPRE_Real **l1_norms; - /* Block data */ hypre_ParCSRBlockMatrix **A_block_array; hypre_ParCSRBlockMatrix **P_block_array; @@ -149,22 +135,22 @@ HYPRE_Int smooth_num_levels; HYPRE_Int smooth_type; HYPRE_Solver *smoother; - HYPRE_Int smooth_num_sweeps; + HYPRE_Int smooth_num_sweeps; HYPRE_Int schw_variant; HYPRE_Int schw_overlap; HYPRE_Int schw_domain_type; - HYPRE_Real schwarz_rlx_weight; + HYPRE_Real schwarz_rlx_weight; HYPRE_Int schwarz_use_nonsymm; - HYPRE_Int ps_sym; - HYPRE_Int ps_level; - HYPRE_Int pi_max_nz_per_row; - HYPRE_Int eu_level; - HYPRE_Int eu_bj; - HYPRE_Real ps_threshold; - HYPRE_Real ps_filter; - HYPRE_Real pi_drop_tol; - HYPRE_Real eu_sparse_A; - char *euclidfile; + HYPRE_Int ps_sym; + HYPRE_Int ps_level; + HYPRE_Int pi_max_nz_per_row; + HYPRE_Int eu_level; + HYPRE_Int eu_bj; + HYPRE_Real ps_threshold; + HYPRE_Real ps_filter; + HYPRE_Real pi_drop_tol; + HYPRE_Real eu_sparse_A; + char *euclidfile; HYPRE_Real *max_eig_est; HYPRE_Real *min_eig_est; @@ -192,8 +178,8 @@ hypre_ParVector *Ztemp; /* fields used by GSMG and LS interpolation */ - HYPRE_Int gsmg; /* nonzero indicates use of GSMG */ - HYPRE_Int num_samples; /* number of sample vectors */ + HYPRE_Int gsmg; /* nonzero indicates use of GSMG */ + HYPRE_Int num_samples; /* number of sample vectors */ /* log info */ HYPRE_Int logging; @@ -221,7 +207,7 @@ HYPRE_Int num_interp_vectors; HYPRE_Int num_levels_interp_vectors; /* not set by user */ hypre_ParVector **interp_vectors; - hypre_ParVector ***interp_vectors_array; + hypre_ParVector ***interp_vectors_array; HYPRE_Int interp_vec_variant; HYPRE_Int interp_vec_first_level; HYPRE_Real interp_vectors_abs_q_trunc; @@ -230,19 +216,20 @@ HYPRE_Int smooth_interp_vectors; HYPRE_Real *expandp_weights; /* currently not set by user */ - /* enable redundant coarse grid solve */ + /* enable redundant coarse grid solve */ HYPRE_Solver coarse_solver; hypre_ParCSRMatrix *A_coarse; hypre_ParVector *f_coarse; hypre_ParVector *u_coarse; MPI_Comm new_comm; - /* store matrix, vector and communication info for Gaussian elimination */ - HYPRE_Real *A_mat; + /* store matrix, vector and communication info for Gaussian elimination */ + HYPRE_Int gs_setup; + HYPRE_Real *A_mat, *A_inv; HYPRE_Real *b_vec; - HYPRE_Int *comm_info; + HYPRE_Int *comm_info; - /* information for multiplication with Lambda - additive AMG */ + /* information for multiplication with Lambda - additive AMG */ HYPRE_Int additive; HYPRE_Int mult_additive; HYPRE_Int simple; @@ -257,14 +244,16 @@ hypre_ParVector *Xtilde; HYPRE_Real *D_inv; + /* Use 2 mat-mat-muls instead of triple product*/ HYPRE_Int rap2; HYPRE_Int keepTranspose; -/* information for preserving indexes as coarse grid points */ + HYPRE_Int modularized_matmat; + /* information for preserving indexes as coarse grid points */ HYPRE_Int C_point_keep_level; HYPRE_Int num_C_point_marker; HYPRE_Int **C_point_marker_array; -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU /* Parameters and data for SuperLU_Dist */ HYPRE_Int dslu_threshold; HYPRE_Solver dslu_solver; @@ -277,11 +266,15 @@ *--------------------------------------------------------------------------*/ /* setup params */ - + #define hypre_ParAMGDataRestriction(amg_data) ((amg_data)->restr_par) +#define hypre_ParAMGDataIsTriangular(amg_data) ((amg_data)->is_triangular) +#define hypre_ParAMGDataGMRESSwitchR(amg_data) ((amg_data)->gmres_switch) #define hypre_ParAMGDataMaxLevels(amg_data) ((amg_data)->max_levels) -#define hypre_ParAMGDataStrongThreshold(amg_data) \ -((amg_data)->strong_threshold) +#define hypre_ParAMGDataStrongThreshold(amg_data) ((amg_data)->strong_threshold) +#define hypre_ParAMGDataStrongThresholdR(amg_data)((amg_data)->strong_thresholdR) +#define hypre_ParAMGDataFilterThresholdR(amg_data)((amg_data)->filter_thresholdR) +#define hypre_ParAMGDataSabs(amg_data) (amg_data->Sabs) #define hypre_ParAMGDataMaxRowSum(amg_data) ((amg_data)->max_row_sum) #define hypre_ParAMGDataTruncFactor(amg_data) ((amg_data)->trunc_factor) #define hypre_ParAMGDataAggTruncFactor(amg_data) ((amg_data)->agg_trunc_factor) @@ -304,6 +297,7 @@ #define hypre_ParAMGDataCRRate(amg_data) ((amg_data)->CR_rate) #define hypre_ParAMGDataCRStrongTh(amg_data) ((amg_data)->CR_strong_th) #define hypre_ParAMGDataADropTol(amg_data) ((amg_data)->A_drop_tol) +#define hypre_ParAMGDataADropType(amg_data) ((amg_data)->A_drop_type) #define hypre_ParAMGDataISType(amg_data) ((amg_data)->IS_type) #define hypre_ParAMGDataCRUseCG(amg_data) ((amg_data)->CR_use_CG) #define hypre_ParAMGDataL1Norms(amg_data) ((amg_data)->l1_norms) @@ -316,6 +310,7 @@ #define hypre_ParAMGDataMinIter(amg_data) ((amg_data)->min_iter) #define hypre_ParAMGDataMaxIter(amg_data) ((amg_data)->max_iter) +#define hypre_ParAMGDataFCycle(amg_data) ((amg_data)->fcycle) #define hypre_ParAMGDataCycleType(amg_data) ((amg_data)->cycle_type) #define hypre_ParAMGDataConvergeType(amg_data) ((amg_data)->converge_type) #define hypre_ParAMGDataTol(amg_data) ((amg_data)->tol) @@ -345,6 +340,7 @@ /* data generated by the setup phase */ #define hypre_ParAMGDataCFMarkerArray(amg_data) ((amg_data)-> CF_marker_array) +#define hypre_ParAMGDataCPointMarkerArray(amg_data) ((amg_data)-> C_point_marker_array) #define hypre_ParAMGDataAArray(amg_data) ((amg_data)->A_array) #define hypre_ParAMGDataFArray(amg_data) ((amg_data)->F_array) #define hypre_ParAMGDataUArray(amg_data) ((amg_data)->U_array) @@ -353,34 +349,34 @@ #define hypre_ParAMGDataDofFuncArray(amg_data) ((amg_data)->dof_func_array) #define hypre_ParAMGDataDofPointArray(amg_data) ((amg_data)->dof_point_array) #define hypre_ParAMGDataPointDofMapArray(amg_data) \ -((amg_data)->point_dof_map_array) -#define hypre_ParAMGDataNumLevels(amg_data) ((amg_data)->num_levels) +((amg_data)->point_dof_map_array) +#define hypre_ParAMGDataNumLevels(amg_data) ((amg_data)->num_levels) #define hypre_ParAMGDataSmoothType(amg_data) ((amg_data)->smooth_type) #define hypre_ParAMGDataSmoothNumLevels(amg_data) \ ((amg_data)->smooth_num_levels) #define hypre_ParAMGDataSmoothNumSweeps(amg_data) \ -((amg_data)->smooth_num_sweeps) -#define hypre_ParAMGDataSmoother(amg_data) ((amg_data)->smoother) -#define hypre_ParAMGDataVariant(amg_data) ((amg_data)->schw_variant) -#define hypre_ParAMGDataOverlap(amg_data) ((amg_data)->schw_overlap) -#define hypre_ParAMGDataDomainType(amg_data) ((amg_data)->schw_domain_type) +((amg_data)->smooth_num_sweeps) +#define hypre_ParAMGDataSmoother(amg_data) ((amg_data)->smoother) +#define hypre_ParAMGDataVariant(amg_data) ((amg_data)->schw_variant) +#define hypre_ParAMGDataOverlap(amg_data) ((amg_data)->schw_overlap) +#define hypre_ParAMGDataDomainType(amg_data) ((amg_data)->schw_domain_type) #define hypre_ParAMGDataSchwarzRlxWeight(amg_data) \ ((amg_data)->schwarz_rlx_weight) #define hypre_ParAMGDataSchwarzUseNonSymm(amg_data) \ ((amg_data)->schwarz_use_nonsymm) -#define hypre_ParAMGDataSym(amg_data) ((amg_data)->ps_sym) -#define hypre_ParAMGDataLevel(amg_data) ((amg_data)->ps_level) +#define hypre_ParAMGDataSym(amg_data) ((amg_data)->ps_sym) +#define hypre_ParAMGDataLevel(amg_data) ((amg_data)->ps_level) #define hypre_ParAMGDataMaxNzPerRow(amg_data) ((amg_data)->pi_max_nz_per_row) -#define hypre_ParAMGDataThreshold(amg_data) ((amg_data)->ps_threshold) -#define hypre_ParAMGDataFilter(amg_data) ((amg_data)->ps_filter) -#define hypre_ParAMGDataDropTol(amg_data) ((amg_data)->pi_drop_tol) -#define hypre_ParAMGDataEuclidFile(amg_data) ((amg_data)->euclidfile) -#define hypre_ParAMGDataEuLevel(amg_data) ((amg_data)->eu_level) +#define hypre_ParAMGDataThreshold(amg_data) ((amg_data)->ps_threshold) +#define hypre_ParAMGDataFilter(amg_data) ((amg_data)->ps_filter) +#define hypre_ParAMGDataDropTol(amg_data) ((amg_data)->pi_drop_tol) +#define hypre_ParAMGDataEuclidFile(amg_data) ((amg_data)->euclidfile) +#define hypre_ParAMGDataEuLevel(amg_data) ((amg_data)->eu_level) #define hypre_ParAMGDataEuSparseA(amg_data) ((amg_data)->eu_sparse_A) #define hypre_ParAMGDataEuBJ(amg_data) ((amg_data)->eu_bj) -#define hypre_ParAMGDataMaxEigEst(amg_data) ((amg_data)->max_eig_est) -#define hypre_ParAMGDataMinEigEst(amg_data) ((amg_data)->min_eig_est) +#define hypre_ParAMGDataMaxEigEst(amg_data) ((amg_data)->max_eig_est) +#define hypre_ParAMGDataMinEigEst(amg_data) ((amg_data)->min_eig_est) #define hypre_ParAMGDataChebyOrder(amg_data) ((amg_data)->cheby_order) #define hypre_ParAMGDataChebyFraction(amg_data) ((amg_data)->cheby_fraction) #define hypre_ParAMGDataChebyEigEst(amg_data) ((amg_data)->cheby_eig_est) @@ -453,7 +449,9 @@ #define hypre_ParAMGDataRedundant(amg_data) ((amg_data)->redundant) #define hypre_ParAMGDataParticipate(amg_data) ((amg_data)->participate) +#define hypre_ParAMGDataGSSetup(amg_data) ((amg_data)->gs_setup) #define hypre_ParAMGDataAMat(amg_data) ((amg_data)->A_mat) +#define hypre_ParAMGDataAInv(amg_data) ((amg_data)->A_inv) #define hypre_ParAMGDataBVec(amg_data) ((amg_data)->b_vec) #define hypre_ParAMGDataCommInfo(amg_data) ((amg_data)->comm_info) @@ -480,6 +478,7 @@ #define hypre_ParAMGDataRAP2(amg_data) ((amg_data)->rap2) #define hypre_ParAMGDataKeepTranspose(amg_data) ((amg_data)->keepTranspose) +#define hypre_ParAMGDataModularizedMatMat(amg_data) ((amg_data)->modularized_matmat) /*indices for the dof which will keep coarsening to the coarse level */ #define hypre_ParAMGDataCPointKeepMarkerArray(amg_data) ((amg_data)-> C_point_marker_array) @@ -487,7 +486,7 @@ #define hypre_ParAMGDataNumCPointKeep(amg_data) ((amg_data)-> num_C_point_marker) /* Parameters and data for SuperLU_Dist */ -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU #define hypre_ParAMGDataDSLUThreshold(amg_data) ((amg_data)->dslu_threshold) #define hypre_ParAMGDataDSLUSolver(amg_data) ((amg_data)->dslu_solver) #endif @@ -552,6 +551,10 @@ HYPRE_Int hypre_AMGHybridSetPCGMaxIter ( void *AMGhybrid_vdata , HYPRE_Int pcg_max_its ); HYPRE_Int hypre_AMGHybridSetSetupType ( void *AMGhybrid_vdata , HYPRE_Int setup_type ); HYPRE_Int hypre_AMGHybridSetSolverType ( void *AMGhybrid_vdata , HYPRE_Int solver_type ); +HYPRE_Int hypre_AMGHybridSetRecomputeResidual ( void *AMGhybrid_vdata , HYPRE_Int recompute_residual ); +HYPRE_Int hypre_AMGHybridGetRecomputeResidual ( void *AMGhybrid_vdata , HYPRE_Int *recompute_residual ); +HYPRE_Int hypre_AMGHybridSetRecomputeResidualP ( void *AMGhybrid_vdata , HYPRE_Int recompute_residual_p ); +HYPRE_Int hypre_AMGHybridGetRecomputeResidualP ( void *AMGhybrid_vdata , HYPRE_Int *recompute_residual_p ); HYPRE_Int hypre_AMGHybridSetKDim ( void *AMGhybrid_vdata , HYPRE_Int k_dim ); HYPRE_Int hypre_AMGHybridSetStopCrit ( void *AMGhybrid_vdata , HYPRE_Int stop_crit ); HYPRE_Int hypre_AMGHybridSetTwoNorm ( void *AMGhybrid_vdata , HYPRE_Int two_norm ); @@ -639,8 +642,8 @@ HYPRE_Int hypre_AMSGetNumIterations ( void *solver , HYPRE_Int *num_iterations ); HYPRE_Int hypre_AMSGetFinalRelativeResidualNorm ( void *solver , HYPRE_Real *rel_resid_norm ); HYPRE_Int hypre_AMSProjectOutGradients ( void *solver , hypre_ParVector *x ); -HYPRE_Int hypre_AMSConstructDiscreteGradient ( hypre_ParCSRMatrix *A , hypre_ParVector *x_coord , HYPRE_Int *edge_vertex , HYPRE_Int edge_orientation , hypre_ParCSRMatrix **G_ptr ); -HYPRE_Int hypre_AMSFEISetup ( void *solver , hypre_ParCSRMatrix *A , hypre_ParVector *b , hypre_ParVector *x , HYPRE_Int num_vert , HYPRE_Int num_local_vert , HYPRE_BigInt *vert_number , HYPRE_Real *vert_coord , HYPRE_Int num_edges , HYPRE_Int *edge_vertex ); +HYPRE_Int hypre_AMSConstructDiscreteGradient ( hypre_ParCSRMatrix *A , hypre_ParVector *x_coord , HYPRE_BigInt *edge_vertex , HYPRE_Int edge_orientation , hypre_ParCSRMatrix **G_ptr ); +HYPRE_Int hypre_AMSFEISetup ( void *solver , hypre_ParCSRMatrix *A , hypre_ParVector *b , hypre_ParVector *x , HYPRE_Int num_vert , HYPRE_Int num_local_vert , HYPRE_BigInt *vert_number , HYPRE_Real *vert_coord , HYPRE_Int num_edges , HYPRE_BigInt *edge_vertex ); HYPRE_Int hypre_AMSFEIDestroy ( void *solver ); HYPRE_Int hypre_ParCSRComputeL1NormsThreads ( hypre_ParCSRMatrix *A , HYPRE_Int option , HYPRE_Int num_threads , HYPRE_Int *cf_marker , HYPRE_Real **l1_norm_ptr ); HYPRE_Int hypre_ParCSRRelaxThreads ( hypre_ParCSRMatrix *A , hypre_ParVector *f , HYPRE_Int relax_type , HYPRE_Int relax_times , HYPRE_Real *l1_norms , HYPRE_Real relax_weight , HYPRE_Real omega , hypre_ParVector *u , hypre_ParVector *Vtemp , hypre_ParVector *z ); @@ -745,8 +748,8 @@ HYPRE_Int HYPRE_AMSGetNumIterations ( HYPRE_Solver solver , HYPRE_Int *num_iterations ); HYPRE_Int HYPRE_AMSGetFinalRelativeResidualNorm ( HYPRE_Solver solver , HYPRE_Real *rel_resid_norm ); HYPRE_Int HYPRE_AMSProjectOutGradients ( HYPRE_Solver solver , HYPRE_ParVector x ); -HYPRE_Int HYPRE_AMSConstructDiscreteGradient ( HYPRE_ParCSRMatrix A , HYPRE_ParVector x_coord , HYPRE_Int *edge_vertex , HYPRE_Int edge_orientation , HYPRE_ParCSRMatrix *G ); -HYPRE_Int HYPRE_AMSFEISetup ( HYPRE_Solver solver , HYPRE_ParCSRMatrix A , HYPRE_ParVector b , HYPRE_ParVector x , HYPRE_Int *EdgeNodeList_ , HYPRE_BigInt *NodeNumbers_ , HYPRE_Int numEdges_ , HYPRE_Int numLocalNodes_ , HYPRE_Int numNodes_ , HYPRE_Real *NodalCoord_ ); +HYPRE_Int HYPRE_AMSConstructDiscreteGradient ( HYPRE_ParCSRMatrix A , HYPRE_ParVector x_coord , HYPRE_BigInt *edge_vertex , HYPRE_Int edge_orientation , HYPRE_ParCSRMatrix *G ); +HYPRE_Int HYPRE_AMSFEISetup ( HYPRE_Solver solver , HYPRE_ParCSRMatrix A , HYPRE_ParVector b , HYPRE_ParVector x , HYPRE_BigInt *EdgeNodeList_ , HYPRE_BigInt *NodeNumbers_ , HYPRE_Int numEdges_ , HYPRE_Int numLocalNodes_ , HYPRE_Int numNodes_ , HYPRE_Real *NodalCoord_ ); HYPRE_Int HYPRE_AMSFEIDestroy ( HYPRE_Solver solver ); /* HYPRE_parcsr_amg.c */ @@ -756,6 +759,8 @@ HYPRE_Int HYPRE_BoomerAMGSolve ( HYPRE_Solver solver , HYPRE_ParCSRMatrix A , HYPRE_ParVector b , HYPRE_ParVector x ); HYPRE_Int HYPRE_BoomerAMGSolveT ( HYPRE_Solver solver , HYPRE_ParCSRMatrix A , HYPRE_ParVector b , HYPRE_ParVector x ); HYPRE_Int HYPRE_BoomerAMGSetRestriction ( HYPRE_Solver solver , HYPRE_Int restr_par ); +HYPRE_Int HYPRE_BoomerAMGSetIsTriangular ( HYPRE_Solver solver , HYPRE_Int is_triangular ); +HYPRE_Int HYPRE_BoomerAMGSetGMRESSwitchR ( HYPRE_Solver solver , HYPRE_Int gmres_switch ); HYPRE_Int HYPRE_BoomerAMGSetMaxLevels ( HYPRE_Solver solver , HYPRE_Int max_levels ); HYPRE_Int HYPRE_BoomerAMGGetMaxLevels ( HYPRE_Solver solver , HYPRE_Int *max_levels ); HYPRE_Int HYPRE_BoomerAMGSetMaxCoarseSize ( HYPRE_Solver solver , HYPRE_Int max_coarse_size ); @@ -768,6 +773,12 @@ HYPRE_Int HYPRE_BoomerAMGGetRedundant ( HYPRE_Solver solver , HYPRE_Int *redundant ); HYPRE_Int HYPRE_BoomerAMGSetStrongThreshold ( HYPRE_Solver solver , HYPRE_Real strong_threshold ); HYPRE_Int HYPRE_BoomerAMGGetStrongThreshold ( HYPRE_Solver solver , HYPRE_Real *strong_threshold ); +HYPRE_Int HYPRE_BoomerAMGSetStrongThresholdR ( HYPRE_Solver solver , HYPRE_Real strong_threshold ); +HYPRE_Int HYPRE_BoomerAMGGetStrongThresholdR ( HYPRE_Solver solver , HYPRE_Real *strong_threshold ); +HYPRE_Int HYPRE_BoomerAMGSetFilterThresholdR ( HYPRE_Solver solver , HYPRE_Real filter_threshold ); +HYPRE_Int HYPRE_BoomerAMGGetFilterThresholdR ( HYPRE_Solver solver , HYPRE_Real *filter_threshold ); +HYPRE_Int HYPRE_BoomerAMGSetGMRESSwitchR ( HYPRE_Solver solver , HYPRE_Int gmres_switch ); +HYPRE_Int HYPRE_BoomerAMGSetSabs ( HYPRE_Solver solver , HYPRE_Int Sabs ); HYPRE_Int HYPRE_BoomerAMGSetMaxRowSum ( HYPRE_Solver solver , HYPRE_Real max_row_sum ); HYPRE_Int HYPRE_BoomerAMGGetMaxRowSum ( HYPRE_Solver solver , HYPRE_Real *max_row_sum ); HYPRE_Int HYPRE_BoomerAMGSetTruncFactor ( HYPRE_Solver solver , HYPRE_Real trunc_factor ); @@ -790,6 +801,8 @@ HYPRE_Int HYPRE_BoomerAMGGetMeasureType ( HYPRE_Solver solver , HYPRE_Int *measure_type ); HYPRE_Int HYPRE_BoomerAMGSetSetupType ( HYPRE_Solver solver , HYPRE_Int setup_type ); HYPRE_Int HYPRE_BoomerAMGSetOldDefault ( HYPRE_Solver solver ); +HYPRE_Int HYPRE_BoomerAMGSetFCycle ( HYPRE_Solver solver , HYPRE_Int fcycle ); +HYPRE_Int HYPRE_BoomerAMGGetFCycle ( HYPRE_Solver solver , HYPRE_Int *fcycle ); HYPRE_Int HYPRE_BoomerAMGSetCycleType ( HYPRE_Solver solver , HYPRE_Int cycle_type ); HYPRE_Int HYPRE_BoomerAMGGetCycleType ( HYPRE_Solver solver , HYPRE_Int *cycle_type ); HYPRE_Int HYPRE_BoomerAMGSetConvergeType ( HYPRE_Solver solver , HYPRE_Int type ); @@ -871,7 +884,8 @@ HYPRE_Int HYPRE_BoomerAMGSetNumCRRelaxSteps ( HYPRE_Solver solver , HYPRE_Int num_CR_relax_steps ); HYPRE_Int HYPRE_BoomerAMGSetCRRate ( HYPRE_Solver solver , HYPRE_Real CR_rate ); HYPRE_Int HYPRE_BoomerAMGSetCRStrongTh ( HYPRE_Solver solver , HYPRE_Real CR_strong_th ); -HYPRE_Int HYPRE_BoomerAMGSetADropTol( HYPRE_Solver solver, HYPRE_Real A_drop_tol ); +HYPRE_Int HYPRE_BoomerAMGSetADropTol( HYPRE_Solver solver, HYPRE_Real A_drop_tol ); +HYPRE_Int HYPRE_BoomerAMGSetADropType( HYPRE_Solver solver, HYPRE_Int A_drop_type ); HYPRE_Int HYPRE_BoomerAMGSetISType ( HYPRE_Solver solver , HYPRE_Int IS_type ); HYPRE_Int HYPRE_BoomerAMGSetCRUseCG ( HYPRE_Solver solver , HYPRE_Int CR_use_CG ); HYPRE_Int HYPRE_BoomerAMGSetGSMG ( HYPRE_Solver solver , HYPRE_Int gsmg ); @@ -904,8 +918,9 @@ HYPRE_Int HYPRE_BoomerAMGSetLevelNonGalerkinTol ( HYPRE_Solver solver , HYPRE_Real nongalerkin_tol , HYPRE_Int level ); HYPRE_Int HYPRE_BoomerAMGSetNonGalerkTol ( HYPRE_Solver solver , HYPRE_Int nongalerk_num_tol , HYPRE_Real *nongalerk_tol ); HYPRE_Int HYPRE_BoomerAMGSetRAP2 ( HYPRE_Solver solver , HYPRE_Int rap2 ); +HYPRE_Int HYPRE_BoomerAMGSetModuleRAP2 ( HYPRE_Solver solver , HYPRE_Int mod_rap2 ); HYPRE_Int HYPRE_BoomerAMGSetKeepTranspose ( HYPRE_Solver solver , HYPRE_Int keepTranspose ); -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU HYPRE_Int HYPRE_BoomerAMGSetDSLUThreshold ( HYPRE_Solver solver , HYPRE_Int slu_threshold ); #endif HYPRE_Int HYPRE_BoomerAMGSetCpointsToKeep( HYPRE_Solver solver, HYPRE_Int cpt_coarse_level, HYPRE_Int num_cpt_coarse,HYPRE_Int *cpt_coarse_index); @@ -1172,6 +1187,8 @@ HYPRE_Int HYPRE_ParCSRPCGGetResidual ( HYPRE_Solver solver , HYPRE_ParVector *residual ); HYPRE_Int HYPRE_ParCSRDiagScaleSetup ( HYPRE_Solver solver , HYPRE_ParCSRMatrix A , HYPRE_ParVector y , HYPRE_ParVector x ); HYPRE_Int HYPRE_ParCSRDiagScale ( HYPRE_Solver solver , HYPRE_ParCSRMatrix HA , HYPRE_ParVector Hy , HYPRE_ParVector Hx ); +HYPRE_Int HYPRE_ParCSROnProcTriSetup ( HYPRE_Solver solver , HYPRE_ParCSRMatrix HA , HYPRE_ParVector Hy , HYPRE_ParVector Hx ); +HYPRE_Int HYPRE_ParCSROnProcTriSolve ( HYPRE_Solver solver , HYPRE_ParCSRMatrix HA , HYPRE_ParVector Hy , HYPRE_ParVector Hx ); /* HYPRE_parcsr_pilut.c */ HYPRE_Int HYPRE_ParCSRPilutCreate ( MPI_Comm comm , HYPRE_Solver *solver ); @@ -1205,6 +1222,8 @@ void *hypre_BoomerAMGCreate ( void ); HYPRE_Int hypre_BoomerAMGDestroy ( void *data ); HYPRE_Int hypre_BoomerAMGSetRestriction ( void *data , HYPRE_Int restr_par ); +HYPRE_Int hypre_BoomerAMGSetIsTriangular ( void *data , HYPRE_Int is_triangular ); +HYPRE_Int hypre_BoomerAMGSetGMRESSwitchR ( void *data , HYPRE_Int gmres_switch ); HYPRE_Int hypre_BoomerAMGSetMaxLevels ( void *data , HYPRE_Int max_levels ); HYPRE_Int hypre_BoomerAMGGetMaxLevels ( void *data , HYPRE_Int *max_levels ); HYPRE_Int hypre_BoomerAMGSetMaxCoarseSize ( void *data , HYPRE_Int max_coarse_size ); @@ -1217,6 +1236,11 @@ HYPRE_Int hypre_BoomerAMGGetRedundant ( void *data , HYPRE_Int *redundant ); HYPRE_Int hypre_BoomerAMGSetStrongThreshold ( void *data , HYPRE_Real strong_threshold ); HYPRE_Int hypre_BoomerAMGGetStrongThreshold ( void *data , HYPRE_Real *strong_threshold ); +HYPRE_Int hypre_BoomerAMGSetStrongThresholdR ( void *data , HYPRE_Real strong_threshold ); +HYPRE_Int hypre_BoomerAMGGetStrongThresholdR ( void *data , HYPRE_Real *strong_threshold ); +HYPRE_Int hypre_BoomerAMGSetFilterThresholdR ( void *data , HYPRE_Real filter_threshold ); +HYPRE_Int hypre_BoomerAMGGetFilterThresholdR ( void *data , HYPRE_Real *filter_threshold ); +HYPRE_Int hypre_BoomerAMGSetSabs ( void *data , HYPRE_Int Sabs ); HYPRE_Int hypre_BoomerAMGSetMaxRowSum ( void *data , HYPRE_Real max_row_sum ); HYPRE_Int hypre_BoomerAMGGetMaxRowSum ( void *data , HYPRE_Real *max_row_sum ); HYPRE_Int hypre_BoomerAMGSetTruncFactor ( void *data , HYPRE_Real trunc_factor ); @@ -1242,6 +1266,8 @@ HYPRE_Int hypre_BoomerAMGGetMeasureType ( void *data , HYPRE_Int *measure_type ); HYPRE_Int hypre_BoomerAMGSetSetupType ( void *data , HYPRE_Int setup_type ); HYPRE_Int hypre_BoomerAMGGetSetupType ( void *data , HYPRE_Int *setup_type ); +HYPRE_Int hypre_BoomerAMGSetFCycle ( void *data , HYPRE_Int fcycle ); +HYPRE_Int hypre_BoomerAMGGetFCycle ( void *data , HYPRE_Int *fcycle ); HYPRE_Int hypre_BoomerAMGSetCycleType ( void *data , HYPRE_Int cycle_type ); HYPRE_Int hypre_BoomerAMGGetCycleType ( void *data , HYPRE_Int *cycle_type ); HYPRE_Int hypre_BoomerAMGSetConvergeType ( void *data , HYPRE_Int type ); @@ -1314,6 +1340,7 @@ HYPRE_Int hypre_BoomerAMGSetCRRate ( void *data , HYPRE_Real CR_rate ); HYPRE_Int hypre_BoomerAMGSetCRStrongTh ( void *data , HYPRE_Real CR_strong_th ); HYPRE_Int hypre_BoomerAMGSetADropTol( void *data, HYPRE_Real A_drop_tol ); +HYPRE_Int hypre_BoomerAMGSetADropType( void *data, HYPRE_Int A_drop_type ); HYPRE_Int hypre_BoomerAMGSetISType ( void *data , HYPRE_Int IS_type ); HYPRE_Int hypre_BoomerAMGSetCRUseCG ( void *data , HYPRE_Int CR_use_CG ); HYPRE_Int hypre_BoomerAMGSetNumPoints ( void *data , HYPRE_Int num_points ); @@ -1366,8 +1393,9 @@ HYPRE_Int hypre_BoomerAMGSetLevelNonGalerkinTol ( void *data , HYPRE_Real nongalerkin_tol , HYPRE_Int level ); HYPRE_Int hypre_BoomerAMGSetNonGalerkTol ( void *data , HYPRE_Int nongalerk_num_tol , HYPRE_Real *nongalerk_tol ); HYPRE_Int hypre_BoomerAMGSetRAP2 ( void *data , HYPRE_Int rap2 ); +HYPRE_Int hypre_BoomerAMGSetModuleRAP2 ( void *data , HYPRE_Int mod_rap2 ); HYPRE_Int hypre_BoomerAMGSetKeepTranspose ( void *data , HYPRE_Int keepTranspose ); -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU HYPRE_Int hypre_BoomerAMGSetDSLUThreshold ( void *data , HYPRE_Int slu_threshold ); #endif HYPRE_Int hypre_BoomerAMGSetCpointsToKeep(void *data, HYPRE_Int cpt_coarse_level, HYPRE_Int num_cpt_coarse, HYPRE_Int *cpt_coarse_index); @@ -1407,6 +1435,11 @@ HYPRE_Int hypre_BoomerAMGCoarsenHMIS ( hypre_ParCSRMatrix *S , hypre_ParCSRMatrix *A , HYPRE_Int measure_type , HYPRE_Int debug_flag , HYPRE_Int **CF_marker_ptr ); HYPRE_Int hypre_BoomerAMGCoarsenPMIS ( hypre_ParCSRMatrix *S , hypre_ParCSRMatrix *A , HYPRE_Int CF_init , HYPRE_Int debug_flag , HYPRE_Int **CF_marker_ptr ); +HYPRE_Int hypre_BoomerAMGCoarsenPMISDevice( hypre_ParCSRMatrix *S, hypre_ParCSRMatrix *A, HYPRE_Int CF_init, HYPRE_Int debug_flag, HYPRE_Int **CF_marker_ptr ); + +/* par_coarsen_device.c */ +HYPRE_Int hypre_GetGlobalMeasureDevice( hypre_ParCSRMatrix *S, hypre_ParCSRCommPkg *comm_pkg, HYPRE_Int CF_init, HYPRE_Int aug_rand, HYPRE_Real *measure_diag, HYPRE_Real *measure_offd, HYPRE_Real *real_send_buf ); + /* par_coarse_parms.c */ HYPRE_Int hypre_BoomerAMGCoarseParms ( 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 ); @@ -1438,7 +1471,6 @@ HYPRE_ParCSRMatrix GenerateDifConv ( MPI_Comm comm , HYPRE_BigInt nx , HYPRE_BigInt ny , HYPRE_BigInt nz , HYPRE_Int P , HYPRE_Int Q , HYPRE_Int R , HYPRE_Int p , HYPRE_Int q , HYPRE_Int r , HYPRE_Real *value ); /* par_gsmg.c */ -HYPRE_Int hypre_ParCSRMatrixClone ( hypre_ParCSRMatrix *A , hypre_ParCSRMatrix **Sp , HYPRE_Int copy_data ); HYPRE_Int hypre_ParCSRMatrixFillSmooth ( HYPRE_Int nsamples , HYPRE_Real *samples , hypre_ParCSRMatrix *S , hypre_ParCSRMatrix *A , HYPRE_Int num_functions , HYPRE_Int *dof_func ); HYPRE_Real hypre_ParCSRMatrixChooseThresh ( hypre_ParCSRMatrix *S ); HYPRE_Int hypre_ParCSRMatrixThreshold ( hypre_ParCSRMatrix *A , HYPRE_Real thresh ); @@ -1453,12 +1485,19 @@ HYPRE_Int hypre_BoomerAMGIndepSetInit ( hypre_ParCSRMatrix *S , HYPRE_Real *measure_array , HYPRE_Int seq_rand ); HYPRE_Int hypre_BoomerAMGIndepSet ( hypre_ParCSRMatrix *S , HYPRE_Real *measure_array , HYPRE_Int *graph_array , HYPRE_Int graph_array_size , HYPRE_Int *graph_array_offd , HYPRE_Int graph_array_offd_size , HYPRE_Int *IS_marker , HYPRE_Int *IS_marker_offd ); +HYPRE_Int hypre_BoomerAMGIndepSetInitDevice( hypre_ParCSRMatrix *S, HYPRE_Real *measure_array, HYPRE_Int aug_rand); + +HYPRE_Int hypre_BoomerAMGIndepSetDevice( hypre_ParCSRMatrix *S, HYPRE_Real *measure_diag, HYPRE_Real *measure_offd, HYPRE_Int graph_diag_size, HYPRE_Int *graph_diag, HYPRE_Int *IS_marker_diag, HYPRE_Int *IS_marker_offd, hypre_ParCSRCommPkg *comm_pkg, HYPRE_Int *int_send_buf ); + /* par_interp.c */ HYPRE_Int hypre_BoomerAMGBuildInterp ( hypre_ParCSRMatrix *A , HYPRE_Int *CF_marker , hypre_ParCSRMatrix *S , HYPRE_BigInt *num_cpts_global , HYPRE_Int num_functions , HYPRE_Int *dof_func , HYPRE_Int debug_flag , HYPRE_Real trunc_factor , HYPRE_Int max_elmts , HYPRE_Int *col_offd_S_to_A , hypre_ParCSRMatrix **P_ptr ); HYPRE_Int hypre_BoomerAMGBuildInterpHE ( hypre_ParCSRMatrix *A , HYPRE_Int *CF_marker , hypre_ParCSRMatrix *S , HYPRE_BigInt *num_cpts_global , HYPRE_Int num_functions , HYPRE_Int *dof_func , HYPRE_Int debug_flag , HYPRE_Real trunc_factor , HYPRE_Int max_elmts , HYPRE_Int *col_offd_S_to_A , hypre_ParCSRMatrix **P_ptr ); HYPRE_Int hypre_BoomerAMGBuildDirInterp ( hypre_ParCSRMatrix *A , HYPRE_Int *CF_marker , hypre_ParCSRMatrix *S , HYPRE_BigInt *num_cpts_global , HYPRE_Int num_functions , HYPRE_Int *dof_func , HYPRE_Int debug_flag , HYPRE_Real trunc_factor , HYPRE_Int max_elmts , HYPRE_Int *col_offd_S_to_A , hypre_ParCSRMatrix **P_ptr ); -HYPRE_Int hypre_BoomerAMGInterpTruncation ( hypre_ParCSRMatrix *P , HYPRE_Real trunc_factor , HYPRE_Int max_elmts ); -void hypre_qsort2abs ( HYPRE_Int *v , HYPRE_Real *w , HYPRE_Int left , HYPRE_Int right ); +HYPRE_Int hypre_BoomerAMGBuildDirInterpDevice( hypre_ParCSRMatrix *A, HYPRE_Int *CF_marker , hypre_ParCSRMatrix *S , HYPRE_BigInt *num_cpts_global , HYPRE_Int num_functions , HYPRE_Int *dof_func , HYPRE_Int debug_flag , HYPRE_Real trunc_factor , HYPRE_Int max_elmts , HYPRE_Int *col_offd_S_to_A , hypre_ParCSRMatrix **P_ptr ); + +HYPRE_Int hypre_BoomerAMGInterpTruncation ( hypre_ParCSRMatrix *P, HYPRE_Real trunc_factor, HYPRE_Int max_elmts ); +HYPRE_Int hypre_BoomerAMGInterpTruncationDevice( hypre_ParCSRMatrix *P, HYPRE_Real trunc_factor, HYPRE_Int max_elmts ); + HYPRE_Int hypre_BoomerAMGBuildInterpModUnk ( hypre_ParCSRMatrix *A , HYPRE_Int *CF_marker , hypre_ParCSRMatrix *S , HYPRE_BigInt *num_cpts_global , HYPRE_Int num_functions , HYPRE_Int *dof_func , HYPRE_Int debug_flag , HYPRE_Real trunc_factor , HYPRE_Int max_elmts , HYPRE_Int *col_offd_S_to_A , hypre_ParCSRMatrix **P_ptr ); HYPRE_Int hypre_BoomerAMGTruncandBuild ( hypre_ParCSRMatrix *P , HYPRE_Real trunc_factor , HYPRE_Int max_elmts ); hypre_ParCSRMatrix *hypre_CreateC ( hypre_ParCSRMatrix *A , HYPRE_Real w ); @@ -1502,9 +1541,9 @@ HYPRE_Int hypre_BoomerAMGCreateScalarCF ( HYPRE_Int *CFN_marker , HYPRE_Int num_functions , HYPRE_Int num_nodes , HYPRE_Int **dof_func_ptr , HYPRE_Int **CF_marker_ptr ); /* par_nongalerkin.c */ -HYPRE_Int hypre_GrabSubArray ( HYPRE_Int *indices , HYPRE_Int start , HYPRE_Int end , HYPRE_BigInt *array , HYPRE_Int *output ); -void hypre_qsort2_abs ( HYPRE_Int *v , HYPRE_Real *w , HYPRE_Int left , HYPRE_Int right ); +HYPRE_Int hypre_GrabSubArray ( HYPRE_Int *indices , HYPRE_Int start , HYPRE_Int end , HYPRE_BigInt *array , HYPRE_BigInt *output ); HYPRE_Int hypre_IntersectTwoArrays ( HYPRE_Int *x , HYPRE_Real *x_data , HYPRE_Int x_length , HYPRE_Int *y , HYPRE_Int y_length , HYPRE_Int *z , HYPRE_Real *output_x_data , HYPRE_Int *intersect_length ); +HYPRE_Int hypre_IntersectTwoBigArrays ( HYPRE_BigInt *x , HYPRE_Real *x_data , HYPRE_Int x_length , HYPRE_BigInt *y , HYPRE_Int y_length , HYPRE_BigInt *z , HYPRE_Real *output_x_data , HYPRE_Int *intersect_length ); HYPRE_Int hypre_SortedCopyParCSRData ( hypre_ParCSRMatrix *A , hypre_ParCSRMatrix *B ); HYPRE_Int hypre_BoomerAMG_MyCreateS ( hypre_ParCSRMatrix *A , HYPRE_Real strength_threshold , HYPRE_Real max_row_sum , HYPRE_Int num_functions , HYPRE_Int *dof_func , hypre_ParCSRMatrix **S_ptr ); HYPRE_Int hypre_BoomerAMGCreateSFromCFMarker(hypre_ParCSRMatrix *A, HYPRE_Real strength_threshold, HYPRE_Real max_row_sum, HYPRE_Int *CF_marker, HYPRE_Int SMRK, hypre_ParCSRMatrix **S_ptr); @@ -1519,7 +1558,6 @@ HYPRE_Int hypre_BoomerAMGBuildNonGalerkinCoarseOperator( hypre_ParCSRMatrix **RAP_ptr, hypre_ParCSRMatrix *AP, HYPRE_Real strong_threshold, HYPRE_Real max_row_sum, HYPRE_Int num_functions, HYPRE_Int * dof_func_value, HYPRE_Real S_commpkg_switch, HYPRE_Int * CF_marker, HYPRE_Real droptol, HYPRE_Int sym_collapse, HYPRE_Real lump_percent, HYPRE_Int collapse_beta ); /* par_rap.c */ -hypre_CSRMatrix *hypre_ExchangeRAPData ( hypre_CSRMatrix *RAP_int , hypre_ParCSRCommPkg *comm_pkg_RT ); HYPRE_Int hypre_BoomerAMGBuildCoarseOperator ( hypre_ParCSRMatrix *RT , hypre_ParCSRMatrix *A , hypre_ParCSRMatrix *P , hypre_ParCSRMatrix **RAP_ptr ); HYPRE_Int hypre_BoomerAMGBuildCoarseOperatorKT ( hypre_ParCSRMatrix *RT , hypre_ParCSRMatrix *A , hypre_ParCSRMatrix *P , HYPRE_Int keepTranspose, hypre_ParCSRMatrix **RAP_ptr ); @@ -1579,6 +1617,7 @@ HYPRE_Int hypre_BoomerAMGCreate2ndS ( hypre_ParCSRMatrix *S , HYPRE_Int *CF_marker , HYPRE_Int num_paths , HYPRE_BigInt *coarse_row_starts , hypre_ParCSRMatrix **C_ptr ); HYPRE_Int hypre_BoomerAMGCorrectCFMarker ( HYPRE_Int *CF_marker , HYPRE_Int num_var , HYPRE_Int *new_CF_marker ); HYPRE_Int hypre_BoomerAMGCorrectCFMarker2 ( HYPRE_Int *CF_marker , HYPRE_Int num_var , HYPRE_Int *new_CF_marker ); +HYPRE_Int hypre_BoomerAMGCreateSDevice(hypre_ParCSRMatrix *A, HYPRE_Real strength_threshold, HYPRE_Real max_row_sum, HYPRE_Int num_functions, HYPRE_Int *dof_func, hypre_ParCSRMatrix **S_ptr); /* par_sv_interp.c */ HYPRE_Int hypre_BoomerAMGSmoothInterpVectors ( hypre_ParCSRMatrix *A , HYPRE_Int num_smooth_vecs , hypre_ParVector **smooth_vecs , HYPRE_Int smooth_steps ); @@ -1668,11 +1707,13 @@ HYPRE_Int hypre_ParGenerateScale ( hypre_ParCSRMatrix *A , hypre_CSRMatrix *domain_structure , HYPRE_Real relaxation_weight , HYPRE_Real **scale_pointer ); HYPRE_Int hypre_ParGenerateHybridScale ( hypre_ParCSRMatrix *A , hypre_CSRMatrix *domain_structure , hypre_CSRMatrix **A_boundary_pointer , HYPRE_Real **scale_pointer ); /* RL */ -HYPRE_Int hypre_BoomerAMGBuildRestrAIR( hypre_ParCSRMatrix *A, HYPRE_Int *CF_marker, hypre_ParCSRMatrix *S, HYPRE_BigInt *num_cpts_global, HYPRE_Int num_functions, HYPRE_Int *dof_func, HYPRE_Int debug_flag, HYPRE_Real trunc_factor, HYPRE_Int max_elmts, HYPRE_Int *col_offd_S_to_A, hypre_ParCSRMatrix **R_ptr); +HYPRE_Int hypre_BoomerAMGBuildRestrAIR( hypre_ParCSRMatrix *A, HYPRE_Int *CF_marker, hypre_ParCSRMatrix *S, HYPRE_BigInt *num_cpts_global, HYPRE_Int num_functions, HYPRE_Int *dof_func, HYPRE_Real filter_thresholdR, HYPRE_Int debug_flag, HYPRE_Int *col_offd_S_to_A, hypre_ParCSRMatrix **R_ptr, HYPRE_Int is_triangular, HYPRE_Int gmres_switch); -HYPRE_Int hypre_BoomerAMGBuildRestrDist2AIR( hypre_ParCSRMatrix *A, HYPRE_Int *CF_marker, hypre_ParCSRMatrix *S, HYPRE_BigInt *num_cpts_global, HYPRE_Int num_functions, HYPRE_Int *dof_func, HYPRE_Int debug_flag, HYPRE_Real trunc_factor, HYPRE_Int max_elmts, HYPRE_Int *col_offd_S_to_A, hypre_ParCSRMatrix **R_ptr); +HYPRE_Int hypre_BoomerAMGBuildRestrDist2AIR( hypre_ParCSRMatrix *A, HYPRE_Int *CF_marker, hypre_ParCSRMatrix *S, HYPRE_BigInt *num_cpts_global, HYPRE_Int num_functions, HYPRE_Int *dof_func, HYPRE_Real filter_thresholdR, HYPRE_Int debug_flag, HYPRE_Int *col_offd_S_to_A, hypre_ParCSRMatrix **R_ptr, HYPRE_Int AIR1_5, HYPRE_Int is_triangular, HYPRE_Int gmres_switch); -#ifdef HAVE_DSUPERLU +HYPRE_Int hypre_BoomerAMGBuildRestrNeumannAIR( hypre_ParCSRMatrix *A, HYPRE_Int *CF_marker, HYPRE_BigInt *num_cpts_global, HYPRE_Int num_functions, HYPRE_Int *dof_func, HYPRE_Int NeumannDeg, HYPRE_Real strong_thresholdR, HYPRE_Real filter_thresholdR, HYPRE_Int debug_flag, HYPRE_Int *col_offd_S_to_A, hypre_ParCSRMatrix **R_ptr); + +#ifdef HYPRE_USING_DSUPERLU /* superlu.c */ HYPRE_Int hypre_SLUDistSetup( HYPRE_Solver *solver, hypre_ParCSRMatrix *A, HYPRE_Int print_level); HYPRE_Int hypre_SLUDistSolve( void* solver, hypre_ParVector *b, hypre_ParVector *x); @@ -1707,12 +1748,12 @@ 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_ParVector *Vtemp,hypre_ParVector *Ztemp); -HYPRE_Int hypre_MGRBuildAff( MPI_Comm comm, HYPRE_Int local_num_variables, HYPRE_Int num_functions, +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_MGRWriteSolverParams(void *mgr_vdata); -HYPRE_Int hypre_MGRSetAffSolverType( void *systg_vdata, HYPRE_Int *aff_solver_type ); +HYPRE_Int hypre_MGRWriteSolverParams(void *mgr_vdata); +HYPRE_Int hypre_MGRSetAffSolverType( void *systg_vdata, HYPRE_Int *aff_solver_type ); HYPRE_Int hypre_MGRSetCoarseSolverType( void *systg_vdata, HYPRE_Int coarse_solver_type ); HYPRE_Int hypre_MGRSetCoarseSolverIter( void *systg_vdata, HYPRE_Int coarse_solver_iter ); HYPRE_Int hypre_MGRSetFineSolverIter( void *systg_vdata, HYPRE_Int fine_solver_iter ); @@ -1734,7 +1775,7 @@ HYPRE_Int hypre_MGRGetNumIterations( void *mgr_vdata, HYPRE_Int *num_iterations ); HYPRE_Int hypre_MGRGetFinalRelativeResidualNorm( void *mgr_vdata, HYPRE_Real *res_norm ); - + #ifdef __cplusplus } #endif diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_ls.h hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_ls.h --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_ls.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_ls.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef HYPRE_PARCSR_LS_HEADER #define HYPRE_PARCSR_LS_HEADER @@ -74,7 +68,7 @@ /** * @name ParCSR BoomerAMG Solver and Preconditioner - * + * * Parallel unstructured algebraic multigrid solver and preconditioner **/ /*@{*/ @@ -90,7 +84,7 @@ HYPRE_Int HYPRE_BoomerAMGDestroy(HYPRE_Solver solver); /** - * Set up the BoomerAMG solver or preconditioner. + * Set up the BoomerAMG solver or preconditioner. * If used as a preconditioner, this function should be passed * to the iterative solver {\tt SetPrecond} function. * @@ -129,7 +123,7 @@ * to the iterative solver {\tt SetPrecond} function. * * @param solver [IN] solver or preconditioner object to be applied. - * @param A [IN] ParCSR matrix + * @param A [IN] ParCSR matrix * @param b [IN] right hand side of the linear system to be solved * @param x [OUT] approximated solution of the linear system to be solved **/ @@ -139,7 +133,7 @@ HYPRE_ParVector x); /** - * Recovers old default for coarsening and interpolation, i.e Falgout + * Recovers old default for coarsening and interpolation, i.e Falgout * coarsening and untruncated modified classical interpolation. * This option might be preferred for 2 dimensional problems. **/ @@ -171,7 +165,7 @@ HYPRE_Int num_functions); /** - * (Optional) Sets the mapping that assigns the function to each variable, + * (Optional) Sets the mapping that assigns the function to each variable, * if using the systems version. If no assignment is made and the number of * functions is k > 1, the mapping generated is (0,1,...,k-1,0,1,...,k-1,...). **/ @@ -233,13 +227,22 @@ * (Optional) Sets AMG strength threshold. The default is 0.25. * For 2d Laplace operators, 0.25 is a good value, for 3d Laplace * operators, 0.5 or 0.6 is a better value. For elasticity problems, - * a large strength threshold, such as 0.9, is often better. + * a large strength threshold, such as 0.9, is often better. The + * strong threshold for R is strong connections used in building an + * approximate ideal restriction, and the filter threshold for R a + * threshold to eliminate small entries from R after building it. **/ HYPRE_Int HYPRE_BoomerAMGSetStrongThreshold(HYPRE_Solver solver, HYPRE_Real strong_threshold); +HYPRE_Int HYPRE_BoomerAMGSetStrongThresholdR(HYPRE_Solver solver, + HYPRE_Real strong_threshold); + +HYPRE_Int HYPRE_BoomerAMGSetFilterThresholdR(HYPRE_Solver solver, + HYPRE_Real filter_threshold); + /** - * (Optional) Defines the largest strength threshold for which + * (Optional) Defines the largest strength threshold for which * the strength matrix S uses the communication package of the operator A. * If the strength threshold is larger than this values, * a communication package is generated for S. This can save @@ -261,8 +264,8 @@ /** * (Optional) Defines which parallel coarsening algorithm is used. - * There are the following options for coarsen\_type: - * + * There are the following options for coarsen\_type: + * * \begin{tabular}{|c|l|} \hline * 0 & CLJP-coarsening (a parallel coarsening algorithm using independent sets. \\ * 1 & classical Ruge-Stueben coarsening on each processor, no boundary treatment (not recommended!) \\ @@ -281,17 +284,17 @@ * 22 & CGC-E coarsening by M. Griebel, B. Metsch and A.Schweitzer \\ * \hline * \end{tabular} - * - * The default is 10. + * + * The default is 10. **/ HYPRE_Int HYPRE_BoomerAMGSetCoarsenType(HYPRE_Solver solver, HYPRE_Int coarsen_type); /** * (Optional) Defines the non-Galerkin drop-tolerance - * for sparsifying coarse grid operators and thus reducing communication. + * for sparsifying coarse grid operators and thus reducing communication. * Value specified here is set on all levels. - * This routine should be used before HYPRE_BoomerAMGSetLevelNonGalerkinTol, which + * This routine should be used before HYPRE_BoomerAMGSetLevelNonGalerkinTol, which * then can be used to change individual levels if desired **/ HYPRE_Int HYPRE_BoomerAMGSetNonGalerkinTol (HYPRE_Solver solver, @@ -299,22 +302,22 @@ /** * (Optional) Defines the level specific non-Galerkin drop-tolerances - * for sparsifying coarse grid operators and thus reducing communication. - * A drop-tolerance of 0.0 means to skip doing non-Galerkin on that - * level. The maximum drop tolerance for a level is 1.0, although + * for sparsifying coarse grid operators and thus reducing communication. + * A drop-tolerance of 0.0 means to skip doing non-Galerkin on that + * level. The maximum drop tolerance for a level is 1.0, although * much smaller values such as 0.03 or 0.01 are recommended. * * Note that if the user wants to set a specific tolerance on all levels, * HYPRE_BooemrAMGSetNonGalerkinTol should be used. Individual levels * can then be changed using this routine. * - * In general, it is safer to drop more aggressively on coarser levels. + * In general, it is safer to drop more aggressively on coarser levels. * For instance, one could use 0.0 on the finest level, 0.01 on the second level and * then using 0.05 on all remaining levels. The best way to achieve this is * to set 0.05 on all levels with HYPRE_BoomerAMGSetNonGalerkinTol and then * change the tolerance on level 0 to 0.0 and the tolerance on level 1 to 0.01 * with HYPRE_BoomerAMGSetLevelNonGalerkinTol. - * Like many AMG parameters, these drop tolerances can be tuned. It is also common + * Like many AMG parameters, these drop tolerances can be tuned. It is also common * to delay the start of the non-Galerkin process further to a later level than * level 1. * @@ -347,7 +350,7 @@ /** * (Optional) Defines the degree of aggressive coarsening. - * The default is 1. Larger numbers lead to less aggressive + * The default is 1. Larger numbers lead to less aggressive * coarsening. **/ HYPRE_Int HYPRE_BoomerAMGSetNumPaths(HYPRE_Solver solver, @@ -362,7 +365,7 @@ /** * (Optional) Sets whether to use the nodal systems coarsening. * Should be used for linear systems generated from systems of PDEs. - * The default is 0 (unknown-based coarsening, + * The default is 0 (unknown-based coarsening, * only coarsens within same function). * For the remaining options a nodal matrix is generated by * applying a norm to the nodal blocks and applying the coarsening @@ -379,7 +382,7 @@ HYPRE_Int HYPRE_BoomerAMGSetNodal(HYPRE_Solver solver, HYPRE_Int nodal); /** - * (Optional) Sets whether to give special treatment to diagonal elements in + * (Optional) Sets whether to give special treatment to diagonal elements in * the nodal systems version. * The default is 0. * If set to 1, the diagonal entry is set to the negative sum of all off @@ -392,8 +395,8 @@ /** * (Optional) Defines which parallel interpolation operator is used. - * There are the following options for interp\_type: - * + * There are the following options for interp\_type: + * * \begin{tabular}{|c|l|} \hline * 0 & classical modified interpolation \\ * 1 & LS interpolation (for use with GSMG) \\ @@ -413,7 +416,7 @@ * 14 & extended interpolation \\ * \hline * \end{tabular} - * + * * The default is ext+i interpolation (interp_type 6) trunctated to at most 4 \\ * elements per row. (see HYPRE_BoomerAMGSetPMaxElmts). **/ @@ -446,7 +449,7 @@ * (Optional) Defines the interpolation used on levels of aggressive coarsening * The default is 4, i.e. multipass interpolation. * The following options exist: - * + * * \begin{tabular}{|c|l|} \hline * 1 & 2-stage extended+i interpolation \\ * 2 & 2-stage standard interpolation \\ @@ -459,7 +462,7 @@ HYPRE_Int agg_interp_type); /** - * (Optional) Defines the truncation factor for the + * (Optional) Defines the truncation factor for the * interpolation used for aggressive coarsening. * The default is 0. **/ @@ -467,7 +470,7 @@ HYPRE_Real agg_trunc_factor); /** - * (Optional) Defines the truncation factor for the + * (Optional) Defines the truncation factor for the * matrices P1 and P2 which are used to build 2-stage interpolation. * The default is 0. **/ @@ -475,7 +478,7 @@ HYPRE_Real agg_P12_trunc_factor); /** - * (Optional) Defines the maximal number of elements per row for the + * (Optional) Defines the maximal number of elements per row for the * interpolation used for aggressive coarsening. * The default is 0. **/ @@ -483,7 +486,7 @@ HYPRE_Int agg_P_max_elmts); /** - * (Optional) Defines the maximal number of elements per row for the + * (Optional) Defines the maximal number of elements per row for the * matrices P1 and P2 which are used to build 2-stage interpolation. * The default is 0. **/ @@ -491,18 +494,18 @@ HYPRE_Int agg_P12_max_elmts); /** - * (Optional) Allows the user to incorporate additional vectors - * into the interpolation for systems AMG, e.g. rigid body modes for + * (Optional) Allows the user to incorporate additional vectors + * into the interpolation for systems AMG, e.g. rigid body modes for * linear elasticity problems. * This can only be used in context with nodal coarsening and still - * requires the user to choose an interpolation. + * requires the user to choose an interpolation. **/ -HYPRE_Int HYPRE_BoomerAMGSetInterpVectors (HYPRE_Solver solver , +HYPRE_Int HYPRE_BoomerAMGSetInterpVectors (HYPRE_Solver solver , HYPRE_Int num_vectors , HYPRE_ParVector *interp_vectors ); /** - * (Optional) Defines the interpolation variant used for + * (Optional) Defines the interpolation variant used for * HYPRE_BoomerAMGSetInterpVectors: * \begin{tabular}{|c|l|} \hline * 1 & GM approach 1 \\ @@ -511,7 +514,7 @@ * \hline * \end{tabular} **/ -HYPRE_Int HYPRE_BoomerAMGSetInterpVecVariant (HYPRE_Solver solver, +HYPRE_Int HYPRE_BoomerAMGSetInterpVecVariant (HYPRE_Solver solver, HYPRE_Int var ); /** @@ -519,7 +522,7 @@ * columns added to the original interpolation matrix P, to reduce complexity. * The default is no truncation. **/ -HYPRE_Int HYPRE_BoomerAMGSetInterpVecQMax (HYPRE_Solver solver, +HYPRE_Int HYPRE_BoomerAMGSetInterpVecQMax (HYPRE_Solver solver, HYPRE_Int q_max ); /** @@ -527,11 +530,11 @@ * columns added to the original interpolation matrix P, to reduce complexity. * The default is no truncation. **/ -HYPRE_Int HYPRE_BoomerAMGSetInterpVecAbsQTrunc (HYPRE_Solver solver, +HYPRE_Int HYPRE_BoomerAMGSetInterpVecAbsQTrunc (HYPRE_Solver solver, HYPRE_Real q_trunc ); /** - * (Optional) Specifies the use of GSMG - geometrically smooth + * (Optional) Specifies the use of GSMG - geometrically smooth * coarsening and interpolation. Currently any nonzero value for * gsmg will lead to the use of GSMG. * The default is 0, i.e. (GSMG is not used) @@ -552,6 +555,13 @@ **/ HYPRE_Int HYPRE_BoomerAMGSetCycleType(HYPRE_Solver solver, HYPRE_Int cycle_type); +/** + * (Optional) Specifies the use of Full multigrid cycle. + * The default is 0. + **/ +HYPRE_Int +HYPRE_BoomerAMGSetFCycle( HYPRE_Solver solver, + HYPRE_Int fcycle ); /** * (Optional) Defines use of an additive V(1,1)-cycle using the @@ -559,7 +569,7 @@ * The multiplicative approach is used on levels 0, ...'addlvl+1'. * 'addlvl' needs to be > -1 for this to have an effect. * Can only be used with weighted Jacobi and l1-Jacobi(default). - * + * * Can only be used when AMG is used as a preconditioner !!! **/ HYPRE_Int HYPRE_BoomerAMGSetAdditive(HYPRE_Solver solver, @@ -571,7 +581,7 @@ * The multiplicative approach is used on levels 0, ...'addlvl+1'. * 'addlvl' needs to be > -1 for this to have an effect. * Can only be used with weighted Jacobi and l1-Jacobi(default). - * + * * Can only be used when AMG is used as a preconditioner !!! **/ HYPRE_Int HYPRE_BoomerAMGSetMultAdditive(HYPRE_Solver solver, @@ -583,7 +593,7 @@ * The multiplicative approach is used on levels 0, ...'addlvl+1'. * 'addlvl' needs to be > -1 for this to have an effect. * Can only be used with weighted Jacobi and l1-Jacobi(default). - * + * * Can only be used when AMG is used as a preconditioner !!! **/ HYPRE_Int HYPRE_BoomerAMGSetSimple(HYPRE_Solver solver, @@ -593,14 +603,14 @@ * (Optional) Defines last level where additive, mult-additive * or simple cycle is used. * The multiplicative approach is used on levels > add_last_lvl. - * + * * Can only be used when AMG is used as a preconditioner !!! **/ HYPRE_Int HYPRE_BoomerAMGSetAddLastLvl(HYPRE_Solver solver, HYPRE_Int add_last_lvl); /** - * (Optional) Defines the truncation factor for the + * (Optional) Defines the truncation factor for the * smoothed interpolation used for mult-additive or simple method. * The default is 0. **/ @@ -608,7 +618,7 @@ HYPRE_Real add_trunc_factor); /** - * (Optional) Defines the maximal number of elements per row for the + * (Optional) Defines the maximal number of elements per row for the * smoothed interpolation used for mult-additive or simple method. * The default is 0. **/ @@ -616,26 +626,26 @@ HYPRE_Int add_P_max_elmts); /** * (Optional) Defines the relaxation type used in the (mult)additive cycle - * portion (also affects simple method.) + * portion (also affects simple method.) * The default is 18 (L1-Jacobi). - * Currently the only other option allowed is 0 (Jacobi) which should be + * Currently the only other option allowed is 0 (Jacobi) which should be * used in combination with HYPRE_BoomerAMGSetAddRelaxWt. **/ HYPRE_Int HYPRE_BoomerAMGSetAddRelaxType(HYPRE_Solver solver, HYPRE_Int add_rlx_type); /** - * (Optional) Defines the relaxation weight used for Jacobi within the + * (Optional) Defines the relaxation weight used for Jacobi within the * (mult)additive or simple cycle portion. - * The default is 1. + * The default is 1. * The weight only affects the Jacobi method, and has no effect on L1-Jacobi **/ HYPRE_Int HYPRE_BoomerAMGSetAddRelaxWt(HYPRE_Solver solver, HYPRE_Real add_rlx_wt); /** - * (Optional) Sets maximal size for agglomeration or redundant coarse grid solve. - * When the system is smaller than this threshold, sequential AMG is used + * (Optional) Sets maximal size for agglomeration or redundant coarse grid solve. + * When the system is smaller than this threshold, sequential AMG is used * on process 0 or on all remaining active processes (if redundant = 1 ). **/ HYPRE_Int HYPRE_BoomerAMGSetSeqThreshold(HYPRE_Solver solver, @@ -648,7 +658,7 @@ HYPRE_Int redundant); /* - * (Optional) Defines the number of sweeps for the fine and coarse grid, + * (Optional) Defines the number of sweeps for the fine and coarse grid, * the up and down cycle. * * Note: This routine will be phased out!!!! @@ -658,8 +668,8 @@ HYPRE_Int *num_grid_sweeps); /** - * (Optional) Sets the number of sweeps. On the finest level, the up and - * the down cycle the number of sweeps are set to num\_sweeps and on the + * (Optional) Sets the number of sweeps. On the finest level, the up and + * the down cycle the number of sweeps are set to num\_sweeps and on the * coarsest level to 1. The default is 1. **/ HYPRE_Int HYPRE_BoomerAMGSetNumSweeps(HYPRE_Solver solver, @@ -681,7 +691,7 @@ HYPRE_Int k); /** - * (Optional) Defines which smoother is used on the fine and coarse grid, + * (Optional) Defines which smoother is used on the fine and coarse grid, * the up and down cycle. * * Note: This routine will be phased out!!!! @@ -692,7 +702,7 @@ /** * (Optional) Defines the smoother to be used. It uses the given - * smoother on the fine grid, the up and + * smoother on the fine grid, the up and * the down cycle and sets the solver on the coarsest level to Gaussian * elimination (9). The default is $\ell_1$-Gauss-Seidel, forward solve (13) * on the down cycle and backward solve (14) on the up cycle. @@ -740,7 +750,7 @@ /** * (Optional) Defines in which order the points are relaxed. There are * the following options for - * relax\_order: + * relax\_order: * * \begin{tabular}{|c|l|} \hline * 0 & the points are relaxed in natural or lexicographic @@ -749,18 +759,18 @@ * cycle the coarse points are relaxed first, \\ * & followed by the fine points; on the up cycle the F-points are relaxed * first, followed by the C-points. \\ - * & On the coarsest level, if an iterative scheme is used, + * & On the coarsest level, if an iterative scheme is used, * the points are relaxed in lexicographic order. \\ * \hline * \end{tabular} * - * The default is 0. + * The default is 0. **/ HYPRE_Int HYPRE_BoomerAMGSetRelaxOrder(HYPRE_Solver solver, HYPRE_Int relax_order); /* - * (Optional) Defines in which order the points are relaxed. + * (Optional) Defines in which order the points are relaxed. * * Note: This routine will be phased out!!!! * Use HYPRE\_BoomerAMGSetRelaxOrder instead. @@ -775,11 +785,11 @@ * Use HYPRE\_BoomerAMGSetRelaxWt or HYPRE\_BoomerAMGSetLevelRelaxWt instead. **/ HYPRE_Int HYPRE_BoomerAMGSetRelaxWeight(HYPRE_Solver solver, - HYPRE_Real *relax_weight); + HYPRE_Real *relax_weight); /** - * (Optional) Defines the relaxation weight for smoothed Jacobi and hybrid SOR - * on all levels. - * + * (Optional) Defines the relaxation weight for smoothed Jacobi and hybrid SOR + * on all levels. + * * \begin{tabular}{|l|l|} \hline * relax\_weight > 0 & this assigns the given relaxation weight on all levels \\ * relax\_weight = 0 & the weight is determined on each level @@ -789,8 +799,8 @@ * on each level \\ * & this should only be used for symmetric positive definite problems) \\ * \hline - * \end{tabular} - * + * \end{tabular} + * * The default is 1. **/ HYPRE_Int HYPRE_BoomerAMGSetRelaxWt(HYPRE_Solver solver, @@ -800,7 +810,7 @@ * (Optional) Defines the relaxation weight for smoothed Jacobi and hybrid SOR * on the user defined level. Note that the finest level is denoted 0, the * next coarser level 1, etc. For nonpositive relax\_weight, the parameter is - * determined on the given level as described for HYPRE\_BoomerAMGSetRelaxWt. + * determined on the given level as described for HYPRE\_BoomerAMGSetRelaxWt. * The default is 1. **/ HYPRE_Int HYPRE_BoomerAMGSetLevelRelaxWt(HYPRE_Solver solver, @@ -818,16 +828,16 @@ /** * (Optional) Defines the outer relaxation weight for hybrid SOR and SSOR * on all levels. - * - * \begin{tabular}{|l|l|} \hline + * + * \begin{tabular}{|l|l|} \hline * omega > 0 & this assigns the same outer relaxation weight omega on each level\\ * omega = -k & an outer relaxation weight is determined with at most k CG * steps on each level \\ * & (this only makes sense for symmetric * positive definite problems and smoothers, e.g. SSOR) \\ * \hline - * \end{tabular} - * + * \end{tabular} + * * The default is 1. **/ HYPRE_Int HYPRE_BoomerAMGSetOuterWt(HYPRE_Solver solver, @@ -837,7 +847,7 @@ * (Optional) Defines the outer relaxation weight for hybrid SOR or SSOR * on the user defined level. Note that the finest level is denoted 0, the * next coarser level 1, etc. For nonpositive omega, the parameter is - * determined on the given level as described for HYPRE\_BoomerAMGSetOuterWt. + * determined on the given level as described for HYPRE\_BoomerAMGSetOuterWt. * The default is 1. **/ HYPRE_Int HYPRE_BoomerAMGSetLevelOuterWt(HYPRE_Solver solver, @@ -874,7 +884,7 @@ /* * (Optional) Defines how to estimate eigenvalues. - * The default is 10 (i.e., 10 CG iterations are used to find extreme + * The default is 10 (i.e., 10 CG iterations are used to find extreme * eigenvalues.) If eig_est=0, the largest eigenvalue is estimated * using Gershgorin, the smallest is set to 0. * If eig_est is a positive number n, n iterations of CG are used to @@ -907,9 +917,9 @@ /** * (Optional) Sets the number of levels for more complex smoothers. - * The smoothers, + * The smoothers, * as defined by HYPRE\_BoomerAMGSetSmoothType, will be used - * on level 0 (the finest level) through level smooth\_num\_levels-1. + * on level 0 (the finest level) through level smooth\_num\_levels-1. * The default is 0, i.e. no complex smoothers are used. **/ HYPRE_Int HYPRE_BoomerAMGSetSmoothNumLevels(HYPRE_Solver solver, @@ -925,14 +935,14 @@ /** * (Optional) Defines which variant of the Schwarz method is used. * The following options exist for variant: - * + * * \begin{tabular}{|c|l|} \hline - * 0 & hybrid multiplicative Schwarz method (no overlap across processor + * 0 & hybrid multiplicative Schwarz method (no overlap across processor * boundaries) \\ - * 1 & hybrid additive Schwarz method (no overlap across processor + * 1 & hybrid additive Schwarz method (no overlap across processor * boundaries) \\ * 2 & additive Schwarz method \\ - * 3 & hybrid multiplicative Schwarz method (with overlap across processor + * 3 & hybrid multiplicative Schwarz method (with overlap across processor * boundaries) \\ * \hline * \end{tabular} @@ -990,7 +1000,7 @@ HYPRE_Int use_nonsymm); /** - * (Optional) Defines symmetry for ParaSAILS. + * (Optional) Defines symmetry for ParaSAILS. * For further explanation see description of ParaSAILS. **/ HYPRE_Int HYPRE_BoomerAMGSetSym(HYPRE_Solver solver, @@ -1036,7 +1046,7 @@ * For further explanation see description of Euclid. **/ HYPRE_Int HYPRE_BoomerAMGSetEuclidFile(HYPRE_Solver solver, - char *euclidfile); + char *euclidfile); /** * (Optional) Defines number of levels for ILU(k) in Euclid. @@ -1061,8 +1071,8 @@ /** * (Optional) Defines which parallel restriction operator is used. - * There are the following options for restr\_type: - * + * There are the following options for restr\_type: + * * \begin{tabular}{|c|l|} \hline * 0 & $P^T$ - Transpose of the interpolation operator \\ * 1 & AIR-1 - Approximate Ideal Restriction (distance 1) \\ @@ -1076,14 +1086,37 @@ HYPRE_Int restr_par); /** - * (Optional) Defines the drop tolerance for the A-matrices + * (Optional) Assumes the matrix is triangular in some ordering + * to speed up the setup time of approximate ideal restriction. + * + * The default is 0. + **/ +HYPRE_Int HYPRE_BoomerAMGSetIsTriangular(HYPRE_Solver solver, + HYPRE_Int is_triangular); + +/** + * (Optional) Set local problem size at which GMRES is used over + * a direct solve in approximating ideal restriction. + * The default is 0. + **/ +HYPRE_Int HYPRE_BoomerAMGSetGMRESSwitchR(HYPRE_Solver solver, + HYPRE_Int gmres_switch); + +/** + * (Optional) Defines the drop tolerance for the A-matrices * from the 2nd level of AMG. * The default is 0. **/ HYPRE_Int -HYPRE_BoomerAMGSetADropTol( HYPRE_Solver solver, +HYPRE_BoomerAMGSetADropTol( HYPRE_Solver solver, HYPRE_Real A_drop_tol ); +/* drop the entries that are not on the diagonal and smaller than + * its row norm: type 1: 1-norm, 2: 2-norm, -1: infinity norm */ +HYPRE_Int +HYPRE_BoomerAMGSetADropType( HYPRE_Solver solver, + HYPRE_Int A_drop_type ); + /* * (Optional) Name of file to which BoomerAMG will print; * cf HYPRE\_BoomerAMGSetPrintLevel. (Presently this is ignored). @@ -1102,7 +1135,7 @@ * \hline * \end{tabular} * - * Note, that if one desires to print information and uses BoomerAMG as a + * Note, that if one desires to print information and uses BoomerAMG as a * preconditioner, suggested print$\_$level is 1 to avoid excessive output, * and use print$\_$level of solver for solve phase information. **/ @@ -1139,7 +1172,14 @@ * replaced by two matrix products. **/ HYPRE_Int HYPRE_BoomerAMGSetRAP2(HYPRE_Solver solver, - HYPRE_Int rap2); + HYPRE_Int rap2); + +/** + * (Optional) If mod_rap2 not equal 0, the triple matrix product RAP is + * replaced by two matrix products with modularized kernels + **/ +HYPRE_Int HYPRE_BoomerAMGSetModuleRAP2(HYPRE_Solver solver, + HYPRE_Int mod_rap2); /** * (Optional) If set to 1, the local interpolation transposes will @@ -1171,7 +1211,7 @@ **/ HYPRE_Int HYPRE_BoomerAMGSetCoordinates (HYPRE_Solver solver, float *coordinates); -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU /* * HYPRE_BoomerAMGSetDSLUThreshold **/ @@ -1191,6 +1231,12 @@ HYPRE_Int cpt_coarse_level, HYPRE_Int num_cpt_coarse, HYPRE_Int *cpt_coarse_index); +/* + * (Optional) if Sabs equals 1, the strength of connection test is based + * on the absolute value of the matrix coefficients + **/ +HYPRE_Int HYPRE_BoomerAMGSetSabs (HYPRE_Solver solver, + HYPRE_Int Sabs ); /*@}*/ @@ -1248,20 +1294,20 @@ * Set the threshold and levels parameter for the ParaSails * preconditioner. The accuracy and cost of ParaSails are * parameterized by these two parameters. Lower values of the - * threshold parameter and higher values of levels parameter + * threshold parameter and higher values of levels parameter * lead to more accurate, but more expensive preconditioners. * * @param solver [IN] Preconditioner object for which to set parameters. * @param thresh [IN] Value of threshold parameter, $0 \le$ thresh $\le 1$. * The default value is 0.1. - * @param nlevels [IN] Value of levels parameter, $0 \le$ nlevels. + * @param nlevels [IN] Value of levels parameter, $0 \le$ nlevels. * The default value is 1. **/ HYPRE_Int HYPRE_ParaSailsSetParams(HYPRE_Solver solver, HYPRE_Real thresh, HYPRE_Int nlevels); /** - * Set the filter parameter for the + * Set the filter parameter for the * ParaSails preconditioner. * * @param solver [IN] Preconditioner object for which to set filter parameter. @@ -1278,8 +1324,8 @@ * Set the symmetry parameter for the * ParaSails preconditioner. * - * \begin{tabular}{|c|l|} \hline - * value & meaning \\ \hline + * \begin{tabular}{|c|l|} \hline + * value & meaning \\ \hline * 0 & nonsymmetric and/or indefinite problem, and nonsymmetric preconditioner\\ * 1 & SPD problem, and SPD (factored) preconditioner \\ * 2 & nonsymmetric, definite problem, and SPD (factored) preconditioner \\ @@ -1298,14 +1344,14 @@ * * @param solver [IN] Preconditioner object for which to set the load balance * parameter. - * @param loadbal [IN] Value of the load balance parameter, + * @param loadbal [IN] Value of the load balance parameter, * $0 \le$ loadbal $\le 1$. A zero value indicates that * no load balance is attempted; a value of unity indicates - * that perfect load balance will be attempted. The + * that perfect load balance will be attempted. The * recommended value is 0.9 to balance the overhead of * data exchanges for load balancing. No load balancing * is needed if the preconditioner is very sparse and - * fast to construct. The default value when this + * fast to construct. The default value when this * parameter is not set is 0. **/ HYPRE_Int HYPRE_ParaSailsSetLoadbal(HYPRE_Solver solver, @@ -1315,12 +1361,12 @@ * Set the pattern reuse parameter for the * ParaSails preconditioner. * - * @param solver [IN] Preconditioner object for which to set the pattern reuse + * @param solver [IN] Preconditioner object for which to set the pattern reuse * parameter. * @param reuse [IN] Value of the pattern reuse parameter. A nonzero value * indicates that the pattern of the preconditioner should - * be reused for subsequent constructions of the - * preconditioner. A zero value indicates that the + * be reused for subsequent constructions of the + * preconditioner. A zero value indicates that the * preconditioner should be constructed from scratch. * The default value when this parameter is not set is 0. **/ @@ -1342,7 +1388,7 @@ /** * Build IJ Matrix of the sparse approximate inverse (factor). - * This function explicitly creates the IJ Matrix corresponding to + * This function explicitly creates the IJ Matrix corresponding to * the sparse approximate inverse or the inverse factor. * Example: HYPRE\_IJMatrix ij\_A; * HYPRE\_ParaSailsBuildIJMatrix(solver, \&ij\_A); @@ -1395,9 +1441,9 @@ *--------------------------------------------------------------------------*/ /** - * @name ParCSR Euclid Preconditioner + * @name ParCSR Euclid Preconditioner * - * MPI Parallel ILU preconditioner + * MPI Parallel ILU preconditioner * * Options summary: * \begin{center} @@ -1458,7 +1504,7 @@ * Insert (name, value) pairs in Euclid's options database * by passing Euclid the command line (or an array of strings). * All Euclid options (e.g, level, drop-tolerance) are stored in - * this database. + * this database. * If a (name, value) pair already exists, this call updates the value. * See also: HYPRE\_EuclidSetParamsFromFile. * @@ -1502,7 +1548,7 @@ HYPRE_Int bj); /** - * If eu\_stats not equal 0, a summary of runtime settings and + * If eu\_stats not equal 0, a summary of runtime settings and * timing information is printed to stdout. **/ HYPRE_Int HYPRE_EuclidSetStats(HYPRE_Solver solver, @@ -1517,7 +1563,7 @@ /** * Defines a drop tolerance for ILU(k). Default: 0 - * Use with HYPRE\_EuclidSetRowScale. + * Use with HYPRE\_EuclidSetRowScale. * Note that this can destroy symmetry in a matrix. **/ HYPRE_Int HYPRE_EuclidSetSparseA(HYPRE_Solver solver, @@ -1904,7 +1950,7 @@ **/ HYPRE_Int HYPRE_AMSConstructDiscreteGradient(HYPRE_ParCSRMatrix A, HYPRE_ParVector x_coord, - HYPRE_Int *edge_vertex, + HYPRE_BigInt *edge_vertex, HYPRE_Int edge_orientation, HYPRE_ParCSRMatrix *G); @@ -2172,7 +2218,7 @@ HYPRE_ParCSRMatrix A, HYPRE_ParVector b, HYPRE_ParVector x); - + HYPRE_Int HYPRE_ParCSRPCGSolve(HYPRE_Solver solver, HYPRE_ParCSRMatrix A, HYPRE_ParVector b, @@ -2240,6 +2286,18 @@ HYPRE_ParVector Hy, HYPRE_ParVector Hx); +/* Setup routine for on-processor triangular solve as preconditioning. */ +HYPRE_Int HYPRE_ParCSROnProcTriSetup(HYPRE_Solver solver, + HYPRE_ParCSRMatrix HA, + HYPRE_ParVector Hy, + HYPRE_ParVector Hx); + +/* Solve routine for on-processor triangular solve as preconditioning. */ +HYPRE_Int HYPRE_ParCSROnProcTriSolve(HYPRE_Solver solver, + HYPRE_ParCSRMatrix HA, + HYPRE_ParVector Hy, + HYPRE_ParVector Hx); + /*@}*/ /*-------------------------------------------------------------------------- @@ -2482,7 +2540,7 @@ HYPRE_Int HYPRE_ParCSRFlexGMRESSetModifyPC( HYPRE_Solver solver, HYPRE_PtrToModifyPCFcn modify_pc); - + /*@}*/ /*-------------------------------------------------------------------------- @@ -2723,6 +2781,36 @@ HYPRE_Int solver_type); /** + * (Optional) Set recompute residual (don't rely on 3-term recurrence). + **/ +HYPRE_Int +HYPRE_ParCSRHybridSetRecomputeResidual( HYPRE_Solver solver, + HYPRE_Int recompute_residual ); + +/** + * (Optional) Get recompute residual option. + **/ +HYPRE_Int +HYPRE_ParCSRHybridGetRecomputeResidual( HYPRE_Solver solver, + HYPRE_Int *recompute_residual ); + +/** + * (Optional) Set recompute residual period (don't rely on 3-term recurrence). + * + * Recomputes residual after every specified number of iterations. + **/ +HYPRE_Int +HYPRE_ParCSRHybridSetRecomputeResidualP( HYPRE_Solver solver, + HYPRE_Int recompute_residual_p ); + +/** + * (Optional) Get recompute residual period option. + **/ +HYPRE_Int +HYPRE_ParCSRHybridGetRecomputeResidualP( HYPRE_Solver solver, + HYPRE_Int *recompute_residual_p ); + +/** * Set the Krylov dimension for restarted GMRES. * The default is 5. **/ @@ -2755,7 +2843,7 @@ HYPRE_PtrToParSolverFcn precond, HYPRE_PtrToParSolverFcn precond_setup, HYPRE_Solver precond_solver); - + /** * Set logging parameter (default: 0, no logging). **/ @@ -2773,7 +2861,7 @@ /** * (Optional) Sets AMG strength threshold. The default is 0.25. - * For elasticity problems, a larger strength threshold, such as 0.7 or 0.8, + * For elasticity problems, a larger strength threshold, such as 0.7 or 0.8, * is often better. **/ HYPRE_Int @@ -3212,7 +3300,7 @@ HYPRE_Int HYPRE_SchwarzSetNonSymm(HYPRE_Solver solver, HYPRE_Int use_nonsymm); - + /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ @@ -3267,18 +3355,18 @@ /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ - + /** * @name ParCSR MGR Solver * - * Parallel multigrid reduction solver and preconditioner. - * This solver or preconditioner is designed with systems of - * PDEs in mind. However, it can also be used for scalar linear - * systems, particularly for problems where the user can exploit - * information from the physics of the problem. In this way, the - * MGR solver could potentially be used as a foundation - * for a physics-based preconditioner. - **/ + * Parallel multigrid reduction solver and preconditioner. + * This solver or preconditioner is designed with systems of + * PDEs in mind. However, it can also be used for scalar linear + * systems, particularly for problems where the user can exploit + * information from the physics of the problem. In this way, the + * MGR solver could potentially be used as a foundation + * for a physics-based preconditioner. + **/ /*@{*/ /** @@ -3300,12 +3388,12 @@ /** * Setup the MGR solver or preconditioner. * If used as a preconditioner, this function should be passed - * to the iterative solver {\tt SetPrecond} function. + * to the iterative solver {\tt SetPrecond} function. * * @param solver [IN] object to be set up. * @param A [IN] ParCSR matrix used to construct the solver/preconditioner. * @param b right-hand-side of the linear system to be solved (Ignored by this function). - * @param x approximate solution of the linear system to be solved (Ignored by this function). + * @param x approximate solution of the linear system to be solved (Ignored by this function). **/ HYPRE_Int HYPRE_MGRSetup( HYPRE_Solver solver, HYPRE_ParCSRMatrix A, @@ -3333,7 +3421,7 @@ * HYPRE_Int HYPRE_MGRSetCpointsByBlock *--------------------------------------------------------------------------*/ /** - * Set the block data and prescribe the coarse indexes per block + * Set the block data and prescribe the coarse indexes per block * for each reduction level. * * @param solver [IN] solver or preconditioner object @@ -3343,16 +3431,16 @@ * @param block_coarse_indexes [IN] index for each block coarse point per level **/ HYPRE_Int HYPRE_MGRSetCpointsByBlock( HYPRE_Solver solver, - HYPRE_Int block_size, + HYPRE_Int block_size, HYPRE_Int max_num_levels, - HYPRE_Int *num_block_coarse_points, + HYPRE_Int *num_block_coarse_points, HYPRE_Int **block_coarse_indexes); /** * (Optional) Set non C-points to F-points. * This routine determines how the coarse points are selected for the next level * reduction. Options for {\tt nonCptToFptFlag} are: - * + * * \begin{tabular}{|c|l|} \hline * 0 & Allow points not prescribed as C points to be potentially set as C points \\ * & using classical AMG coarsening strategies (currently uses CLJP-coarsening). \\ @@ -3360,7 +3448,7 @@ * \hline * \end{tabular} * - **/ + **/ HYPRE_Int HYPRE_MGRSetNonCpointsToFpoints( HYPRE_Solver solver, HYPRE_Int nonCptToFptFlag); @@ -3388,7 +3476,7 @@ *--------------------------------------------------------------------------*/ /** * (Optional) Defines indexes of coarse nodes to be kept to the coarsest level. - * These indexes are passed down through the MGR hierarchy to the coarsest grid + * These indexes are passed down through the MGR hierarchy to the coarsest grid * of the coarse grid (BoomerAMG) solver. * * @param solver [IN] solver or preconditioner object @@ -3397,14 +3485,14 @@ **/ HYPRE_Int HYPRE_MGRSetReservedCoarseNodes( HYPRE_Solver solver, HYPRE_Int reserved_coarse_size, HYPRE_Int *reserved_coarse_nodes ); - + /*-------------------------------------------------------------------------- * HYPRE_MGRSetRelaxType *--------------------------------------------------------------------------*/ /** * (Optional) Set the relaxation type for F-relaxation. * Currently supports the following flavors of relaxation types - * as described in the {\tt BoomerAMGSetRelaxType}: + * as described in the {\tt BoomerAMGSetRelaxType}: * relax\_types 0 - 8, 13, 14, 18, 19, 98. **/ HYPRE_Int @@ -3421,7 +3509,7 @@ * 0 & Single-level relaxation sweeps for F-relaxation as prescribed by {\tt MGRSetRelaxType} \\ * 1 & Multi-level relaxation strategy for F-relaxation (V(1,0) cycle currently supported). \\ * \hline - * \end{tabular} + * \end{tabular} **/ HYPRE_Int HYPRE_MGRSetFRelaxMethod(HYPRE_Solver solver, HYPRE_Int relax_method ); @@ -3429,8 +3517,8 @@ /*-------------------------------------------------------------------------- * HYPRE_MGRSetRestrictType *--------------------------------------------------------------------------*/ -/** - * (Optional) Set the strategy for computing the MGR restriction operator. +/** + * (Optional) Set the strategy for computing the MGR restriction operator. * * Options for {\tt restrict\_type} are: * @@ -3440,9 +3528,9 @@ * 2 & diagonal scaling (Jacobi) \\ * else & use classical modified interpolation \\ * \hline - * \end{tabular} + * \end{tabular} * - * These options are currently active for the last stage reduction. Intermediate + * These options are currently active for the last stage reduction. Intermediate * reduction levels use injection. The default is injection. **/ HYPRE_Int @@ -3456,13 +3544,13 @@ * This option is for restrict\_type > 2. **/ HYPRE_Int -HYPRE_MGRSetNumRestrictSweeps( HYPRE_Solver solver, HYPRE_Int nsweeps ); +HYPRE_MGRSetNumRestrictSweeps( HYPRE_Solver solver, HYPRE_Int nsweeps ); /*-------------------------------------------------------------------------- * HYPRE_MGRSetInterpType *--------------------------------------------------------------------------*/ -/** - * (Optional) Set the strategy for computing the MGR restriction operator. +/** + * (Optional) Set the strategy for computing the MGR restriction operator. * Options for {\tt interp\_type} are: * * \begin{tabular}{|c|l|} \hline @@ -3471,9 +3559,9 @@ * 2 & diagonal scaling (Jacobi) \\ * else & use default (classical modified interpolation) \\ * \hline - * \end{tabular} + * \end{tabular} * - * These options are currently active for the last stage reduction. Intermediate + * These options are currently active for the last stage reduction. Intermediate * reduction levels use diagonal scaling. **/ HYPRE_Int @@ -3485,7 +3573,7 @@ /** * (Optional) Set number of relaxation sweeps. * This option is for the `single level' F-relaxation (relax\_method = 0). - **/ + **/ HYPRE_Int HYPRE_MGRSetNumRelaxSweeps( HYPRE_Solver solver, HYPRE_Int nsweeps ); @@ -3497,7 +3585,7 @@ * This option is for interp\_type > 2. **/ HYPRE_Int -HYPRE_MGRSetNumInterpSweeps( HYPRE_Solver solver, HYPRE_Int nsweeps ); +HYPRE_MGRSetNumInterpSweeps( HYPRE_Solver solver, HYPRE_Int nsweeps ); /*-------------------------------------------------------------------------- * HYPRE_MGRSetCoarseSolver @@ -3510,7 +3598,7 @@ * @param solver [IN] solver or preconditioner object * @param coarse_grid_solver_solve [IN] solve routine for BoomerAMG * @param coarse_grid_solver_setup [IN] setup routine for BoomerAMG - * @param coarse_grid_solver [IN] BoomerAMG solver + * @param coarse_grid_solver [IN] BoomerAMG solver **/ HYPRE_Int HYPRE_MGRSetCoarseSolver(HYPRE_Solver solver, HYPRE_PtrToParSolverFcn coarse_grid_solver_solve, @@ -3529,7 +3617,7 @@ * 2 & print solve information \\ * 3 & print both setup and solve information \\ * \hline - * \end{tabular} + * \end{tabular} **/ HYPRE_Int HYPRE_MGRSetPrintLevel( HYPRE_Solver solver, HYPRE_Int print_level ); @@ -3561,7 +3649,7 @@ *--------------------------------------------------------------------------*/ /** * (Optional) Set the convergence tolerance for the MGR solver. - * Use tol = 0.0 if MGR is used as a preconditioner. The default is 1.e-7. + * Use tol = 0.0 if MGR is used as a preconditioner. The default is 1.e-7. **/ HYPRE_Int HYPRE_MGRSetTol( HYPRE_Solver solver, HYPRE_Real tol ); @@ -3578,7 +3666,7 @@ /*-------------------------------------------------------------------------- * HYPRE_MGRSetGlobalsmoothType - *--------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------*/ /** * (Optional) Determines type of global smoother. * Options for {\tt smooth\_type} are: @@ -3594,7 +3682,7 @@ * 7 & hybrid symmetric Gauss-Seidel or SSOR \\ * 8 & Euclid (ILU) \\ * \hline - * \end{tabular} + * \end{tabular} **/ HYPRE_Int HYPRE_MGRSetGlobalsmoothType( HYPRE_Solver solver, HYPRE_Int smooth_type ); @@ -3681,7 +3769,7 @@ HYPRE_Int q, HYPRE_Real alpha, HYPRE_Real eps ); - + HYPRE_ParCSRMatrix GenerateVarDifConv(MPI_Comm comm, HYPRE_BigInt nx, @@ -3762,7 +3850,7 @@ HYPRE_Real CR_strong_th); /* - * (Optional) Defines whether to use CG + * (Optional) Defines whether to use CG **/ HYPRE_Int HYPRE_BoomerAMGSetCRUseCG(HYPRE_Solver solver, HYPRE_Int CR_use_CG); @@ -3819,7 +3907,7 @@ /*@}*/ /*-------------------------------------------------------------------------- - *--------------------------------------------------------------------------*/ + *--------------------------------------------------------------------------*/ /*@}*/ #ifdef __cplusplus diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_mgr.c hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_mgr.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_mgr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_mgr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_ml.cpp hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_ml.cpp --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_ml.cpp 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_ml.cpp 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************/ /* HYPRE_ParCSRML interface */ diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_ParaSails.c hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_ParaSails.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_ParaSails.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_ParaSails.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_pcg.c hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_pcg.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_pcg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_pcg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" @@ -45,7 +40,7 @@ * HYPRE_ParCSRPCGDestroy *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int HYPRE_ParCSRPCGDestroy( HYPRE_Solver solver ) { return( hypre_PCGDestroy( (void *) solver ) ); @@ -55,7 +50,7 @@ * HYPRE_ParCSRPCGSetup *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int HYPRE_ParCSRPCGSetup( HYPRE_Solver solver, HYPRE_ParCSRMatrix A, HYPRE_ParVector b, @@ -71,7 +66,7 @@ * HYPRE_ParCSRPCGSolve *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int HYPRE_ParCSRPCGSolve( HYPRE_Solver solver, HYPRE_ParCSRMatrix A, HYPRE_ParVector b, @@ -236,8 +231,8 @@ /*-------------------------------------------------------------------------- * HYPRE_ParCSRDiagScaleSetup *--------------------------------------------------------------------------*/ - -HYPRE_Int + +HYPRE_Int HYPRE_ParCSRDiagScaleSetup( HYPRE_Solver solver, HYPRE_ParCSRMatrix A, HYPRE_ParVector y, @@ -245,12 +240,12 @@ { return 0; } - + /*-------------------------------------------------------------------------- * HYPRE_ParCSRDiagScale *--------------------------------------------------------------------------*/ - -HYPRE_Int + +HYPRE_Int HYPRE_ParCSRDiagScale( HYPRE_Solver solver, HYPRE_ParCSRMatrix HA, HYPRE_ParVector Hy, @@ -265,36 +260,32 @@ HYPRE_Int *A_i = hypre_CSRMatrixI(hypre_ParCSRMatrixDiag(A)); HYPRE_Int local_size = hypre_VectorSize(hypre_ParVectorLocalVector(x)); HYPRE_Int ierr = 0; -#if defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) - DiagScaleVector(x_data, y_data, A_data, A_i, local_size, HYPRE_STREAM(4)); -#elif defined(HYPRE_USING_DEVICE_OPENMP) && defined(HYPRE_USING_UNIFIED_MEMORY) - HYPRE_Int i; -#pragma omp target teams distribute parallel for private(i) is_device_ptr(x_data,y_data,A_data,A_i) - for (i=0; i < local_size; i++) - { - x_data[i] = y_data[i]/A_data[A_i[i]]; - } -#else +#if defined(HYPRE_USING_CUDA) + hypreDevice_DiagScaleVector(local_size, A_i, A_data, y_data, x_data); + //hypre_SyncCudaComputeStream(hypre_handle); +#else /* #if defined(HYPRE_USING_CUDA) */ HYPRE_Int i; -#if (HYPRE_USING_OPENMP) +#if defined(HYPRE_USING_DEVICE_OPENMP) +#pragma omp target teams distribute parallel for private(i) is_device_ptr(x_data,y_data,A_data,A_i) +#elif defined(HYPRE_USING_OPENMP) #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif for (i=0; i < local_size; i++) { x_data[i] = y_data[i]/A_data[A_i[i]]; - } -#endif - + } +#endif /* #if defined(HYPRE_USING_CUDA) */ + return ierr; } /*-------------------------------------------------------------------------- * HYPRE_ParCSRSymPrecondSetup *--------------------------------------------------------------------------*/ - + /* -HYPRE_Int +HYPRE_Int HYPRE_ParCSRSymPrecondSetup( HYPRE_Solver solver, HYPRE_ParCSRMatrix A, HYPRE_ParVector b, @@ -327,7 +318,7 @@ for (i=0; i < hypre_VectorSize(hypre_ParVectorLocalVector(x)); i++) { x_data[i] = y_data[i]/A_data[A_i[i]]; - } - + } + return ierr; } */ diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_pilut.c hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_pilut.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_pilut.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_pilut.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_schwarz.c hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_schwarz.c --- hypre-2.16.0/src/parcsr_ls/HYPRE_parcsr_schwarz.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/HYPRE_parcsr_schwarz.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" diff -Nru hypre-2.16.0/src/parcsr_ls/Makefile hypre-2.18.2/src/parcsr_ls/Makefile --- hypre-2.16.0/src/parcsr_ls/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config @@ -90,6 +83,7 @@ par_amg_solveT.c\ par_cg_relax_wt.c\ par_coarsen.c\ + par_coarsen_device.c\ par_cgc_coarsen.c\ par_cheby.c\ par_coarse_parms.c\ @@ -98,9 +92,13 @@ par_cycle.c\ par_add_cycle.c\ par_difconv.c\ + par_gauss_elim.c\ par_gsmg.c\ par_indepset.c\ + par_indepset_device.c\ par_interp.c\ + par_interp_device.c\ + par_interp_trunc_device.c\ par_jacobi_interp.c\ par_multi_interp.c\ par_laplace.c\ @@ -122,6 +120,7 @@ par_schwarz.c\ par_stats.c\ par_strength.c\ + par_strength_device.c\ par_sv_interp.c\ par_sv_interp_ln.c\ par_vardifconv.c\ diff -Nru hypre-2.16.0/src/parcsr_ls/par_add_cycle.c hypre-2.18.2/src/parcsr_ls/par_add_cycle.c --- hypre-2.16.0/src/parcsr_ls/par_add_cycle.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_add_cycle.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -56,7 +47,7 @@ HYPRE_Int n_global; HYPRE_Int rlx_order; - /* Local variables */ + /* Local variables */ HYPRE_Int Solve_err_flag = 0; HYPRE_Int level; HYPRE_Int coarse_grid; @@ -81,7 +72,7 @@ HYPRE_Real *D_mat; HYPRE_Real *S_vec; #endif - + /* Acquire data and allocate storage */ A_array = hypre_ParAMGDataAArray(amg_data); @@ -134,7 +125,7 @@ v_data = hypre_VectorData(hypre_ParVectorLocalVector(Vtemp)); l1_norms_lvl = l1_norms[level]; - hypre_ParVectorSetConstantValues(U_array[coarse_grid], 0.0); + hypre_ParVectorSetConstantValues(U_array[coarse_grid], 0.0); if (level < addlvl || level > add_end) /* multiplicative version */ { @@ -162,7 +153,7 @@ for (j=0; j < num_grid_sweeps[1]; j++) { hypre_BoomerAMGRelaxIF(A_array[fine_grid],F_array[fine_grid], - CF_marker_array[fine_grid], rlx_down,rlx_order,1, + CF_marker_array[fine_grid], rlx_down,rlx_order,1, relax_weight[fine_grid], omega[fine_grid], l1_norms[level], U_array[fine_grid], Vtemp, Ztemp); hypre_ParVectorCopy(F_array[fine_grid],Vtemp); @@ -177,11 +168,11 @@ #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < num_rows; i++) + for (i = 0; i < num_rows; i++) u_data[i] += v_data[i] / l1_norms_lvl[i]; } } - + alpha = -1.0; beta = 1.0; hypre_ParCSRMatrixMatvec(alpha, A_array[fine_grid], U_array[fine_grid], @@ -207,7 +198,7 @@ } } - /* additive smoothing and solve coarse grid */ + /* additive smoothing and solve coarse grid */ if (addlvl < num_levels) { if (simple > -1) @@ -218,8 +209,8 @@ #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i=0; i < n_global; i++) - x_global[i] += D_inv[i]*r_global[i]; + for (i=0; i < n_global; i++) + x_global[i] += D_inv[i]*r_global[i]; } else { @@ -227,9 +218,9 @@ { n_global = hypre_VectorSize(hypre_ParVectorLocalVector(Rtilde)); hypre_ParVector *Tmptilde = hypre_CTAlloc(hypre_ParVector, 1, HYPRE_MEMORY_HOST); - hypre_Vector *Tmptilde_local = hypre_SeqVectorCreate(n_global); + hypre_Vector *Tmptilde_local = hypre_SeqVectorCreate(n_global); hypre_SeqVectorInitialize(Tmptilde_local); - hypre_ParVectorLocalVector(Tmptilde) = Tmptilde_local; + hypre_ParVectorLocalVector(Tmptilde) = Tmptilde_local; hypre_ParVectorOwnsData(Tmptilde) = 1; hypre_ParCSRMatrixMatvec(1.0, Lambda, Rtilde, 0.0, Tmptilde); hypre_ParVectorScale(2.0,Rtilde); @@ -245,13 +236,13 @@ fine_grid = num_levels -1; for (j=0; j < num_grid_sweeps[3]; j++) if (rlx_coarse == 18) - hypre_ParCSRRelax(A_array[fine_grid], F_array[fine_grid], + hypre_ParCSRRelax(A_array[fine_grid], F_array[fine_grid], 1, 1, l1_norms[fine_grid], 1.0, 1.0 ,0,0,0,0, U_array[fine_grid], Vtemp, Ztemp); else hypre_BoomerAMGRelaxIF(A_array[fine_grid],F_array[fine_grid], - NULL, rlx_coarse,0,0, + NULL, rlx_coarse,0,0, relax_weight[fine_grid], omega[fine_grid], l1_norms[fine_grid], U_array[fine_grid], Vtemp, Ztemp); } @@ -266,15 +257,15 @@ { alpha = 1.0; beta = 1.0; - hypre_ParCSRMatrixMatvec(alpha, P_array[fine_grid], + hypre_ParCSRMatrixMatvec(alpha, P_array[fine_grid], U_array[coarse_grid], - beta, U_array[fine_grid]); + beta, U_array[fine_grid]); if (rlx_up != 18) /*hypre_BoomerAMGRelax(A_array[fine_grid],F_array[fine_grid],NULL,rlx_up,0,*/ for (j=0; j < num_grid_sweeps[2]; j++) hypre_BoomerAMGRelaxIF(A_array[fine_grid],F_array[fine_grid], - CF_marker_array[fine_grid], - rlx_up,rlx_order,2, + CF_marker_array[fine_grid], + rlx_up,rlx_order,2, relax_weight[fine_grid], omega[fine_grid], l1_norms[fine_grid], U_array[fine_grid], Vtemp, Ztemp); else if (rlx_order) @@ -290,7 +281,7 @@ 1.0, l1_norms[fine_grid], U_array[fine_grid], Vtemp); } - else + else for (j=0; j < num_grid_sweeps[2]; j++) hypre_ParCSRRelax(A_array[fine_grid], F_array[fine_grid], 1, 1, l1_norms[fine_grid], @@ -301,9 +292,9 @@ { alpha = 1.0; beta = 1.0; - hypre_ParCSRMatrixMatvec(alpha, P_array[fine_grid], + hypre_ParCSRMatrixMatvec(alpha, P_array[fine_grid], U_array[coarse_grid], - beta, U_array[fine_grid]); + beta, U_array[fine_grid]); } } @@ -400,7 +391,7 @@ HYPRE_Int max_sends, max_recvs; HYPRE_Int ns; - /* Local variables */ + /* Local variables */ HYPRE_Int Solve_err_flag = 0; HYPRE_Int num_nonzeros_diag; HYPRE_Int num_nonzeros_offd; @@ -430,7 +421,7 @@ hypre_MPI_Comm_size(comm,&num_procs); - l1_norms_ptr = hypre_ParAMGDataL1Norms(amg_data); + l1_norms_ptr = hypre_ParAMGDataL1Norms(amg_data); addlvl = hypre_max(additive, mult_additive); if (add_last_lvl != -1) add_end = add_last_lvl+1; @@ -443,7 +434,7 @@ num_cols_offd_L = 0; num_nonzeros_diag = 0; num_nonzeros_offd = 0; - level_start[0] = 0; + level_start[0] = 0; cnt = 1; max_sends = 0; max_recvs = 0; @@ -467,8 +458,8 @@ { num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); max_sends += num_sends; - if (num_sends) - send_data_L += hypre_ParCSRCommPkgSendMapStart(comm_pkg,num_sends); + if (num_sends) + send_data_L += hypre_ParCSRCommPkgSendMapStart(comm_pkg,num_sends); max_recvs += hypre_ParCSRCommPkgNumRecvs(comm_pkg); } } @@ -497,9 +488,9 @@ send_procs = hypre_ParCSRCommPkgSendProcs(comm_pkg); recv_procs = hypre_ParCSRCommPkgRecvProcs(comm_pkg); for (j = 0; j < num_sends; j++) - all_send_procs[cnt_send++] = send_procs[j]; + all_send_procs[cnt_send++] = send_procs[j]; for (j = 0; j < num_recvs; j++) - all_recv_procs[cnt_recv++] = recv_procs[j]; + all_recv_procs[cnt_recv++] = recv_procs[j]; } } if (max_sends) @@ -517,8 +508,8 @@ } L_send_procs = hypre_CTAlloc(HYPRE_Int, num_sends_L, HYPRE_MEMORY_HOST); for (j=0; j < num_sends_L; j++) - L_send_procs[j] = all_send_procs[j]; - hypre_TFree(all_send_procs, HYPRE_MEMORY_HOST); + L_send_procs[j] = all_send_procs[j]; + hypre_TFree(all_send_procs, HYPRE_MEMORY_HOST); } if (max_recvs) { @@ -535,8 +526,8 @@ } L_recv_procs = hypre_CTAlloc(HYPRE_Int, num_recvs_L, HYPRE_MEMORY_HOST); for (j=0; j < num_recvs_L; j++) - L_recv_procs[j] = all_recv_procs[j]; - hypre_TFree(all_recv_procs, HYPRE_MEMORY_HOST); + L_recv_procs[j] = all_recv_procs[j]; + hypre_TFree(all_recv_procs, HYPRE_MEMORY_HOST); } L_recv_ptr = hypre_CTAlloc(HYPRE_Int, num_recvs_L+1, HYPRE_MEMORY_HOST); @@ -599,15 +590,15 @@ for (j = 0; j < num_sends; j++) { this_proc = send_procs[j]; - if (all_send_procs[this_proc] == 0) - num_sends_L++; + if (all_send_procs[this_proc] == 0) + num_sends_L++; all_send_procs[this_proc] += send_map_starts[j+1]-send_map_starts[j]; } for (j = 0; j < num_recvs; j++) { this_proc = recv_procs[j]; - if (all_recv_procs[this_proc] == 0) - num_recvs_L++; + if (all_recv_procs[this_proc] == 0) + num_recvs_L++; all_recv_procs[this_proc] += recv_vec_starts[j+1]-recv_vec_starts[j]; } } @@ -619,12 +610,12 @@ num_sends_L = 0; for (j=0; j < num_procs; j++) { - this_proc = all_send_procs[j]; - if (this_proc) - { - L_send_procs[num_sends_L++] = j; - L_send_ptr[num_sends_L] = this_proc + L_send_ptr[num_sends_L-1]; - } + this_proc = all_send_procs[j]; + if (this_proc) + { + L_send_procs[num_sends_L++] = j; + L_send_ptr[num_sends_L] = this_proc + L_send_ptr[num_sends_L-1]; + } } } if (max_recvs) @@ -634,15 +625,15 @@ num_recvs_L = 0; for (j=0; j < num_procs; j++) { - this_proc = all_recv_procs[j]; - if (this_proc) - { - L_recv_procs[num_recvs_L++] = j; - L_recv_ptr[num_recvs_L] = this_proc + L_recv_ptr[num_recvs_L-1]; - } + this_proc = all_recv_procs[j]; + if (this_proc) + { + L_recv_procs[num_recvs_L++] = j; + L_recv_ptr[num_recvs_L] = this_proc + L_recv_ptr[num_recvs_L-1]; + } } } - } + } } if (max_sends) hypre_TFree(all_send_procs, HYPRE_MEMORY_HOST); if (max_recvs) hypre_TFree(all_recv_procs, HYPRE_MEMORY_HOST); @@ -665,7 +656,7 @@ } L_offd_i = hypre_CSRMatrixI(L_offd); - if (ns > 1) + if (ns > 1) { Atilde_diag = hypre_CSRMatrixCreate(num_rows_L, num_rows_L, num_nonzeros_diag); Atilde_offd = hypre_CSRMatrixCreate(num_rows_L, num_cols_offd_L, num_nonzeros_offd); @@ -688,7 +679,7 @@ if (num_rows_L) D_data = hypre_CTAlloc(HYPRE_Real, num_rows_L, HYPRE_MEMORY_HOST); if (send_data_L) { - L_send_map_elmts = hypre_CTAlloc(HYPRE_Int, send_data_L, HYPRE_MEMORY_SHARED); + L_send_map_elmts = hypre_CTAlloc(HYPRE_Int, send_data_L, HYPRE_MEMORY_HOST); buf_data = hypre_CTAlloc(HYPRE_Real, send_data_L, HYPRE_MEMORY_HOST); } if (num_cols_offd_L) @@ -699,31 +690,31 @@ } Rtilde = hypre_CTAlloc(hypre_ParVector, 1, HYPRE_MEMORY_HOST); - Rtilde_local = hypre_SeqVectorCreate(num_rows_L); + Rtilde_local = hypre_SeqVectorCreate(num_rows_L); hypre_SeqVectorInitialize(Rtilde_local); - hypre_ParVectorLocalVector(Rtilde) = Rtilde_local; + hypre_ParVectorLocalVector(Rtilde) = Rtilde_local; hypre_ParVectorOwnsData(Rtilde) = 1; Xtilde = hypre_CTAlloc(hypre_ParVector, 1, HYPRE_MEMORY_HOST); - Xtilde_local = hypre_SeqVectorCreate(num_rows_L); + Xtilde_local = hypre_SeqVectorCreate(num_rows_L); hypre_SeqVectorInitialize(Xtilde_local); - hypre_ParVectorLocalVector(Xtilde) = Xtilde_local; + hypre_ParVectorLocalVector(Xtilde) = Xtilde_local; hypre_ParVectorOwnsData(Xtilde) = 1; - + x_data = hypre_VectorData(hypre_ParVectorLocalVector(Xtilde)); r_data = hypre_VectorData(hypre_ParVectorLocalVector(Rtilde)); cnt = 0; cnt_level = 0; - cnt_diag = 0; - cnt_offd = 0; - cnt_row = 1; + cnt_diag = 0; + cnt_offd = 0; + cnt_row = 1; L_diag_i[0] = 0; L_offd_i[0] = 0; - if (ns > 1) + if (ns > 1) { - A_cnt_diag = 0; - A_cnt_offd = 0; + A_cnt_diag = 0; + A_cnt_offd = 0; Atilde_diag_i[0] = 0; Atilde_offd_i[0] = 0; } @@ -733,11 +724,18 @@ if (level != 0) { tmp_data = hypre_VectorData(hypre_ParVectorLocalVector(F_array[level])); - if (tmp_data) hypre_TFree(tmp_data, HYPRE_MEMORY_SHARED); + if (tmp_data) + { + hypre_TFree(tmp_data, hypre_VectorMemoryLocation(hypre_ParVectorLocalVector(F_array[level]))); + } hypre_VectorData(hypre_ParVectorLocalVector(F_array[level])) = &r_data[row_start]; hypre_VectorOwnsData(hypre_ParVectorLocalVector(F_array[level])) = 0; + tmp_data = hypre_VectorData(hypre_ParVectorLocalVector(U_array[level])); - if (tmp_data) hypre_TFree(tmp_data, HYPRE_MEMORY_SHARED); + if (tmp_data) + { + hypre_TFree(tmp_data, hypre_VectorMemoryLocation(hypre_ParVectorLocalVector(U_array[level]))); + } hypre_VectorData(hypre_ParVectorLocalVector(U_array[level])) = &x_data[row_start]; hypre_VectorOwnsData(hypre_ParVectorLocalVector(U_array[level])) = 0; } @@ -771,7 +769,7 @@ num_sends = 0; num_recvs = 0; } - + /* Compute new combined communication package */ for (i=0; i < num_sends; i++) { @@ -779,11 +777,11 @@ indx = L_send_ptr[this_proc]; for (j=send_map_starts[i]; j < send_map_starts[i+1]; j++) { - L_send_map_elmts[indx++] = row_start + send_map_elmts[j]; + L_send_map_elmts[indx++] = row_start + send_map_elmts[j]; } L_send_ptr[this_proc] = indx; } - + cnt_map = 0; for (i = 0; i < num_recvs; i++) { @@ -791,12 +789,12 @@ indx = L_recv_ptr[this_proc]; for (j=recv_vec_starts[i]; j < recv_vec_starts[i+1]; j++) { - remap[cnt_map++] = indx++; + remap[cnt_map++] = indx++; } L_recv_ptr[this_proc] = indx; } - - /* Compute Lambda */ + + /* Compute Lambda */ if (add_rlx == 0) { /*HYPRE_Real rlx_wt = relax_weight[level];*/ @@ -835,7 +833,7 @@ Atilde_offd_i[cnt_row+i] = start_offd + A_tmp_offd_i[i+1]; } } - + if (num_procs > 1) { index = 0; @@ -947,16 +945,16 @@ A_send_map_elmts = hypre_CTAlloc(HYPRE_Int, L_send_ptr[num_sends_L], HYPRE_MEMORY_HOST); for (i=0; i -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU #include #include "superlu_ddefs.h" #endif @@ -41,6 +32,9 @@ HYPRE_Int max_coarse_size; HYPRE_Int min_coarse_size; HYPRE_Real strong_threshold; + HYPRE_Real strong_threshold_R; + HYPRE_Real filter_threshold_R; + HYPRE_Int Sabs; HYPRE_Real max_row_sum; HYPRE_Real trunc_factor; HYPRE_Real agg_trunc_factor; @@ -50,30 +44,32 @@ HYPRE_Real CR_rate; HYPRE_Real CR_strong_th; HYPRE_Real A_drop_tol; + HYPRE_Int A_drop_type; HYPRE_Int interp_type; HYPRE_Int sep_weight; HYPRE_Int coarsen_type; HYPRE_Int measure_type; HYPRE_Int setup_type; HYPRE_Int P_max_elmts; - HYPRE_Int num_functions; - HYPRE_Int nodal, nodal_levels, nodal_diag; - HYPRE_Int num_paths; - HYPRE_Int agg_num_levels; + HYPRE_Int num_functions; + HYPRE_Int nodal, nodal_levels, nodal_diag; + HYPRE_Int num_paths; + HYPRE_Int agg_num_levels; HYPRE_Int agg_interp_type; HYPRE_Int agg_P_max_elmts; HYPRE_Int agg_P12_max_elmts; HYPRE_Int post_interp_type; - HYPRE_Int num_CR_relax_steps; - HYPRE_Int IS_type; - HYPRE_Int CR_use_CG; - HYPRE_Int cgc_its; - HYPRE_Int seq_threshold; + HYPRE_Int num_CR_relax_steps; + HYPRE_Int IS_type; + HYPRE_Int CR_use_CG; + HYPRE_Int cgc_its; + HYPRE_Int seq_threshold; HYPRE_Int redundant; /* solve params */ HYPRE_Int min_iter; HYPRE_Int max_iter; + HYPRE_Int fcycle; HYPRE_Int cycle_type; HYPRE_Int converge_type; @@ -93,9 +89,9 @@ HYPRE_Int variant, overlap, domain_type, schwarz_use_nonsymm; HYPRE_Real schwarz_rlx_weight; - HYPRE_Int level, sym; - HYPRE_Int eu_level, eu_bj; - HYPRE_Int max_nz_per_row; + HYPRE_Int level, sym; + HYPRE_Int eu_level, eu_bj; + HYPRE_Int max_nz_per_row; HYPRE_Real thresh, filter; HYPRE_Real drop_tol; HYPRE_Real eu_sparse_A; @@ -142,6 +138,9 @@ seq_threshold = 0; redundant = 0; strong_threshold = 0.25; + strong_threshold_R = 0.25; + filter_threshold_R = 0.0; + Sabs = 0; max_row_sum = 0.9; trunc_factor = 0.0; agg_trunc_factor = 0.0; @@ -169,6 +168,7 @@ CR_rate = 0.7; CR_strong_th = 0; A_drop_tol = 0.0; + A_drop_type = -1; IS_type = 1; CR_use_CG = 0; cgc_its = 1; @@ -196,6 +196,7 @@ /* solve params */ min_iter = 0; max_iter = 20; + fcycle = 0; cycle_type = 1; converge_type = 0; tol = 1.0e-7; @@ -255,6 +256,9 @@ hypre_BoomerAMGSetMaxCoarseSize(amg_data, max_coarse_size); hypre_BoomerAMGSetMinCoarseSize(amg_data, min_coarse_size); hypre_BoomerAMGSetStrongThreshold(amg_data, strong_threshold); + hypre_BoomerAMGSetStrongThresholdR(amg_data, strong_threshold_R); + hypre_BoomerAMGSetFilterThresholdR(amg_data, filter_threshold_R); + hypre_BoomerAMGSetSabs(amg_data, Sabs); hypre_BoomerAMGSetMaxRowSum(amg_data, max_row_sum); hypre_BoomerAMGSetTruncFactor(amg_data, trunc_factor); hypre_BoomerAMGSetAggTruncFactor(amg_data, agg_trunc_factor); @@ -281,6 +285,7 @@ hypre_BoomerAMGSetCRRate(amg_data, CR_rate); hypre_BoomerAMGSetCRStrongTh(amg_data, CR_strong_th); hypre_BoomerAMGSetADropTol(amg_data, A_drop_tol); + hypre_BoomerAMGSetADropType(amg_data, A_drop_type); hypre_BoomerAMGSetISType(amg_data, IS_type); hypre_BoomerAMGSetCRUseCG(amg_data, CR_use_CG); hypre_BoomerAMGSetCGCIts(amg_data, cgc_its); @@ -303,6 +308,7 @@ hypre_BoomerAMGSetMinIter(amg_data, min_iter); hypre_BoomerAMGSetMaxIter(amg_data, max_iter); hypre_BoomerAMGSetCycleType(amg_data, cycle_type); + hypre_BoomerAMGSetFCycle(amg_data, fcycle); hypre_BoomerAMGSetConvergeType(amg_data, converge_type); hypre_BoomerAMGSetTol(amg_data, tol); hypre_BoomerAMGSetNumSweeps(amg_data, num_sweeps); @@ -345,6 +351,8 @@ hypre_BoomerAMGSetPrintFileName(amg_data, log_file_name); hypre_BoomerAMGSetDebugFlag(amg_data, debug_flag); hypre_BoomerAMGSetRestriction(amg_data, 0); + hypre_BoomerAMGSetIsTriangular(amg_data, 0); + hypre_BoomerAMGSetGMRESSwitchR(amg_data, 64); hypre_BoomerAMGSetGSMG(amg_data, 0); hypre_BoomerAMGSetNumSamples(amg_data, 0); @@ -411,22 +419,31 @@ hypre_ParAMGDataNewComm(amg_data) = hypre_MPI_COMM_NULL; /* for Gaussian elimination coarse grid solve */ + hypre_ParAMGDataGSSetup(amg_data) = 0; hypre_ParAMGDataAMat(amg_data) = NULL; + hypre_ParAMGDataAInv(amg_data) = NULL; hypre_ParAMGDataBVec(amg_data) = NULL; hypre_ParAMGDataCommInfo(amg_data) = NULL; hypre_ParAMGDataNonGalerkinTol(amg_data) = nongalerkin_tol; hypre_ParAMGDataNonGalTolArray(amg_data) = NULL; - hypre_ParAMGDataRAP2(amg_data) = 0; - hypre_ParAMGDataKeepTranspose(amg_data) = 0; +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + hypre_ParAMGDataRAP2(amg_data) = 1; + hypre_ParAMGDataKeepTranspose(amg_data) = 1; + hypre_ParAMGDataModularizedMatMat(amg_data) = 1; +#else + hypre_ParAMGDataRAP2(amg_data) = 0; + hypre_ParAMGDataKeepTranspose(amg_data) = 0; + hypre_ParAMGDataModularizedMatMat(amg_data) = 0; +#endif -/* information for preserving indices as coarse grid points */ + /* information for preserving indices as coarse grid points */ hypre_ParAMGDataCPointKeepMarkerArray(amg_data) = NULL; hypre_ParAMGDataCPointKeepLevel(amg_data) = 0; hypre_ParAMGDataNumCPointKeep(amg_data) = 0; -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU hypre_ParAMGDataDSLUThreshold(amg_data) = 0; hypre_ParAMGDataDSLUSolver(amg_data) = NULL; #endif @@ -454,7 +471,7 @@ HYPRE_ANNOTATION_BEGIN("BoomerAMG.destroy"); -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU if (hypre_ParAMGDataDSLUThreshold(amg_data) > 0) hypre_SLUDistDestroy(hypre_ParAMGDataDSLUSolver(amg_data)); #endif @@ -480,10 +497,10 @@ if (grid_relax_type[1] == 15 || grid_relax_type[3] == 15 ) { if (grid_relax_type[1] == 15) - for (i=0; i < num_levels; i++) - HYPRE_ParCSRPCGDestroy(smoother[i]); + for (i=0; i < num_levels; i++) + HYPRE_ParCSRPCGDestroy(smoother[i]); if (grid_relax_type[3] == 15 && grid_relax_type[1] != 15) - HYPRE_ParCSRPCGDestroy(smoother[num_levels-1]); + HYPRE_ParCSRPCGDestroy(smoother[num_levels-1]); hypre_TFree(smoother, HYPRE_MEMORY_HOST); } @@ -513,51 +530,53 @@ if (hypre_ParAMGDataGridRelaxPoints(amg_data)) { for (i=0; i < 4; i++) - hypre_TFree(hypre_ParAMGDataGridRelaxPoints(amg_data)[i], HYPRE_MEMORY_HOST); + hypre_TFree(hypre_ParAMGDataGridRelaxPoints(amg_data)[i], HYPRE_MEMORY_HOST); hypre_TFree(hypre_ParAMGDataGridRelaxPoints(amg_data), HYPRE_MEMORY_HOST); hypre_ParAMGDataGridRelaxPoints(amg_data) = NULL; } for (i=1; i < num_levels; i++) { - hypre_ParVectorDestroy(hypre_ParAMGDataFArray(amg_data)[i]); - hypre_ParVectorDestroy(hypre_ParAMGDataUArray(amg_data)[i]); + hypre_ParVectorDestroy(hypre_ParAMGDataFArray(amg_data)[i]); + hypre_ParVectorDestroy(hypre_ParAMGDataUArray(amg_data)[i]); + + if (hypre_ParAMGDataAArray(amg_data)[i]) + hypre_ParCSRMatrixDestroy(hypre_ParAMGDataAArray(amg_data)[i]); + + if (hypre_ParAMGDataPArray(amg_data)[i-1]) + hypre_ParCSRMatrixDestroy(hypre_ParAMGDataPArray(amg_data)[i-1]); + + /* RL */ + if (hypre_ParAMGDataRestriction(amg_data)) + { + if (hypre_ParAMGDataRArray(amg_data)[i-1]) + { + hypre_ParCSRMatrixDestroy(hypre_ParAMGDataRArray(amg_data)[i-1]); + } + } - if (hypre_ParAMGDataAArray(amg_data)[i]) - hypre_ParCSRMatrixDestroy(hypre_ParAMGDataAArray(amg_data)[i]); + hypre_TFree(hypre_ParAMGDataCFMarkerArray(amg_data)[i-1], HYPRE_MEMORY_HOST); - if (hypre_ParAMGDataPArray(amg_data)[i-1]) - hypre_ParCSRMatrixDestroy(hypre_ParAMGDataPArray(amg_data)[i-1]); + /* get rid of any block structures */ + if (hypre_ParAMGDataABlockArray(amg_data)[i]) + hypre_ParCSRBlockMatrixDestroy(hypre_ParAMGDataABlockArray(amg_data)[i]); - /* RL */ - if (hypre_ParAMGDataRestriction(amg_data)) - { - if (hypre_ParAMGDataRArray(amg_data)[i-1]) - { - hypre_ParCSRMatrixDestroy(hypre_ParAMGDataRArray(amg_data)[i-1]); - } - } - - hypre_TFree(hypre_ParAMGDataCFMarkerArray(amg_data)[i-1], HYPRE_MEMORY_HOST); - - /* get rid of any block structures */ - if (hypre_ParAMGDataABlockArray(amg_data)[i]) - hypre_ParCSRBlockMatrixDestroy(hypre_ParAMGDataABlockArray(amg_data)[i]); - - if (hypre_ParAMGDataPBlockArray(amg_data)[i-1]) - hypre_ParCSRBlockMatrixDestroy(hypre_ParAMGDataPBlockArray(amg_data)[i-1]); - - /* RL */ - if (hypre_ParAMGDataRestriction(amg_data)) - { - if (hypre_ParAMGDataRBlockArray(amg_data)[i-1]) - { - hypre_ParCSRBlockMatrixDestroy(hypre_ParAMGDataRBlockArray(amg_data)[i-1]); - } - } + if (hypre_ParAMGDataPBlockArray(amg_data)[i-1]) + hypre_ParCSRBlockMatrixDestroy(hypre_ParAMGDataPBlockArray(amg_data)[i-1]); + + /* RL */ + if (hypre_ParAMGDataRestriction(amg_data)) + { + if (hypre_ParAMGDataRBlockArray(amg_data)[i-1]) + { + hypre_ParCSRBlockMatrixDestroy(hypre_ParAMGDataRBlockArray(amg_data)[i-1]); + } + } } if (hypre_ParAMGDataLambda(amg_data)) + { hypre_ParCSRMatrixDestroy(hypre_ParAMGDataLambda(amg_data)); + } if (hypre_ParAMGDataAtilde(amg_data)) { @@ -577,7 +596,7 @@ { for (i=0; i < num_levels; i++) if (hypre_ParAMGDataL1Norms(amg_data)[i]) - hypre_TFree(hypre_ParAMGDataL1Norms(amg_data)[i], HYPRE_MEMORY_SHARED); + hypre_TFree(hypre_ParAMGDataL1Norms(amg_data)[i], HYPRE_MEMORY_SHARED); hypre_TFree(hypre_ParAMGDataL1Norms(amg_data), HYPRE_MEMORY_HOST); } @@ -585,7 +604,7 @@ { for (i=0; i < num_levels; i++) if (hypre_ParAMGDataChebyCoefs(amg_data)[i]) - hypre_TFree(hypre_ParAMGDataChebyCoefs(amg_data)[i], HYPRE_MEMORY_HOST); + hypre_TFree(hypre_ParAMGDataChebyCoefs(amg_data)[i], HYPRE_MEMORY_HOST); hypre_TFree(hypre_ParAMGDataChebyCoefs(amg_data), HYPRE_MEMORY_HOST); } @@ -593,7 +612,7 @@ { for (i=0; i < num_levels; i++) if (hypre_ParAMGDataChebyDS(amg_data)[i]) - hypre_TFree(hypre_ParAMGDataChebyDS(amg_data)[i], HYPRE_MEMORY_HOST); + hypre_TFree(hypre_ParAMGDataChebyDS(amg_data)[i], HYPRE_MEMORY_HOST); hypre_TFree(hypre_ParAMGDataChebyDS(amg_data), HYPRE_MEMORY_HOST); } @@ -603,7 +622,7 @@ /* get rid of a fine level block matrix */ if (hypre_ParAMGDataABlockArray(amg_data)) if (hypre_ParAMGDataABlockArray(amg_data)[0]) - hypre_ParCSRBlockMatrixDestroy(hypre_ParAMGDataABlockArray(amg_data)[0]); + hypre_ParCSRBlockMatrixDestroy(hypre_ParAMGDataABlockArray(amg_data)[0]); /* see comments in par_coarsen.c regarding special case for CF_marker */ @@ -630,58 +649,59 @@ if (hypre_ParAMGDataDofFuncArray(amg_data)) { for (i=1; i < num_levels; i++) - hypre_TFree(hypre_ParAMGDataDofFuncArray(amg_data)[i], HYPRE_MEMORY_HOST); + hypre_TFree(hypre_ParAMGDataDofFuncArray(amg_data)[i], HYPRE_MEMORY_HOST); hypre_TFree(hypre_ParAMGDataDofFuncArray(amg_data), HYPRE_MEMORY_HOST); hypre_ParAMGDataDofFuncArray(amg_data) = NULL; } if (hypre_ParAMGDataRestriction(amg_data)) { - hypre_TFree(hypre_ParAMGDataRBlockArray(amg_data),HYPRE_MEMORY_HOST); - hypre_TFree(hypre_ParAMGDataRArray(amg_data),HYPRE_MEMORY_HOST); + hypre_TFree(hypre_ParAMGDataRBlockArray(amg_data),HYPRE_MEMORY_HOST); + hypre_TFree(hypre_ParAMGDataRArray(amg_data),HYPRE_MEMORY_HOST); hypre_ParAMGDataRArray(amg_data) = NULL; } if (hypre_ParAMGDataDofPointArray(amg_data)) { for (i=0; i < num_levels; i++) - hypre_TFree(hypre_ParAMGDataDofPointArray(amg_data)[i], HYPRE_MEMORY_HOST); + hypre_TFree(hypre_ParAMGDataDofPointArray(amg_data)[i], HYPRE_MEMORY_HOST); hypre_TFree(hypre_ParAMGDataDofPointArray(amg_data), HYPRE_MEMORY_HOST); hypre_ParAMGDataDofPointArray(amg_data) = NULL; } if (hypre_ParAMGDataPointDofMapArray(amg_data)) { for (i=0; i < num_levels; i++) - hypre_TFree(hypre_ParAMGDataPointDofMapArray(amg_data)[i], HYPRE_MEMORY_HOST); + hypre_TFree(hypre_ParAMGDataPointDofMapArray(amg_data)[i], HYPRE_MEMORY_HOST); hypre_TFree(hypre_ParAMGDataPointDofMapArray(amg_data), HYPRE_MEMORY_HOST); hypre_ParAMGDataPointDofMapArray(amg_data) = NULL; } + if (smooth_num_levels) { if (hypre_ParAMGDataSmoothType(amg_data) == 7) { for (i=0; i < smooth_num_levels; i++) { - HYPRE_ParCSRPilutDestroy(smoother[i]); + HYPRE_ParCSRPilutDestroy(smoother[i]); } } else if (hypre_ParAMGDataSmoothType(amg_data) == 8) { for (i=0; i < smooth_num_levels; i++) { - HYPRE_ParCSRParaSailsDestroy(smoother[i]); + HYPRE_ParCSRParaSailsDestroy(smoother[i]); } } else if (hypre_ParAMGDataSmoothType(amg_data) == 9) { for (i=0; i < smooth_num_levels; i++) - { - HYPRE_EuclidDestroy(smoother[i]); + { + HYPRE_EuclidDestroy(smoother[i]); } } else if (hypre_ParAMGDataSmoothType(amg_data) == 6) { for (i=0; i < smooth_num_levels; i++) - { - HYPRE_SchwarzDestroy(smoother[i]); + { + HYPRE_SchwarzDestroy(smoother[i]); } } hypre_TFree(hypre_ParAMGDataSmoother(amg_data), HYPRE_MEMORY_HOST); @@ -694,7 +714,7 @@ if (hypre_ParAMGInterpVecVariant(amg_data) > 0 - && hypre_ParAMGNumInterpVectors(amg_data) > 0) + && hypre_ParAMGNumInterpVectors(amg_data) > 0) { HYPRE_Int j; @@ -729,27 +749,28 @@ hypre_ParVectorDestroy(hypre_ParAMGDataFCoarse(amg_data)); /* destroy Cpoint_keep data */ - if(hypre_ParAMGDataCPointKeepMarkerArray(amg_data)) + if (hypre_ParAMGDataCPointKeepMarkerArray(amg_data)) { - for(i=0; i1: AIR-2 + * 2: AIR-2 + * 15: a special version of AIR-2 with less communication cost + * k(k>=3,k!=15): Neumann AIR of degree k-3 */ if (restr_par < 0) { @@ -790,6 +813,40 @@ } HYPRE_Int +hypre_BoomerAMGSetIsTriangular(void *data, + HYPRE_Int is_triangular ) +{ + hypre_ParAMGData *amg_data = (hypre_ParAMGData*) data; + + if (!amg_data) + { + hypre_error_in_arg(1); + return hypre_error_flag; + } + + hypre_ParAMGDataIsTriangular(amg_data) = is_triangular; + + return hypre_error_flag; +} + +HYPRE_Int +hypre_BoomerAMGSetGMRESSwitchR(void *data, + HYPRE_Int gmres_switch ) +{ + hypre_ParAMGData *amg_data = (hypre_ParAMGData*) data; + + if (!amg_data) + { + hypre_error_in_arg(1); + return hypre_error_flag; + } + + hypre_ParAMGDataGMRESSwitchR(amg_data) = gmres_switch; + + return hypre_error_flag; +} + +HYPRE_Int hypre_BoomerAMGSetMaxLevels( void *data, HYPRE_Int max_levels ) { @@ -827,7 +884,7 @@ { outer_wt = hypre_ParAMGDataOuterWt(amg_data); omega = hypre_TReAlloc(omega, HYPRE_Real, max_levels, HYPRE_MEMORY_HOST); - for(i=old_max_levels; i < max_levels; i++) + for (i=old_max_levels; i < max_levels; i++) omega[i] = outer_wt; hypre_ParAMGDataOmega(amg_data) = omega; } @@ -836,7 +893,7 @@ { nongalerkin_tol = hypre_ParAMGDataNonGalerkinTol(amg_data); nongal_tol_array = hypre_TReAlloc(nongal_tol_array, HYPRE_Real, max_levels, HYPRE_MEMORY_HOST); - for(i=old_max_levels; i < max_levels; i++) + for (i=old_max_levels; i < max_levels; i++) nongal_tol_array[i] = nongalerkin_tol; hypre_ParAMGDataNonGalTolArray(amg_data) = nongal_tol_array; } @@ -1064,6 +1121,103 @@ } HYPRE_Int +hypre_BoomerAMGSetStrongThresholdR( void *data, + HYPRE_Real strong_threshold ) +{ + hypre_ParAMGData *amg_data = (hypre_ParAMGData*) data; + + if (!amg_data) + { + hypre_error_in_arg(1); + return hypre_error_flag; + } + + if (strong_threshold < 0 || strong_threshold > 1) + { + hypre_error_in_arg(2); + return hypre_error_flag; + } + + hypre_ParAMGDataStrongThresholdR(amg_data) = strong_threshold; + + return hypre_error_flag; +} + +HYPRE_Int +hypre_BoomerAMGGetStrongThresholdR( void *data, + HYPRE_Real *strong_threshold ) +{ + hypre_ParAMGData *amg_data = (hypre_ParAMGData*) data; + + if (!amg_data) + { + hypre_error_in_arg(1); + return hypre_error_flag; + } + + *strong_threshold = hypre_ParAMGDataStrongThresholdR(amg_data); + + return hypre_error_flag; +} + +HYPRE_Int +hypre_BoomerAMGSetFilterThresholdR( void *data, + HYPRE_Real filter_threshold ) +{ + hypre_ParAMGData *amg_data = (hypre_ParAMGData*) data; + + if (!amg_data) + { + hypre_error_in_arg(1); + return hypre_error_flag; + } + + if (filter_threshold < 0 || filter_threshold > 1) + { + hypre_error_in_arg(2); + return hypre_error_flag; + } + + hypre_ParAMGDataFilterThresholdR(amg_data) = filter_threshold; + + return hypre_error_flag; +} + +HYPRE_Int +hypre_BoomerAMGGetFilterThresholdR( void *data, + HYPRE_Real *filter_threshold ) +{ + hypre_ParAMGData *amg_data = (hypre_ParAMGData*) data; + + if (!amg_data) + { + hypre_error_in_arg(1); + return hypre_error_flag; + } + + *filter_threshold = hypre_ParAMGDataFilterThresholdR(amg_data); + + return hypre_error_flag; +} + +HYPRE_Int +hypre_BoomerAMGSetSabs( void *data, + HYPRE_Int Sabs ) +{ + hypre_ParAMGData *amg_data = (hypre_ParAMGData*) data; + + if (!amg_data) + { + hypre_error_in_arg(1); + return hypre_error_flag; + } + + hypre_ParAMGDataSabs(amg_data) = Sabs != 0; + + return hypre_error_flag; +} + +HYPRE_Int hypre_BoomerAMGSetMaxRowSum( void *data, HYPRE_Real max_row_sum ) { @@ -1573,6 +1727,40 @@ } HYPRE_Int +hypre_BoomerAMGSetFCycle( void *data, + HYPRE_Int fcycle ) +{ + hypre_ParAMGData *amg_data = (hypre_ParAMGData*) data; + + if (!amg_data) + { + hypre_error_in_arg(1); + return hypre_error_flag; + } + + hypre_ParAMGDataFCycle(amg_data) = fcycle != 0; + + return hypre_error_flag; +} + +HYPRE_Int +hypre_BoomerAMGGetFCycle( void *data, + HYPRE_Int *fcycle ) +{ + hypre_ParAMGData *amg_data = (hypre_ParAMGData*) data; + + if (!amg_data) + { + hypre_error_in_arg(1); + return hypre_error_flag; + } + + *fcycle = hypre_ParAMGDataFCycle(amg_data); + + return hypre_error_flag; +} + +HYPRE_Int hypre_BoomerAMGSetConvergeType( void *data, HYPRE_Int type ) { @@ -1723,7 +1911,7 @@ { num_grid_sweeps = hypre_CTAlloc(HYPRE_Int, 4, HYPRE_MEMORY_HOST); for (i=0; i < 4; i++) - num_grid_sweeps[i] = 1; + num_grid_sweeps[i] = 1; hypre_ParAMGDataNumGridSweeps(amg_data) = num_grid_sweeps; } @@ -1863,14 +2051,18 @@ { grid_relax_type = hypre_CTAlloc(HYPRE_Int, 4, HYPRE_MEMORY_HOST); for (i=0; i < 3; i++) + { grid_relax_type[i] = 3; + } grid_relax_type[3] = 9; hypre_ParAMGDataGridRelaxType(amg_data) = grid_relax_type; } hypre_ParAMGDataGridRelaxType(amg_data)[k] = relax_type; if (k == 3) + { hypre_ParAMGDataUserCoarseRelaxType(amg_data) = relax_type; + } return hypre_error_flag; } @@ -2456,7 +2648,7 @@ hypre_error_in_arg(1); return hypre_error_flag; } - if( strlen(print_file_name) > 256 ) + if ( strlen(print_file_name) > 256 ) { hypre_error_in_arg(2); return hypre_error_flag; @@ -2606,7 +2798,7 @@ hypre_error_in_arg(1); return hypre_error_flag; } - if( strlen(plot_file_name)>251 ) + if ( strlen(plot_file_name)>251 ) { hypre_error_in_arg(2); return hypre_error_flag; @@ -3097,6 +3289,21 @@ return hypre_error_flag; } +HYPRE_Int +hypre_BoomerAMGSetADropType( void *data, + HYPRE_Int A_drop_type ) +{ + hypre_ParAMGData *amg_data = (hypre_ParAMGData*) data; + + if (!amg_data) + { + hypre_error_in_arg(1); + return hypre_error_flag; + } + hypre_ParAMGDataADropType(amg_data) = A_drop_type; + + return hypre_error_flag; +} /*-------------------------------------------------------------------------- * Indicates which independent set algorithm is used for CR *--------------------------------------------------------------------------*/ @@ -4045,8 +4252,8 @@ } HYPRE_Int -hypre_BoomerAMGSetRAP2( void *data, - HYPRE_Int rap2) +hypre_BoomerAMGSetRAP2( void *data, + HYPRE_Int rap2 ) { hypre_ParAMGData *amg_data = (hypre_ParAMGData*) data; @@ -4056,6 +4263,16 @@ HYPRE_Int +hypre_BoomerAMGSetModuleRAP2( void *data, + HYPRE_Int mod_rap2 ) +{ + hypre_ParAMGData *amg_data = (hypre_ParAMGData*) data; + + hypre_ParAMGDataModularizedMatMat(amg_data) = mod_rap2; + return hypre_error_flag; +} + +HYPRE_Int hypre_BoomerAMGSetKeepTranspose( void *data, HYPRE_Int keepTranspose) { @@ -4065,7 +4282,7 @@ return hypre_error_flag; } -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU HYPRE_Int hypre_BoomerAMGSetDSLUThreshold( void *data, HYPRE_Int dslu_threshold) @@ -4079,73 +4296,75 @@ HYPRE_Int hypre_BoomerAMGSetCpointsToKeep(void *data, - HYPRE_Int cpt_coarse_level, - HYPRE_Int num_cpt_coarse, - HYPRE_Int *cpt_coarse_index) -{ - hypre_ParAMGData *amg_data = (hypre_ParAMGData*) data; - - HYPRE_Int **C_point_marker_array = NULL; - HYPRE_Int *C_point_marker = NULL; - HYPRE_Int cpt_level; - HYPRE_Int i; - - if (!amg_data) - { - hypre_printf("Warning! AMG object empty!\n"); - hypre_error_in_arg(1); - return hypre_error_flag; - } - if(cpt_coarse_level < 0) - { - hypre_printf("Warning! cpt_coarse_level < 0 !\n"); - hypre_error_in_arg(2); - return hypre_error_flag; - } - if(num_cpt_coarse < 0) - { - hypre_printf("Warning! num_cpt_coarse < 0 !\n"); - hypre_error_in_arg(2); - return hypre_error_flag; - } - - /* free data not previously destroyed */ - if(hypre_ParAMGDataCPointKeepLevel(amg_data)) - { - for(i=0; irestr_par) +#define hypre_ParAMGDataIsTriangular(amg_data) ((amg_data)->is_triangular) +#define hypre_ParAMGDataGMRESSwitchR(amg_data) ((amg_data)->gmres_switch) #define hypre_ParAMGDataMaxLevels(amg_data) ((amg_data)->max_levels) #define hypre_ParAMGDataStrongThreshold(amg_data) \ ((amg_data)->strong_threshold) @@ -274,13 +270,15 @@ #define hypre_ParAMGDataNumCRRelaxSteps(amg_data) ((amg_data)->num_CR_relax_steps) #define hypre_ParAMGDataCRRate(amg_data) ((amg_data)->CR_rate) #define hypre_ParAMGDataCRStrongTh(amg_data) ((amg_data)->CR_strong_th) +#define hypre_ParAMGDataADropTol(amg_data) ((amg_data)->A_drop_tol) +#define hypre_ParAMGDataADropType(amg_data) ((amg_data)->A_drop_type) #define hypre_ParAMGDataISType(amg_data) ((amg_data)->IS_type) #define hypre_ParAMGDataCRUseCG(amg_data) ((amg_data)->CR_use_CG) #define hypre_ParAMGDataL1Norms(amg_data) ((amg_data)->l1_norms) - #define hypre_ParAMGDataCGCIts(amg_data) ((amg_data)->cgc_its) - #define hypre_ParAMGDataMaxCoarseSize(amg_data) ((amg_data)->max_coarse_size) - #define hypre_ParAMGDataMinCoarseSize(amg_data) ((amg_data)->min_coarse_size) - #define hypre_ParAMGDataSeqThreshold(amg_data) ((amg_data)->seq_threshold) +#define hypre_ParAMGDataCGCIts(amg_data) ((amg_data)->cgc_its) +#define hypre_ParAMGDataMaxCoarseSize(amg_data) ((amg_data)->max_coarse_size) +#define hypre_ParAMGDataMinCoarseSize(amg_data) ((amg_data)->min_coarse_size) +#define hypre_ParAMGDataSeqThreshold(amg_data) ((amg_data)->seq_threshold) /* solve params */ @@ -324,34 +322,34 @@ #define hypre_ParAMGDataDofFuncArray(amg_data) ((amg_data)->dof_func_array) #define hypre_ParAMGDataDofPointArray(amg_data) ((amg_data)->dof_point_array) #define hypre_ParAMGDataPointDofMapArray(amg_data) \ -((amg_data)->point_dof_map_array) -#define hypre_ParAMGDataNumLevels(amg_data) ((amg_data)->num_levels) +((amg_data)->point_dof_map_array) +#define hypre_ParAMGDataNumLevels(amg_data) ((amg_data)->num_levels) #define hypre_ParAMGDataSmoothType(amg_data) ((amg_data)->smooth_type) #define hypre_ParAMGDataSmoothNumLevels(amg_data) \ ((amg_data)->smooth_num_levels) #define hypre_ParAMGDataSmoothNumSweeps(amg_data) \ -((amg_data)->smooth_num_sweeps) -#define hypre_ParAMGDataSmoother(amg_data) ((amg_data)->smoother) -#define hypre_ParAMGDataVariant(amg_data) ((amg_data)->schw_variant) -#define hypre_ParAMGDataOverlap(amg_data) ((amg_data)->schw_overlap) -#define hypre_ParAMGDataDomainType(amg_data) ((amg_data)->schw_domain_type) +((amg_data)->smooth_num_sweeps) +#define hypre_ParAMGDataSmoother(amg_data) ((amg_data)->smoother) +#define hypre_ParAMGDataVariant(amg_data) ((amg_data)->schw_variant) +#define hypre_ParAMGDataOverlap(amg_data) ((amg_data)->schw_overlap) +#define hypre_ParAMGDataDomainType(amg_data) ((amg_data)->schw_domain_type) #define hypre_ParAMGDataSchwarzRlxWeight(amg_data) \ ((amg_data)->schwarz_rlx_weight) #define hypre_ParAMGDataSchwarzUseNonSymm(amg_data) \ ((amg_data)->schwarz_use_nonsymm) -#define hypre_ParAMGDataSym(amg_data) ((amg_data)->ps_sym) -#define hypre_ParAMGDataLevel(amg_data) ((amg_data)->ps_level) +#define hypre_ParAMGDataSym(amg_data) ((amg_data)->ps_sym) +#define hypre_ParAMGDataLevel(amg_data) ((amg_data)->ps_level) #define hypre_ParAMGDataMaxNzPerRow(amg_data) ((amg_data)->pi_max_nz_per_row) -#define hypre_ParAMGDataThreshold(amg_data) ((amg_data)->ps_threshold) -#define hypre_ParAMGDataFilter(amg_data) ((amg_data)->ps_filter) -#define hypre_ParAMGDataDropTol(amg_data) ((amg_data)->pi_drop_tol) -#define hypre_ParAMGDataEuclidFile(amg_data) ((amg_data)->euclidfile) -#define hypre_ParAMGDataEuLevel(amg_data) ((amg_data)->eu_level) +#define hypre_ParAMGDataThreshold(amg_data) ((amg_data)->ps_threshold) +#define hypre_ParAMGDataFilter(amg_data) ((amg_data)->ps_filter) +#define hypre_ParAMGDataDropTol(amg_data) ((amg_data)->pi_drop_tol) +#define hypre_ParAMGDataEuclidFile(amg_data) ((amg_data)->euclidfile) +#define hypre_ParAMGDataEuLevel(amg_data) ((amg_data)->eu_level) #define hypre_ParAMGDataEuSparseA(amg_data) ((amg_data)->eu_sparse_A) #define hypre_ParAMGDataEuBJ(amg_data) ((amg_data)->eu_bj) -#define hypre_ParAMGDataMaxEigEst(amg_data) ((amg_data)->max_eig_est) -#define hypre_ParAMGDataMinEigEst(amg_data) ((amg_data)->min_eig_est) +#define hypre_ParAMGDataMaxEigEst(amg_data) ((amg_data)->max_eig_est) +#define hypre_ParAMGDataMinEigEst(amg_data) ((amg_data)->min_eig_est) #define hypre_ParAMGDataChebyEigEst(amg_data) ((amg_data)->cheby_eig_est) #define hypre_ParAMGDataChebyVariant(amg_data) ((amg_data)->cheby_variant) #define hypre_ParAMGDataChebyScale(amg_data) ((amg_data)->cheby_scale) @@ -457,13 +455,12 @@ #define hypre_ParAMGDataCPointKeepLevel(amg_data) ((amg_data)-> C_point_keep_level) #define hypre_ParAMGDataNumCPointKeep(amg_data) ((amg_data)-> num_C_point_marker) -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU /* Parameters and data for SuperLU_Dist */ #define hypre_ParAMGDataDSLUThreshold(amg_data) ((amg_data)->dslu_threshold) #define hypre_ParAMGDataDSLUSolver(amg_data) ((amg_data)->dslu_solver) #endif - #endif diff -Nru hypre-2.16.0/src/parcsr_ls/par_amg_setup.c hypre-2.18.2/src/parcsr_ls/par_amg_setup.c --- hypre-2.16.0/src/parcsr_ls/par_amg_setup.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_amg_setup.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" #include "par_amg.h" @@ -30,11 +25,11 @@ HYPRE_Int hypre_BoomerAMGSetup( void *amg_vdata, - hypre_ParCSRMatrix *A, - hypre_ParVector *f, - hypre_ParVector *u ) + hypre_ParCSRMatrix *A, + hypre_ParVector *f, + hypre_ParVector *u ) { - MPI_Comm comm = hypre_ParCSRMatrixComm(A); + MPI_Comm comm = hypre_ParCSRMatrixComm(A); hypre_ParAMGData *amg_data = (hypre_ParAMGData*) amg_vdata; /* Data Structure variables */ @@ -48,44 +43,45 @@ hypre_ParVector *Ztemp = NULL; hypre_ParCSRMatrix **P_array; hypre_ParCSRMatrix **R_array; - hypre_ParVector *Residual_array; - HYPRE_Int **CF_marker_array; - HYPRE_Int **dof_func_array; - HYPRE_Int *dof_func; - HYPRE_Int *col_offd_S_to_A, *col_offd_Sabs_to_A = NULL; - HYPRE_Int *col_offd_SN_to_AN; + hypre_ParVector *Residual_array; + HYPRE_Int **CF_marker_array; + HYPRE_Int **dof_func_array; + HYPRE_Int *dof_func; + HYPRE_Int *col_offd_S_to_A, *col_offd_Sabs_to_A = NULL; + HYPRE_Int *col_offd_SN_to_AN; HYPRE_Real *relax_weight; HYPRE_Real *omega; HYPRE_Real schwarz_relax_wt = 1; HYPRE_Real strong_threshold; + HYPRE_Int useSabs; HYPRE_Real CR_strong_th; HYPRE_Real max_row_sum; HYPRE_Real trunc_factor, jacobi_trunc_threshold; HYPRE_Real agg_trunc_factor, agg_P12_trunc_factor; HYPRE_Real S_commpkg_switch; - HYPRE_Real CR_rate; - HYPRE_Int relax_order; - HYPRE_Int max_levels; - HYPRE_Int amg_logging; - HYPRE_Int amg_print_level; - HYPRE_Int debug_flag; - HYPRE_Int dbg_flg; - HYPRE_Int local_num_vars; - HYPRE_Int P_max_elmts; - HYPRE_Int agg_P_max_elmts; - HYPRE_Int agg_P12_max_elmts; - HYPRE_Int IS_type; - HYPRE_Int num_CR_relax_steps; - HYPRE_Int CR_use_CG; - HYPRE_Int cgc_its; /* BM Aug 25, 2006 */ - HYPRE_Int mult_additive = hypre_ParAMGDataMultAdditive(amg_data); - HYPRE_Int additive = hypre_ParAMGDataAdditive(amg_data); - HYPRE_Int simple = hypre_ParAMGDataSimple(amg_data); - HYPRE_Int add_last_lvl = hypre_ParAMGDataAddLastLvl(amg_data); - HYPRE_Int add_P_max_elmts = hypre_ParAMGDataMultAddPMaxElmts(amg_data); - HYPRE_Real add_trunc_factor = hypre_ParAMGDataMultAddTruncFactor(amg_data); - HYPRE_Int add_rlx = hypre_ParAMGDataAddRelaxType(amg_data); - HYPRE_Real add_rlx_wt = hypre_ParAMGDataAddRelaxWt(amg_data); + HYPRE_Real CR_rate; + HYPRE_Int relax_order; + HYPRE_Int max_levels; + HYPRE_Int amg_logging; + HYPRE_Int amg_print_level; + HYPRE_Int debug_flag; + HYPRE_Int dbg_flg; + HYPRE_Int local_num_vars; + HYPRE_Int P_max_elmts; + HYPRE_Int agg_P_max_elmts; + HYPRE_Int agg_P12_max_elmts; + HYPRE_Int IS_type; + HYPRE_Int num_CR_relax_steps; + HYPRE_Int CR_use_CG; + HYPRE_Int cgc_its; /* BM Aug 25, 2006 */ + HYPRE_Int mult_additive = hypre_ParAMGDataMultAdditive(amg_data); + HYPRE_Int additive = hypre_ParAMGDataAdditive(amg_data); + HYPRE_Int simple = hypre_ParAMGDataSimple(amg_data); + HYPRE_Int add_last_lvl = hypre_ParAMGDataAddLastLvl(amg_data); + HYPRE_Int add_P_max_elmts = hypre_ParAMGDataMultAddPMaxElmts(amg_data); + HYPRE_Real add_trunc_factor = hypre_ParAMGDataMultAddTruncFactor(amg_data); + HYPRE_Int add_rlx = hypre_ParAMGDataAddRelaxType(amg_data); + HYPRE_Real add_rlx_wt = hypre_ParAMGDataAddRelaxWt(amg_data); hypre_ParCSRBlockMatrix **A_block_array, **P_block_array, **R_block_array; @@ -119,7 +115,7 @@ HYPRE_Int setup_type; HYPRE_BigInt fine_size; HYPRE_Int rest, tms, indx; - HYPRE_Real size; + HYPRE_Real size; HYPRE_Int not_finished_coarsening = 1; HYPRE_Int coarse_threshold = hypre_ParAMGDataMaxCoarseSize(amg_data); HYPRE_Int min_coarse_size = hypre_ParAMGDataMinCoarseSize(amg_data); @@ -135,26 +131,26 @@ HYPRE_Int agg_num_levels = hypre_ParAMGDataAggNumLevels(amg_data); HYPRE_Int agg_interp_type = hypre_ParAMGDataAggInterpType(amg_data); HYPRE_Int sep_weight = hypre_ParAMGDataSepWeight(amg_data); - HYPRE_Int *coarse_dof_func = NULL; - HYPRE_BigInt *coarse_pnts_global; - HYPRE_BigInt *coarse_pnts_global1; + HYPRE_Int *coarse_dof_func = NULL; + HYPRE_BigInt *coarse_pnts_global; + HYPRE_BigInt *coarse_pnts_global1; HYPRE_Int num_cg_sweeps; HYPRE_Real *max_eig_est = NULL; HYPRE_Real *min_eig_est = NULL; HYPRE_Solver *smoother = NULL; - HYPRE_Int smooth_type = hypre_ParAMGDataSmoothType(amg_data); - HYPRE_Int smooth_num_levels = hypre_ParAMGDataSmoothNumLevels(amg_data); - HYPRE_Int sym; - HYPRE_Int nlevel; + HYPRE_Int smooth_type = hypre_ParAMGDataSmoothType(amg_data); + HYPRE_Int smooth_num_levels = hypre_ParAMGDataSmoothNumLevels(amg_data); + HYPRE_Int sym; + HYPRE_Int nlevel; HYPRE_Real thresh; HYPRE_Real filter; HYPRE_Real drop_tol; - HYPRE_Int max_nz_per_row; - char *euclidfile; - HYPRE_Int eu_level; - HYPRE_Int eu_bj; + HYPRE_Int max_nz_per_row; + char *euclidfile; + HYPRE_Int eu_level; + HYPRE_Int eu_bj; HYPRE_Real eu_sparse_A; HYPRE_Int interp_type, restri_type; @@ -200,11 +196,12 @@ HYPRE_Real wall_time; /* for debugging instrumentation */ HYPRE_Int add_end; -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU HYPRE_Int dslu_threshold = hypre_ParAMGDataDSLUThreshold(amg_data); #endif -#if defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) +#if defined(HYPRE_USING_CUDA) && defined(HYPRE_USING_UNIFIED_MEMORY) +#if 0 if ( hypre_ParAMGDataPrintLevel(amg_data) > 3 ) { if (!hypre_ParCSRMatrixIsManaged(A)) @@ -223,6 +220,7 @@ } } #endif +#endif /*hypre_CSRMatrix *A_new;*/ @@ -486,18 +484,25 @@ if (hypre_ParAMGDataAMat(amg_data)) { - hypre_TFree(hypre_ParAMGDataAMat(amg_data), HYPRE_MEMORY_HOST); - hypre_ParAMGDataAMat(amg_data) = NULL; + hypre_TFree(hypre_ParAMGDataAMat(amg_data), HYPRE_MEMORY_HOST); + hypre_ParAMGDataAMat(amg_data) = NULL; + } + + if (hypre_ParAMGDataAInv(amg_data)) + { + hypre_TFree(hypre_ParAMGDataAInv(amg_data), HYPRE_MEMORY_HOST); + hypre_ParAMGDataAInv(amg_data) = NULL; } + if (hypre_ParAMGDataBVec(amg_data)) { - hypre_TFree(hypre_ParAMGDataBVec(amg_data), HYPRE_MEMORY_HOST); - hypre_ParAMGDataBVec(amg_data) = NULL; + hypre_TFree(hypre_ParAMGDataBVec(amg_data), HYPRE_MEMORY_HOST); + hypre_ParAMGDataBVec(amg_data) = NULL; } if (hypre_ParAMGDataCommInfo(amg_data)) { - hypre_TFree(hypre_ParAMGDataCommInfo(amg_data), HYPRE_MEMORY_HOST); - hypre_ParAMGDataCommInfo(amg_data) = NULL; + hypre_TFree(hypre_ParAMGDataCommInfo(amg_data), HYPRE_MEMORY_HOST); + hypre_ParAMGDataCommInfo(amg_data) = NULL; } if (new_comm != hypre_MPI_COMM_NULL) @@ -539,7 +544,7 @@ { if (smoother[i]) { - HYPRE_ParCSRPilutDestroy(smoother[i]); + HYPRE_ParCSRPilutDestroy(smoother[i]); smoother[i] = NULL; } } @@ -658,8 +663,8 @@ if (block_mode) { - A_block_array[0] = hypre_ParCSRBlockMatrixConvertFromParCSRMatrix( - A_array[0], num_functions); + A_block_array[0] = hypre_ParCSRBlockMatrixConvertFromParCSRMatrix(A_array[0], + num_functions); hypre_ParCSRBlockMatrixSetNumNonzeros(A_block_array[0]); hypre_ParCSRBlockMatrixSetDNumNonzeros(A_block_array[0]); } @@ -710,9 +715,9 @@ hypre_ParVectorSetPartitioningOwner(Vtemp,0); hypre_ParAMGDataVtemp(amg_data) = Vtemp; - if ((smooth_num_levels > 0 && smooth_type > 9) - || relax_weight[0] < 0 || omega[0] < 0 || - hypre_ParAMGDataSchwarzRlxWeight(amg_data) < 0) + if ( (smooth_num_levels > 0 && smooth_type > 9) || + relax_weight[0] < 0 || omega[0] < 0 || + hypre_ParAMGDataSchwarzRlxWeight(amg_data) < 0 ) { Ptemp = hypre_ParVectorCreate(hypre_ParCSRMatrixComm(A_array[0]), hypre_ParCSRMatrixGlobalNumRows(A_array[0]), @@ -729,9 +734,9 @@ } /* See if we need the Ztemp vector */ - if ((smooth_num_levels > 0 && smooth_type > 6) - || relax_weight[0] < 0 || omega[0] < 0 || - hypre_ParAMGDataSchwarzRlxWeight(amg_data) < 0) + if ( (smooth_num_levels > 0 && smooth_type > 6) || + relax_weight[0] < 0 || omega[0] < 0 || + hypre_ParAMGDataSchwarzRlxWeight(amg_data) < 0 ) { Ztemp = hypre_ParVectorCreate(hypre_ParCSRMatrixComm(A_array[0]), hypre_ParCSRMatrixGlobalNumRows(A_array[0]), @@ -812,6 +817,7 @@ level = 0; strong_threshold = hypre_ParAMGDataStrongThreshold(amg_data); + useSabs = hypre_ParAMGDataSabs(amg_data); CR_strong_th = hypre_ParAMGDataCRStrongTh(amg_data); max_row_sum = hypre_ParAMGDataMaxRowSum(amg_data); trunc_factor = hypre_ParAMGDataTruncFactor(amg_data); @@ -843,7 +849,7 @@ if (block_mode) { - fine_size = hypre_ParCSRBlockMatrixGlobalNumRows(A_block_array[level]); + fine_size = hypre_ParCSRBlockMatrixGlobalNumRows(A_block_array[level]); } else { @@ -904,15 +910,15 @@ if ( max_levels == 1) { - S = NULL; - coarse_pnts_global = NULL; + S = NULL; + coarse_pnts_global = NULL; CF_marker = hypre_CTAlloc(HYPRE_Int, local_size , HYPRE_MEMORY_HOST); - for (i=0; i < local_size ; i++) - CF_marker[i] = 1; + for (i=0; i < local_size ; i++) + CF_marker[i] = 1; /* AB removed below - already allocated */ /* CF_marker_array = hypre_CTAlloc(HYPRE_Int*, 1);*/ - CF_marker_array[level] = CF_marker; - coarse_size = fine_size; + CF_marker_array[level] = CF_marker; + coarse_size = fine_size; } else /* max_levels > 1 */ { @@ -926,24 +932,24 @@ local_num_vars = hypre_CSRMatrixNumRows(hypre_ParCSRMatrixDiag(A_array[level])); } - if (hypre_ParAMGDataGSMG(amg_data) || + if (hypre_ParAMGDataGSMG(amg_data) || hypre_ParAMGDataInterpType(amg_data) == 1) { - hypre_BoomerAMGCreateSmoothVecs(amg_data, A_array[level], - hypre_ParAMGDataNumGridSweeps(amg_data)[1], - level, &SmoothVecs); + hypre_BoomerAMGCreateSmoothVecs(amg_data, A_array[level], + hypre_ParAMGDataNumGridSweeps(amg_data)[1], + level, &SmoothVecs); } /**** Get the Strength Matrix ****/ if (hypre_ParAMGDataGSMG(amg_data) == 0) - { - if (nodal) /* if we are solving systems and + { + if (nodal) /* if we are solving systems and not using the unknown approach then we need to convert A to a nodal matrix - values that represent the blocks - before getting the strength matrix*/ - { + { if (block_mode) { @@ -962,68 +968,83 @@ /* first: positive and negative entries */ if (nodal == 3 || nodal == 6 || nodal_diag > 0) hypre_BoomerAMGCreateS(AN, strong_threshold, max_row_sum, - 1, NULL,&SN); + 1, NULL,&SN); else /* all entries are positive */ - hypre_BoomerAMGCreateSabs(AN, strong_threshold, max_row_sum, - 1, NULL,&SN); + hypre_BoomerAMGCreateSabs(AN, strong_threshold, max_row_sum, + 1, NULL,&SN); col_offd_S_to_A = NULL; - col_offd_SN_to_AN = NULL; - if (strong_threshold > S_commpkg_switch) - hypre_BoomerAMGCreateSCommPkg(AN,SN,&col_offd_SN_to_AN); - } - else /* standard AMG or unknown approach */ - { - hypre_BoomerAMGCreateS(A_array[level], - strong_threshold, max_row_sum, - num_functions, dof_func_array[level],&S); - - col_offd_S_to_A = NULL; - if (strong_threshold > S_commpkg_switch) - hypre_BoomerAMGCreateSCommPkg(A_array[level],S, - &col_offd_S_to_A); - } + col_offd_SN_to_AN = NULL; + if (strong_threshold > S_commpkg_switch) + { + hypre_BoomerAMGCreateSCommPkg(AN, SN, &col_offd_SN_to_AN); + } + } + else /* standard AMG or unknown approach */ + { + if (!useSabs) + { + hypre_BoomerAMGCreateS(A_array[level], strong_threshold, max_row_sum, + num_functions, dof_func_array[level], &S); + } + else + { + /* + hypre_BoomerAMGCreateSabs(A_array[level], strong_threshold, max_row_sum, + num_functions, dof_func_array[level], &S); + */ + hypre_BoomerAMGCreateSabs(A_array[level], strong_threshold, 1.0, + 1, NULL, &S); + } + col_offd_S_to_A = NULL; + if (strong_threshold > S_commpkg_switch) + { + hypre_BoomerAMGCreateSCommPkg(A_array[level], S, &col_offd_S_to_A); + } + } - /* for AIR, need absolute value SOC */ + /* for AIR, need absolute value SOC: use a different threshold */ if (restri_type) { - hypre_BoomerAMGCreateSabs(A_array[level], strong_threshold, 1.0, - num_functions, dof_func_array[level], &Sabs); + HYPRE_Real strong_thresholdR; + strong_thresholdR = hypre_ParAMGDataStrongThresholdR(amg_data); + hypre_BoomerAMGCreateSabs(A_array[level], strong_thresholdR, 1.0, + 1, NULL, &Sabs); - col_offd_Sabs_to_A = NULL; - if (strong_threshold > S_commpkg_switch) + col_offd_Sabs_to_A = NULL; + if (strong_thresholdR > S_commpkg_switch) { hypre_BoomerAMGCreateSCommPkg(A_array[level], Sabs, &col_offd_Sabs_to_A); } } - } - else - { - hypre_BoomerAMGCreateSmoothDirs(amg_data, A_array[level], - SmoothVecs, strong_threshold, - num_functions, dof_func_array[level], &S); - } + } + else + { + hypre_BoomerAMGCreateSmoothDirs(amg_data, A_array[level], + SmoothVecs, strong_threshold, + num_functions, dof_func_array[level], &S); + } /**** Do the appropriate coarsening ****/ if (nodal == 0) /* no nodal coarsening */ { - if (coarsen_type == 6) + if (coarsen_type == 6) hypre_BoomerAMGCoarsenFalgout(S, A_array[level], measure_type, debug_flag, &CF_marker); - else if (coarsen_type == 7) + else if (coarsen_type == 7) hypre_BoomerAMGCoarsen(S, A_array[level], 2, debug_flag, &CF_marker); - else if (coarsen_type == 8) + else if (coarsen_type == 8) hypre_BoomerAMGCoarsenPMIS(S, A_array[level], 0, debug_flag, &CF_marker); - else if (coarsen_type == 9) + else if (coarsen_type == 9) hypre_BoomerAMGCoarsenPMIS(S, A_array[level], 2, debug_flag, &CF_marker); - else if (coarsen_type == 10) + else if (coarsen_type == 10) hypre_BoomerAMGCoarsenHMIS(S, A_array[level], measure_type, debug_flag, &CF_marker); else if (coarsen_type == 21 || coarsen_type == 22) @@ -1037,69 +1058,82 @@ } else if (coarsen_type == 98) hypre_BoomerAMGCoarsenCR1(A_array[level], &CF_marker, - &coarse_size, - num_CR_relax_steps, IS_type, 0); - else if (coarsen_type == 99) - { - hypre_BoomerAMGCreateS(A_array[level], - CR_strong_th, 1, - num_functions, dof_func_array[level],&SCR); - hypre_BoomerAMGCoarsenCR(A_array[level], &CF_marker, - &coarse_size, - num_CR_relax_steps, IS_type, 1, grid_relax_type[0], - relax_weight[level], omega[level], CR_rate, - NULL,NULL,CR_use_CG,SCR); - hypre_ParCSRMatrixDestroy(SCR); - } - else if (coarsen_type == 999) { - /* RL_DEBUG: read C/F splitting from files */ - /* read from file */ - HYPRE_Int my_id; - MPI_Comm comm = hypre_ParCSRMatrixComm(A_array[level]); - hypre_MPI_Comm_rank(comm, &my_id); - HYPRE_Int first_local_row = hypre_ParCSRMatrixFirstRowIndex(A_array[level]); - HYPRE_Int local_size = hypre_CSRMatrixNumRows(hypre_ParCSRMatrixDiag(A_array[level])); - char CFfile[256], line[1024]; - hypre_sprintf(CFfile, "CF_%d.txt", level); - hypre_printf("myid %d: level %d, read C/F from file %s, first_row %d, local_size %d\n", - my_id, level, CFfile, first_local_row, local_size); - CF_marker = hypre_CTAlloc(HYPRE_Int, local_size, HYPRE_MEMORY_HOST); - FILE *fp; - if ((fp = fopen(CFfile, "r")) == NULL) { - hypre_printf("cannot open file %s\n", CFfile); - exit(0); - } - HYPRE_Int i; - for (i=0; i 0) { - if (coarsen_type == 6) + if (coarsen_type == 6) hypre_BoomerAMGCoarsenFalgout(SN, SN, measure_type, debug_flag, &CFN_marker); - else if (coarsen_type == 7) + else if (coarsen_type == 7) hypre_BoomerAMGCoarsen(SN, SN, 2, debug_flag, &CFN_marker); - else if (coarsen_type == 8) + else if (coarsen_type == 8) hypre_BoomerAMGCoarsenPMIS(SN, SN, 0, debug_flag, &CFN_marker); - else if (coarsen_type == 9) + else if (coarsen_type == 9) hypre_BoomerAMGCoarsenPMIS(SN, SN, 2, debug_flag, &CFN_marker); - else if (coarsen_type == 10) + else if (coarsen_type == 10) hypre_BoomerAMGCoarsenHMIS(SN, SN, measure_type, debug_flag, &CFN_marker); - else if (coarsen_type == 21 || coarsen_type == 22) + else if (coarsen_type == 21 || coarsen_type == 22) hypre_BoomerAMGCoarsenCGCb(SN, SN, measure_type, - coarsen_type, cgc_its, debug_flag, &CFN_marker); - else if (coarsen_type) - hypre_BoomerAMGCoarsenRuge(SN, SN, - measure_type, coarsen_type, debug_flag, &CFN_marker); - else - hypre_BoomerAMGCoarsen(SN, SN, 0, + coarsen_type, cgc_its, debug_flag, &CFN_marker); + else if (coarsen_type) + hypre_BoomerAMGCoarsenRuge(SN, SN, + measure_type, coarsen_type, debug_flag, &CFN_marker); + else + hypre_BoomerAMGCoarsen(SN, SN, 0, debug_flag, &CFN_marker); - if (level < agg_num_levels) - { + if (level < agg_num_levels) + { hypre_BoomerAMGCoarseParms(comm, local_num_vars/num_functions, - 1, dof_func_array[level], CFN_marker, - &coarse_dof_func,&coarse_pnts_global1); - hypre_BoomerAMGCreate2ndS (SN, CFN_marker, num_paths, - coarse_pnts_global1, &S2); + 1, dof_func_array[level], CFN_marker, + &coarse_dof_func,&coarse_pnts_global1); + hypre_BoomerAMGCreate2ndS(SN, CFN_marker, num_paths, + coarse_pnts_global1, &S2); if (coarsen_type == 10) hypre_BoomerAMGCoarsenHMIS(S2, S2, measure_type+3, - debug_flag, &CF2_marker); + debug_flag, &CF2_marker); else if (coarsen_type == 8) - hypre_BoomerAMGCoarsenPMIS(S2, S2, 3, - debug_flag, &CF2_marker); + hypre_BoomerAMGCoarsenPMIS(S2, S2, 3, + debug_flag, &CF2_marker); else if (coarsen_type == 9) - hypre_BoomerAMGCoarsenPMIS(S2, S2, 4, - debug_flag, &CF2_marker); + hypre_BoomerAMGCoarsenPMIS(S2, S2, 4, + debug_flag, &CF2_marker); else if (coarsen_type == 6) hypre_BoomerAMGCoarsenFalgout(S2, S2, measure_type, - debug_flag, &CF2_marker); + debug_flag, &CF2_marker); else if (coarsen_type == 21 || coarsen_type == 22) hypre_BoomerAMGCoarsenCGCb(S2, S2, measure_type, - coarsen_type, cgc_its, debug_flag, &CF2_marker); + coarsen_type, cgc_its, debug_flag, &CF2_marker); else if (coarsen_type == 7) hypre_BoomerAMGCoarsen(S2, S2, 2, debug_flag, &CF2_marker); else if (coarsen_type) hypre_BoomerAMGCoarsenRuge(S2, S2, measure_type, coarsen_type, - debug_flag, &CF2_marker); + debug_flag, &CF2_marker); else hypre_BoomerAMGCoarsen(S2, S2, 0, debug_flag, &CF2_marker); hypre_ParCSRMatrixDestroy(S2); S2 = NULL; - } - else - { - col_offd_S_to_A = NULL; - /* hypre_BoomerAMGCreateScalarCFS(A_array[level], - SN, CFN_marker, col_offd_SN_to_AN, - num_functions, nodal, 0, NULL, &CF_marker, - &col_offd_S_to_A, &S); */ - - hypre_BoomerAMGCreateScalarCFS( - SN, CFN_marker, col_offd_SN_to_AN, - num_functions, nodal, 0, NULL, &CF_marker, - &col_offd_S_to_A, &S); - if (col_offd_SN_to_AN == NULL) - col_offd_S_to_A = NULL; - hypre_TFree(CFN_marker, HYPRE_MEMORY_HOST); - hypre_TFree(col_offd_SN_to_AN, HYPRE_MEMORY_HOST); - hypre_ParCSRMatrixDestroy(SN); - SN = NULL; - hypre_ParCSRMatrixDestroy(AN); - AN = NULL; - } + } + else + { + col_offd_S_to_A = NULL; + /* hypre_BoomerAMGCreateScalarCFS(A_array[level], + SN, CFN_marker, col_offd_SN_to_AN, + num_functions, nodal, 0, NULL, &CF_marker, + &col_offd_S_to_A, &S); */ + + hypre_BoomerAMGCreateScalarCFS(SN, CFN_marker, col_offd_SN_to_AN, + num_functions, nodal, 0, NULL, &CF_marker, + &col_offd_S_to_A, &S); + if (col_offd_SN_to_AN == NULL) + { + col_offd_S_to_A = NULL; + } + hypre_TFree(CFN_marker, HYPRE_MEMORY_HOST); + hypre_TFree(col_offd_SN_to_AN, HYPRE_MEMORY_HOST); + hypre_ParCSRMatrixDestroy(SN); + SN = NULL; + hypre_ParCSRMatrixDestroy(AN); + AN = NULL; + } } /**************************************************/ @@ -1304,7 +1343,7 @@ /*****xxxxxxxxxxxxx changes for min_coarse_size */ /* here we will determine the coarse grid size to be able to determine if it is not smaller - than requested minimal size */ + than requested minimal size */ if (level >= agg_num_levels) { if (block_mode ) @@ -1394,73 +1433,95 @@ { if (nodal == 0) { - if (agg_interp_type == 1) - hypre_BoomerAMGBuildExtPIInterp(A_array[level], - CF_marker, S, coarse_pnts_global1, - num_functions, dof_func_array[level], debug_flag, - agg_P12_trunc_factor, agg_P12_max_elmts, col_offd_S_to_A, &P1); - else if (agg_interp_type == 2) + if (agg_interp_type == 1) + { + hypre_BoomerAMGBuildExtPIInterp(A_array[level], + CF_marker, S, coarse_pnts_global1, + num_functions, dof_func_array[level], debug_flag, + agg_P12_trunc_factor, agg_P12_max_elmts, col_offd_S_to_A, &P1); + } + else if (agg_interp_type == 2) + { hypre_BoomerAMGBuildStdInterp(A_array[level], - CF_marker, S, coarse_pnts_global1, - num_functions, dof_func_array[level], debug_flag, - agg_P12_trunc_factor, agg_P12_max_elmts, 0, col_offd_S_to_A, &P1); - else if (agg_interp_type == 3) + CF_marker, S, coarse_pnts_global1, + num_functions, dof_func_array[level], debug_flag, + agg_P12_trunc_factor, agg_P12_max_elmts, 0, col_offd_S_to_A, &P1); + } + else if (agg_interp_type == 3) + { hypre_BoomerAMGBuildExtInterp(A_array[level], - CF_marker, S, coarse_pnts_global1, - num_functions, dof_func_array[level], debug_flag, - agg_P12_trunc_factor, agg_P12_max_elmts, col_offd_S_to_A, &P1); + CF_marker, S, coarse_pnts_global1, + num_functions, dof_func_array[level], debug_flag, + agg_P12_trunc_factor, agg_P12_max_elmts, col_offd_S_to_A, &P1); + } + if (agg_interp_type == 4) { hypre_BoomerAMGCorrectCFMarker (CF_marker, local_num_vars, - CFN_marker); + CFN_marker); hypre_TFree(coarse_pnts_global1, HYPRE_MEMORY_HOST); /*hypre_TFree(coarse_dof_func); coarse_dof_func = NULL;*/ hypre_TFree(CFN_marker, HYPRE_MEMORY_HOST); hypre_BoomerAMGCoarseParms(comm, local_num_vars, - num_functions, dof_func_array[level], CF_marker, - &coarse_dof_func,&coarse_pnts_global); + num_functions, dof_func_array[level], CF_marker, + &coarse_dof_func,&coarse_pnts_global); hypre_BoomerAMGBuildMultipass(A_array[level], - CF_marker, S, coarse_pnts_global, - num_functions, dof_func_array[level], debug_flag, - agg_trunc_factor, agg_P_max_elmts, sep_weight, - col_offd_S_to_A, &P); + CF_marker, S, coarse_pnts_global, + num_functions, dof_func_array[level], debug_flag, + agg_trunc_factor, agg_P_max_elmts, sep_weight, + col_offd_S_to_A, &P); } else { hypre_BoomerAMGCorrectCFMarker2 (CF_marker, local_num_vars, - CFN_marker); + CFN_marker); hypre_TFree(CFN_marker, HYPRE_MEMORY_HOST); /*hypre_TFree(coarse_dof_func); coarse_dof_func = NULL;*/ hypre_BoomerAMGCoarseParms(comm, local_num_vars, - num_functions, dof_func_array[level], CF_marker, - &coarse_dof_func,&coarse_pnts_global); + num_functions, dof_func_array[level], CF_marker, + &coarse_dof_func,&coarse_pnts_global); /*if (num_functions > 1 && nodal > -1 && (!block_mode) ) dof_func_array[level+1] = coarse_dof_func;*/ - hypre_TFree(col_offd_S_to_A, HYPRE_MEMORY_HOST); + hypre_TFree(col_offd_S_to_A, HYPRE_MEMORY_HOST); if (agg_interp_type == 1) - hypre_BoomerAMGBuildPartialExtPIInterp(A_array[level], - CF_marker, S, coarse_pnts_global, - coarse_pnts_global1, num_functions, - dof_func_array[level], debug_flag, agg_P12_trunc_factor, - agg_P12_max_elmts, col_offd_S_to_A, &P2); + { + hypre_BoomerAMGBuildPartialExtPIInterp(A_array[level], + CF_marker, S, coarse_pnts_global, + coarse_pnts_global1, num_functions, + dof_func_array[level], debug_flag, agg_P12_trunc_factor, + agg_P12_max_elmts, col_offd_S_to_A, &P2); + } else if (agg_interp_type == 2) - hypre_BoomerAMGBuildPartialStdInterp(A_array[level], - CF_marker, S, coarse_pnts_global, - coarse_pnts_global1, num_functions, - dof_func_array[level], debug_flag, agg_P12_trunc_factor, - agg_P12_max_elmts, sep_weight, col_offd_S_to_A, &P2); + { + hypre_BoomerAMGBuildPartialStdInterp(A_array[level], + CF_marker, S, coarse_pnts_global, + coarse_pnts_global1, num_functions, + dof_func_array[level], debug_flag, agg_P12_trunc_factor, + agg_P12_max_elmts, sep_weight, col_offd_S_to_A, &P2); + } else if (agg_interp_type == 3) - hypre_BoomerAMGBuildPartialExtInterp(A_array[level], - CF_marker, S, coarse_pnts_global, - coarse_pnts_global1, num_functions, - dof_func_array[level], debug_flag, agg_P12_trunc_factor, - agg_P12_max_elmts, col_offd_S_to_A, &P2); - P = hypre_ParMatmul(P1,P2); + { + hypre_BoomerAMGBuildPartialExtInterp(A_array[level], + CF_marker, S, coarse_pnts_global, + coarse_pnts_global1, num_functions, + dof_func_array[level], debug_flag, agg_P12_trunc_factor, + agg_P12_max_elmts, col_offd_S_to_A, &P2); + } + + if (hypre_ParAMGDataModularizedMatMat(amg_data)) + { + P = hypre_ParCSRMatMat(P1, P2); + } + else + { + P = hypre_ParMatmul(P1, P2); + } + hypre_BoomerAMGInterpTruncation(P, agg_trunc_factor, - agg_P_max_elmts); - hypre_MatvecCommPkgCreate(P); + agg_P_max_elmts); + hypre_MatvecCommPkgCreate(P); hypre_ParCSRMatrixDestroy(P1); hypre_ParCSRMatrixOwnsColStarts(P2) = 0; hypre_ParCSRMatrixDestroy(P2); @@ -1471,65 +1532,66 @@ { if (agg_interp_type == 4) { - hypre_BoomerAMGCorrectCFMarker (CFN_marker, - local_num_vars/num_functions, CF2_marker); - hypre_TFree(CF2_marker, HYPRE_MEMORY_HOST); + hypre_BoomerAMGCorrectCFMarker (CFN_marker, + local_num_vars/num_functions, CF2_marker); + hypre_TFree(CF2_marker, HYPRE_MEMORY_HOST); hypre_TFree(coarse_pnts_global1, HYPRE_MEMORY_HOST); col_offd_S_to_A = NULL; + /* hypre_BoomerAMGCreateScalarCFS(A_array[level],SN, CFN_marker, - col_offd_SN_to_AN, num_functions, nodal, 0, NULL, - &CF_marker, &col_offd_S_to_A, &S); */ + col_offd_SN_to_AN, num_functions, nodal, 0, NULL, + &CF_marker, &col_offd_S_to_A, &S); */ hypre_BoomerAMGCreateScalarCFS(SN, CFN_marker, - col_offd_SN_to_AN, num_functions, nodal, 0, NULL, - &CF_marker, &col_offd_S_to_A, &S); + col_offd_SN_to_AN, num_functions, nodal, 0, NULL, + &CF_marker, &col_offd_S_to_A, &S); if (col_offd_SN_to_AN == NULL) - col_offd_S_to_A = NULL; + col_offd_S_to_A = NULL; hypre_TFree(CFN_marker, HYPRE_MEMORY_HOST); hypre_BoomerAMGCoarseParms(comm, local_num_vars, - num_functions, dof_func_array[level], CF_marker, - &coarse_dof_func,&coarse_pnts_global); + num_functions, dof_func_array[level], CF_marker, + &coarse_dof_func,&coarse_pnts_global); hypre_BoomerAMGBuildMultipass(A_array[level], - CF_marker, S, coarse_pnts_global, - num_functions, dof_func_array[level], debug_flag, - agg_trunc_factor, agg_P_max_elmts, sep_weight, - col_offd_S_to_A, &P); + CF_marker, S, coarse_pnts_global, + num_functions, dof_func_array[level], debug_flag, + agg_trunc_factor, agg_P_max_elmts, sep_weight, + col_offd_S_to_A, &P); } - else - { + else + { col_offd_S_to_A = NULL; /* hypre_BoomerAMGCreateScalarCFS(A_array[level],SN, CFN_marker, - col_offd_SN_to_AN, num_functions, nodal, 0, NULL, - &CF_marker, &col_offd_S_to_A, &S);*/ + col_offd_SN_to_AN, num_functions, nodal, 0, NULL, + &CF_marker, &col_offd_S_to_A, &S);*/ hypre_BoomerAMGCreateScalarCFS(SN, CFN_marker, - col_offd_SN_to_AN, num_functions, nodal, 0, NULL, - &CF_marker, &col_offd_S_to_A, &S); + col_offd_SN_to_AN, num_functions, nodal, 0, NULL, + &CF_marker, &col_offd_S_to_A, &S); #ifdef HYPRE_NO_GLOBAL_PARTITION for (i=0; i < 2; i++) - coarse_pnts_global1[i] *= num_functions; + coarse_pnts_global1[i] *= num_functions; #else for (i=1; i < num_procs+1; i++) - coarse_pnts_global1[i] *= num_functions; + coarse_pnts_global1[i] *= num_functions; #endif if (col_offd_SN_to_AN == NULL) - col_offd_S_to_A = NULL; - if (agg_interp_type == 1) - hypre_BoomerAMGBuildExtPIInterp(A_array[level], - CF_marker, S, coarse_pnts_global1, - num_functions, dof_func_array[level], debug_flag, - agg_P12_trunc_factor, agg_P12_max_elmts, col_offd_S_to_A, &P1); - else if (agg_interp_type == 2) + col_offd_S_to_A = NULL; + if (agg_interp_type == 1) + hypre_BoomerAMGBuildExtPIInterp(A_array[level], + CF_marker, S, coarse_pnts_global1, + num_functions, dof_func_array[level], debug_flag, + agg_P12_trunc_factor, agg_P12_max_elmts, col_offd_S_to_A, &P1); + else if (agg_interp_type == 2) hypre_BoomerAMGBuildStdInterp(A_array[level], - CF_marker, S, coarse_pnts_global1, - num_functions, dof_func_array[level], debug_flag, - agg_P12_trunc_factor, agg_P12_max_elmts, 0, col_offd_S_to_A, &P1); - else if (agg_interp_type == 3) + CF_marker, S, coarse_pnts_global1, + num_functions, dof_func_array[level], debug_flag, + agg_P12_trunc_factor, agg_P12_max_elmts, 0, col_offd_S_to_A, &P1); + else if (agg_interp_type == 3) hypre_BoomerAMGBuildExtInterp(A_array[level], - CF_marker, S, coarse_pnts_global1, - num_functions, dof_func_array[level], debug_flag, - agg_P12_trunc_factor, agg_P12_max_elmts, col_offd_S_to_A, &P1); - hypre_BoomerAMGCorrectCFMarker2 (CFN_marker, - local_num_vars/num_functions, CF2_marker); + CF_marker, S, coarse_pnts_global1, + num_functions, dof_func_array[level], debug_flag, + agg_P12_trunc_factor, agg_P12_max_elmts, col_offd_S_to_A, &P1); + hypre_BoomerAMGCorrectCFMarker2 (CFN_marker, + local_num_vars/num_functions, CF2_marker); hypre_TFree(CF2_marker, HYPRE_MEMORY_HOST); hypre_TFree(CF_marker, HYPRE_MEMORY_HOST); hypre_TFree(col_offd_S_to_A, HYPRE_MEMORY_HOST); @@ -1538,50 +1600,63 @@ CF2_marker = NULL; hypre_ParCSRMatrixDestroy(S); /* hypre_BoomerAMGCreateScalarCFS(A_array[level],SN, CFN_marker, - col_offd_SN_to_AN, num_functions, nodal, 0, NULL, - &CF_marker, &col_offd_S_to_A, &S); */ + col_offd_SN_to_AN, num_functions, nodal, 0, NULL, + &CF_marker, &col_offd_S_to_A, &S); */ hypre_BoomerAMGCreateScalarCFS(SN, CFN_marker, - col_offd_SN_to_AN, num_functions, nodal, 0, NULL, - &CF_marker, &col_offd_S_to_A, &S); + col_offd_SN_to_AN, num_functions, nodal, 0, NULL, + &CF_marker, &col_offd_S_to_A, &S); if (col_offd_SN_to_AN == NULL) - col_offd_S_to_A = NULL; + col_offd_S_to_A = NULL; hypre_TFree(CFN_marker, HYPRE_MEMORY_HOST); hypre_BoomerAMGCoarseParms(comm, local_num_vars, - num_functions, dof_func_array[level], CF_marker, - &coarse_dof_func,&coarse_pnts_global); + num_functions, dof_func_array[level], CF_marker, + &coarse_dof_func,&coarse_pnts_global); /*if (num_functions > 1 && nodal > -1 && (!block_mode) ) dof_func_array[level+1] = coarse_dof_func;*/ if (agg_interp_type == 1) - hypre_BoomerAMGBuildPartialExtPIInterp(A_array[level], - CF_marker, S, coarse_pnts_global, - coarse_pnts_global1, num_functions, - dof_func_array[level], debug_flag, agg_P12_trunc_factor, - agg_P12_max_elmts, col_offd_S_to_A, &P2); + hypre_BoomerAMGBuildPartialExtPIInterp(A_array[level], + CF_marker, S, coarse_pnts_global, + coarse_pnts_global1, num_functions, + dof_func_array[level], debug_flag, agg_P12_trunc_factor, + agg_P12_max_elmts, col_offd_S_to_A, &P2); else if (agg_interp_type == 2) - hypre_BoomerAMGBuildPartialStdInterp(A_array[level], - CF_marker, S, coarse_pnts_global, - coarse_pnts_global1, num_functions, - dof_func_array[level], debug_flag, agg_P12_trunc_factor, - agg_P12_max_elmts, sep_weight, col_offd_S_to_A, &P2); + hypre_BoomerAMGBuildPartialStdInterp(A_array[level], + CF_marker, S, coarse_pnts_global, + coarse_pnts_global1, num_functions, + dof_func_array[level], debug_flag, agg_P12_trunc_factor, + agg_P12_max_elmts, sep_weight, col_offd_S_to_A, &P2); else if (agg_interp_type == 3) - hypre_BoomerAMGBuildPartialExtInterp(A_array[level], - CF_marker, S, coarse_pnts_global, - coarse_pnts_global1, num_functions, - dof_func_array[level], debug_flag, agg_P12_trunc_factor, - agg_P12_max_elmts, col_offd_S_to_A, &P2); + hypre_BoomerAMGBuildPartialExtInterp(A_array[level], + CF_marker, S, coarse_pnts_global, + coarse_pnts_global1, num_functions, + dof_func_array[level], debug_flag, agg_P12_trunc_factor, + agg_P12_max_elmts, col_offd_S_to_A, &P2); + if (hypre_ParAMGDataModularizedMatMat(amg_data)) + { + P = hypre_ParCSRMatMat(P1,P2); + } + else + { P = hypre_ParMatmul(P1,P2); + } hypre_BoomerAMGInterpTruncation(P, agg_trunc_factor, - agg_P_max_elmts); - hypre_MatvecCommPkgCreate(P); + agg_P_max_elmts); + hypre_MatvecCommPkgCreate(P); hypre_ParCSRMatrixDestroy(P1); hypre_ParCSRMatrixOwnsColStarts(P2) = 0; hypre_ParCSRMatrixDestroy(P2); hypre_ParCSRMatrixOwnsColStarts(P) = 1; } - if (SN) hypre_ParCSRMatrixDestroy(SN); + if (SN) + { + hypre_ParCSRMatrixDestroy(SN); + } SN = NULL; - if (AN) hypre_ParCSRMatrixDestroy(AN); + if (AN) + { + hypre_ParCSRMatrixDestroy(AN); + } AN = NULL; } #ifdef HYPRE_NO_GLOBAL_PARTITION @@ -1625,7 +1700,10 @@ /* RL: build restriction */ if (restri_type) { - + HYPRE_Real filter_thresholdR; + filter_thresholdR = hypre_ParAMGDataFilterThresholdR(amg_data); + HYPRE_Int is_triangular = hypre_ParAMGDataIsTriangular(amg_data); + HYPRE_Int gmres_switch = hypre_ParAMGDataGMRESSwitchR(amg_data); /* !!! RL: ensure that CF_marker contains -1 or 1 !!! */ for (i = 0; i < hypre_CSRMatrixNumRows(hypre_ParCSRMatrixDiag(A_array[level])); i++) { @@ -1635,18 +1713,30 @@ if (restri_type == 1) /* distance-1 AIR */ { hypre_BoomerAMGBuildRestrAIR(A_array[level], CF_marker, - Sabs, coarse_pnts_global, num_functions, - dof_func_array[level], - debug_flag, trunc_factor, P_max_elmts, - col_offd_Sabs_to_A, &R ); + Sabs, coarse_pnts_global, 1, NULL, + filter_thresholdR, debug_flag, + col_offd_Sabs_to_A, &R, + is_triangular, gmres_switch ); } - else /* distance-2 AIR */ + else if (restri_type == 2 || restri_type == 15) /* distance-2, 1.5 AIR */ { hypre_BoomerAMGBuildRestrDist2AIR(A_array[level], CF_marker, - Sabs, coarse_pnts_global, num_functions, - dof_func_array[level], - debug_flag, trunc_factor, P_max_elmts, - col_offd_Sabs_to_A, &R ); + Sabs, coarse_pnts_global, 1, NULL, + filter_thresholdR, debug_flag, + col_offd_Sabs_to_A, &R, restri_type == 15, + is_triangular, gmres_switch); + } + else + { + HYPRE_Int NeumannAIRDeg = restri_type - 3; + hypre_assert(NeumannAIRDeg >= 0); + HYPRE_Real strong_thresholdR; + strong_thresholdR = hypre_ParAMGDataStrongThresholdR(amg_data); + hypre_BoomerAMGBuildRestrNeumannAIR(A_array[level], CF_marker, + coarse_pnts_global, 1, NULL, + NeumannAIRDeg, strong_thresholdR, + filter_thresholdR, debug_flag, + col_offd_Sabs_to_A, &R ); } #if DEBUG_SAVE_ALL_OPS @@ -1669,7 +1759,7 @@ hypre_BoomerAMGBuildMultipass(A_array[level], CF_marker, S, coarse_pnts_global, num_functions, dof_func_array[level], debug_flag, trunc_factor, P_max_elmts, sep_weight, col_offd_S_to_A, &P); - hypre_TFree(col_offd_S_to_A, HYPRE_MEMORY_HOST); + hypre_TFree(col_offd_S_to_A, HYPRE_MEMORY_HOST); } else if (interp_type == 1) { @@ -1687,14 +1777,14 @@ hypre_BoomerAMGBuildInterpHE(A_array[level], CF_marker, S, coarse_pnts_global, num_functions, dof_func_array[level], debug_flag, trunc_factor, P_max_elmts, col_offd_S_to_A, &P); - hypre_TFree(col_offd_S_to_A, HYPRE_MEMORY_HOST); + hypre_TFree(col_offd_S_to_A, HYPRE_MEMORY_HOST); } else if (interp_type == 3) { hypre_BoomerAMGBuildDirInterp(A_array[level], CF_marker, S, coarse_pnts_global, num_functions, dof_func_array[level], debug_flag, trunc_factor, P_max_elmts, col_offd_S_to_A, &P); - hypre_TFree(col_offd_S_to_A, HYPRE_MEMORY_HOST); + hypre_TFree(col_offd_S_to_A, HYPRE_MEMORY_HOST); } else if (interp_type == 6) /*Extended+i classical interpolation */ { @@ -1730,38 +1820,38 @@ S, coarse_pnts_global, num_functions, dof_func_array[level], debug_flag, trunc_factor, P_max_elmts, col_offd_S_to_A, &P); hypre_TFree(col_offd_S_to_A, HYPRE_MEMORY_HOST); - } - else if (interp_type == 8) /*Standard interpolation */ - { - hypre_BoomerAMGBuildStdInterp(A_array[level], CF_marker, - S, coarse_pnts_global, num_functions, dof_func_array[level], - debug_flag, trunc_factor, P_max_elmts, sep_weight, col_offd_S_to_A, &P); - hypre_TFree(col_offd_S_to_A, HYPRE_MEMORY_HOST); - } - else if (interp_type == 100) /* 1pt interpolation */ - { - hypre_BoomerAMGBuildInterpOnePnt(A_array[level], CF_marker, S, - coarse_pnts_global, num_functions, dof_func_array[level], - debug_flag, col_offd_S_to_A, &P); - hypre_TFree(col_offd_S_to_A, HYPRE_MEMORY_HOST); + } + else if (interp_type == 8) /*Standard interpolation */ + { + hypre_BoomerAMGBuildStdInterp(A_array[level], CF_marker, + S, coarse_pnts_global, num_functions, dof_func_array[level], + debug_flag, trunc_factor, P_max_elmts, sep_weight, col_offd_S_to_A, &P); + hypre_TFree(col_offd_S_to_A, HYPRE_MEMORY_HOST); + } + else if (interp_type == 100) /* 1pt interpolation */ + { + hypre_BoomerAMGBuildInterpOnePnt(A_array[level], CF_marker, S, + coarse_pnts_global, 1, NULL, + debug_flag, col_offd_S_to_A, &P); + hypre_TFree(col_offd_S_to_A, HYPRE_MEMORY_HOST); #if DEBUG_SAVE_ALL_OPS - char file[256]; - hypre_sprintf(file, "P_%d.mtx", level); - hypre_ParCSRMatrixPrintIJ(P, 1, 1, file); + char file[256]; + hypre_sprintf(file, "P_%d.mtx", level); + hypre_ParCSRMatrixPrintIJ(P, 1, 1, file); #endif - } - else if (hypre_ParAMGDataGSMG(amg_data) == 0) /* none of above choosen and not GMSMG */ - { - if (block_mode) /* nodal interpolation */ - { + } + else if (hypre_ParAMGDataGSMG(amg_data) == 0) /* none of above choosen and not GMSMG */ + { + if (block_mode) /* nodal interpolation */ + { - /* convert A to a block matrix if there isn't already a block + /* convert A to a block matrix if there isn't already a block matrix - there should be one already*/ if (!(A_block_array[level])) { A_block_array[level] = hypre_ParCSRBlockMatrixConvertFromParCSRMatrix( - A_array[level], num_functions); + A_array[level], num_functions); } /* note that the current CF_marker is nodal */ @@ -1969,7 +2059,7 @@ dof_func_array[level+1] = NULL; if (num_functions > 1 && nodal > -1 && (!block_mode) ) - dof_func_array[level+1] = coarse_dof_func; + dof_func_array[level+1] = coarse_dof_func; @@ -1980,19 +2070,19 @@ if ( (coarse_size == 0) || (coarse_size == fine_size) ) { HYPRE_Int *num_grid_sweeps = - hypre_ParAMGDataNumGridSweeps(amg_data); + hypre_ParAMGDataNumGridSweeps(amg_data); HYPRE_Int **grid_relax_points = - hypre_ParAMGDataGridRelaxPoints(amg_data); + hypre_ParAMGDataGridRelaxPoints(amg_data); if (grid_relax_type[3] == 9 || grid_relax_type[3] == 99 - || grid_relax_type[3] == 19 || grid_relax_type[3] == 98) - { - grid_relax_type[3] = grid_relax_type[0]; - num_grid_sweeps[3] = 1; - if (grid_relax_points) grid_relax_points[3][0] = 0; - } - if (S) + || grid_relax_type[3] == 19 || grid_relax_type[3] == 98) + { + grid_relax_type[3] = grid_relax_type[0]; + num_grid_sweeps[3] = 1; + if (grid_relax_points) grid_relax_points[3][0] = 0; + } + if (S) hypre_ParCSRMatrixDestroy(S); - if (P) + if (P) hypre_ParCSRMatrixDestroy(P); if (level > 0) { @@ -2007,9 +2097,9 @@ } if (level < agg_num_levels && coarse_size < min_coarse_size) { - if (S) + if (S) hypre_ParCSRMatrixDestroy(S); - if (P) + if (P) hypre_ParCSRMatrixDestroy(P); if (level > 0) { @@ -2192,28 +2282,54 @@ /*HYPRE_Real w_inv = 1.0/hypre_ParAMGDataRelaxWeight(amg_data)[level];*/ d_diag = hypre_CTAlloc(HYPRE_Real, lvl_nrows, HYPRE_MEMORY_HOST); for (i=0; i < lvl_nrows; i++) - d_diag[i] = lvl_data[lvl_i[i]]*w_inv; + { + d_diag[i] = lvl_data[lvl_i[i]]*w_inv; + } } else { if (num_threads == 1) - hypre_ParCSRComputeL1Norms(A_array[level], 1, NULL, &d_diag); + { + hypre_ParCSRComputeL1Norms(A_array[level], 1, NULL, &d_diag); + } else + { hypre_ParCSRComputeL1NormsThreads(A_array[level], 1, num_threads, NULL, &d_diag); + } } + if (ns == 1) { hypre_ParCSRMatrix *Q = NULL; - Q = hypre_ParMatmul(A_array[level],P); - hypre_ParCSRMatrixAminvDB(P,Q,d_diag,&P_array[level]); - A_H = hypre_ParTMatmul(P,Q); + if (hypre_ParAMGDataModularizedMatMat(amg_data)) + { + Q = hypre_ParCSRMatMat(A_array[level],P); + hypre_ParCSRMatrixAminvDB(P,Q,d_diag,&P_array[level]); + A_H = hypre_ParCSRTMatMat(P,Q); + } + else + { + Q = hypre_ParMatmul(A_array[level],P); + hypre_ParCSRMatrixAminvDB(P,Q,d_diag,&P_array[level]); + A_H = hypre_ParTMatmul(P,Q); + } hypre_ParCSRMatrixRowStarts(A_H) = hypre_ParCSRMatrixColStarts(A_H); hypre_ParCSRMatrixOwnsRowStarts(A_H) = 1; hypre_ParCSRMatrixOwnsColStarts(A_H) = 0; hypre_ParCSRMatrixOwnsColStarts(P) = 0; - if (num_procs > 1) hypre_MatvecCommPkgCreate(A_H); + if (num_procs > 1) + { + hypre_MatvecCommPkgCreate(A_H); + } /*hypre_ParCSRMatrixDestroy(P); */ - hypre_TFree(d_diag, HYPRE_MEMORY_SHARED); + if (add_rlx == 0) + { + hypre_TFree(d_diag, HYPRE_MEMORY_HOST); + } + else + { + hypre_TFree(d_diag, HYPRE_MEMORY_SHARED); + } /* Set NonGalerkin drop tol on each level */ if (level < nongalerk_num_tol) nongalerk_tol_l = nongalerk_tol[level]; if (nongal_tol_array) nongalerk_tol_l = nongal_tol_array[level]; @@ -2232,7 +2348,6 @@ hypre_MatvecCommPkgCreate(A_H); } hypre_ParCSRMatrixDestroy(Q); - } else { @@ -2248,8 +2363,16 @@ { /* Construct AP, and then RAP */ hypre_ParCSRMatrix *Q = NULL; - Q = hypre_ParMatmul(A_array[level],P_array[level]); - A_H = hypre_ParTMatmul(P_array[level],Q); + if (hypre_ParAMGDataModularizedMatMat(amg_data)) + { + Q = hypre_ParCSRMatMat(A_array[level],P_array[level]); + A_H = hypre_ParCSRTMatMatKT(P_array[level],Q,keepTranspose); + } + else + { + Q = hypre_ParMatmul(A_array[level],P_array[level]); + A_H = hypre_ParTMatmul(P_array[level],Q); + } hypre_ParCSRMatrixRowStarts(A_H) = hypre_ParCSRMatrixColStarts(A_H); hypre_ParCSRMatrixOwnsRowStarts(A_H) = 1; hypre_ParCSRMatrixOwnsColStarts(A_H) = 0; @@ -2273,8 +2396,16 @@ { /* Use two matrix products to generate A_H */ hypre_ParCSRMatrix *Q = NULL; - Q = hypre_ParMatmul(A_array[level],P_array[level]); - A_H = hypre_ParTMatmul(P_array[level],Q); + if (hypre_ParAMGDataModularizedMatMat(amg_data)) + { + Q = hypre_ParCSRMatMat(A_array[level],P_array[level]); + A_H = hypre_ParCSRTMatMatKT(P_array[level],Q,keepTranspose); + } + else + { + Q = hypre_ParMatmul(A_array[level],P_array[level]); + A_H = hypre_ParTMatmul(P_array[level],Q); + } hypre_ParCSRMatrixOwnsRowStarts(A_H) = 1; hypre_ParCSRMatrixOwnsColStarts(A_H) = 0; hypre_ParCSRMatrixOwnsColStarts(P_array[level]) = 0; @@ -2284,35 +2415,49 @@ } else { - hypre_BoomerAMGBuildCoarseOperatorKT(P, A_array[level] , P, - keepTranspose, &A_H); + if (hypre_ParAMGDataModularizedMatMat(amg_data)) + { + A_H = hypre_ParCSRMatrixRAPKT(P, A_array[level], + P, keepTranspose); + } + else + { + hypre_BoomerAMGBuildCoarseOperatorKT(P, A_array[level] , P, + keepTranspose, &A_H); + } } if (add_rlx == 18) - C = hypre_CreateC(A_array[level], 0.0); + C = hypre_CreateC(A_array[level], 0.0); else - C = hypre_CreateC(A_array[level], add_rlx_wt); + C = hypre_CreateC(A_array[level], add_rlx_wt); Ptmp = P; - while (ns_tmp > 0) + while (ns_tmp > 0) { Pnew = Ptmp; Ptmp = NULL; - Ptmp = hypre_ParMatmul(C,Pnew); + if (hypre_ParAMGDataModularizedMatMat(amg_data)) + { + Ptmp = hypre_ParCSRMatMat(C,Pnew); + } + else + { + Ptmp = hypre_ParMatmul(C,Pnew); + } if (ns_tmp < ns) - hypre_ParCSRMatrixDestroy(Pnew); - ns_tmp--; + { + hypre_ParCSRMatrixDestroy(Pnew); + } + ns_tmp--; } Pnew = Ptmp; P_array[level] = Pnew; hypre_ParCSRMatrixDestroy(C); } - - if (add_P_max_elmts || add_trunc_factor) { - hypre_BoomerAMGTruncandBuild(P_array[level], - add_trunc_factor,add_P_max_elmts); + hypre_BoomerAMGTruncandBuild(P_array[level], add_trunc_factor,add_P_max_elmts); } /*else hypre_MatvecCommPkgCreate(P_array[level]); */ @@ -2329,7 +2474,10 @@ } } - if (S) hypre_ParCSRMatrixDestroy(S); + if (S) + { + hypre_ParCSRMatrixDestroy(S); + } S = NULL; hypre_TFree(SmoothVecs, HYPRE_MEMORY_HOST); @@ -2372,8 +2520,16 @@ { /* Construct AP, and then RAP */ hypre_ParCSRMatrix *Q = NULL; - Q = hypre_ParMatmul(A_array[level],P_array[level]); - A_H = hypre_ParTMatmul(P_array[level],Q); + if (hypre_ParAMGDataModularizedMatMat(amg_data)) + { + Q = hypre_ParCSRMatMat(A_array[level],P_array[level]); + A_H = hypre_ParCSRTMatMatKT(P_array[level],Q,keepTranspose); + } + else + { + Q = hypre_ParMatmul(A_array[level],P_array[level]); + A_H = hypre_ParTMatmul(P_array[level],Q); + } hypre_ParCSRMatrixRowStarts(A_H) = hypre_ParCSRMatrixColStarts(A_H); hypre_ParCSRMatrixOwnsRowStarts(A_H) = 1; hypre_ParCSRMatrixOwnsColStarts(A_H) = 0; @@ -2382,14 +2538,15 @@ /* Build Non-Galerkin Coarse Grid */ hypre_BoomerAMGBuildNonGalerkinCoarseOperator(&A_H, Q, - 0.333*strong_threshold, max_row_sum, num_functions, - dof_func_array[level+1], S_commpkg_switch, CF_marker_array[level], - /* nongalerk_tol, sym_collapse, lump_percent, beta );*/ - nongalerk_tol_l, 1, 0.5, 1.0 ); + 0.333*strong_threshold, max_row_sum, num_functions, + dof_func_array[level+1], S_commpkg_switch, CF_marker_array[level], + /* nongalerk_tol, sym_collapse, lump_percent, beta );*/ + nongalerk_tol_l, 1, 0.5, 1.0 ); if (!hypre_ParCSRMatrixCommPkg(A_H)) - hypre_MatvecCommPkgCreate(A_H); - + { + hypre_MatvecCommPkgCreate(A_H); + } /* Delete AP */ hypre_ParCSRMatrixDestroy(Q); } @@ -2397,8 +2554,16 @@ { /* Use two matrix products to generate A_H */ hypre_ParCSRMatrix *AP = NULL; - AP = hypre_ParMatmul(A_array[level], P_array[level]); - A_H = hypre_ParMatmul(R_array[level], AP); + if (hypre_ParAMGDataModularizedMatMat(amg_data)) + { + AP = hypre_ParCSRMatMat(A_array[level], P_array[level]); + A_H = hypre_ParCSRMatMat(R_array[level], AP); + } + else + { + AP = hypre_ParMatmul(A_array[level], P_array[level]); + A_H = hypre_ParMatmul(R_array[level], AP); + } /* RL: XXX NEED TO CHECK THIS WITH UMY */ hypre_ParCSRMatrixOwnsRowStarts(A_H) = 1; hypre_ParCSRMatrixOwnsColStarts(A_H) = 0; @@ -2427,26 +2592,45 @@ { /* Use two matrix products to generate A_H */ hypre_ParCSRMatrix *Q = NULL; - Q = hypre_ParMatmul(A_array[level],P_array[level]); - A_H = hypre_ParTMatmul(P_array[level],Q); + if (hypre_ParAMGDataModularizedMatMat(amg_data)) + { + Q = hypre_ParCSRMatMat(A_array[level], P_array[level]); + A_H = hypre_ParCSRTMatMatKT(P_array[level], Q, keepTranspose); + } + else + { + Q = hypre_ParMatmul(A_array[level],P_array[level]); + A_H = hypre_ParTMatmul(P_array[level],Q); + } hypre_ParCSRMatrixOwnsRowStarts(A_H) = 1; hypre_ParCSRMatrixOwnsColStarts(A_H) = 0; hypre_ParCSRMatrixOwnsColStarts(P_array[level]) = 0; - if (num_procs > 1) hypre_MatvecCommPkgCreate(A_H); + if (num_procs > 1) + { + hypre_MatvecCommPkgCreate(A_H); + } /* Delete AP */ hypre_ParCSRMatrixDestroy(Q); } else { /* Compute standard Galerkin coarse-grid product */ - hypre_BoomerAMGBuildCoarseOperatorKT(P_array[level], A_array[level] , - P_array[level], keepTranspose, &A_H); + if (hypre_ParAMGDataModularizedMatMat(amg_data)) + { + A_H = hypre_ParCSRMatrixRAPKT(P_array[level], A_array[level], + P_array[level], keepTranspose); + } + else + { + hypre_BoomerAMGBuildCoarseOperatorKT(P_array[level], A_array[level] , + P_array[level], keepTranspose, &A_H); + } + if (Pnew && ns==1) { hypre_ParCSRMatrixDestroy(P); P_array[level] = Pnew; } - } } @@ -2456,7 +2640,7 @@ wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Level = %d Build Coarse Operator Time = %f\n", my_id,level, wall_time); - fflush(NULL); + fflush(NULL); } ++level; @@ -2464,23 +2648,32 @@ if (!block_mode) { /* dropping in A_H */ - hypre_ParCSRMatrixDropSmallEntries(A_H, hypre_ParAMGDataADropTol(amg_data)); - hypre_ParCSRMatrixSetNumNonzeros(A_H); - hypre_ParCSRMatrixSetDNumNonzeros(A_H); + hypre_ParCSRMatrixDropSmallEntries(A_H, hypre_ParAMGDataADropTol(amg_data), + hypre_ParAMGDataADropType(amg_data)); + /* if CommPkg for A_H was not built */ + if (num_procs > 1 && hypre_ParCSRMatrixCommPkg(A_H) == NULL) + { + hypre_MatvecCommPkgCreate(A_H); + } + if (hypre_ParAMGDataADropTol(amg_data) <= 0.0) + { + hypre_ParCSRMatrixSetNumNonzeros(A_H); + hypre_ParCSRMatrixSetDNumNonzeros(A_H); + } A_array[level] = A_H; } size = ((HYPRE_Real) fine_size )*.75; if (coarsen_type > 0 && coarse_size >= (HYPRE_BigInt) size) { - coarsen_type = 0; + coarsen_type = 0; } { - HYPRE_Int max_thresh = hypre_max(coarse_threshold, seq_threshold); -#ifdef HAVE_DSUPERLU - max_thresh = hypre_max(max_thresh, dslu_threshold); + HYPRE_Int max_thresh = hypre_max(coarse_threshold, seq_threshold); +#ifdef HYPRE_USING_DSUPERLU + max_thresh = hypre_max(max_thresh, dslu_threshold); #endif if ( (level == max_levels-1) || (coarse_size <= (HYPRE_BigInt) max_thresh) ) { @@ -2495,7 +2688,7 @@ hypre_seqAMGSetup( amg_data, level, coarse_threshold); } -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU else if ( ((dslu_threshold >= coarse_threshold) && (coarse_size > (HYPRE_BigInt)coarse_threshold) && (level != max_levels-1))) { HYPRE_Solver dslu_solver; @@ -2503,17 +2696,23 @@ hypre_ParAMGDataDSLUSolver(amg_data) = dslu_solver; } #endif - else if (grid_relax_type[3] == 9 || grid_relax_type[3] == 99) /*use of Gaussian elimination on coarsest level */ + else if (grid_relax_type[3] == 9 || grid_relax_type[3] == 99 || grid_relax_type[3] == 199) /*use of Gaussian elimination on coarsest level */ { if (coarse_size <= coarse_threshold) + { hypre_GaussElimSetup(amg_data, level, grid_relax_type[3]); + } else + { grid_relax_type[3] = grid_relax_type[1]; + } } else if (grid_relax_type[3] == 19 || grid_relax_type[3] == 98) /*use of Gaussian elimination on coarsest level */ { if (coarse_size > coarse_threshold) + { grid_relax_type[3] = grid_relax_type[1]; + } } if (level > 0) @@ -2569,11 +2768,11 @@ *-----------------------------------------------------------------------*/ if (addlvl > -1 || - grid_relax_type[1] == 7 || grid_relax_type[2] == 7 || grid_relax_type[3] == 7 || - grid_relax_type[1] == 8 || grid_relax_type[2] == 8 || grid_relax_type[3] == 8 || - grid_relax_type[1] == 13 || grid_relax_type[2] == 13 || grid_relax_type[3] == 13 || - grid_relax_type[1] == 14 || grid_relax_type[2] == 14 || grid_relax_type[3] == 14 || - grid_relax_type[1] == 18 || grid_relax_type[2] == 18 || grid_relax_type[3] == 18) + grid_relax_type[1] == 7 || grid_relax_type[2] == 7 || grid_relax_type[3] == 7 || + grid_relax_type[1] == 8 || grid_relax_type[2] == 8 || grid_relax_type[3] == 8 || + grid_relax_type[1] == 13 || grid_relax_type[2] == 13 || grid_relax_type[3] == 13 || + grid_relax_type[1] == 14 || grid_relax_type[2] == 14 || grid_relax_type[3] == 14 || + grid_relax_type[1] == 18 || grid_relax_type[2] == 18 || grid_relax_type[3] == 18) { l1_norms = hypre_CTAlloc(HYPRE_Real *, num_levels, HYPRE_MEMORY_HOST); hypre_ParAMGDataL1Norms(amg_data) = l1_norms; @@ -2603,8 +2802,8 @@ if (num_threads == 1) { if (j < num_levels-1 && (grid_relax_type[1] == 8 || grid_relax_type[1] == 13 || - grid_relax_type[1] == 14 || grid_relax_type[2] == 8 || grid_relax_type[2] == 13 || - grid_relax_type[2] == 14)) + grid_relax_type[1] == 14 || grid_relax_type[2] == 8 || grid_relax_type[2] == 13 || + grid_relax_type[2] == 14)) { if (relax_order) hypre_ParCSRComputeL1Norms(A_array[j], 4, CF_marker_array[j], &l1_norms[j]); @@ -2612,7 +2811,7 @@ hypre_ParCSRComputeL1Norms(A_array[j], 4, NULL, &l1_norms[j]); } else if ((grid_relax_type[3] == 8 || grid_relax_type[3] == 13 || grid_relax_type[3] == 14) - && j == num_levels-1) + && j == num_levels-1) { hypre_ParCSRComputeL1Norms(A_array[j], 4, NULL, &l1_norms[j]); } @@ -2631,8 +2830,8 @@ else { if (j < num_levels-1 && (grid_relax_type[1] == 8 || grid_relax_type[1] == 13 || - grid_relax_type[1] == 14 || grid_relax_type[2] == 8 || grid_relax_type[2] == 13 || - grid_relax_type[2] == 14)) + grid_relax_type[1] == 14 || grid_relax_type[2] == 8 || grid_relax_type[2] == 13 || + grid_relax_type[2] == 14)) { if (relax_order) hypre_ParCSRComputeL1NormsThreads(A_array[j], 4, num_threads, CF_marker_array[j] , &l1_norms[j]); @@ -2640,7 +2839,7 @@ hypre_ParCSRComputeL1NormsThreads(A_array[j], 4, num_threads, NULL, &l1_norms[j]); } else if ((grid_relax_type[3] == 8 || grid_relax_type[3] == 13 || grid_relax_type[3] == 14) - && j == num_levels-1) + && j == num_levels-1) { hypre_ParCSRComputeL1NormsThreads(A_array[j], 4, num_threads, NULL, &l1_norms[j]); } @@ -2672,8 +2871,8 @@ if (num_threads == 1) { if (j < num_levels-1 && (grid_relax_type[1] == 8 || grid_relax_type[1] == 13 || - grid_relax_type[1] == 14 || grid_relax_type[2] == 8 || grid_relax_type[2] == 13 || - grid_relax_type[2] == 14)) + grid_relax_type[1] == 14 || grid_relax_type[2] == 8 || grid_relax_type[2] == 13 || + grid_relax_type[2] == 14)) { if (relax_order) hypre_ParCSRComputeL1Norms(A_array[j], 4, CF_marker_array[j], &l1_norms[j]); @@ -2681,7 +2880,7 @@ hypre_ParCSRComputeL1Norms(A_array[j], 4, NULL, &l1_norms[j]); } else if ((grid_relax_type[3] == 8 || grid_relax_type[3] == 13 || grid_relax_type[3] == 14) - && j == num_levels-1) + && j == num_levels-1) { hypre_ParCSRComputeL1Norms(A_array[j], 4, NULL, &l1_norms[j]); } @@ -2700,8 +2899,8 @@ else { if (j < num_levels-1 && (grid_relax_type[1] == 8 || grid_relax_type[1] == 13 || - grid_relax_type[1] == 14 || grid_relax_type[2] == 8 || grid_relax_type[2] == 13 || - grid_relax_type[2] == 14)) + grid_relax_type[1] == 14 || grid_relax_type[2] == 8 || grid_relax_type[2] == 13 || + grid_relax_type[2] == 14)) { if (relax_order) hypre_ParCSRComputeL1NormsThreads(A_array[j], 4, num_threads, CF_marker_array[j] , &l1_norms[j]); @@ -2709,7 +2908,7 @@ hypre_ParCSRComputeL1NormsThreads(A_array[j], 4, num_threads, NULL, &l1_norms[j]); } else if ((grid_relax_type[3] == 8 || grid_relax_type[3] == 13 || grid_relax_type[3] == 14) - && j == num_levels-1) + && j == num_levels-1) { hypre_ParCSRComputeL1NormsThreads(A_array[j], 4, num_threads, NULL, &l1_norms[j]); } @@ -2743,14 +2942,14 @@ HYPRE_Int cheby_eig_est = hypre_ParAMGDataChebyEigEst(amg_data); HYPRE_Real cheby_fraction = hypre_ParAMGDataChebyFraction(amg_data); if (cheby_eig_est) - hypre_ParCSRMaxEigEstimateCG(A_array[j], scale, cheby_eig_est, - &max_eig, &min_eig); + hypre_ParCSRMaxEigEstimateCG(A_array[j], scale, cheby_eig_est, + &max_eig, &min_eig); else - hypre_ParCSRMaxEigEstimate(A_array[j], scale, &max_eig); + hypre_ParCSRMaxEigEstimate(A_array[j], scale, &max_eig); max_eig_est[j] = max_eig; min_eig_est[j] = min_eig; hypre_ParCSRRelax_Cheby_Setup(A_array[j],max_eig, min_eig, - cheby_fraction, cheby_order, scale, variant, &coefs, &ds); + cheby_fraction, cheby_order, scale, variant, &coefs, &ds); cheby_coefs[j] = coefs; cheby_ds[j] = ds; } @@ -2868,8 +3067,8 @@ HYPRE_ParCSRPilutSetFactorRowSize(smoother[j],max_nz_per_row); } else if ((j < num_levels-1) || ((j == num_levels-1) && (grid_relax_type[3]!= 9 && - grid_relax_type[3] != 99 && grid_relax_type[3] != 19 && grid_relax_type[3] != 98) - && coarse_size > 9)) + grid_relax_type[3] != 99 && grid_relax_type[3] != 19 && grid_relax_type[3] != 98) + && coarse_size > 9)) { if (relax_weight[j] < 0 ) { @@ -2888,10 +3087,9 @@ if ( amg_logging > 1 ) { - Residual_array= - hypre_ParVectorCreate(hypre_ParCSRMatrixComm(A_array[0]), - hypre_ParCSRMatrixGlobalNumRows(A_array[0]), - hypre_ParCSRMatrixRowStarts(A_array[0]) ); + Residual_array = hypre_ParVectorCreate(hypre_ParCSRMatrixComm(A_array[0]), + hypre_ParCSRMatrixGlobalNumRows(A_array[0]), + hypre_ParCSRMatrixRowStarts(A_array[0]) ); hypre_ParVectorInitialize(Residual_array); hypre_ParVectorSetPartitioningOwner(Residual_array,0); hypre_ParAMGDataResidual(amg_data) = Residual_array; @@ -2900,10 +3098,14 @@ hypre_ParAMGDataResidual(amg_data) = NULL; if (simple > -1 && simple < num_levels) - hypre_CreateDinv(amg_data); - else if ((mult_additive > -1 && mult_additive < num_levels) || - (additive > -1 && additive < num_levels)) - hypre_CreateLambda(amg_data); + { + hypre_CreateDinv(amg_data); + } + else if ( (mult_additive > -1 && mult_additive < num_levels) || + (additive > -1 && additive < num_levels) ) + { + hypre_CreateLambda(amg_data); + } /*----------------------------------------------------------------------- * Print some stuff @@ -2912,67 +3114,81 @@ if (amg_print_level == 1 || amg_print_level == 3) hypre_BoomerAMGSetupStats(amg_data,A); -/* print out CF info to plot grids in matlab (see 'tools/AMGgrids.m') */ + /* print out CF info to plot grids in matlab (see 'tools/AMGgrids.m') */ if (hypre_ParAMGDataPlotGrids(amg_data)) { - HYPRE_Int *CF, *CFc, *itemp; - FILE* fp; - char filename[256]; - HYPRE_Int coorddim = hypre_ParAMGDataCoordDim (amg_data); - float *coordinates = hypre_ParAMGDataCoordinates (amg_data); + HYPRE_Int *CF, *CFc, *itemp; + FILE* fp; + char filename[256]; + HYPRE_Int coorddim = hypre_ParAMGDataCoordDim (amg_data); + float *coordinates = hypre_ParAMGDataCoordinates (amg_data); - if (!coordinates) coorddim=0; + if (!coordinates) coorddim=0; - if (block_mode) - local_size = hypre_CSRMatrixNumRows(hypre_ParCSRBlockMatrixDiag(A_block_array[0])); - else - local_size = hypre_CSRMatrixNumRows(hypre_ParCSRMatrixDiag(A)); + if (block_mode) + { + local_size = hypre_CSRMatrixNumRows(hypre_ParCSRBlockMatrixDiag(A_block_array[0])); + } + else + { + local_size = hypre_CSRMatrixNumRows(hypre_ParCSRMatrixDiag(A)); + } - CF = hypre_CTAlloc(HYPRE_Int, local_size, HYPRE_MEMORY_HOST); - CFc = hypre_CTAlloc(HYPRE_Int, local_size, HYPRE_MEMORY_HOST); + CF = hypre_CTAlloc(HYPRE_Int, local_size, HYPRE_MEMORY_HOST); + CFc = hypre_CTAlloc(HYPRE_Int, local_size, HYPRE_MEMORY_HOST); - for (level = (num_levels - 2); level >= 0; level--) - { - /* swap pointers */ - itemp = CFc; - CFc = CF; - CF = itemp; - if (block_mode) - local_size = hypre_CSRMatrixNumRows(hypre_ParCSRBlockMatrixDiag(A_block_array[level])); - else - local_size = hypre_CSRMatrixNumRows(hypre_ParCSRMatrixDiag(A_array[level])); + for (level = (num_levels - 2); level >= 0; level--) + { + /* swap pointers */ + itemp = CFc; + CFc = CF; + CF = itemp; + if (block_mode) + { + local_size = hypre_CSRMatrixNumRows(hypre_ParCSRBlockMatrixDiag(A_block_array[level])); + } + else + { + local_size = hypre_CSRMatrixNumRows(hypre_ParCSRMatrixDiag(A_array[level])); + } + for (i = 0, j = 0; i < local_size; i++) + { + /* if a C-point */ + CF[i] = 0; + if (CF_marker_array[level][i] > -1) + { + CF[i] = CFc[j] + 1; + j++; + } + } + } + if (block_mode) + { + local_size = hypre_CSRMatrixNumRows(hypre_ParCSRBlockMatrixDiag(A_block_array[0])); + } + else + { + local_size = hypre_CSRMatrixNumRows(hypre_ParCSRMatrixDiag(A)); + } + hypre_sprintf (filename,"%s.%05d",hypre_ParAMGDataPlotFileName (amg_data),my_id); + fp = fopen(filename, "w"); - for (i = 0, j = 0; i < local_size; i++) + for (i = 0; i < local_size; i++) { - /* if a C-point */ - CF[i] = 0; - if (CF_marker_array[level][i] > -1) + for (j = 0; j < coorddim; j++) { - CF[i] = CFc[j] + 1; - j++; + hypre_fprintf (fp,"% f ",coordinates[coorddim*i+j]); } + hypre_fprintf(fp, "%d\n", CF[i]); } - } - if (block_mode) - local_size = hypre_CSRMatrixNumRows(hypre_ParCSRBlockMatrixDiag(A_block_array[0])); - else - local_size = hypre_CSRMatrixNumRows(hypre_ParCSRMatrixDiag(A)); - hypre_sprintf (filename,"%s.%05d",hypre_ParAMGDataPlotFileName (amg_data),my_id); fp = fopen(filename, "w"); + fclose(fp); - for (i = 0; i < local_size; i++) - { - for (j = 0; j < coorddim; j++) - hypre_fprintf (fp,"%f ",coordinates[coorddim*i+j]); - hypre_fprintf(fp, "%d\n", CF[i]); - } - fclose(fp); - - hypre_TFree(CF, HYPRE_MEMORY_HOST); - hypre_TFree(CFc, HYPRE_MEMORY_HOST); - } + hypre_TFree(CF, HYPRE_MEMORY_HOST); + hypre_TFree(CFc, HYPRE_MEMORY_HOST); + } /* print out matrices on all levels */ #if DEBUG diff -Nru hypre-2.16.0/src/parcsr_ls/par_amg_solve.c hypre-2.18.2/src/parcsr_ls/par_amg_solve.c --- hypre-2.16.0/src/parcsr_ls/par_amg_solve.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_amg_solve.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -33,8 +24,7 @@ hypre_ParVector *f, hypre_ParVector *u ) { - - MPI_Comm comm = hypre_ParCSRMatrixComm(A); + MPI_Comm comm = hypre_ParCSRMatrixComm(A); hypre_ParAMGData *amg_data = (hypre_ParAMGData*) amg_vdata; @@ -49,7 +39,7 @@ HYPRE_Real tol; HYPRE_Int block_mode; - + hypre_ParCSRMatrix **A_array; hypre_ParVector **F_array; @@ -91,7 +81,7 @@ hypre_ParVector *Residual; HYPRE_ANNOTATION_BEGIN("BoomerAMG.solve"); - hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_size(comm, &num_procs); hypre_MPI_Comm_rank(comm,&my_id); amg_print_level = hypre_ParAMGDataPrintLevel(amg_data); @@ -118,25 +108,26 @@ block_mode = hypre_ParAMGDataBlockMode(amg_data); - A_block_array = hypre_ParAMGDataABlockArray(amg_data); + A_block_array = hypre_ParAMGDataABlockArray(amg_data); -/* Vtemp = hypre_ParVectorCreate(hypre_ParCSRMatrixComm(A_array[0]), - hypre_ParCSRMatrixGlobalNumRows(A_array[0]), - hypre_ParCSRMatrixRowStarts(A_array[0])); - hypre_ParVectorInitialize(Vtemp); - hypre_ParVectorSetPartitioningOwner(Vtemp,0); - hypre_ParAMGDataVtemp(amg_data) = Vtemp; -*/ + /* Vtemp = hypre_ParVectorCreate(hypre_ParCSRMatrixComm(A_array[0]), + hypre_ParCSRMatrixGlobalNumRows(A_array[0]), + hypre_ParCSRMatrixRowStarts(A_array[0])); + hypre_ParVectorInitialize(Vtemp); + hypre_ParVectorSetPartitioningOwner(Vtemp,0); + hypre_ParAMGDataVtemp(amg_data) = Vtemp; + */ Vtemp = hypre_ParAMGDataVtemp(amg_data); /*----------------------------------------------------------------------- * Write the solver parameters *-----------------------------------------------------------------------*/ - if (my_id == 0 && amg_print_level > 1) - hypre_BoomerAMGWriteSolverParams(amg_data); + { + hypre_BoomerAMGWriteSolverParams(amg_data); + } /*----------------------------------------------------------------------- * Initialize the solver error flag and assorted bookkeeping variables @@ -155,142 +146,159 @@ *-----------------------------------------------------------------------*/ if (my_id == 0 && amg_print_level > 1 && tol > 0.) - hypre_printf("\n\nAMG SOLUTION INFO:\n"); + hypre_printf("\n\nAMG SOLUTION INFO:\n"); /*----------------------------------------------------------------------- - * Compute initial fine-grid residual and print + * Compute initial fine-grid residual and print *-----------------------------------------------------------------------*/ if (amg_print_level > 1 || amg_logging > 1 || tol > 0.) { - if ( amg_logging > 1 ) { - hypre_ParVectorCopy(F_array[0], Residual ); - if (tol > 0) - hypre_ParCSRMatrixMatvec(alpha, A_array[0], U_array[0], beta, Residual ); - resid_nrm = sqrt(hypre_ParVectorInnerProd( Residual, Residual )); - } - else { - hypre_ParVectorCopy(F_array[0], Vtemp); - if (tol > 0) - hypre_ParCSRMatrixMatvec(alpha, A_array[0], U_array[0], beta, Vtemp); - resid_nrm = sqrt(hypre_ParVectorInnerProd(Vtemp, Vtemp)); - } - - /* Since it is does not diminish performance, attempt to return an error flag - and notify users when they supply bad input. */ - if (resid_nrm != 0.) ieee_check = resid_nrm/resid_nrm; /* INF -> NaN conversion */ - if (ieee_check != ieee_check) - { - /* ...INFs or NaNs in input can make ieee_check a NaN. This test - for ieee_check self-equality works on all IEEE-compliant compilers/ - machines, c.f. page 8 of "Lecture Notes on the Status of IEEE 754" - by W. Kahan, May 31, 1996. Currently (July 2002) this paper may be - found at http://HTTP.CS.Berkeley.EDU/~wkahan/ieee754status/IEEE754.PDF */ - if (amg_print_level > 0) - { - hypre_printf("\n\nERROR detected by Hypre ... BEGIN\n"); - hypre_printf("ERROR -- hypre_BoomerAMGSolve: INFs and/or NaNs detected in input.\n"); - hypre_printf("User probably placed non-numerics in supplied A, x_0, or b.\n"); - hypre_printf("ERROR detected by Hypre ... END\n\n\n"); - } - hypre_error(HYPRE_ERROR_GENERIC); - HYPRE_ANNOTATION_END("BoomerAMG.solve"); - return hypre_error_flag; - } - - /* r0 */ - resid_nrm_init = resid_nrm; - - if (0 == converge_type) - { - rhs_norm = sqrt(hypre_ParVectorInnerProd(f, f)); - if (rhs_norm) - { - relative_resid = resid_nrm_init / rhs_norm; - } - else - { - relative_resid = resid_nrm_init; - } - } - else - { - /* converge_type != 0, test convergence with ||r|| / ||r0|| */ - relative_resid = 1.0; - } + if ( amg_logging > 1 ) + { + hypre_ParVectorCopy(F_array[0], Residual ); + if (tol > 0) + { + hypre_ParCSRMatrixMatvec(alpha, A_array[0], U_array[0], beta, Residual ); + } + resid_nrm = sqrt(hypre_ParVectorInnerProd( Residual, Residual )); + } + else + { + hypre_ParVectorCopy(F_array[0], Vtemp); + if (tol > 0) + { + hypre_ParCSRMatrixMatvec(alpha, A_array[0], U_array[0], beta, Vtemp); + } + resid_nrm = sqrt(hypre_ParVectorInnerProd(Vtemp, Vtemp)); + } + + /* Since it is does not diminish performance, attempt to return an error flag + and notify users when they supply bad input. */ + if (resid_nrm != 0.) + { + ieee_check = resid_nrm/resid_nrm; /* INF -> NaN conversion */ + } + + if (ieee_check != ieee_check) + { + /* ...INFs or NaNs in input can make ieee_check a NaN. This test + for ieee_check self-equality works on all IEEE-compliant compilers/ + machines, c.f. page 8 of "Lecture Notes on the Status of IEEE 754" + by W. Kahan, May 31, 1996. Currently (July 2002) this paper may be + found at http://HTTP.CS.Berkeley.EDU/~wkahan/ieee754status/IEEE754.PDF */ + if (amg_print_level > 0) + { + hypre_printf("\n\nERROR detected by Hypre ... BEGIN\n"); + hypre_printf("ERROR -- hypre_BoomerAMGSolve: INFs and/or NaNs detected in input.\n"); + hypre_printf("User probably placed non-numerics in supplied A, x_0, or b.\n"); + hypre_printf("ERROR detected by Hypre ... END\n\n\n"); + } + hypre_error(HYPRE_ERROR_GENERIC); + HYPRE_ANNOTATION_END("BoomerAMG.solve"); + return hypre_error_flag; + } + + /* r0 */ + resid_nrm_init = resid_nrm; + + if (0 == converge_type) + { + rhs_norm = sqrt(hypre_ParVectorInnerProd(f, f)); + if (rhs_norm) + { + relative_resid = resid_nrm_init / rhs_norm; + } + else + { + relative_resid = resid_nrm_init; + } + } + else + { + /* converge_type != 0, test convergence with ||r|| / ||r0|| */ + relative_resid = 1.0; + } } else { - relative_resid = 1.; + relative_resid = 1.; } if (my_id == 0 && amg_print_level > 1) - { + { hypre_printf(" relative\n"); hypre_printf(" residual factor residual\n"); hypre_printf(" -------- ------ --------\n"); hypre_printf(" Initial %e %e\n", resid_nrm_init, - relative_resid); + relative_resid); } /*----------------------------------------------------------------------- * Main V-cycle loop *-----------------------------------------------------------------------*/ - + while ( (relative_resid >= tol || cycle_count < min_iter) && cycle_count < max_iter ) { hypre_ParAMGDataCycleOpCount(amg_data) = 0; /* Op count only needed for one cycle */ - if ((additive < 0 || additive >= num_levels) - && (mult_additive < 0 || mult_additive >= num_levels) - && (simple < 0 || simple >= num_levels) ) - hypre_BoomerAMGCycle(amg_data, F_array, U_array); + if ( (additive < 0 || additive >= num_levels) && + (mult_additive < 0 || mult_additive >= num_levels) && + (simple < 0 || simple >= num_levels) ) + { + hypre_BoomerAMGCycle(amg_data, F_array, U_array); + } else - hypre_BoomerAMGAdditiveCycle(amg_data); + { + hypre_BoomerAMGAdditiveCycle(amg_data); + } + /*--------------------------------------------------------------- * Compute fine-grid residual and residual norm *----------------------------------------------------------------*/ if (amg_print_level > 1 || amg_logging > 1 || tol > 0.) { - old_resid = resid_nrm; + old_resid = resid_nrm; - if ( amg_logging > 1 ) { - hypre_ParCSRMatrixMatvecOutOfPlace(alpha, A_array[0], U_array[0], beta, F_array[0], Residual ); - resid_nrm = sqrt(hypre_ParVectorInnerProd( Residual, Residual )); - } - else { - hypre_ParCSRMatrixMatvecOutOfPlace(alpha, A_array[0], U_array[0], beta, F_array[0], Vtemp); - resid_nrm = sqrt(hypre_ParVectorInnerProd(Vtemp, Vtemp)); - } - - if (old_resid) - { - conv_factor = resid_nrm / old_resid; - } - else - { - conv_factor = resid_nrm; - } - - if (0 == converge_type) - { - if (rhs_norm) - { - relative_resid = resid_nrm / rhs_norm; - } - else - { - relative_resid = resid_nrm; - } - } - else - { - relative_resid = resid_nrm / resid_nrm_init; - } + if ( amg_logging > 1 ) + { + hypre_ParCSRMatrixMatvecOutOfPlace(alpha, A_array[0], U_array[0], beta, F_array[0], Residual ); + resid_nrm = sqrt(hypre_ParVectorInnerProd( Residual, Residual )); + } + else + { + hypre_ParCSRMatrixMatvecOutOfPlace(alpha, A_array[0], U_array[0], beta, F_array[0], Vtemp); + resid_nrm = sqrt(hypre_ParVectorInnerProd(Vtemp, Vtemp)); + } + + if (old_resid) + { + conv_factor = resid_nrm / old_resid; + } + else + { + conv_factor = resid_nrm; + } - hypre_ParAMGDataRelativeResidualNorm(amg_data) = relative_resid; + if (0 == converge_type) + { + if (rhs_norm) + { + relative_resid = resid_nrm / rhs_norm; + } + else + { + relative_resid = resid_nrm; + } + } + else + { + relative_resid = resid_nrm / resid_nrm_init; + } + + hypre_ParAMGDataRelativeResidualNorm(amg_data) = relative_resid; } ++cycle_count; @@ -301,9 +309,9 @@ #endif if (my_id == 0 && amg_print_level > 1) - { + { hypre_printf(" Cycle %2d %e %f %e \n", cycle_count, - resid_nrm, conv_factor, relative_resid); + resid_nrm, conv_factor, relative_resid); } } @@ -317,12 +325,12 @@ * Compute closing statistics *-----------------------------------------------------------------------*/ - if (cycle_count > 0 && resid_nrm_init) - conv_factor = pow((resid_nrm/resid_nrm_init),(1.0/(HYPRE_Real) cycle_count)); + if (cycle_count > 0 && resid_nrm_init) + conv_factor = pow((resid_nrm/resid_nrm_init),(1.0/(HYPRE_Real) cycle_count)); else - conv_factor = 1.; + conv_factor = 1.; - if (amg_print_level > 1) + if (amg_print_level > 1) { num_coeffs = hypre_CTAlloc(HYPRE_Real, num_levels, HYPRE_MEMORY_HOST); num_variables = hypre_CTAlloc(HYPRE_Real, num_levels, HYPRE_MEMORY_HOST); @@ -348,7 +356,7 @@ num_variables[j] = (HYPRE_Real) hypre_ParCSRMatrixGlobalNumRows(A_array[j]); } } - + for (j=0;j 0; i--) { ST_i[i] = ST_i[i-1]; @@ -211,8 +205,8 @@ measure_array_master[i] = ST_i[i+1]-ST_i[i]; } - if ((measure_type || (coarsen_type != 1 && coarsen_type != 11)) - && num_procs > 1) + if ((measure_type || (coarsen_type != 1 && coarsen_type != 11)) + && num_procs > 1) { if (use_commpkg_A) S_ext = hypre_ParCSRMatrixExtractBExt(S,A,0); @@ -223,16 +217,16 @@ num_nonzeros = S_ext_i[num_cols_offd]; first_col = hypre_ParCSRMatrixFirstColDiag(S); /*col_0 = first_col-1; - col_n = col_0+num_variables;*/ + col_n = col_0+num_variables;*/ if (measure_type) { - for (i=0; i < num_nonzeros; i++) + for (i=0; i < num_nonzeros; i++) { - index = (HYPRE_Int)(S_ext_j[i] - first_col); - if (index > -1 && index < num_variables) - measure_array_master[index]++; - } - } + index = (HYPRE_Int)(S_ext_j[i] - first_col); + if (index > -1 && index < num_variables) + measure_array_master[index]++; + } + } } /*--------------------------------------------------- @@ -243,214 +237,214 @@ /* first coarsening phase */ - /************************************************************* - * - * Initialize the lists - * - *************************************************************/ + /************************************************************* + * + * Initialize the lists + * + *************************************************************/ CF_marker = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); - + num_left = 0; for (j = 0; j < num_variables; j++) { - if ((S_i[j+1]-S_i[j])== 0 && - (S_offd_i[j+1]-S_offd_i[j]) == 0) - { - CF_marker[j] = SF_PT; - measure_array_master[j] = 0; - } - else - { - CF_marker[j] = UNDECIDED; - /* num_left++; */ /* BM May 19, 2006: see below*/ - } - } + if ((S_i[j+1]-S_i[j])== 0 && + (S_offd_i[j+1]-S_offd_i[j]) == 0) + { + CF_marker[j] = SF_PT; + measure_array_master[j] = 0; + } + else + { + CF_marker[j] = UNDECIDED; + /* num_left++; */ /* BM May 19, 2006: see below*/ + } + } if (coarsen_type==22) { - /* BM Sep 8, 2006: allow_emptygrids only if the following holds for all points j: - (a) the point has no strong connections at all, OR - (b) the point has a strong connection across a boundary */ - for (j=0;jS_i[j] && S_offd_i[j+1] == S_offd_i[j]) {coarsen_type=21;break;} + /* BM Sep 8, 2006: allow_emptygrids only if the following holds for all points j: + (a) the point has no strong connections at all, OR + (b) the point has a strong connection across a boundary */ + for (j=0;jS_i[j] && S_offd_i[j+1] == S_offd_i[j]) {coarsen_type=21;break;} } for (l = 1; l <= cgc_its; l++) { - LoL_head = NULL; - LoL_tail = NULL; - num_left = 0; /* compute num_left before each RS coarsening loop */ - hypre_TMemcpy(measure_array, measure_array_master, HYPRE_Int, num_variables, HYPRE_MEMORY_HOST, HYPRE_MEMORY_HOST); - memset (lists,0,sizeof(HYPRE_Int)*num_variables); - memset (where,0,sizeof(HYPRE_Int)*num_variables); - - for (j = 0; j < num_variables; j++) - { - measure = measure_array[j]; - if (CF_marker[j] != SF_PT) - { - if (measure > 0) - { - hypre_enter_on_lists(&LoL_head, &LoL_tail, measure, j, lists, where); - num_left++; /* compute num_left before each RS coarsening loop */ - } - else if (CF_marker[j] == 0) /* increase weight of strongly coupled neighbors only - if j is not conained in a previously constructed coarse grid. - Reason: these neighbors should start with the same initial weight - in each CGC iteration. BM Aug 30, 2006 */ - - { - if (measure < 0) hypre_error_w_msg(HYPRE_ERROR_GENERIC,"negative measure!\n"); -/* CF_marker[j] = f_pnt; */ - for (k = S_i[j]; k < S_i[j+1]; k++) - { - nabor = S_j[k]; -/* if (CF_marker[nabor] != SF_PT) */ - if (CF_marker[nabor] == 0) /* BM Aug 30, 2006: don't alter weights of points - contained in other candidate coarse grids */ - { - if (nabor < j) - { - new_meas = measure_array[nabor]; - if (new_meas > 0) - hypre_remove_point(&LoL_head, &LoL_tail, new_meas, - nabor, lists, where); - else num_left++; /* BM Aug 29, 2006 */ - - new_meas = ++(measure_array[nabor]); - hypre_enter_on_lists(&LoL_head, &LoL_tail, new_meas, - nabor, lists, where); - } - else - { - new_meas = ++(measure_array[nabor]); - } - } - } - /* --num_left; */ /* BM May 19, 2006 */ + LoL_head = NULL; + LoL_tail = NULL; + num_left = 0; /* compute num_left before each RS coarsening loop */ + hypre_TMemcpy(measure_array, measure_array_master, HYPRE_Int, num_variables, HYPRE_MEMORY_HOST, HYPRE_MEMORY_HOST); + memset (lists,0,sizeof(HYPRE_Int)*num_variables); + memset (where,0,sizeof(HYPRE_Int)*num_variables); + + for (j = 0; j < num_variables; j++) + { + measure = measure_array[j]; + if (CF_marker[j] != SF_PT) + { + if (measure > 0) + { + hypre_enter_on_lists(&LoL_head, &LoL_tail, measure, j, lists, where); + num_left++; /* compute num_left before each RS coarsening loop */ + } + else if (CF_marker[j] == 0) /* increase weight of strongly coupled neighbors only + if j is not conained in a previously constructed coarse grid. + Reason: these neighbors should start with the same initial weight + in each CGC iteration. BM Aug 30, 2006 */ + + { + if (measure < 0) hypre_error_w_msg(HYPRE_ERROR_GENERIC,"negative measure!\n"); + /* CF_marker[j] = f_pnt; */ + for (k = S_i[j]; k < S_i[j+1]; k++) + { + nabor = S_j[k]; + /* if (CF_marker[nabor] != SF_PT) */ + if (CF_marker[nabor] == 0) /* BM Aug 30, 2006: don't alter weights of points + contained in other candidate coarse grids */ + { + if (nabor < j) + { + new_meas = measure_array[nabor]; + if (new_meas > 0) + hypre_remove_point(&LoL_head, &LoL_tail, new_meas, + nabor, lists, where); + else num_left++; /* BM Aug 29, 2006 */ + + new_meas = ++(measure_array[nabor]); + hypre_enter_on_lists(&LoL_head, &LoL_tail, new_meas, + nabor, lists, where); + } + else + { + new_meas = ++(measure_array[nabor]); + } + } + } + /* --num_left; */ /* BM May 19, 2006 */ + } } - } - } + } - /* BM Aug 30, 2006: first iteration: determine maximal weight */ - if (num_left && l==1) measure_max = measure_array[LoL_head->head]; - /* BM Aug 30, 2006: break CGC iteration if no suitable - starting point is available any more */ - if (!num_left || measure_array[LoL_head->head]next_elt; - hypre_dispose_elt (list_ptr); - } - break; - } + /* BM Aug 30, 2006: first iteration: determine maximal weight */ + if (num_left && l==1) measure_max = measure_array[LoL_head->head]; + /* BM Aug 30, 2006: break CGC iteration if no suitable + starting point is available any more */ + if (!num_left || measure_array[LoL_head->head]next_elt; + hypre_dispose_elt (list_ptr); + } + break; + } - /**************************************************************** - * - * Main loop of Ruge-Stueben first coloring pass. - * - * WHILE there are still points to classify DO: - * 1) find first point, i, on list with max_measure - * make i a C-point, remove it from the lists - * 2) For each point, j, in S_i^T, - * a) Set j to be an F-point - * b) For each point, k, in S_j - * move k to the list in LoL with measure one - * greater than it occupies (creating new LoL - * entry if necessary) - * 3) For each point, j, in S_i, - * move j to the list in LoL with measure one - * smaller than it occupies (creating new LoL - * entry if necessary) - * - ****************************************************************/ + /**************************************************************** + * + * Main loop of Ruge-Stueben first coloring pass. + * + * WHILE there are still points to classify DO: + * 1) find first point, i, on list with max_measure + * make i a C-point, remove it from the lists + * 2) For each point, j, in S_i^T, + * a) Set j to be an F-point + * b) For each point, k, in S_j + * move k to the list in LoL with measure one + * greater than it occupies (creating new LoL + * entry if necessary) + * 3) For each point, j, in S_i, + * move j to the list in LoL with measure one + * smaller than it occupies (creating new LoL + * entry if necessary) + * + ****************************************************************/ + + while (num_left > 0) + { + index = LoL_head -> head; + /* index = LoL_head -> tail; */ + + /* CF_marker[index] = C_PT; */ + CF_marker[index] = l; /* BM Aug 18, 2006 */ + measure = measure_array[index]; + measure_array[index] = 0; + measure_array_master[index] = 0; /* BM May 19: for CGC */ + --num_left; + + hypre_remove_point(&LoL_head, &LoL_tail, measure, index, lists, where); + + for (j = ST_i[index]; j < ST_i[index+1]; j++) + { + nabor = ST_j[j]; + /* if (CF_marker[nabor] == UNDECIDED) */ + if (measure_array[nabor]>0) /* undecided point */ + { + /* CF_marker[nabor] = F_PT; */ /* BM Aug 18, 2006 */ + measure = measure_array[nabor]; + measure_array[nabor]=0; - while (num_left > 0) - { - index = LoL_head -> head; -/* index = LoL_head -> tail; */ - -/* CF_marker[index] = C_PT; */ - CF_marker[index] = l; /* BM Aug 18, 2006 */ - measure = measure_array[index]; - measure_array[index] = 0; - measure_array_master[index] = 0; /* BM May 19: for CGC */ - --num_left; - - hypre_remove_point(&LoL_head, &LoL_tail, measure, index, lists, where); - - for (j = ST_i[index]; j < ST_i[index+1]; j++) - { - nabor = ST_j[j]; -/* if (CF_marker[nabor] == UNDECIDED) */ - if (measure_array[nabor]>0) /* undecided point */ - { - /* CF_marker[nabor] = F_PT; */ /* BM Aug 18, 2006 */ - measure = measure_array[nabor]; - measure_array[nabor]=0; - - hypre_remove_point(&LoL_head, &LoL_tail, measure, nabor, lists, where); - --num_left; - - for (k = S_i[nabor]; k < S_i[nabor+1]; k++) - { - nabor_two = S_j[k]; -/* if (CF_marker[nabor_two] == UNDECIDED) */ - if (measure_array[nabor_two]>0) /* undecided point */ - { - measure = measure_array[nabor_two]; - hypre_remove_point(&LoL_head, &LoL_tail, measure, - nabor_two, lists, where); - - new_meas = ++(measure_array[nabor_two]); - - hypre_enter_on_lists(&LoL_head, &LoL_tail, new_meas, - nabor_two, lists, where); - } - } + hypre_remove_point(&LoL_head, &LoL_tail, measure, nabor, lists, where); + --num_left; + + for (k = S_i[nabor]; k < S_i[nabor+1]; k++) + { + nabor_two = S_j[k]; + /* if (CF_marker[nabor_two] == UNDECIDED) */ + if (measure_array[nabor_two]>0) /* undecided point */ + { + measure = measure_array[nabor_two]; + hypre_remove_point(&LoL_head, &LoL_tail, measure, + nabor_two, lists, where); + + new_meas = ++(measure_array[nabor_two]); + + hypre_enter_on_lists(&LoL_head, &LoL_tail, new_meas, + nabor_two, lists, where); + } + } + } } - } - for (j = S_i[index]; j < S_i[index+1]; j++) - { - nabor = S_j[j]; -/* if (CF_marker[nabor] == UNDECIDED) */ - if (measure_array[nabor]>0) /* undecided point */ + for (j = S_i[index]; j < S_i[index+1]; j++) { - measure = measure_array[nabor]; - - hypre_remove_point(&LoL_head, &LoL_tail, measure, nabor, lists, where); - - measure_array[nabor] = --measure; - - if (measure > 0) - hypre_enter_on_lists(&LoL_head, &LoL_tail, measure, nabor, - lists, where); - else - { -/* CF_marker[nabor] = F_PT; */ /* BM Aug 18, 2006 */ - --num_left; - - for (k = S_i[nabor]; k < S_i[nabor+1]; k++) - { - nabor_two = S_j[k]; -/* if (CF_marker[nabor_two] == UNDECIDED) */ - if (measure_array[nabor_two]>0) + nabor = S_j[j]; + /* if (CF_marker[nabor] == UNDECIDED) */ + if (measure_array[nabor]>0) /* undecided point */ + { + measure = measure_array[nabor]; + + hypre_remove_point(&LoL_head, &LoL_tail, measure, nabor, lists, where); + + measure_array[nabor] = --measure; + + if (measure > 0) + hypre_enter_on_lists(&LoL_head, &LoL_tail, measure, nabor, + lists, where); + else { - new_meas = measure_array[nabor_two]; - hypre_remove_point(&LoL_head, &LoL_tail, new_meas, - nabor_two, lists, where); - - new_meas = ++(measure_array[nabor_two]); - - hypre_enter_on_lists(&LoL_head, &LoL_tail, new_meas, - nabor_two, lists, where); - } - } - } + /* CF_marker[nabor] = F_PT; */ /* BM Aug 18, 2006 */ + --num_left; + + for (k = S_i[nabor]; k < S_i[nabor+1]; k++) + { + nabor_two = S_j[k]; + /* if (CF_marker[nabor_two] == UNDECIDED) */ + if (measure_array[nabor_two]>0) + { + new_meas = measure_array[nabor_two]; + hypre_remove_point(&LoL_head, &LoL_tail, new_meas, + nabor_two, lists, where); + + new_meas = ++(measure_array[nabor_two]); + + hypre_enter_on_lists(&LoL_head, &LoL_tail, new_meas, + nabor_two, lists, where); + } + } + } + } } - } - } - if (LoL_head) hypre_error_w_msg (HYPRE_ERROR_GENERIC,"Linked list not empty!\n"); /*head: %d\n",LoL_head->head);*/ + } + if (LoL_head) hypre_error_w_msg (HYPRE_ERROR_GENERIC,"Linked list not empty!\n"); /*head: %d\n",LoL_head->head);*/ } l--; /* BM Aug 15, 2006 */ @@ -462,34 +456,34 @@ { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Coarsen 1st pass = %f\n", - my_id, wall_time); + my_id, wall_time); } hypre_TFree(lists, HYPRE_MEMORY_HOST); hypre_TFree(where, HYPRE_MEMORY_HOST); - - if (num_procs>1) { - if (debug_flag == 3) wall_time = time_getWallclockSeconds(); - hypre_BoomerAMGCoarsenCGC (S,l,coarsen_type,CF_marker); - - if (debug_flag == 3) { - wall_time = time_getWallclockSeconds() - wall_time; - hypre_printf("Proc = %d Coarsen CGC = %f\n", - my_id, wall_time); - } - } - else { - /* the first candiate coarse grid is the coarse grid */ - for (j=0;j1) { + if (debug_flag == 3) wall_time = time_getWallclockSeconds(); + hypre_BoomerAMGCoarsenCGC (S,l,coarsen_type,CF_marker); + + if (debug_flag == 3) { + wall_time = time_getWallclockSeconds() - wall_time; + hypre_printf("Proc = %d Coarsen CGC = %f\n", + my_id, wall_time); + } + } + else { + /* the first candiate coarse grid is the coarse grid */ + for (j=0;j 0) + graph_array[j] = i; + } + for (ji = S_i[i]; ji < S_i[i+1]; ji++) { - for (ji = S_i[i]; ji < S_i[i+1]; ji++) - { - j = S_j[ji]; - if (CF_marker[j] > 0) - graph_array[j] = i; - } - for (ji = S_i[i]; ji < S_i[i+1]; ji++) - { - j = S_j[ji]; - if (CF_marker[j] == -1) - { - set_empty = 1; - for (jj = S_i[j]; jj < S_i[j+1]; jj++) - { - index = S_j[jj]; - if (graph_array[index] == i) - { - set_empty = 0; - break; - } - } - if (set_empty) - { - if (C_i_nonempty) - { - CF_marker[i] = 1; - if (ci_tilde > -1) - { - CF_marker[ci_tilde] = -1; - ci_tilde = -1; - } - C_i_nonempty = 0; - break; - } - else - { - ci_tilde = j; - ci_tilde_mark = i; - CF_marker[j] = 1; - C_i_nonempty = 1; - i--; - break; - } - } - } - } - } + j = S_j[ji]; + if (CF_marker[j] == -1) + { + set_empty = 1; + for (jj = S_i[j]; jj < S_i[j+1]; jj++) + { + index = S_j[jj]; + if (graph_array[index] == i) + { + set_empty = 0; + break; + } + } + if (set_empty) + { + if (C_i_nonempty) + { + CF_marker[i] = 1; + if (ci_tilde > -1) + { + CF_marker[ci_tilde] = -1; + ci_tilde = -1; + } + C_i_nonempty = 0; + break; + } + else + { + ci_tilde = j; + ci_tilde_mark = i; + CF_marker[j] = 1; + C_i_nonempty = 1; + i--; + break; + } + } + } + } } + } if (debug_flag == 3 && coarsen_type != 2) { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Coarsen 2nd pass = %f\n", - my_id, wall_time); + my_id, wall_time); } /* third pass, check boundary fine points for coarse neighbors */ - /*------------------------------------------------ - * Exchange boundary data for CF_marker - *------------------------------------------------*/ - - if (debug_flag == 3) wall_time = time_getWallclockSeconds(); - - CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); - int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, - num_sends), HYPRE_MEMORY_HOST); - - index = 0; - for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - if (num_procs > 1) - { + /*------------------------------------------------ + * Exchange boundary data for CF_marker + *------------------------------------------------*/ + + if (debug_flag == 3) wall_time = time_getWallclockSeconds(); + + CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); + int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, + num_sends), HYPRE_MEMORY_HOST); + + index = 0; + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + int_buf_data[index++] + = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } + + if (num_procs > 1) + { comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, int_buf_data, - CF_marker_offd); - + CF_marker_offd); + hypre_ParCSRCommHandleDestroy(comm_handle); - } - hypre_AmgCGCBoundaryFix (S,CF_marker,CF_marker_offd); - if (debug_flag == 3) - { - wall_time = time_getWallclockSeconds() - wall_time; - hypre_printf("Proc = %d CGC boundary fix = %f\n", - my_id, wall_time); - } + } + hypre_AmgCGCBoundaryFix (S,CF_marker,CF_marker_offd); + if (debug_flag == 3) + { + wall_time = time_getWallclockSeconds() - wall_time; + hypre_printf("Proc = %d CGC boundary fix = %f\n", + my_id, wall_time); + } /*--------------------------------------------------- * Clean up and return *---------------------------------------------------*/ /*if (coarsen_type != 1) - { */ - if (CF_marker_offd) hypre_TFree(CF_marker_offd, HYPRE_MEMORY_HOST); /* BM Aug 21, 2006 */ - if (int_buf_data) hypre_TFree(int_buf_data, HYPRE_MEMORY_HOST); /* BM Aug 21, 2006 */ - /*if (ci_array) hypre_TFree(ci_array);*/ /* BM Aug 21, 2006 */ - /*} */ + { */ + if (CF_marker_offd) hypre_TFree(CF_marker_offd, HYPRE_MEMORY_HOST); /* BM Aug 21, 2006 */ + if (int_buf_data) hypre_TFree(int_buf_data, HYPRE_MEMORY_HOST); /* BM Aug 21, 2006 */ + /*if (ci_array) hypre_TFree(ci_array);*/ /* BM Aug 21, 2006 */ + /*} */ hypre_TFree(graph_array, HYPRE_MEMORY_HOST); - if ((measure_type || (coarsen_type != 1 && coarsen_type != 11)) - && num_procs > 1) - hypre_CSRMatrixDestroy(S_ext); - + if ((measure_type || (coarsen_type != 1 && coarsen_type != 11)) + && num_procs > 1) + hypre_CSRMatrixDestroy(S_ext); + *CF_marker_ptr = CF_marker; - + return hypre_error_flag; } @@ -632,141 +626,141 @@ * gridpartition : the grid partition * =====================================================================================================*/ { - HYPRE_Int j,/*p,*/mpisize,mpirank,/*rstart,rend,*/choice,*coarse; - HYPRE_Int *vertexrange = NULL; - HYPRE_Int *vertexrange_all = NULL; - HYPRE_Int *CF_marker_offd = NULL; - HYPRE_Int num_variables = hypre_CSRMatrixNumRows (hypre_ParCSRMatrixDiag(S)); -/* HYPRE_Int num_cols_offd = hypre_CSRMatrixNumCols (hypre_ParCSRMatrixOffd (S)); */ -/* HYPRE_Int *col_map_offd = hypre_ParCSRMatrixColMapOffd (S); */ - -/* HYPRE_Real wall_time; */ - - HYPRE_IJMatrix ijG; - hypre_ParCSRMatrix *G; - hypre_CSRMatrix *Gseq; - MPI_Comm comm = hypre_ParCSRMatrixComm(S); + HYPRE_Int j,/*p,*/mpisize,mpirank,/*rstart,rend,*/choice,*coarse; + HYPRE_Int *vertexrange = NULL; + HYPRE_Int *vertexrange_all = NULL; + HYPRE_Int *CF_marker_offd = NULL; + HYPRE_Int num_variables = hypre_CSRMatrixNumRows (hypre_ParCSRMatrixDiag(S)); + /* HYPRE_Int num_cols_offd = hypre_CSRMatrixNumCols (hypre_ParCSRMatrixOffd (S)); */ + /* HYPRE_Int *col_map_offd = hypre_ParCSRMatrixColMapOffd (S); */ + + /* HYPRE_Real wall_time; */ + + HYPRE_IJMatrix ijG; + hypre_ParCSRMatrix *G; + hypre_CSRMatrix *Gseq; + MPI_Comm comm = hypre_ParCSRMatrixComm(S); - hypre_MPI_Comm_size (comm,&mpisize); - hypre_MPI_Comm_rank (comm,&mpirank); + hypre_MPI_Comm_size (comm,&mpisize); + hypre_MPI_Comm_rank (comm,&mpirank); #if 0 - if (!mpirank) { + if (!mpirank) { wall_time = time_getWallclockSeconds(); hypre_printf ("Starting CGC preparation\n"); - } + } #endif - hypre_AmgCGCPrepare (S,numberofgrids,CF_marker,&CF_marker_offd,coarsen_type,&vertexrange); + hypre_AmgCGCPrepare (S,numberofgrids,CF_marker,&CF_marker_offd,coarsen_type,&vertexrange); #if 0 /* debugging */ - if (!mpirank) { - wall_time = time_getWallclockSeconds() - wall_time; - hypre_printf ("Finished CGC preparation, wall_time = %f s\n",wall_time); - wall_time = time_getWallclockSeconds(); - hypre_printf ("Starting CGC matrix assembly\n"); - } + if (!mpirank) { + wall_time = time_getWallclockSeconds() - wall_time; + hypre_printf ("Finished CGC preparation, wall_time = %f s\n",wall_time); + wall_time = time_getWallclockSeconds(); + hypre_printf ("Starting CGC matrix assembly\n"); + } #endif - hypre_AmgCGCGraphAssemble (S,vertexrange,CF_marker,CF_marker_offd,coarsen_type,&ijG); + hypre_AmgCGCGraphAssemble (S,vertexrange,CF_marker,CF_marker_offd,coarsen_type,&ijG); #if 0 - HYPRE_IJMatrixPrint (ijG,"graph.txt"); + HYPRE_IJMatrixPrint (ijG,"graph.txt"); #endif - HYPRE_IJMatrixGetObject (ijG,(void**)&G); + HYPRE_IJMatrixGetObject (ijG,(void**)&G); #if 0 /* debugging */ - if (!mpirank) { - wall_time = time_getWallclockSeconds() - wall_time; - hypre_printf ("Finished CGC matrix assembly, wall_time = %f s\n",wall_time); - wall_time = time_getWallclockSeconds(); - hypre_printf ("Starting CGC matrix communication\n"); - } + if (!mpirank) { + wall_time = time_getWallclockSeconds() - wall_time; + hypre_printf ("Finished CGC matrix assembly, wall_time = %f s\n",wall_time); + wall_time = time_getWallclockSeconds(); + hypre_printf ("Starting CGC matrix communication\n"); + } #endif #ifdef HYPRE_NO_GLOBAL_PARTITION - { - /* classical CGC does not really make sense in combination with HYPRE_NO_GLOBAL_PARTITION, - but anyway, here it is: - */ - HYPRE_Int nlocal = vertexrange[1]-vertexrange[0]; - vertexrange_all = hypre_CTAlloc(HYPRE_Int, mpisize+1, HYPRE_MEMORY_HOST); - hypre_MPI_Allgather (&nlocal,1,HYPRE_MPI_INT,vertexrange_all+1,1,HYPRE_MPI_INT,comm); - vertexrange_all[0]=0; - for (j=2;j<=mpisize;j++) vertexrange_all[j]+=vertexrange_all[j-1]; - } + { + /* classical CGC does not really make sense in combination with HYPRE_NO_GLOBAL_PARTITION, + but anyway, here it is: + */ + HYPRE_Int nlocal = vertexrange[1]-vertexrange[0]; + vertexrange_all = hypre_CTAlloc(HYPRE_Int, mpisize+1, HYPRE_MEMORY_HOST); + hypre_MPI_Allgather (&nlocal,1,HYPRE_MPI_INT,vertexrange_all+1,1,HYPRE_MPI_INT,comm); + vertexrange_all[0]=0; + for (j=2;j<=mpisize;j++) vertexrange_all[j]+=vertexrange_all[j-1]; + } #else - vertexrange_all = vertexrange; + vertexrange_all = vertexrange; #endif - Gseq = hypre_ParCSRMatrixToCSRMatrixAll (G); + Gseq = hypre_ParCSRMatrixToCSRMatrixAll (G); #if 0 /* debugging */ - if (!mpirank) { - wall_time = time_getWallclockSeconds() - wall_time; - hypre_printf ("Finished CGC matrix communication, wall_time = %f s\n",wall_time); - } + if (!mpirank) { + wall_time = time_getWallclockSeconds() - wall_time; + hypre_printf ("Finished CGC matrix communication, wall_time = %f s\n",wall_time); + } #endif - if (Gseq) { /* BM Aug 31, 2006: Gseq==NULL if G has no local rows */ + if (Gseq) { /* BM Aug 31, 2006: Gseq==NULL if G has no local rows */ #if 0 /* debugging */ - if (!mpirank) { - wall_time = time_getWallclockSeconds(); - hypre_printf ("Starting CGC election\n"); - } + if (!mpirank) { + wall_time = time_getWallclockSeconds(); + hypre_printf ("Starting CGC election\n"); + } #endif - hypre_AmgCGCChoose (Gseq,vertexrange_all,mpisize,&coarse); + hypre_AmgCGCChoose (Gseq,vertexrange_all,mpisize,&coarse); #if 0 /* debugging */ - if (!mpirank) { - wall_time = time_getWallclockSeconds() - wall_time; - hypre_printf ("Finished CGC election, wall_time = %f s\n",wall_time); - } + if (!mpirank) { + wall_time = time_getWallclockSeconds() - wall_time; + hypre_printf ("Finished CGC election, wall_time = %f s\n",wall_time); + } #endif #if 0 /* debugging */ - if (!mpirank) { - for (j=0;j0) - CF_marker[i]+=vstart; - } - else { -/* hypre_printf ("processor %d: empty grid allowed\n",mpirank); */ - for (i=0;i0) - CF_marker[i]+=vstart+1; /* add one because vertexrange[mpirank]+1 denotes the empty grid. - Hence, vertexrange[mpirank]+2 is the first coarse grid denoted in - global indices, ... */ - } - } - - /* exchange data */ - *CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); - int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart (comm_pkg, num_sends), HYPRE_MEMORY_HOST); - - for (i=0,ii=0;i1) { - comm_handle = hypre_ParCSRCommHandleCreate (11,comm_pkg,int_buf_data,*CF_marker_offd); - hypre_ParCSRCommHandleDestroy (comm_handle); - } - hypre_TFree(int_buf_data, HYPRE_MEMORY_HOST); - *vrange=vertexrange; - return hypre_error_flag; + vertexrange = hypre_CTAlloc(HYPRE_Int, mpisize+1, HYPRE_MEMORY_HOST); + + hypre_MPI_Allgather (&nlocal,1,HYPRE_MPI_INT,vertexrange+1,1,HYPRE_MPI_INT,comm); + vertexrange[0]=0; + for (i=2;i<=mpisize;i++) vertexrange[i]+=vertexrange[i-1]; + vstart = vertexrange[mpirank]; + /*vend = vertexrange[mpirank+1];*/ +#endif + + /* Note: vstart uses 0-based indexing, while CF_marker uses 1-based indexing */ + if (coarsen_type % 2 == 1) { /* see above */ + for (i=0;i0) + CF_marker[i]+=vstart; + } + else { + /* hypre_printf ("processor %d: empty grid allowed\n",mpirank); */ + for (i=0;i0) + CF_marker[i]+=vstart+1; /* add one because vertexrange[mpirank]+1 denotes the empty grid. + Hence, vertexrange[mpirank]+2 is the first coarse grid denoted in + global indices, ... */ + } + } + + /* exchange data */ + *CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); + int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart (comm_pkg, num_sends), HYPRE_MEMORY_HOST); + + for (i=0,ii=0;i1) { + comm_handle = hypre_ParCSRCommHandleCreate (11,comm_pkg,int_buf_data,*CF_marker_offd); + hypre_ParCSRCommHandleDestroy (comm_handle); + } + hypre_TFree(int_buf_data, HYPRE_MEMORY_HOST); + *vrange=vertexrange; + return hypre_error_flag; } #define tag_pointrange 301 #define tag_vertexrange 302 HYPRE_Int hypre_AmgCGCGraphAssemble (hypre_ParCSRMatrix *S,HYPRE_Int *vertexrange,HYPRE_Int *CF_marker,HYPRE_Int *CF_marker_offd,HYPRE_Int coarsen_type, - HYPRE_IJMatrix *ijG) + HYPRE_IJMatrix *ijG) /* assemble a graph representing the connections between the grids * ================================================================================================ * S : the strength matrix * vertexrange : the parallel layout of the candidate coarse grid vertices - * CF_marker, CF_marker_offd : the coarse/fine markers + * CF_marker, CF_marker_offd : the coarse/fine markers * coarsen_type : the coarsening type * ijG : the created graph * ================================================================================================*/ { - HYPRE_Int i,/* ii,ip,*/ j,jj,m,n,p; - HYPRE_Int mpisize,mpirank; + HYPRE_Int i,/* ii,ip,*/ j,jj,m,n,p; + HYPRE_Int mpisize,mpirank; - HYPRE_Real weight; + HYPRE_Real weight; - MPI_Comm comm = hypre_ParCSRMatrixComm(S); -/* hypre_MPI_Status status; */ + MPI_Comm comm = hypre_ParCSRMatrixComm(S); + /* hypre_MPI_Status status; */ - HYPRE_IJMatrix ijmatrix; - hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag (S); - hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd (S); -/* HYPRE_Int *S_i = hypre_CSRMatrixI(S_diag); */ -/* HYPRE_Int *S_j = hypre_CSRMatrixJ(S_diag); */ - HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); - HYPRE_Int *S_offd_j = NULL; - HYPRE_Int num_variables = hypre_CSRMatrixNumRows (S_diag); - HYPRE_Int num_cols_offd = hypre_CSRMatrixNumCols (S_offd); - HYPRE_BigInt *col_map_offd = hypre_ParCSRMatrixColMapOffd (S); - HYPRE_BigInt *pointrange; - HYPRE_Int *pointrange_nonlocal,*pointrange_strong=NULL; - HYPRE_Int vertexrange_start,vertexrange_end; - HYPRE_Int *vertexrange_strong= NULL; - HYPRE_Int *vertexrange_nonlocal; - HYPRE_Int num_recvs,num_recvs_strong; - HYPRE_Int *recv_procs,*recv_procs_strong=NULL; - HYPRE_Int /* *zeros,*rownz,*/*rownz_diag,*rownz_offd; - HYPRE_Int nz; - HYPRE_Int nlocal; - HYPRE_Int one=1; - - hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg (S); - - - hypre_MPI_Comm_size (comm,&mpisize); - hypre_MPI_Comm_rank (comm,&mpirank); - - /* determine neighbor processors */ - num_recvs = hypre_ParCSRCommPkgNumRecvs (comm_pkg); - recv_procs = hypre_ParCSRCommPkgRecvProcs (comm_pkg); - pointrange = hypre_ParCSRMatrixRowStarts (S); - pointrange_nonlocal = hypre_CTAlloc(HYPRE_Int, 2*num_recvs, HYPRE_MEMORY_HOST); - vertexrange_nonlocal = hypre_CTAlloc(HYPRE_Int, 2*num_recvs, HYPRE_MEMORY_HOST); + HYPRE_IJMatrix ijmatrix; + hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag (S); + hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd (S); + /* HYPRE_Int *S_i = hypre_CSRMatrixI(S_diag); */ + /* HYPRE_Int *S_j = hypre_CSRMatrixJ(S_diag); */ + HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); + HYPRE_Int *S_offd_j = NULL; + HYPRE_Int num_variables = hypre_CSRMatrixNumRows (S_diag); + HYPRE_Int num_cols_offd = hypre_CSRMatrixNumCols (S_offd); + HYPRE_BigInt *col_map_offd = hypre_ParCSRMatrixColMapOffd (S); + HYPRE_BigInt *pointrange; + HYPRE_Int *pointrange_nonlocal,*pointrange_strong=NULL; + HYPRE_Int vertexrange_start,vertexrange_end; + HYPRE_Int *vertexrange_strong= NULL; + HYPRE_Int *vertexrange_nonlocal; + HYPRE_Int num_recvs,num_recvs_strong; + HYPRE_Int *recv_procs,*recv_procs_strong=NULL; + HYPRE_Int /* *zeros,*rownz,*/*rownz_diag,*rownz_offd; + HYPRE_Int nz; + HYPRE_Int nlocal; + HYPRE_Int one=1; + + hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg (S); + + + hypre_MPI_Comm_size (comm,&mpisize); + hypre_MPI_Comm_rank (comm,&mpirank); + + /* determine neighbor processors */ + num_recvs = hypre_ParCSRCommPkgNumRecvs (comm_pkg); + recv_procs = hypre_ParCSRCommPkgRecvProcs (comm_pkg); + pointrange = hypre_ParCSRMatrixRowStarts (S); + pointrange_nonlocal = hypre_CTAlloc(HYPRE_Int, 2*num_recvs, HYPRE_MEMORY_HOST); + vertexrange_nonlocal = hypre_CTAlloc(HYPRE_Int, 2*num_recvs, HYPRE_MEMORY_HOST); #ifdef HYPRE_NO_GLOBAL_PARTITION - { - HYPRE_Int num_sends = hypre_ParCSRCommPkgNumSends (comm_pkg); - HYPRE_Int *send_procs = hypre_ParCSRCommPkgSendProcs (comm_pkg); - HYPRE_Int *int_buf_data = hypre_CTAlloc(HYPRE_Int, 4*num_sends, HYPRE_MEMORY_HOST); - HYPRE_Int *int_buf_data2 = int_buf_data + 2*num_sends; - hypre_MPI_Request *sendrequest,*recvrequest; - HYPRE_Int pointrange_start,pointrange_end; - - nlocal = vertexrange[1] - vertexrange[0]; - pointrange_start = pointrange[0]; - pointrange_end = pointrange[1]; - vertexrange_start = vertexrange[0]; - vertexrange_end = vertexrange[1]; - sendrequest = hypre_CTAlloc(hypre_MPI_Request, 2*(num_sends+num_recvs), HYPRE_MEMORY_HOST); - recvrequest = sendrequest+2*num_sends; - - for (i=0;i= pointrange_nonlocal[2*p] && jj < pointrange_nonlocal[2*p+1]) break; + nlocal = vertexrange[mpirank+1] - vertexrange[mpirank]; + /*pointrange_start = pointrange[mpirank]; + pointrange_end = pointrange[mpirank+1];*/ + vertexrange_start = vertexrange[mpirank]; + vertexrange_end = vertexrange[mpirank+1]; + for (i=0;i= pointrange_nonlocal[2*p] && jj < pointrange_nonlocal[2*p+1]) break; #if 0 - hypre_printf ("Processor %d, remote point %d on processor %d\n",mpirank,jj,recv_procs[p]); + hypre_printf ("Processor %d, remote point %d on processor %d\n",mpirank,jj,recv_procs[p]); #endif - recv_procs_strong [p]=1; + recv_procs_strong [p]=1; + } + + for (p=0,num_recvs_strong=0;p= pointrange_strong[2*p] && col_map_offd[jj] < pointrange_strong[2*p+1]) break; - /*ip=recv_procs_strong[p];*/ - /* loop over all coarse grids constructed on this processor domain */ - for (m=vertexrange_start;mlocal/gridpartition->nonlocal starts with one - while counting inside range starts with zero */ - if (CF_marker[i]-1==m && CF_marker_offd[jj]-1==n) - /* C-C-coupling */ - weight = -1; - else if ( (CF_marker[i]-1==m && (CF_marker_offd[jj]==0 || CF_marker_offd[jj]-1!=n) ) - || ( (CF_marker[i]==0 || CF_marker[i]-1!=m) && CF_marker_offd[jj]-1==n ) ) - /* C-F-coupling */ - weight = 0; - else weight = -8; /* F-F-coupling */ - HYPRE_IJMatrixAddToValues (ijmatrix,1,&one,&big_m,&big_n,&weight); -/*#if 0 - if (ierr) hypre_printf ("Processor %d: error %d while adding %lf to entry (%d, %d)\n",mpirank,ierr,weight,m,n); + } + + /* weight graph */ + for (i=0;i= pointrange_strong[2*p] && col_map_offd[jj] < pointrange_strong[2*p+1]) break; + /*ip=recv_procs_strong[p];*/ + /* loop over all coarse grids constructed on this processor domain */ + for (m=vertexrange_start;mlocal/gridpartition->nonlocal starts with one + while counting inside range starts with zero */ + if (CF_marker[i]-1==m && CF_marker_offd[jj]-1==n) + /* C-C-coupling */ + weight = -1; + else if ( (CF_marker[i]-1==m && (CF_marker_offd[jj]==0 || CF_marker_offd[jj]-1!=n) ) + || ( (CF_marker[i]==0 || CF_marker[i]-1!=m) && CF_marker_offd[jj]-1==n ) ) + /* C-F-coupling */ + weight = 0; + else weight = -8; /* F-F-coupling */ + HYPRE_IJMatrixAddToValues (ijmatrix,1,&one,&big_m,&big_n,&weight); + /*#if 0 + if (ierr) hypre_printf ("Processor %d: error %d while adding %lf to entry (%d, %d)\n",mpirank,ierr,weight,m,n); #endif*/ - } + } + } } - } - } + } - /* assemble */ - HYPRE_IJMatrixAssemble (ijmatrix); - /*if (num_recvs_strong) {*/ - hypre_TFree(recv_procs_strong, HYPRE_MEMORY_HOST); - hypre_TFree(pointrange_strong, HYPRE_MEMORY_HOST); - hypre_TFree(vertexrange_strong, HYPRE_MEMORY_HOST); - /*} */ + /* assemble */ + HYPRE_IJMatrixAssemble (ijmatrix); + /*if (num_recvs_strong) {*/ + hypre_TFree(recv_procs_strong, HYPRE_MEMORY_HOST); + hypre_TFree(pointrange_strong, HYPRE_MEMORY_HOST); + hypre_TFree(vertexrange_strong, HYPRE_MEMORY_HOST); + /*} */ - *ijG = ijmatrix; - return hypre_error_flag; + *ijG = ijmatrix; + return hypre_error_flag; } HYPRE_Int hypre_AmgCGCChoose (hypre_CSRMatrix *G,HYPRE_Int *vertexrange,HYPRE_Int mpisize,HYPRE_Int **coarse) @@ -1095,203 +1089,205 @@ * coarse : the chosen coarse grids * ===========================================================*/ { - HYPRE_Int i,j,jj,p,choice,*processor; - HYPRE_Int measure,new_measure; + HYPRE_Int i,j,jj,p,choice,*processor; + HYPRE_Int measure,new_measure; + + /* MPI_Comm comm = hypre_ParCSRMatrixComm(G); */ -/* MPI_Comm comm = hypre_ParCSRMatrixComm(G); */ + /* hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg (G); */ + /* hypre_ParCSRCommHandle *comm_handle; */ -/* hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg (G); */ -/* hypre_ParCSRCommHandle *comm_handle; */ + HYPRE_Real *G_data = hypre_CSRMatrixData (G); + HYPRE_Real max; + HYPRE_Int *G_i = hypre_CSRMatrixI(G); + HYPRE_Int *G_j = hypre_CSRMatrixJ(G); + hypre_CSRMatrix *H,*HT; + HYPRE_Int *H_i,*H_j,*HT_i,*HT_j; + HYPRE_Int jG,jH; + HYPRE_Int num_vertices = hypre_CSRMatrixNumRows (G); + HYPRE_Int *measure_array; + HYPRE_Int *lists,*where; + + hypre_LinkList LoL_head = NULL; + hypre_LinkList LoL_tail = NULL; + + processor = hypre_CTAlloc(HYPRE_Int, num_vertices, HYPRE_MEMORY_HOST); + *coarse = hypre_CTAlloc(HYPRE_Int, mpisize, HYPRE_MEMORY_HOST); + memset (*coarse,0,sizeof(HYPRE_Int)*mpisize); + + measure_array = hypre_CTAlloc(HYPRE_Int, num_vertices, HYPRE_MEMORY_HOST); + lists = hypre_CTAlloc(HYPRE_Int, num_vertices, HYPRE_MEMORY_HOST); + where = hypre_CTAlloc(HYPRE_Int, num_vertices, HYPRE_MEMORY_HOST); + + /* for (p=0;p=0.0) - hypre_printf ("G[%d,%d]=0. G_j(j)=%d, G_data(j)=%f.\n",i,G_j[j],j,G_data[j]); + if (G_data[j]>=0.0) + hypre_printf ("G[%d,%d]=0. G_j(j)=%d, G_data(j)=%f.\n",i,G_j[j],j,G_data[j]); #endif - /* G_data is always negative, so this test is sufficient */ - if (choice==-1 || G_data[j]>max) { - choice = G_j[j]; - max = G_data[j]; - } - if (j==G_i[i+1]-1 || processor[G_j[j+1]] > processor[choice]) { - /* we are done for this processor boundary */ - H_j[jj++]=choice; - H_i[i+1]++; + /* G_data is always negative, so this test is sufficient */ + if (choice==-1 || G_data[j]>max) { + choice = G_j[j]; + max = G_data[j]; + } + if (j==G_i[i+1]-1 || processor[G_j[j+1]] > processor[choice]) { + /* we are done for this processor boundary */ + H_j[jj++]=choice; + H_i[i+1]++; #if 0 - hypre_printf (" %d",choice); + hypre_printf (" %d",choice); #endif - choice = -1; max=0; + choice = -1; max=0; + } } - } #if 0 - hypre_printf("\n"); + hypre_printf("\n"); #endif - } + } - /****************************************************************** - * compute H^T, the transpose of H - ******************************************************************/ - - jH = H_i[num_vertices]; - HT = hypre_CSRMatrixCreate (num_vertices,num_vertices,jH); - HT_i = hypre_CTAlloc(HYPRE_Int, num_vertices+1, HYPRE_MEMORY_HOST); - HT_j = hypre_CTAlloc(HYPRE_Int, jH, HYPRE_MEMORY_HOST); - hypre_CSRMatrixI(HT) = HT_i; - hypre_CSRMatrixJ(HT) = HT_j; + /****************************************************************** + * compute H^T, the transpose of H + ******************************************************************/ + + jH = H_i[num_vertices]; + HT = hypre_CSRMatrixCreate (num_vertices,num_vertices,jH); + HT_i = hypre_CTAlloc(HYPRE_Int, num_vertices+1, HYPRE_MEMORY_HOST); + HT_j = hypre_CTAlloc(HYPRE_Int, jH, HYPRE_MEMORY_HOST); + hypre_CSRMatrixI(HT) = HT_i; + hypre_CSRMatrixJ(HT) = HT_j; + hypre_CSRMatrixMemoryLocation(HT) = HYPRE_MEMORY_HOST; for (i=0; i <= num_vertices; i++) HT_i[i] = 0; for (i=0; i < jH; i++) { - HT_i[H_j[i]+1]++; + HT_i[H_j[i]+1]++; } for (i=0; i < num_vertices; i++) { - HT_i[i+1] += HT_i[i]; + HT_i[i+1] += HT_i[i]; } for (i=0; i < num_vertices; i++) { - for (j=H_i[i]; j < H_i[i+1]; j++) { - HYPRE_Int myindex = H_j[j]; - HT_j[HT_i[myindex]] = i; - HT_i[myindex]++; - } - } + for (j=H_i[i]; j < H_i[i+1]; j++) { + HYPRE_Int myindex = H_j[j]; + HT_j[HT_i[myindex]] = i; + HT_i[myindex]++; + } + } for (i = num_vertices; i > 0; i--) { - HT_i[i] = HT_i[i-1]; + HT_i[i] = HT_i[i-1]; } HT_i[0] = 0; - /***************************************************************** - * set initial vertex weights - *****************************************************************/ - - for (i=0;ihead]) { + while (LoL_head && measure_array[LoL_head->head]) { - choice = LoL_head->head; - measure = measure_array[choice]; + choice = LoL_head->head; + measure = measure_array[choice]; #if 0 - hypre_printf ("Choice: %d, measure %d, processor %d\n",choice, measure,processor[choice]); - fflush(stdout); + hypre_printf ("Choice: %d, measure %d, processor %d\n",choice, measure,processor[choice]); + fflush(stdout); #endif - (*coarse)[processor[choice]] = choice+1; /* add one because coarsegrid indexing starts with 1, not 0 */ - /* new maximal weight */ - new_measure = measure+1; - for (i=vertexrange[processor[choice]];ihead; measure = measure_array[i]; - hypre_remove_point (&LoL_head,&LoL_tail,measure,i,lists,where); - measure_array[i]=0; - } - for (j=H_i[choice];jhead; - measure = measure_array[i]; #if 0 - hypre_assert (measure==0); + hypre_assert (measure==0); #endif - hypre_remove_point (&LoL_head,&LoL_tail,measure,i,lists,where); - } - - - for (p=0;p 1) - comm_handle = hypre_ParCSRCommHandleCreate(2, comm_pkg, - &measure_array[num_variables], buf_data); + comm_handle = hypre_ParCSRCommHandleCreate(2, comm_pkg, + &measure_array[num_variables], buf_data); for (i=0; i < S_diag_i[num_variables]; i++) - { + { measure_array[S_diag_j[i]] += 1.0; } if (num_procs > 1) - hypre_ParCSRCommHandleDestroy(comm_handle); - + hypre_ParCSRCommHandleDestroy(comm_handle); + index = 0; for (i=0; i < num_sends; i++) { start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - measure_array[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)] - += buf_data[index++]; + measure_array[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)] + += buf_data[index++]; } for (i=num_variables; i < num_variables+num_cols_offd; i++) - { + { measure_array[i] = 0; } @@ -260,9 +251,9 @@ * followed by boundary values *---------------------------------------------------*/ - graph_array = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); - if (num_cols_offd) - graph_array_offd = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); + graph_array = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); + if (num_cols_offd) + graph_array_offd = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); else graph_array_offd = NULL; @@ -273,7 +264,7 @@ /*--------------------------------------------------- * Initialize the C/F marker array - * C/F marker array contains interior points in elements 0 ... + * C/F marker array contains interior points in elements 0 ... * num_variables-1 followed by boundary values *---------------------------------------------------*/ @@ -286,14 +277,14 @@ for (i=0; i < num_variables; i++) { if ( (S_offd_i[i+1]-S_offd_i[i]) > 0 - || CF_marker[i] == -1) + || CF_marker[i] == -1) { CF_marker[i] = 0; } if ( CF_marker[i] == Z_PT) { if (measure_array[i] >= 1.0 || - (S_diag_i[i+1]-S_diag_i[i]) > 0) + (S_diag_i[i+1]-S_diag_i[i]) > 0) { CF_marker[i] = 0; graph_array[cnt++] = i; @@ -304,25 +295,25 @@ } } else if (CF_marker[i] == SF_PT) - measure_array[i] = 0; - else + measure_array[i] = 0; + else graph_array[cnt++] = i; } } else { - CF_marker = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); + CF_marker = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); cnt = 0; for (i=0; i < num_variables; i++) { - CF_marker[i] = 0; - if ( (S_diag_i[i+1]-S_diag_i[i]) == 0 - && (S_offd_i[i+1]-S_offd_i[i]) == 0) - { - CF_marker[i] = SF_PT; - measure_array[i] = 0; - } - else + CF_marker[i] = 0; + if ( (S_diag_i[i+1]-S_diag_i[i]) == 0 + && (S_offd_i[i+1]-S_offd_i[i]) == 0) + { + CF_marker[i] = SF_PT; + measure_array[i] = 0; + } + else graph_array[cnt++] = i; } } @@ -332,8 +323,8 @@ else CF_marker_offd = NULL; for (i=0; i < num_cols_offd; i++) - CF_marker_offd[i] = 0; - + CF_marker_offd[i] = 0; + /*--------------------------------------------------- * Loop until all points are either fine or coarse. *---------------------------------------------------*/ @@ -355,16 +346,16 @@ { for (j=S_ext_i[i]; j < S_ext_i[i+1]; j++) { - big_k = S_ext_j[j]; - if (big_k >= col_1 && big_k < col_n) - { - S_ext_j[index++] = big_k - col_1; - } - else - { - kc = hypre_BigBinarySearch(col_map_offd,big_k,num_cols_offd); - if (kc > -1) S_ext_j[index++] = (HYPRE_BigInt)(-kc-1); - } + big_k = S_ext_j[j]; + if (big_k >= col_1 && big_k < col_n) + { + S_ext_j[index++] = big_k - col_1; + } + else + { + kc = hypre_BigBinarySearch(col_map_offd,big_k,num_cols_offd); + if (kc > -1) S_ext_j[index++] = (HYPRE_BigInt)(-kc-1); + } } S_ext_i[i] = index; } @@ -376,7 +367,7 @@ { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Initialize CLJP phase = %f\n", - my_id, wall_time); + my_id, wall_time); } while (1) @@ -386,25 +377,25 @@ *------------------------------------------------*/ if (num_procs > 1) - comm_handle = hypre_ParCSRCommHandleCreate(2, comm_pkg, - &measure_array[num_variables], buf_data); + comm_handle = hypre_ParCSRCommHandleCreate(2, comm_pkg, + &measure_array[num_variables], buf_data); if (num_procs > 1) - hypre_ParCSRCommHandleDestroy(comm_handle); - + hypre_ParCSRCommHandleDestroy(comm_handle); + index = 0; for (i=0; i < num_sends; i++) { start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) measure_array[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)] - += buf_data[index++]; + += buf_data[index++]; } /*------------------------------------------------ * Set F-pts and update subgraph *------------------------------------------------*/ - + if (iter || (CF_init != 1)) { for (ig = 0; ig < graph_size; ig++) @@ -415,8 +406,8 @@ { /* set to be an F-pt */ CF_marker[i] = F_PT; - - /* make sure all dependencies have been accounted for */ + + /* make sure all dependencies have been accounted for */ for (jS = S_diag_i[i]; jS < S_diag_i[i+1]; jS++) { if (S_diag_j[jS] > -1) @@ -435,7 +426,7 @@ if (CF_marker[i]) { measure_array[i] = 0; - + /* take point out of the subgraph */ graph_size--; graph_array[ig] = graph_array[graph_size]; @@ -444,9 +435,9 @@ } } } - + /*------------------------------------------------ - * Exchange boundary data, i.i. get measures + * Exchange boundary data, i.i. get measures *------------------------------------------------*/ if (debug_flag == 3) wall_time = time_getWallclockSeconds(); @@ -454,22 +445,22 @@ index = 0; for (i = 0; i < num_sends; i++) { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + { jrow = hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j); buf_data[index++] = measure_array[jrow]; } } if (num_procs > 1) - { - comm_handle = hypre_ParCSRCommHandleCreate(1, comm_pkg, buf_data, - &measure_array[num_variables]); - - hypre_ParCSRCommHandleDestroy(comm_handle); - - } + { + comm_handle = hypre_ParCSRCommHandleCreate(1, comm_pkg, buf_data, + &measure_array[num_variables]); + + hypre_ParCSRCommHandleDestroy(comm_handle); + + } /*------------------------------------------------ * Debugging: * @@ -521,14 +512,14 @@ *------------------------------------------------*/ if (iter || (CF_init != 1)) { - hypre_BoomerAMGIndepSet(S, measure_array, graph_array, - graph_size, - graph_array_offd, graph_offd_size, - CF_marker, CF_marker_offd); + hypre_BoomerAMGIndepSet(S, measure_array, graph_array, + graph_size, + graph_array_offd, graph_offd_size, + CF_marker, CF_marker_offd); if (num_procs > 1) { comm_handle = hypre_ParCSRCommHandleCreate(12, comm_pkg, - CF_marker_offd, int_buf_data); + CF_marker_offd, int_buf_data); hypre_ParCSRCommHandleDestroy(comm_handle); } @@ -556,22 +547,22 @@ index = 0; for (i = 0; i < num_sends; i++) { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - { - elmt = hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j); - int_buf_data[index++] = CF_marker[elmt]; - } + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + { + elmt = hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j); + int_buf_data[index++] = CF_marker[elmt]; + } } if (num_procs > 1) { - comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, int_buf_data, - CF_marker_offd); - - hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, int_buf_data, + CF_marker_offd); + + hypre_ParCSRCommHandleDestroy(comm_handle); } - + for (ig = 0; ig < graph_offd_size; ig++) { i = graph_array_offd[ig]; @@ -589,14 +580,14 @@ { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d iter %d comm. and subgraph update = %f\n", - my_id, iter, wall_time); + my_id, iter, wall_time); } /*------------------------------------------------ * Set C_pts and apply heuristics. *------------------------------------------------*/ for (i=num_variables; i < num_variables+num_cols_offd; i++) - { + { measure_array[i] = 0; } @@ -611,7 +602,7 @@ *---------------------------------------------*/ if (CF_marker[i] > 0) - { + { /* set to be a C-pt */ CF_marker[i] = C_PT; @@ -620,10 +611,10 @@ j = S_diag_j[jS]; if (j > -1) { - + /* "remove" edge from S */ S_diag_j[jS] = -S_diag_j[jS]-1; - + /* decrement measures of unmarked neighbors */ if (!CF_marker[j]) { @@ -636,10 +627,10 @@ j = S_offd_j[jS]; if (j > -1) { - + /* "remove" edge from S */ S_offd_j[jS] = -S_offd_j[jS]-1; - + /* decrement measures of unmarked neighbors */ if (!CF_marker_offd[j]) { @@ -648,14 +639,14 @@ } } } - else - { + else + { /* marked dependencies */ for (jS = S_diag_i[i]; jS < S_diag_i[i+1]; jS++) { j = S_diag_j[jS]; - if (j < 0) j = -j-1; - + if (j < 0) j = -j-1; + if (CF_marker[j] > 0) { if (S_diag_j[jS] > -1) @@ -663,7 +654,7 @@ /* "remove" edge from S */ S_diag_j[jS] = -S_diag_j[jS]-1; } - + /* IMPORTANT: consider all dependencies */ /* temporarily modify CF_marker */ CF_marker[j] = COMMON_C_PT; @@ -680,8 +671,8 @@ for (jS = S_offd_i[i]; jS < S_offd_i[i+1]; jS++) { j = S_offd_j[jS]; - if (j < 0) j = -j-1; - + if (j < 0) j = -j-1; + if (CF_marker_offd[j] > 0) { if (S_offd_j[jS] > -1) @@ -689,7 +680,7 @@ /* "remove" edge from S */ S_offd_j[jS] = -S_offd_j[jS]-1; } - + /* IMPORTANT: consider all dependencies */ /* temporarily modify CF_marker */ CF_marker_offd[j] = COMMON_C_PT; @@ -703,20 +694,20 @@ } } } - + /* unmarked dependencies */ for (jS = S_diag_i[i]; jS < S_diag_i[i+1]; jS++) { if (S_diag_j[jS] > -1) { j = S_diag_j[jS]; - break_var = 1; + break_var = 1; /* check for common C-pt */ for (kS = S_diag_i[j]; kS < S_diag_i[j+1]; kS++) { k = S_diag_j[kS]; - if (k < 0) k = -k-1; - + if (k < 0) k = -k-1; + /* IMPORTANT: consider all dependencies */ if (CF_marker[k] == COMMON_C_PT) { @@ -727,13 +718,13 @@ break; } } - if (break_var) + if (break_var) { for (kS = S_offd_i[j]; kS < S_offd_i[j+1]; kS++) { k = S_offd_j[kS]; - if (k < 0) k = -k-1; - + if (k < 0) k = -k-1; + /* IMPORTANT: consider all dependencies */ if ( CF_marker_offd[k] == COMMON_C_PT) { @@ -751,13 +742,13 @@ if (S_offd_j[jS] > -1) { j = S_offd_j[jS]; - + /* check for common C-pt */ for (kS = S_ext_i[j]; kS < S_ext_i[j+1]; kS++) { k = (HYPRE_Int)S_ext_j[kS]; - if (k >= 0) - { + if (k >= 0) + { /* IMPORTANT: consider all dependencies */ if (CF_marker[k] == COMMON_C_PT) { @@ -767,27 +758,27 @@ break; } } - else - { - kc = -k-1; - if (kc > -1 && CF_marker_offd[kc] == COMMON_C_PT) - { + else + { + kc = -k-1; + if (kc > -1 && CF_marker_offd[kc] == COMMON_C_PT) + { /* "remove" edge from S and update measure*/ S_offd_j[jS] = -S_offd_j[jS]-1; measure_array[j+num_variables]--; break; - } - } + } + } } } } } /* reset CF_marker */ - for (jS = S_diag_i[i]; jS < S_diag_i[i+1]; jS++) - { + for (jS = S_diag_i[i]; jS < S_diag_i[i+1]; jS++) + { j = S_diag_j[jS]; - if (j < 0) j = -j-1; + if (j < 0) j = -j-1; if (CF_marker[j] == COMMON_C_PT) { @@ -797,7 +788,7 @@ for (jS = S_offd_i[i]; jS < S_offd_i[i+1]; jS++) { j = S_offd_j[jS]; - if (j < 0) j = -j-1; + if (j < 0) j = -j-1; if (CF_marker_offd[j] == COMMON_C_PT) { @@ -809,7 +800,7 @@ { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d CLJP phase = %f graph_size = %d nc_offd = %d\n", - my_id, wall_time, graph_size, num_cols_offd); + my_id, wall_time, graph_size, num_cols_offd); } } @@ -829,7 +820,7 @@ S_offd_j[i] = -S_offd_j[i]-1; } /*for (i=0; i < num_variables; i++) - if (CF_marker[i] == SF_PT) CF_marker[i] = F_PT;*/ + if (CF_marker[i] == SF_PT) CF_marker[i] = F_PT;*/ hypre_TFree(measure_array, HYPRE_MEMORY_HOST); hypre_TFree(graph_array, HYPRE_MEMORY_HOST); @@ -845,7 +836,7 @@ } /*========================================================================== - * Ruge's coarsening algorithm + * Ruge's coarsening algorithm *==========================================================================*/ #define C_PT 1 @@ -853,7 +844,7 @@ #define Z_PT -2 #define SF_PT -3 /* special fine points */ #define SC_PT 3 /* special coarse points */ -#define UNDECIDED 0 +#define UNDECIDED 0 /************************************************************** @@ -880,16 +871,16 @@ HYPRE_Int *S_offd_j = NULL; HYPRE_Int num_variables = hypre_CSRMatrixNumRows(S_diag); HYPRE_Int num_cols_offd = hypre_CSRMatrixNumCols(S_offd); - HYPRE_BigInt *col_map_offd = hypre_ParCSRMatrixColMapOffd(S); - + HYPRE_BigInt *col_map_offd = hypre_ParCSRMatrixColMapOffd(S); + hypre_CSRMatrix *S_ext = NULL; HYPRE_Int *S_ext_i = NULL; HYPRE_BigInt *S_ext_j = NULL; - + hypre_CSRMatrix *ST; HYPRE_Int *ST_i; HYPRE_Int *ST_j; - + HYPRE_Int *CF_marker; HYPRE_Int *CF_marker_offd = NULL; HYPRE_Int ci_tilde = -1; @@ -899,20 +890,20 @@ HYPRE_Int *measure_array; HYPRE_Int *graph_array; - HYPRE_Int *int_buf_data = NULL; - HYPRE_Int *ci_array = NULL; + HYPRE_Int *int_buf_data = NULL; + HYPRE_Int *ci_array = NULL; HYPRE_BigInt big_k; HYPRE_Int i, j, k, jS; - HYPRE_Int ji, jj, jk, jm, index; - HYPRE_Int set_empty = 1; - HYPRE_Int C_i_nonempty = 0; - //HYPRE_Int num_nonzeros; - HYPRE_Int num_procs, my_id; - HYPRE_Int num_sends = 0; - HYPRE_BigInt first_col; - HYPRE_Int start; - HYPRE_BigInt col_0, col_n; + HYPRE_Int ji, jj, jk, jm, index; + HYPRE_Int set_empty = 1; + HYPRE_Int C_i_nonempty = 0; + //HYPRE_Int num_nonzeros; + HYPRE_Int num_procs, my_id; + HYPRE_Int num_sends = 0; + HYPRE_BigInt first_col; + HYPRE_Int start; + HYPRE_BigInt col_0, col_n; hypre_LinkList LoL_head; hypre_LinkList LoL_tail; @@ -927,11 +918,20 @@ HYPRE_Int use_commpkg_A = 0; HYPRE_Int break_var = 0; HYPRE_Int f_pnt = F_PT; - HYPRE_Real wall_time; + HYPRE_Real wall_time; - if (coarsen_type < 0) coarsen_type = -coarsen_type; - if (measure_type == 1 || measure_type == 4) meas_type = 1; - if (measure_type == 4 || measure_type == 3) agg_2 = 1; + if (coarsen_type < 0) + { + coarsen_type = -coarsen_type; + } + if (measure_type == 1 || measure_type == 4) + { + meas_type = 1; + } + if (measure_type == 4 || measure_type == 3) + { + agg_2 = 1; + } /*------------------------------------------------------- * Initialize the C/F marker, LoL_head, LoL_tail arrays @@ -966,29 +966,33 @@ first_col = hypre_ParCSRMatrixFirstColDiag(S); col_0 = first_col-1; - col_n = col_0+(HYPRE_BigInt)num_variables; + col_n = col_0+(HYPRE_BigInt)num_variables; hypre_MPI_Comm_size(comm,&num_procs); hypre_MPI_Comm_rank(comm,&my_id); if (!comm_pkg) { - use_commpkg_A = 1; - comm_pkg = hypre_ParCSRMatrixCommPkg(A); + use_commpkg_A = 1; + comm_pkg = hypre_ParCSRMatrixCommPkg(A); } if (!comm_pkg) { - hypre_MatvecCommPkgCreate(A); - comm_pkg = hypre_ParCSRMatrixCommPkg(A); + hypre_MatvecCommPkgCreate(A); + comm_pkg = hypre_ParCSRMatrixCommPkg(A); } num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - if (num_cols_offd) S_offd_j = hypre_CSRMatrixJ(S_offd); + if (num_cols_offd) + { + S_offd_j = hypre_CSRMatrixJ(S_offd); + } jS = S_i[num_variables]; ST = hypre_CSRMatrixCreate(num_variables, num_variables, jS); + hypre_CSRMatrixMemoryLocation(ST) = HYPRE_MEMORY_HOST; ST_i = hypre_CTAlloc(HYPRE_Int, num_variables+1, HYPRE_MEMORY_HOST); ST_j = hypre_CTAlloc(HYPRE_Int, jS, HYPRE_MEMORY_HOST); hypre_CSRMatrixI(ST) = ST_i; @@ -999,11 +1003,12 @@ *----------------------------------------------------------*/ for (i=0; i <= num_variables; i++) + { ST_i[i] = 0; - + } for (i=0; i < jS; i++) { - ST_i[S_j[i]+1]++; + ST_i[S_j[i]+1]++; } for (i=0; i < num_variables; i++) { @@ -1013,11 +1018,11 @@ { for (j=S_i[i]; j < S_i[i+1]; j++) { - index = S_j[j]; - ST_j[ST_i[index]] = i; - ST_i[index]++; + index = S_j[j]; + ST_j[ST_i[index]] = i; + ST_i[index]++; } - } + } for (i = num_variables; i > 0; i--) { ST_i[i] = ST_i[i-1]; @@ -1042,7 +1047,7 @@ } /* special case for Falgout coarsening */ - if (coarsen_type == 6) + if (coarsen_type == 6) { f_pnt = Z_PT; coarsen_type = 1; @@ -1053,8 +1058,7 @@ coarsen_type = 11; } - if ((meas_type || (coarsen_type != 1 && coarsen_type != 11)) - && num_procs > 1) + if ((meas_type || (coarsen_type != 1 && coarsen_type != 11)) && num_procs > 1) { if (use_commpkg_A) S_ext = hypre_ParCSRMatrixExtractBExt(S,A,0); @@ -1064,17 +1068,17 @@ S_ext_j = hypre_CSRMatrixBigJ(S_ext); HYPRE_Int num_nonzeros = S_ext_i[num_cols_offd]; /*first_col = hypre_ParCSRMatrixFirstColDiag(S); - col_0 = first_col-1; - col_n = col_0+num_variables; */ + col_0 = first_col-1; + col_n = col_0+num_variables; */ if (meas_type) { - for (i=0; i < num_nonzeros; i++) + for (i=0; i < num_nonzeros; i++) { - index = (HYPRE_Int)(S_ext_j[i] - first_col); - if (index > -1 && index < num_variables) - measure_array[index]++; - } - } + index = (HYPRE_Int)(S_ext_j[i] - first_col); + if (index > -1 && index < num_variables) + measure_array[index]++; + } + } } /*--------------------------------------------------- @@ -1085,22 +1089,24 @@ /* first coarsening phase */ - /************************************************************* - * - * Initialize the lists - * - *************************************************************/ + /************************************************************* + * + * Initialize the lists + * + *************************************************************/ CF_marker = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); - + num_left = 0; for (j = 0; j < num_variables; j++) { - if ((S_i[j+1]-S_i[j])== 0 && - (S_offd_i[j+1]-S_offd_i[j]) == 0) + if (S_i[j+1]-S_i[j] == 0 && S_offd_i[j+1]-S_offd_i[j] == 0) { CF_marker[j] = SF_PT; - if (agg_2) CF_marker[j] = SC_PT; + if (agg_2) + { + CF_marker[j] = SC_PT; + } measure_array[j] = 0; } else @@ -1108,10 +1114,10 @@ CF_marker[j] = UNDECIDED; num_left++; } - } + } - for (j = 0; j < num_variables; j++) - { + for (j = 0; j < num_variables; j++) + { measure = measure_array[j]; if (CF_marker[j] != SF_PT && CF_marker[j] != SC_PT) { @@ -1121,8 +1127,12 @@ } else { - if (measure < 0) hypre_error_w_msg(HYPRE_ERROR_GENERIC,"negative measure!\n"); + if (measure < 0) + { + hypre_error_w_msg(HYPRE_ERROR_GENERIC,"negative measure!\n"); + } /*if (measure < 0) hypre_printf("negative measure!\n");*/ + CF_marker[j] = f_pnt; for (k = S_i[j]; k < S_i[j+1]; k++) { @@ -1132,15 +1142,17 @@ if (nabor < j) { new_meas = measure_array[nabor]; - if (new_meas > 0) - hypre_remove_point(&LoL_head, &LoL_tail, new_meas, - nabor, lists, where); + if (new_meas > 0) + { + hypre_remove_point(&LoL_head, &LoL_tail, new_meas, + nabor, lists, where); + } new_meas = ++(measure_array[nabor]); hypre_enter_on_lists(&LoL_head, &LoL_tail, new_meas, - nabor, lists, where); + nabor, lists, where); } - else + else { new_meas = ++(measure_array[nabor]); } @@ -1179,9 +1191,9 @@ measure = measure_array[index]; measure_array[index] = 0; --num_left; - + hypre_remove_point(&LoL_head, &LoL_tail, measure, index, lists, where); - + for (j = ST_i[index]; j < ST_i[index+1]; j++) { nabor = ST_j[j]; @@ -1199,13 +1211,13 @@ if (CF_marker[nabor_two] == UNDECIDED) { measure = measure_array[nabor_two]; - hypre_remove_point(&LoL_head, &LoL_tail, measure, - nabor_two, lists, where); + hypre_remove_point(&LoL_head, &LoL_tail, measure, + nabor_two, lists, where); new_meas = ++(measure_array[nabor_two]); - + hypre_enter_on_lists(&LoL_head, &LoL_tail, new_meas, - nabor_two, lists, where); + nabor_two, lists, where); } } } @@ -1220,12 +1232,14 @@ hypre_remove_point(&LoL_head, &LoL_tail, measure, nabor, lists, where); measure_array[nabor] = --measure; - - if (measure > 0) - hypre_enter_on_lists(&LoL_head, &LoL_tail, measure, nabor, - lists, where); - else - { + + if (measure > 0) + { + hypre_enter_on_lists(&LoL_head, &LoL_tail, measure, nabor, + lists, where); + } + else + { CF_marker[nabor] = F_PT; --num_left; @@ -1235,16 +1249,16 @@ if (CF_marker[nabor_two] == UNDECIDED) { new_meas = measure_array[nabor_two]; - hypre_remove_point(&LoL_head, &LoL_tail, new_meas, - nabor_two, lists, where); + hypre_remove_point(&LoL_head, &LoL_tail, new_meas, + nabor_two, lists, where); new_meas = ++(measure_array[nabor_two]); - + hypre_enter_on_lists(&LoL_head, &LoL_tail, new_meas, - nabor_two, lists, where); + nabor_two, lists, where); } } - } + } } } } @@ -1256,7 +1270,7 @@ { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Coarsen 1st pass = %f\n", - my_id, wall_time); + my_id, wall_time); } hypre_TFree(lists, HYPRE_MEMORY_HOST); @@ -1265,17 +1279,24 @@ hypre_TFree(LoL_tail, HYPRE_MEMORY_HOST); for (i=0; i < num_variables; i++) - if (CF_marker[i] == SC_PT) CF_marker[i] = C_PT; + { + if (CF_marker[i] == SC_PT) + { + CF_marker[i] = C_PT; + } + } if (coarsen_type == 11) { *CF_marker_ptr = CF_marker; if (meas_type && num_procs > 1) - hypre_CSRMatrixDestroy(S_ext); + { + hypre_CSRMatrixDestroy(S_ext); + } return 0; } - /* second pass, check fine points for coarse neighbors + /* second pass, check fine points for coarse neighbors for coarsen_type = 2, the second pass includes off-processore boundary points */ @@ -1297,34 +1318,37 @@ /*------------------------------------------------ * Exchange boundary data for CF_marker *------------------------------------------------*/ - + CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); - int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, - num_sends), HYPRE_MEMORY_HOST); - + int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, + num_sends), HYPRE_MEMORY_HOST); + index = 0; for (i = 0; i < num_sends; i++) { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + { + int_buf_data[index++] = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } } - + if (num_procs > 1) { - comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, int_buf_data, CF_marker_offd); + comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, int_buf_data, + CF_marker_offd); + hypre_ParCSRCommHandleDestroy(comm_handle); } - + ci_array = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); for (i=0; i < num_cols_offd; i++) - ci_array[i] = -1; - + ci_array[i] = -1; + for (i=0; i < num_variables; i++) { - if (ci_tilde_mark != i) ci_tilde = -1; - if (ci_tilde_offd_mark != i) ci_tilde_offd = -1; + if (ci_tilde_mark != i) ci_tilde = -1; + if (ci_tilde_offd_mark != i) ci_tilde_offd = -1; if (CF_marker[i] == -1) { break_var = 1; @@ -1355,7 +1379,7 @@ break; } } - if (set_empty) + if (set_empty) { for (jj = S_offd_i[j]; jj < S_offd_i[j+1]; jj++) { @@ -1366,7 +1390,7 @@ break; } } - } + } if (set_empty) { if (C_i_nonempty) @@ -1420,7 +1444,7 @@ } else { - jk = hypre_BigBinarySearch(col_map_offd,big_k,num_cols_offd); + jk = hypre_BigBinarySearch(col_map_offd,big_k,num_cols_offd); if (jk != -1) { if (ci_array[jk] == i) @@ -1469,56 +1493,56 @@ { for (i=0; i < num_variables; i++) { - if (ci_tilde_mark != i) ci_tilde = -1; + if (ci_tilde_mark != i) ci_tilde = -1; if (CF_marker[i] == -1) { - for (ji = S_i[i]; ji < S_i[i+1]; ji++) - { - j = S_j[ji]; - if (CF_marker[j] > 0) - graph_array[j] = i; - } - for (ji = S_i[i]; ji < S_i[i+1]; ji++) - { - j = S_j[ji]; - if (CF_marker[j] == -1) - { - set_empty = 1; - for (jj = S_i[j]; jj < S_i[j+1]; jj++) - { - index = S_j[jj]; - if (graph_array[index] == i) - { - set_empty = 0; - break; - } - } - if (set_empty) - { - if (C_i_nonempty) - { - CF_marker[i] = 1; - if (ci_tilde > -1) - { - CF_marker[ci_tilde] = -1; - ci_tilde = -1; - } - C_i_nonempty = 0; - break; - } - else - { - ci_tilde = j; - ci_tilde_mark = i; - CF_marker[j] = 1; - C_i_nonempty = 1; - i--; - break; - } - } - } - } - } + for (ji = S_i[i]; ji < S_i[i+1]; ji++) + { + j = S_j[ji]; + if (CF_marker[j] > 0) + graph_array[j] = i; + } + for (ji = S_i[i]; ji < S_i[i+1]; ji++) + { + j = S_j[ji]; + if (CF_marker[j] == -1) + { + set_empty = 1; + for (jj = S_i[j]; jj < S_i[j+1]; jj++) + { + index = S_j[jj]; + if (graph_array[index] == i) + { + set_empty = 0; + break; + } + } + if (set_empty) + { + if (C_i_nonempty) + { + CF_marker[i] = 1; + if (ci_tilde > -1) + { + CF_marker[ci_tilde] = -1; + ci_tilde = -1; + } + C_i_nonempty = 0; + break; + } + else + { + ci_tilde = j; + ci_tilde_mark = i; + CF_marker[j] = 1; + C_i_nonempty = 1; + i--; + break; + } + } + } + } + } } } @@ -1526,7 +1550,7 @@ { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Coarsen 2nd pass = %f\n", - my_id, wall_time); + my_id, wall_time); } /* third pass, check boundary fine points for coarse neighbors */ @@ -1536,8 +1560,8 @@ if (debug_flag == 3) wall_time = time_getWallclockSeconds(); CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); - int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, - num_sends), HYPRE_MEMORY_HOST); + int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + HYPRE_MEMORY_HOST); /*------------------------------------------------ * Exchange boundary data for CF_marker @@ -1546,283 +1570,283 @@ index = 0; for (i = 0; i < num_sends; i++) { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + int_buf_data[index++] + = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; } - + if (num_procs > 1) { - comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, int_buf_data, - CF_marker_offd); - - hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, int_buf_data, + CF_marker_offd); + + hypre_ParCSRCommHandleDestroy(comm_handle); } ci_array = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); for (i=0; i < num_cols_offd; i++) - ci_array[i] = -1; + ci_array[i] = -1; } if (coarsen_type > 1 && coarsen_type < 5) - { + { for (i=0; i < num_variables; i++) - graph_array[i] = -1; + graph_array[i] = -1; for (i=0; i < num_cols_offd; i++) { - if (ci_tilde_mark != i) ci_tilde = -1; - if (ci_tilde_offd_mark != i) ci_tilde_offd = -1; + if (ci_tilde_mark != i) ci_tilde = -1; + if (ci_tilde_offd_mark != i) ci_tilde_offd = -1; if (CF_marker_offd[i] == -1) { - for (ji = S_ext_i[i]; ji < S_ext_i[i+1]; ji++) - { - big_k = S_ext_j[ji]; - if (big_k > col_0 && big_k < col_n) - { - j = (HYPRE_Int)(big_k - first_col); - if (CF_marker[j] > 0) - graph_array[j] = i; - } - else - { - jj = hypre_BigBinarySearch(col_map_offd,big_k,num_cols_offd); - if (jj != -1 && CF_marker_offd[jj] > 0) - ci_array[jj] = i; - } - } - for (ji = S_ext_i[i]; ji < S_ext_i[i+1]; ji++) - { - big_k = S_ext_j[ji]; - if (big_k > col_0 && big_k < col_n) - { - j = (HYPRE_Int)(big_k - first_col); - if ( CF_marker[j] == -1) - { - set_empty = 1; - for (jj = S_i[j]; jj < S_i[j+1]; jj++) - { - index = S_j[jj]; - if (graph_array[index] == i) - { - set_empty = 0; - break; - } - } - for (jj = S_offd_i[j]; jj < S_offd_i[j+1]; jj++) - { - index = S_offd_j[jj]; - if (ci_array[index] == i) - { - set_empty = 0; - break; - } - } - if (set_empty) - { - if (C_i_nonempty) - { - CF_marker_offd[i] = 1; - if (ci_tilde > -1) - { - CF_marker[ci_tilde] = -1; - ci_tilde = -1; - } - if (ci_tilde_offd > -1) - { - CF_marker_offd[ci_tilde_offd] = -1; - ci_tilde_offd = -1; - } - C_i_nonempty = 0; - break; - } - else - { - ci_tilde = j; - ci_tilde_mark = i; - CF_marker[j] = 1; - C_i_nonempty = 1; - i--; - break; - } - } - } - } - else - { - jm = hypre_BigBinarySearch(col_map_offd,big_k,num_cols_offd); - if (jm != -1 && CF_marker_offd[jm] == -1) - { - set_empty = 1; - for (jj = S_ext_i[jm]; jj < S_ext_i[jm+1]; jj++) - { - big_k = S_ext_j[jj]; - if (big_k > col_0 && big_k < col_n) - { - if (graph_array[(HYPRE_Int)(big_k-first_col)] == i) - { - set_empty = 0; - break; - } - } - else - { - jk = hypre_BigBinarySearch(col_map_offd,big_k,num_cols_offd); - if (jk != -1) - { - if (ci_array[jk] == i) - { - set_empty = 0; - break; - } - } - } - } - if (set_empty) - { - if (C_i_nonempty) - { - CF_marker_offd[i] = 1; - if (ci_tilde > -1) - { - CF_marker[ci_tilde] = -1; - ci_tilde = -1; - } - if (ci_tilde_offd > -1) - { - CF_marker_offd[ci_tilde_offd] = -1; - ci_tilde_offd = -1; - } - C_i_nonempty = 0; - break; - } - else - { - ci_tilde_offd = jm; - ci_tilde_offd_mark = i; - CF_marker_offd[jm] = 1; - C_i_nonempty = 1; - i--; - break; - } - } - } - } - } - } - } - /*------------------------------------------------ - * Send boundary data for CF_marker back - *------------------------------------------------*/ - if (num_procs > 1) - { - comm_handle = hypre_ParCSRCommHandleCreate(12, comm_pkg, CF_marker_offd, - int_buf_data); - - hypre_ParCSRCommHandleDestroy(comm_handle); - } - - /* only CF_marker entries from larger procs are accepted - if coarsen_type = 4 coarse points are not overwritten */ - - index = 0; - if (coarsen_type != 4) - { - for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - if (hypre_ParCSRCommPkgSendProc(comm_pkg,i) > my_id) - { - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)] = - int_buf_data[index++]; - } - else - { - index += hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1) - start; - } - } - } - else - { - for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - if (hypre_ParCSRCommPkgSendProc(comm_pkg,i) > my_id) - { - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - { - elmt = hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j); - if (CF_marker[elmt] != 1) - CF_marker[elmt] = int_buf_data[index]; - index++; - } - } - else - { - index += hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1) - start; - } - } - } - if (debug_flag == 3) - { - wall_time = time_getWallclockSeconds() - wall_time; - if (coarsen_type == 4) - hypre_printf("Proc = %d Coarsen 3rd pass = %f\n", - my_id, wall_time); - if (coarsen_type == 3) - hypre_printf("Proc = %d Coarsen 3rd pass = %f\n", - my_id, wall_time); - if (coarsen_type == 2) - hypre_printf("Proc = %d Coarsen 2nd pass = %f\n", - my_id, wall_time); - } - } - if (coarsen_type == 5) - { - /*------------------------------------------------ - * Exchange boundary data for CF_marker - *------------------------------------------------*/ - - if (debug_flag == 3) wall_time = time_getWallclockSeconds(); - - CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); - int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, - num_sends), HYPRE_MEMORY_HOST); - - index = 0; - for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - if (num_procs > 1) - { - comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, int_buf_data, - CF_marker_offd); - - hypre_ParCSRCommHandleDestroy(comm_handle); - } - - ci_array = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); - for (i=0; i < num_cols_offd; i++) - ci_array[i] = -1; - for (i=0; i < num_variables; i++) - graph_array[i] = -1; - - for (i=0; i < num_variables; i++) - { - if (CF_marker[i] == -1 && (S_offd_i[i+1]-S_offd_i[i]) > 0) - { - break_var = 1; - for (ji = S_i[i]; ji < S_i[i+1]; ji++) + for (ji = S_ext_i[i]; ji < S_ext_i[i+1]; ji++) { - j = S_j[ji]; - if (CF_marker[j] > 0) - graph_array[j] = i; + big_k = S_ext_j[ji]; + if (big_k > col_0 && big_k < col_n) + { + j = (HYPRE_Int)(big_k - first_col); + if (CF_marker[j] > 0) + graph_array[j] = i; + } + else + { + jj = hypre_BigBinarySearch(col_map_offd,big_k,num_cols_offd); + if (jj != -1 && CF_marker_offd[jj] > 0) + ci_array[jj] = i; + } + } + for (ji = S_ext_i[i]; ji < S_ext_i[i+1]; ji++) + { + big_k = S_ext_j[ji]; + if (big_k > col_0 && big_k < col_n) + { + j = (HYPRE_Int)(big_k - first_col); + if ( CF_marker[j] == -1) + { + set_empty = 1; + for (jj = S_i[j]; jj < S_i[j+1]; jj++) + { + index = S_j[jj]; + if (graph_array[index] == i) + { + set_empty = 0; + break; + } + } + for (jj = S_offd_i[j]; jj < S_offd_i[j+1]; jj++) + { + index = S_offd_j[jj]; + if (ci_array[index] == i) + { + set_empty = 0; + break; + } + } + if (set_empty) + { + if (C_i_nonempty) + { + CF_marker_offd[i] = 1; + if (ci_tilde > -1) + { + CF_marker[ci_tilde] = -1; + ci_tilde = -1; + } + if (ci_tilde_offd > -1) + { + CF_marker_offd[ci_tilde_offd] = -1; + ci_tilde_offd = -1; + } + C_i_nonempty = 0; + break; + } + else + { + ci_tilde = j; + ci_tilde_mark = i; + CF_marker[j] = 1; + C_i_nonempty = 1; + i--; + break; + } + } + } + } + else + { + jm = hypre_BigBinarySearch(col_map_offd,big_k,num_cols_offd); + if (jm != -1 && CF_marker_offd[jm] == -1) + { + set_empty = 1; + for (jj = S_ext_i[jm]; jj < S_ext_i[jm+1]; jj++) + { + big_k = S_ext_j[jj]; + if (big_k > col_0 && big_k < col_n) + { + if (graph_array[(HYPRE_Int)(big_k-first_col)] == i) + { + set_empty = 0; + break; + } + } + else + { + jk = hypre_BigBinarySearch(col_map_offd,big_k,num_cols_offd); + if (jk != -1) + { + if (ci_array[jk] == i) + { + set_empty = 0; + break; + } + } + } + } + if (set_empty) + { + if (C_i_nonempty) + { + CF_marker_offd[i] = 1; + if (ci_tilde > -1) + { + CF_marker[ci_tilde] = -1; + ci_tilde = -1; + } + if (ci_tilde_offd > -1) + { + CF_marker_offd[ci_tilde_offd] = -1; + ci_tilde_offd = -1; + } + C_i_nonempty = 0; + break; + } + else + { + ci_tilde_offd = jm; + ci_tilde_offd_mark = i; + CF_marker_offd[jm] = 1; + C_i_nonempty = 1; + i--; + break; + } + } + } + } + } + } + } + /*------------------------------------------------ + * Send boundary data for CF_marker back + *------------------------------------------------*/ + if (num_procs > 1) + { + comm_handle = hypre_ParCSRCommHandleCreate(12, comm_pkg, CF_marker_offd, + int_buf_data); + + hypre_ParCSRCommHandleDestroy(comm_handle); + } + + /* only CF_marker entries from larger procs are accepted + if coarsen_type = 4 coarse points are not overwritten */ + + index = 0; + if (coarsen_type != 4) + { + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + if (hypre_ParCSRCommPkgSendProc(comm_pkg,i) > my_id) + { + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)] = + int_buf_data[index++]; + } + else + { + index += hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1) - start; + } + } + } + else + { + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + if (hypre_ParCSRCommPkgSendProc(comm_pkg,i) > my_id) + { + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + { + elmt = hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j); + if (CF_marker[elmt] != 1) + CF_marker[elmt] = int_buf_data[index]; + index++; + } + } + else + { + index += hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1) - start; + } + } + } + if (debug_flag == 3) + { + wall_time = time_getWallclockSeconds() - wall_time; + if (coarsen_type == 4) + hypre_printf("Proc = %d Coarsen 3rd pass = %f\n", + my_id, wall_time); + if (coarsen_type == 3) + hypre_printf("Proc = %d Coarsen 3rd pass = %f\n", + my_id, wall_time); + if (coarsen_type == 2) + hypre_printf("Proc = %d Coarsen 2nd pass = %f\n", + my_id, wall_time); + } + } + if (coarsen_type == 5) + { + /*------------------------------------------------ + * Exchange boundary data for CF_marker + *------------------------------------------------*/ + + if (debug_flag == 3) wall_time = time_getWallclockSeconds(); + + CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); + int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, + num_sends), HYPRE_MEMORY_HOST); + + index = 0; + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + int_buf_data[index++] + = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } + + if (num_procs > 1) + { + comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, int_buf_data, + CF_marker_offd); + + hypre_ParCSRCommHandleDestroy(comm_handle); + } + + ci_array = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); + for (i=0; i < num_cols_offd; i++) + ci_array[i] = -1; + for (i=0; i < num_variables; i++) + graph_array[i] = -1; + + for (i=0; i < num_variables; i++) + { + if (CF_marker[i] == -1 && (S_offd_i[i+1]-S_offd_i[i]) > 0) + { + break_var = 1; + for (ji = S_i[i]; ji < S_i[i+1]; ji++) + { + j = S_j[ji]; + if (CF_marker[j] > 0) + graph_array[j] = i; } for (ji = S_offd_i[i]; ji < S_offd_i[i+1]; ji++) { @@ -1849,7 +1873,7 @@ } else { - jk = hypre_BigBinarySearch(col_map_offd,big_k,num_cols_offd); + jk = hypre_BigBinarySearch(col_map_offd,big_k,num_cols_offd); if (jk != -1) { if (ci_array[jk] == i) @@ -1883,7 +1907,7 @@ { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Coarsen special points = %f\n", - my_id, wall_time); + my_id, wall_time); } } @@ -1892,18 +1916,19 @@ *---------------------------------------------------*/ /*if (coarsen_type != 1) - { */ - hypre_TFree(CF_marker_offd, HYPRE_MEMORY_HOST); - hypre_TFree(int_buf_data, HYPRE_MEMORY_HOST); - hypre_TFree(ci_array, HYPRE_MEMORY_HOST); - /*} */ + { */ + hypre_TFree(CF_marker_offd, HYPRE_MEMORY_HOST); + hypre_TFree(int_buf_data, HYPRE_MEMORY_HOST); + hypre_TFree(ci_array, HYPRE_MEMORY_HOST); + /*} */ hypre_TFree(graph_array, HYPRE_MEMORY_HOST); - if ((meas_type || (coarsen_type != 1 && coarsen_type != 11)) - && num_procs > 1) - hypre_CSRMatrixDestroy(S_ext); - + if ((meas_type || (coarsen_type != 1 && coarsen_type != 11)) && num_procs > 1) + { + hypre_CSRMatrixDestroy(S_ext); + } + *CF_marker_ptr = CF_marker; - + return hypre_error_flag; } @@ -1921,36 +1946,15 @@ * Perform Ruge coarsening followed by CLJP coarsening *-------------------------------------------------------*/ - ierr += hypre_BoomerAMGCoarsenRuge (S, A, measure_type, 6, debug_flag, - CF_marker_ptr); + ierr += hypre_BoomerAMGCoarsenRuge (S, A, measure_type, 6, debug_flag, + CF_marker_ptr); - ierr += hypre_BoomerAMGCoarsen (S, A, 1, debug_flag, - CF_marker_ptr); + ierr += hypre_BoomerAMGCoarsen (S, A, 1, debug_flag, + CF_marker_ptr); return (ierr); } -HYPRE_Int -hypre_BoomerAMGCoarsenHMIS( hypre_ParCSRMatrix *S, - hypre_ParCSRMatrix *A, - HYPRE_Int measure_type, - HYPRE_Int debug_flag, - HYPRE_Int **CF_marker_ptr) -{ - HYPRE_Int ierr = 0; - - /*------------------------------------------------------- - * Perform Ruge coarsening followed by CLJP coarsening - *-------------------------------------------------------*/ - - ierr += hypre_BoomerAMGCoarsenRuge (S, A, measure_type, 10, debug_flag, - CF_marker_ptr); - - ierr += hypre_BoomerAMGCoarsenPMIS (S, A, 1, debug_flag, - CF_marker_ptr); - - return (ierr); -} /*--------------------------------------------------------------------------*/ @@ -1969,8 +1973,8 @@ * **************************************************************/ HYPRE_Int -hypre_BoomerAMGCoarsenPMIS( hypre_ParCSRMatrix *S, - hypre_ParCSRMatrix *A, +hypre_BoomerAMGCoarsenPMISHost( hypre_ParCSRMatrix *S, + hypre_ParCSRMatrix *A, HYPRE_Int CF_init, HYPRE_Int debug_flag, HYPRE_Int **CF_marker_ptr) @@ -1979,50 +1983,49 @@ hypre_profile_times[HYPRE_TIMER_ID_PMIS] -= hypre_MPI_Wtime(); #endif - MPI_Comm comm = hypre_ParCSRMatrixComm(S); - hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(S); - hypre_ParCSRCommHandle *comm_handle; + MPI_Comm comm = hypre_ParCSRMatrixComm(S); + hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(S); + hypre_ParCSRCommHandle *comm_handle; - hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); - HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); - HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); + hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); + HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); + HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); - hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); - HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); - HYPRE_Int *S_offd_j; + hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); + HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); + HYPRE_Int *S_offd_j; - HYPRE_Int num_variables = hypre_CSRMatrixNumRows(S_diag); - HYPRE_Int num_cols_offd = 0; - - /* hypre_CSRMatrix *S_ext; - HYPRE_Int *S_ext_i; - HYPRE_Int *S_ext_j; */ - - HYPRE_Int num_sends = 0; - HYPRE_Int *int_buf_data; - HYPRE_Real *buf_data; + HYPRE_Int num_variables = hypre_CSRMatrixNumRows(S_diag); + HYPRE_Int num_cols_offd = 0; - HYPRE_Int *CF_marker; - HYPRE_Int *CF_marker_offd; - - HYPRE_Real *measure_array; - HYPRE_Int *graph_array; - HYPRE_Int *graph_array_offd; - HYPRE_Int graph_size; - HYPRE_BigInt big_graph_size; - HYPRE_Int graph_offd_size; - HYPRE_BigInt global_graph_size; - - HYPRE_Int i, j, jj, jS, ig; - HYPRE_Int index, start, my_id, num_procs, jrow, cnt, elmt; - - HYPRE_Int ierr = 0; + /* hypre_CSRMatrix *S_ext; + HYPRE_Int *S_ext_i; + HYPRE_Int *S_ext_j; */ - HYPRE_Real wall_time; - HYPRE_Int iter = 0; + HYPRE_Int num_sends = 0; + HYPRE_Int *int_buf_data; + HYPRE_Real *buf_data; + + HYPRE_Int *CF_marker; + HYPRE_Int *CF_marker_offd; + + HYPRE_Real *measure_array; + HYPRE_Int *graph_array; + HYPRE_Int *graph_array_offd; + HYPRE_Int graph_size; + HYPRE_BigInt big_graph_size; + HYPRE_Int graph_offd_size; + HYPRE_BigInt global_graph_size; + + HYPRE_Int i, j, jj, jS, ig; + HYPRE_Int index, start, my_id, num_procs, jrow, cnt, elmt; - HYPRE_Int *prefix_sum_workspace; + HYPRE_Int ierr = 0; + HYPRE_Real wall_time; + HYPRE_Int iter = 0; + + HYPRE_Int *prefix_sum_workspace; #if 0 /* debugging */ char filename[256]; @@ -2031,12 +2034,12 @@ #endif /******************************************************************************* - BEFORE THE INDEPENDENT SET COARSENING LOOP: - measure_array: calculate the measures, and communicate them - (this array contains measures for both local and external nodes) - CF_marker, CF_marker_offd: initialize CF_marker - (separate arrays for local and external; 0=unassigned, negative=F point, positive=C point) - ******************************************************************************/ + BEFORE THE INDEPENDENT SET COARSENING LOOP: +measure_array: calculate the measures, and communicate them +(this array contains measures for both local and external nodes) +CF_marker, CF_marker_offd: initialize CF_marker +(separate arrays for local and external; 0=unassigned, negative=F point, positive=C point) + ******************************************************************************/ /*-------------------------------------------------------------- * Use the ParCSR strength matrix, S. @@ -2053,28 +2056,30 @@ *----------------------------------------------------------------*/ /*S_ext = NULL; */ - if (debug_flag == 3) wall_time = time_getWallclockSeconds(); - hypre_MPI_Comm_size(comm,&num_procs); - hypre_MPI_Comm_rank(comm,&my_id); + if (debug_flag == 3) + { + wall_time = time_getWallclockSeconds(); + } + + hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_rank(comm, &my_id); if (!comm_pkg) { - comm_pkg = hypre_ParCSRMatrixCommPkg(A); + comm_pkg = hypre_ParCSRMatrixCommPkg(A); } if (!comm_pkg) { - hypre_MatvecCommPkgCreate(A); - comm_pkg = hypre_ParCSRMatrixCommPkg(A); + hypre_MatvecCommPkgCreate(A); + comm_pkg = hypre_ParCSRMatrixCommPkg(A); } num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, - num_sends), HYPRE_MEMORY_HOST); - buf_data = hypre_CTAlloc(HYPRE_Real, hypre_ParCSRCommPkgSendMapStart(comm_pkg, - num_sends), HYPRE_MEMORY_HOST); - + int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + buf_data = hypre_CTAlloc(HYPRE_Real, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + num_cols_offd = hypre_CSRMatrixNumCols(S_offd); S_diag_j = hypre_CSRMatrixJ(S_diag); @@ -2095,76 +2100,80 @@ * between 0 and 1. *----------------------------------------------------------*/ - measure_array = hypre_CTAlloc(HYPRE_Real, num_variables+num_cols_offd, HYPRE_MEMORY_HOST); + measure_array = hypre_CTAlloc(HYPRE_Real, num_variables + num_cols_offd, HYPRE_MEMORY_HOST); /* first calculate the local part of the sums for the external nodes */ #ifdef HYPRE_USING_OPENMP - HYPRE_Int *measure_array_temp = hypre_CTAlloc(HYPRE_Int, num_variables+num_cols_offd, HYPRE_MEMORY_HOST); + HYPRE_Int *measure_array_temp = hypre_CTAlloc(HYPRE_Int, num_variables + num_cols_offd, HYPRE_MEMORY_HOST); #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE - for (i=0; i < S_offd_i[num_variables]; i++) + for (i = 0; i < S_offd_i[num_variables]; i++) { #pragma omp atomic measure_array_temp[num_variables + S_offd_j[i]]++; } #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE - for (i=0; i < num_cols_offd; i++) + for (i = 0; i < num_cols_offd; i++) { - measure_array[i + num_variables] = measure_array_temp[i + num_variables]; + measure_array[i + num_variables] = measure_array_temp[i + num_variables]; } #else - for (i=0; i < S_offd_i[num_variables]; i++) - { + for (i = 0; i < S_offd_i[num_variables]; i++) + { measure_array[num_variables + S_offd_j[i]] += 1.0; } #endif // HYPRE_USING_OPENMP /* now send those locally calculated values for the external nodes to the neighboring processors */ if (num_procs > 1) - comm_handle = hypre_ParCSRCommHandleCreate(2, comm_pkg, - &measure_array[num_variables], buf_data); + { + comm_handle = hypre_ParCSRCommHandleCreate(2, comm_pkg, &measure_array[num_variables], buf_data); + } /* calculate the local part for the local nodes */ #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE - for (i=0; i < S_diag_i[num_variables]; i++) + for (i = 0; i < S_diag_i[num_variables]; i++) { #pragma omp atomic measure_array_temp[S_diag_j[i]]++; } #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE - for (i=0; i < num_variables; i++) + for (i = 0; i < num_variables; i++) { - measure_array[i] = measure_array_temp[i]; + measure_array[i] = measure_array_temp[i]; } hypre_TFree(measure_array_temp, HYPRE_MEMORY_HOST); #else - for (i=0; i < S_diag_i[num_variables]; i++) - { + for (i = 0; i < S_diag_i[num_variables]; i++) + { measure_array[S_diag_j[i]] += 1.0; } #endif // HYPRE_USING_OPENMP /* finish the communication */ if (num_procs > 1) - hypre_ParCSRCommHandleDestroy(comm_handle); - + { + hypre_ParCSRCommHandleDestroy(comm_handle); + } + /* now add the externally calculated part of the local nodes to the local nodes */ index = 0; - for (i=0; i < num_sends; i++) + for (i = 0; i < num_sends; i++) { start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - measure_array[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)] - += buf_data[index++]; + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + { + measure_array[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)] += buf_data[index++]; + } } /* set the measures of the external nodes to zero */ - for (i=num_variables; i < num_variables+num_cols_offd; i++) - { + for (i = num_variables; i < num_variables + num_cols_offd; i++) + { measure_array[i] = 0; } @@ -2172,42 +2181,51 @@ /* (only for the local part) */ /* this augments the measures */ if (CF_init == 2 || CF_init == 4) + { hypre_BoomerAMGIndepSetInit(S, measure_array, 1); + } else + { hypre_BoomerAMGIndepSetInit(S, measure_array, 0); + } /*--------------------------------------------------- * Initialize the graph arrays, and CF_marker arrays *---------------------------------------------------*/ /* first the off-diagonal part of the graph array */ - if (num_cols_offd) - graph_array_offd = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); + if (num_cols_offd) + { + graph_array_offd = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); + } else + { graph_array_offd = NULL; + } for (ig = 0; ig < num_cols_offd; ig++) + { graph_array_offd[ig] = ig; + } graph_offd_size = num_cols_offd; /* now the local part of the graph array, and the local CF_marker array */ - graph_array = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); + graph_array = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); - if (CF_init==1) - { + if (CF_init == 1) + { CF_marker = *CF_marker_ptr; cnt = 0; - for (i=0; i < num_variables; i++) + for (i = 0; i < num_variables; i++) { - if ( (S_offd_i[i+1]-S_offd_i[i]) > 0 || CF_marker[i] == -1) - { - CF_marker[i] = 0; - } + if ( S_offd_i[i+1] - S_offd_i[i] > 0 || CF_marker[i] == -1 ) + { + CF_marker[i] = 0; + } if ( CF_marker[i] == Z_PT) { - if (measure_array[i] >= 1.0 || - (S_diag_i[i+1]-S_diag_i[i]) > 0) + if ( measure_array[i] >= 1.0 || S_diag_i[i+1] - S_diag_i[i] > 0 ) { CF_marker[i] = 0; graph_array[cnt++] = i; @@ -2218,397 +2236,430 @@ } } else if (CF_marker[i] == SF_PT) + { measure_array[i] = 0; + } else + { graph_array[cnt++] = i; + } } } else { - CF_marker = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); + CF_marker = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); cnt = 0; - for (i=0; i < num_variables; i++) + for (i = 0; i < num_variables; i++) { CF_marker[i] = 0; - if ( (S_diag_i[i+1]-S_diag_i[i]) == 0 - && (S_offd_i[i+1]-S_offd_i[i]) == 0) + if ( S_diag_i[i+1] - S_diag_i[i] == 0 && S_offd_i[i+1] - S_offd_i[i] == 0) { CF_marker[i] = SF_PT; /* an isolated fine grid */ - if (CF_init == 3 || CF_init == 4) CF_marker[i] = C_PT; + if (CF_init == 3 || CF_init == 4) + { + CF_marker[i] = C_PT; + } measure_array[i] = 0; } else + { graph_array[cnt++] = i; + } } } + graph_size = cnt; /* now the off-diagonal part of CF_marker */ if (num_cols_offd) - CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); + { + CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); + } else - CF_marker_offd = NULL; + { + CF_marker_offd = NULL; + } + + for (i = 0; i < num_cols_offd; i++) + { + CF_marker_offd[i] = 0; + } - for (i=0; i < num_cols_offd; i++) - CF_marker_offd[i] = 0; - /*------------------------------------------------ * Communicate the local measures, which are complete, - to the external nodes + to the external nodes *------------------------------------------------*/ index = 0; for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - { - jrow = hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j); - buf_data[index++] = measure_array[jrow]; - } - } - + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + { + jrow = hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j); + buf_data[index++] = measure_array[jrow]; + } + } + if (num_procs > 1) - { - comm_handle = hypre_ParCSRCommHandleCreate(1, comm_pkg, buf_data, - &measure_array[num_variables]); - - hypre_ParCSRCommHandleDestroy(comm_handle); - - } - + { + comm_handle = hypre_ParCSRCommHandleCreate(1, comm_pkg, buf_data, &measure_array[num_variables]); + hypre_ParCSRCommHandleDestroy(comm_handle); + } + if (debug_flag == 3) { wall_time = time_getWallclockSeconds() - wall_time; - hypre_printf("Proc = %d Initialize CLJP phase = %f\n", - my_id, wall_time); + hypre_printf("Proc = %d Initialize CLJP phase = %f\n", my_id, wall_time); } - HYPRE_Int *graph_array2 = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); + /* graph_array2 */ + HYPRE_Int *graph_array2 = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); HYPRE_Int *graph_array_offd2 = NULL; if (num_cols_offd) - graph_array_offd2 = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); + { + graph_array_offd2 = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); + } /******************************************************************************* - THE INDEPENDENT SET COARSENING LOOP: - ******************************************************************************/ + THE INDEPENDENT SET COARSENING LOOP: + ******************************************************************************/ /*--------------------------------------------------- * Loop until all points are either fine or coarse. *---------------------------------------------------*/ - while (1) { + big_graph_size = (HYPRE_BigInt) graph_size; + + /* stop the coarsening if nothing left to be coarsened */ + hypre_MPI_Allreduce(&big_graph_size, &global_graph_size, 1, HYPRE_MPI_BIG_INT, hypre_MPI_SUM,comm); + + /* if (my_id == 0) { hypre_printf("graph size %b\n", global_graph_size); } */ + + if (global_graph_size == 0) + { + break; + } - big_graph_size = (HYPRE_BigInt) graph_size; - /* stop the coarsening if nothing left to be coarsened */ - hypre_MPI_Allreduce(&big_graph_size,&global_graph_size,1,HYPRE_MPI_BIG_INT,hypre_MPI_SUM,comm); - - if (global_graph_size == 0) - break; - - /* hypre_printf("\n"); - hypre_printf("*** MIS iteration %d\n",iter); - hypre_printf("graph_size remaining %d\n",graph_size);*/ - - /*------------------------------------------------ - * Pick an independent set of points with - * maximal measure. - At the end, CF_marker is complete, but still needs to be - communicated to CF_marker_offd - *------------------------------------------------*/ + /* + hypre_printf("\n"); + hypre_printf("*** MIS iteration %d\n",iter); + hypre_printf("graph_size remaining %d\n",graph_size); + */ + + /*----------------------------------------------------------------------------------------- + * Pick an independent set of points with maximal measure + * At the end, CF_marker is complete, but still needs to be communicated to CF_marker_offd + * for CF_init == 1, as in HMIS, the first IS was fed from prior R-S coarsening + *----------------------------------------------------------------------------------------*/ if (!CF_init || iter) { - /*hypre_BoomerAMGIndepSet(S, measure_array, graph_array, - graph_size, - graph_array_offd, graph_offd_size, - CF_marker, CF_marker_offd);*/ + /* + hypre_BoomerAMGIndepSet(S, measure_array, graph_array, graph_size, + graph_array_offd, graph_offd_size, CF_marker, CF_marker_offd); + */ + #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(ig, i) HYPRE_SMP_SCHEDULE #endif - for (ig = 0; ig < graph_size; ig++) - { - i = graph_array[ig]; - if (measure_array[i] > 1) - { - CF_marker[i] = 1; - } - } + for (ig = 0; ig < graph_size; ig++) + { + i = graph_array[ig]; + if (measure_array[i] > 1) + { + CF_marker[i] = 1; + } + } + #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(ig, i) HYPRE_SMP_SCHEDULE #endif - for (ig = 0; ig < graph_offd_size; ig++) - { - i = graph_array_offd[ig]; - if (measure_array[i+num_variables] > 1) - { - CF_marker_offd[i] = 1; - } - } - - /*------------------------------------------------------- - * Remove nodes from the initial independent set - *-------------------------------------------------------*/ + for (ig = 0; ig < graph_offd_size; ig++) + { + i = graph_array_offd[ig]; + if (measure_array[i+num_variables] > 1) + { + CF_marker_offd[i] = 1; + } + } + /*------------------------------------------------------- + * Remove nodes from the initial independent set + *-------------------------------------------------------*/ #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(ig, i, jS, j, jj) HYPRE_SMP_SCHEDULE #endif - for (ig = 0; ig < graph_size; ig++) - { - i = graph_array[ig]; - if (measure_array[i] > 1) - { - for (jS = S_diag_i[i]; jS < S_diag_i[i+1]; jS++) - { - j = S_diag_j[jS]; - if (measure_array[j] > 1) - { - if (measure_array[i] > measure_array[j]) - CF_marker[j] = 0; - else if (measure_array[j] > measure_array[i]) - CF_marker[i] = 0; - } - } /* for each local neighbor j of i */ - for (jS = S_offd_i[i]; jS < S_offd_i[i+1]; jS++) - { - jj = S_offd_j[jS]; - j = num_variables+jj; - if (measure_array[j] > 1) - { - if (measure_array[i] > measure_array[j]) - CF_marker_offd[jj] = 0; - else if (measure_array[j] > measure_array[i]) - CF_marker[i] = 0; - } - } - } /* for each node with measure > 1 */ - } /* for each node i */ + for (ig = 0; ig < graph_size; ig++) + { + i = graph_array[ig]; + if (measure_array[i] > 1) + { + /* for each local neighbor j of i */ + for (jS = S_diag_i[i]; jS < S_diag_i[i+1]; jS++) + { + j = S_diag_j[jS]; + if (measure_array[j] > 1) + { + if (measure_array[i] > measure_array[j]) + { + CF_marker[j] = 0; + } + else if (measure_array[j] > measure_array[i]) + { + CF_marker[i] = 0; + } + } + } - /*------------------------------------------------ - * Exchange boundary data for CF_marker: send internal - points to external points - *------------------------------------------------*/ + /* for each offd neighbor j of i */ + for (jS = S_offd_i[i]; jS < S_offd_i[i+1]; jS++) + { + jj = S_offd_j[jS]; + j = num_variables + jj; + if (measure_array[j] > 1) + { + if (measure_array[i] > measure_array[j]) + { + CF_marker_offd[jj] = 0; + } + else if (measure_array[j] > measure_array[i]) + { + CF_marker[i] = 0; + } + } + } + } /* for each node with measure > 1 */ + } /* for each node i */ - if (num_procs > 1) - { - comm_handle = hypre_ParCSRCommHandleCreate(12, comm_pkg, - CF_marker_offd, int_buf_data); - - hypre_ParCSRCommHandleDestroy(comm_handle); - } + /*------------------------------------------------------------------------------ + * Exchange boundary data for CF_marker: send external CF to internal CF + *------------------------------------------------------------------------------*/ + if (num_procs > 1) + { + comm_handle = hypre_ParCSRCommHandleCreate(12, comm_pkg, CF_marker_offd, int_buf_data); + hypre_ParCSRCommHandleDestroy(comm_handle); + } - index = 0; - for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + index = 0; + for (i = 0; i < num_sends; i++) { - elmt = hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j); - if (!int_buf_data[index] && CF_marker[elmt] > 0) - { - CF_marker[elmt] = 0; - index++; - } - else + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) { - int_buf_data[index++] = CF_marker[elmt]; + elmt = hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j); + if (!int_buf_data[index] && CF_marker[elmt] > 0) + { + CF_marker[elmt] = 0; + index++; + } + else + { + int_buf_data[index++] = CF_marker[elmt]; + } } } - } - - if (num_procs > 1) - { - comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, int_buf_data, - CF_marker_offd); - - hypre_ParCSRCommHandleDestroy(comm_handle); - } - } + + if (num_procs > 1) + { + comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, int_buf_data, CF_marker_offd); + hypre_ParCSRCommHandleDestroy(comm_handle); + } + } /* if (!CF_init || iter) */ iter++; - /*------------------------------------------------ - * Set C-pts and F-pts. - *------------------------------------------------*/ + /*------------------------------------------------ + * Set C-pts and F-pts. + *------------------------------------------------*/ #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(ig, i, jS, j) HYPRE_SMP_SCHEDULE #endif - for (ig = 0; ig < graph_size; ig++) { - i = graph_array[ig]; + for (ig = 0; ig < graph_size; ig++) + { + i = graph_array[ig]; - /*--------------------------------------------- - * If the measure of i is smaller than 1, then - * make i and F point (because it does not influence - * any other point) - *---------------------------------------------*/ - - if(measure_array[i]<1.) CF_marker[i]= F_PT; - - /*--------------------------------------------- - * First treat the case where point i is in the - * independent set: make i a C point, - *---------------------------------------------*/ - - if (CF_marker[i] > 0) CF_marker[i] = C_PT; - - /*--------------------------------------------- - * Now treat the case where point i is not in the - * independent set: loop over - * all the points j that influence equation i; if - * j is a C point, then make i an F point. - *---------------------------------------------*/ - - else - { - /* first the local part */ - for (jS = S_diag_i[i]; jS < S_diag_i[i+1]; jS++) - { - /* j is the column number, or the local number of the point influencing i */ - j = S_diag_j[jS]; - if (CF_marker[j] > 0) /* j is a C-point */ - CF_marker[i] = F_PT; - } - /* now the external part */ - for (jS = S_offd_i[i]; jS < S_offd_i[i+1]; jS++) - { - j = S_offd_j[jS]; - if (CF_marker_offd[j] > 0) /* j is a C-point */ - CF_marker[i] = F_PT; - } + /*--------------------------------------------- + * If the measure of i is smaller than 1, then + * make i and F point (because it does not influence + * any other point) + *---------------------------------------------*/ - } /* end else */ - } /* end first loop over graph */ + if (measure_array[i] < 1) + { + CF_marker[i]= F_PT; + } - /* now communicate CF_marker to CF_marker_offd, to make - sure that new external F points are known on this processor */ + /*--------------------------------------------- + * First treat the case where point i is in the + * independent set: make i a C point, + *---------------------------------------------*/ - /*------------------------------------------------ - * Exchange boundary data for CF_marker: send internal - points to external points - *------------------------------------------------*/ + if (CF_marker[i] > 0) + { + CF_marker[i] = C_PT; + } + /*--------------------------------------------- + * Now treat the case where point i is not in the + * independent set: loop over + * all the points j that influence equation i; if + * j is a C point, then make i an F point. + *---------------------------------------------*/ + else + { + /* first the local part */ + for (jS = S_diag_i[i]; jS < S_diag_i[i+1]; jS++) + { + /* j is the column number, or the local number of the point influencing i */ + j = S_diag_j[jS]; + if (CF_marker[j] > 0) /* j is a C-point */ + { + CF_marker[i] = F_PT; + } + } + /* now the external part */ + for (jS = S_offd_i[i]; jS < S_offd_i[i+1]; jS++) + { + j = S_offd_j[jS]; + if (CF_marker_offd[j] > 0) /* j is a C-point */ + { + CF_marker[i] = F_PT; + } + } + } /* end else */ + } /* end first loop over graph */ + /* now communicate CF_marker to CF_marker_offd, to make + sure that new external F points are known on this processor */ + + /*------------------------------------------------------------------------------ + * Exchange boundary data for CF_marker: send internal points to external points + *------------------------------------------------------------------------------*/ index = 0; for (i = 0; i < num_sends; i++) { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + { + int_buf_data[index++] = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } } - + if (num_procs > 1) { - comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, int_buf_data, - CF_marker_offd); - - hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, int_buf_data, CF_marker_offd); + hypre_ParCSRCommHandleDestroy(comm_handle); } - /*------------------------------------------------ - * Update subgraph - *------------------------------------------------*/ + /*------------------------------------------------ + * Update subgraph + *------------------------------------------------*/ - /*HYPRE_Int prefix_sum_workspace[2*(hypre_NumThreads() + 1)];*/ - prefix_sum_workspace = hypre_TAlloc(HYPRE_Int, 2*(hypre_NumThreads() + 1), HYPRE_MEMORY_HOST); + /*HYPRE_Int prefix_sum_workspace[2*(hypre_NumThreads() + 1)];*/ + prefix_sum_workspace = hypre_TAlloc(HYPRE_Int, 2*(hypre_NumThreads() + 1), HYPRE_MEMORY_HOST); #ifdef HYPRE_USING_OPENMP #pragma omp parallel private(ig,i) #endif - { - HYPRE_Int private_graph_size_cnt = 0; - HYPRE_Int private_graph_offd_size_cnt = 0; - - HYPRE_Int ig_begin, ig_end; - hypre_GetSimpleThreadPartition(&ig_begin, &ig_end, graph_size); - - HYPRE_Int ig_offd_begin, ig_offd_end; - hypre_GetSimpleThreadPartition(&ig_offd_begin, &ig_offd_end, graph_offd_size); - - for (ig = ig_begin; ig < ig_end; ig++) - { - i = graph_array[ig]; - - if (CF_marker[i]!=0) /* C or F point */ - { - /* the independent set subroutine needs measure 0 for - removed nodes */ - measure_array[i] = 0; - } - else - { - private_graph_size_cnt++; - } - } - - for (ig = ig_offd_begin; ig < ig_offd_end; ig++) - { - i = graph_array_offd[ig]; - - if (CF_marker_offd[i]!=0) /* C of F point */ - { - /* the independent set subroutine needs measure 0 for - removed nodes */ - measure_array[i + num_variables] = 0; - } - else - { - private_graph_offd_size_cnt++; - } - } - - hypre_prefix_sum_pair(&private_graph_size_cnt, &graph_size, &private_graph_offd_size_cnt, &graph_offd_size, prefix_sum_workspace); - - for (ig = ig_begin; ig < ig_end; ig++) - { - i = graph_array[ig]; - if (CF_marker[i]==0) - { - graph_array2[private_graph_size_cnt++] = i; - } - } - - for (ig = ig_offd_begin; ig < ig_offd_end; ig++) - { - i = graph_array_offd[ig]; - if (CF_marker_offd[i]==0) - { - graph_array_offd2[private_graph_offd_size_cnt++] = i; - } - } - } /* omp parallel */ - - HYPRE_Int *temp = graph_array; - graph_array = graph_array2; - graph_array2 = temp; - - temp = graph_array_offd; - graph_array_offd = graph_array_offd2; - graph_array_offd2 = temp; + { + HYPRE_Int private_graph_size_cnt = 0; + HYPRE_Int private_graph_offd_size_cnt = 0; + + HYPRE_Int ig_begin, ig_end; + hypre_GetSimpleThreadPartition(&ig_begin, &ig_end, graph_size); + + HYPRE_Int ig_offd_begin, ig_offd_end; + hypre_GetSimpleThreadPartition(&ig_offd_begin, &ig_offd_end, graph_offd_size); + + for (ig = ig_begin; ig < ig_end; ig++) + { + i = graph_array[ig]; + + if (CF_marker[i] != 0) /* C or F point */ + { + /* the independent set subroutine needs measure 0 for removed nodes */ + measure_array[i] = 0; + } + else + { + private_graph_size_cnt++; + } + } + + for (ig = ig_offd_begin; ig < ig_offd_end; ig++) + { + i = graph_array_offd[ig]; + + if (CF_marker_offd[i] != 0) /* C of F point */ + { + /* the independent set subroutine needs measure 0 for removed nodes */ + measure_array[i + num_variables] = 0; + } + else + { + private_graph_offd_size_cnt++; + } + } + + hypre_prefix_sum_pair(&private_graph_size_cnt, &graph_size, &private_graph_offd_size_cnt, &graph_offd_size, prefix_sum_workspace); + + for (ig = ig_begin; ig < ig_end; ig++) + { + i = graph_array[ig]; + if (CF_marker[i] == 0) + { + graph_array2[private_graph_size_cnt++] = i; + } + } + + for (ig = ig_offd_begin; ig < ig_offd_end; ig++) + { + i = graph_array_offd[ig]; + if (CF_marker_offd[i] == 0) + { + graph_array_offd2[private_graph_offd_size_cnt++] = i; + } + } + } /* omp parallel */ + + HYPRE_Int *temp = graph_array; + graph_array = graph_array2; + graph_array2 = temp; + + temp = graph_array_offd; + graph_array_offd = graph_array_offd2; + graph_array_offd2 = temp; + + hypre_TFree(prefix_sum_workspace, HYPRE_MEMORY_HOST); - hypre_TFree(prefix_sum_workspace, HYPRE_MEMORY_HOST); - } /* end while */ - /* hypre_printf("*** MIS iteration %d\n",iter); - hypre_printf("graph_size remaining %d\n",graph_size); + /* + hypre_printf("*** MIS iteration %d\n",iter); + hypre_printf("graph_size remaining %d\n",graph_size); - hypre_printf("num_cols_offd %d\n",num_cols_offd); - for (i=0;i= sizeof(HYPRE_Int) ) + { + send_buf = (void *) hypre_TAlloc(HYPRE_Real, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + HYPRE_MEMORY_DEVICE); + + } + else + { + send_buf = (void *) hypre_TAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + HYPRE_MEMORY_DEVICE); + } + + /*------------------------------------------------------------------- + * Compute the global measures + * The measures are currently given by the column sums of S + * Hence, measure_array[i] is the number of influences of variable i + * The measures are augmented by a random number between 0 and 1 + * Note that measure_offd is not sync'ed + *-------------------------------------------------------------------*/ + hypre_GetGlobalMeasureDevice(S, comm_pkg, CF_init, 2, measure_diag, measure_offd, (HYPRE_Real *) send_buf); + + /* initialize CF marker, graph arrays and measure_diag, measure_offd is sync'ed + * Note: CF_marker_offd is not sync'ed */ + hypre_PMISCoarseningInitDevice(S, comm_pkg, CF_init, measure_diag, measure_offd, (HYPRE_Real *) send_buf, + &graph_diag_size, graph_diag, CF_marker_diag); + + while (1) + { + HYPRE_BigInt big_graph_size, global_graph_size; + + big_graph_size = graph_diag_size; + + /* stop the coarsening if nothing left to be coarsened */ + hypre_MPI_Allreduce(&big_graph_size, &global_graph_size, 1, HYPRE_MPI_BIG_INT, hypre_MPI_SUM, comm); + + /* if (my_id == 0) { hypre_printf("graph size %b\n", global_graph_size); } */ + + if (global_graph_size == 0) + { + break; + } + + if (!CF_init || iter) + { + /* on input CF_marker_offd does not need to be sync'ed, (but has minimal requirement on + * the values, see comments therein), and will NOT be sync'ed on exit */ + hypre_BoomerAMGIndepSetDevice(S, measure_diag, measure_offd, graph_diag_size, graph_diag, + CF_marker_diag, CF_marker_offd, comm_pkg, (HYPRE_Int *) send_buf); + + /* sync CF_marker_offd */ + HYPRE_THRUST_CALL( gather, + hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg), + hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg) + + hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + CF_marker_diag, + (HYPRE_Int *) send_buf ); + + comm_handle = hypre_ParCSRCommHandleCreate_v2(11, comm_pkg, + HYPRE_MEMORY_DEVICE, (HYPRE_Int *) send_buf, + HYPRE_MEMORY_DEVICE, CF_marker_offd); + + hypre_ParCSRCommHandleDestroy(comm_handle); + } + + iter ++; + + /* From the IS, set C/F-pts in CF_marker_diag (for the nodes still in graph) and + * clear their values in measure_diag. measure_offd is sync'ed afterwards. + * Note: CF_marker_offd is NOT sync'ed */ + hypre_PMISCoarseningUpdateCFDevice(S, measure_diag, measure_offd, graph_diag_size, graph_diag, + CF_marker_diag, CF_marker_offd, comm_pkg, (HYPRE_Real *) send_buf, + (HYPRE_Int *)send_buf); + + /* Update graph_diag. Remove the nodes with CF_marker_diag != 0 */ + HYPRE_THRUST_CALL(gather, graph_diag, graph_diag + graph_diag_size, CF_marker_diag, diag_iwork); + + HYPRE_Int *new_end = HYPRE_THRUST_CALL(remove_if, graph_diag, graph_diag + graph_diag_size, + diag_iwork, thrust::identity()); + + graph_diag_size = new_end - graph_diag; + } + + /*--------------------------------------------------- + * Clean up and return + *---------------------------------------------------*/ + *CF_marker_ptr = hypre_CTAlloc(HYPRE_Int, num_cols_diag, HYPRE_MEMORY_HOST); + hypre_TMemcpy( *CF_marker_ptr, CF_marker_diag, HYPRE_Int, num_cols_diag, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE ); + hypre_TFree(CF_marker_diag,HYPRE_MEMORY_DEVICE); + + hypre_TFree(measure_diag, HYPRE_MEMORY_DEVICE); + hypre_TFree(measure_offd, HYPRE_MEMORY_DEVICE); + hypre_TFree(graph_diag, HYPRE_MEMORY_DEVICE); + hypre_TFree(diag_iwork, HYPRE_MEMORY_DEVICE); + hypre_TFree(CF_marker_offd, HYPRE_MEMORY_DEVICE); + hypre_TFree(send_buf, HYPRE_MEMORY_DEVICE); + + // *CF_marker_ptr = CF_marker_diag; + +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_PMIS] += hypre_MPI_Wtime(); +#endif + + return ierr; +} + +HYPRE_Int +hypre_GetGlobalMeasureDevice( hypre_ParCSRMatrix *S, + hypre_ParCSRCommPkg *comm_pkg, + HYPRE_Int CF_init, + HYPRE_Int aug_rand, + HYPRE_Real *measure_diag, + HYPRE_Real *measure_offd, + HYPRE_Real *real_send_buf ) +{ + hypre_ParCSRCommHandle *comm_handle; + HYPRE_Int num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); + hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); + + /* Compute global column nnz */ + /* compute local column nnz of the offd part */ + hypre_CSRMatrixColNNzRealDevice(S_offd, measure_offd); + + /* send local column nnz of the offd part to neighbors */ + comm_handle = hypre_ParCSRCommHandleCreate_v2(2, comm_pkg, HYPRE_MEMORY_DEVICE, measure_offd, + HYPRE_MEMORY_DEVICE, real_send_buf); + + + /* compute local column nnz of the diag part */ + hypre_CSRMatrixColNNzRealDevice(S_diag, measure_diag); + + hypre_ParCSRCommHandleDestroy(comm_handle); + + /* add to the local column nnz of the diag part */ + if (hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg) == NULL) + { + hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg) = + hypre_TAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + HYPRE_MEMORY_DEVICE); + + hypre_TMemcpy(hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg), + hypre_ParCSRCommPkgSendMapElmts(comm_pkg), + HYPRE_Int, + hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_HOST); + } + + hypreDevice_GenScatterAdd(measure_diag, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg), real_send_buf); + + /* Augments the measures with a random number between 0 and 1 (only for the local part) */ + if (aug_rand) + { + hypre_BoomerAMGIndepSetInitDevice(S, measure_diag, aug_rand); + } + + /* Note that measure_offd is not sync'ed (communicated) here + * and is not set to zero as in the cpu pmis */ + + return hypre_error_flag; +} + +__global__ void +hypreCUDAKernel_PMISCoarseningInit(HYPRE_Int nrows, + HYPRE_Int CF_init, + HYPRE_Int *S_diag_i, + HYPRE_Int *S_offd_i, + HYPRE_Real *measure_diag, + HYPRE_Int *CF_marker_diag) +{ + /* global_thread_id */ + const HYPRE_Int i = hypre_cuda_get_grid_thread_id<1,1>(); + + if (i >= nrows) + { + return; + } + + /*--------------------------------------------- + * If the measure of i is smaller than 1, then + * make i and F point (because it does not influence + * any other point) + * RL: move this step to pmis init and don't do the check + * in pmis iterations. different from cpu impl + *---------------------------------------------*/ + if ( measure_diag[i] < 1.0 ) + { + CF_marker_diag[i] = F_PT; + measure_diag[i] = 0.0; + + return; + } + + if (CF_init == 1) + { + // TODO + } + else + { + if ( S_diag_i[i+1] - S_diag_i[i] == 0 && S_offd_i[i+1] - S_offd_i[i] == 0 ) + { + HYPRE_Int mark = (CF_init == 3 || CF_init == 4) ? C_PT : SF_PT; + CF_marker_diag[i] = mark; + measure_diag[i] = 0.0; + } + else + { + CF_marker_diag[i] = 0; + } + } +} + +HYPRE_Int +hypre_PMISCoarseningInitDevice( hypre_ParCSRMatrix *S, /* in */ + hypre_ParCSRCommPkg *comm_pkg, /* in */ + HYPRE_Int CF_init, /* in */ + HYPRE_Real *measure_diag, /* in */ + HYPRE_Real *measure_offd, /* out */ + HYPRE_Real *real_send_buf, /* in */ + HYPRE_Int *graph_diag_size, /* out */ + HYPRE_Int *graph_diag, /* out */ + HYPRE_Int *CF_marker_diag /* in/out */ ) +{ + hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); + hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); + HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); + HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); + HYPRE_Int num_rows_diag = hypre_CSRMatrixNumRows(S_diag); + HYPRE_Int num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + + dim3 bDim, gDim; + bDim = hypre_GetDefaultCUDABlockDimension(); + gDim = hypre_GetDefaultCUDAGridDimension(num_rows_diag, "thread", bDim); + + hypre_ParCSRCommHandle *comm_handle; + HYPRE_Int *new_end; + + /* init CF_marker_diag and measure_diag: remove some special nodes */ + HYPRE_CUDA_LAUNCH( hypreCUDAKernel_PMISCoarseningInit, gDim, bDim, + num_rows_diag, CF_init, S_diag_i, S_offd_i, measure_diag, CF_marker_diag ); + + /* communicate for measure_offd */ + HYPRE_THRUST_CALL(gather, + hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg), + hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg) + + hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + measure_diag, + real_send_buf); + + comm_handle = hypre_ParCSRCommHandleCreate_v2(1, comm_pkg, + HYPRE_MEMORY_DEVICE, real_send_buf, + HYPRE_MEMORY_DEVICE, measure_offd); + + hypre_ParCSRCommHandleDestroy(comm_handle); + + /* graph_diag consists points with CF_marker_diag == 0 */ + new_end = + HYPRE_THRUST_CALL(remove_copy_if, + thrust::make_counting_iterator(0), + thrust::make_counting_iterator(num_rows_diag), + CF_marker_diag, + graph_diag, + thrust::identity()); + + *graph_diag_size = new_end - graph_diag; + + return hypre_error_flag; +} + +__global__ void +hypreCUDAKernel_PMISCoarseningUpdateCF(HYPRE_Int graph_diag_size, + HYPRE_Int *graph_diag, + HYPRE_Int *S_diag_i, + HYPRE_Int *S_diag_j, + HYPRE_Int *S_offd_i, + HYPRE_Int *S_offd_j, + HYPRE_Real *measure_diag, + HYPRE_Int *CF_marker_diag, + HYPRE_Int *CF_marker_offd) +{ + HYPRE_Int warp_id = hypre_cuda_get_grid_warp_id<1,1>(); + + if (warp_id >= graph_diag_size) + { + return; + } + + HYPRE_Int lane = hypre_cuda_get_lane_id<1>(); + HYPRE_Int row, i, marker_row, row_start, row_end; + + if (lane < 2) + { + row = read_only_load(graph_diag + warp_id); + i = read_only_load(CF_marker_diag + row); + } + + marker_row = __shfl_sync(HYPRE_WARP_FULL_MASK, i, 0); + + if (marker_row > 0) + { + if (lane == 0) + { + measure_diag[row] = 0.0; + /* this node is in the IS, mark it as C_PT */ + /* given the fact that C_PT == 1, can skip */ + /* + CF_marker_diag[row] = C_PT; + */ + } + } + else + { + assert(marker_row == 0); + + /*------------------------------------------------- + * Now treat the case where this node is not in the + * independent set: loop over + * all the points j that influence equation i; if + * j is a C point, then make i an F point. + *-------------------------------------------------*/ + if (lane < 2) + { + i = read_only_load(S_diag_i + row + lane); + } + + row_start = __shfl_sync(HYPRE_WARP_FULL_MASK, i, 0); + row_end = __shfl_sync(HYPRE_WARP_FULL_MASK, i, 1); + + for (i = row_start + lane; i < row_end; i += HYPRE_WARP_SIZE) + { + HYPRE_Int j = read_only_load(S_diag_j + i); + /* CF_marker_diag is not r.o. in this kernel */ + HYPRE_Int marker_j = CF_marker_diag[j]; + + if (marker_j > 0) + { + marker_row = -1; + break; + } + } + + marker_row = warp_allreduce_min(marker_row); + + if (marker_row == 0) + { + if (lane < 2) + { + i = read_only_load(S_offd_i + row + lane); + } + + row_start = __shfl_sync(HYPRE_WARP_FULL_MASK, i, 0); + row_end = __shfl_sync(HYPRE_WARP_FULL_MASK, i, 1); + + for (i = row_start + lane; i < row_end; i += HYPRE_WARP_SIZE) + { + HYPRE_Int j = read_only_load(S_offd_j + i); + HYPRE_Int marker_j = read_only_load(CF_marker_offd + j); + + if (marker_j > 0) + { + marker_row = -1; + break; + } + } + + marker_row = warp_reduce_min(marker_row); + } + + if (lane == 0 && marker_row == -1) + { + CF_marker_diag[row] = F_PT; + measure_diag[row] = 0.0; + } + } +} + +HYPRE_Int +hypre_PMISCoarseningUpdateCFDevice( hypre_ParCSRMatrix *S, /* in */ + HYPRE_Real *measure_diag, + HYPRE_Real *measure_offd, + HYPRE_Int graph_diag_size, /* in */ + HYPRE_Int *graph_diag, /* in */ + HYPRE_Int *CF_marker_diag, /* in/out */ + HYPRE_Int *CF_marker_offd, /* in/out */ + hypre_ParCSRCommPkg *comm_pkg, + HYPRE_Real *real_send_buf, + HYPRE_Int *int_send_buf ) +{ + hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); + HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); + HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); + hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); + HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); + HYPRE_Int *S_offd_j = hypre_CSRMatrixJ(S_offd); + HYPRE_Int num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + + dim3 bDim, gDim; + bDim = hypre_GetDefaultCUDABlockDimension(); + gDim = hypre_GetDefaultCUDAGridDimension(graph_diag_size, "warp", bDim); + + HYPRE_CUDA_LAUNCH( hypreCUDAKernel_PMISCoarseningUpdateCF, gDim, bDim, + graph_diag_size, graph_diag, S_diag_i, S_diag_j, S_offd_i, S_offd_j, + measure_diag, CF_marker_diag, CF_marker_offd ); + + hypre_ParCSRCommHandle *comm_handle; + + /* communicate for measure_offd */ + HYPRE_THRUST_CALL(gather, + hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg), + hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg) + + hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + measure_diag, + real_send_buf); + + comm_handle = hypre_ParCSRCommHandleCreate_v2(1, comm_pkg, + HYPRE_MEMORY_DEVICE, real_send_buf, + HYPRE_MEMORY_DEVICE, measure_offd); + + hypre_ParCSRCommHandleDestroy(comm_handle); + +#if 0 + /* now communicate CF_marker to CF_marker_offd, to make + sure that new external F points are known on this processor */ + HYPRE_THRUST_CALL(gather, + hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg), + hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg) + + hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + CF_marker_diag, + int_send_buf); + + comm_handle = hypre_ParCSRCommHandleCreate_v2(11, comm_pkg, + HYPRE_MEMORY_DEVICE, int_send_buf, + HYPRE_MEMORY_DEVICE, CF_marker_offd); + + hypre_ParCSRCommHandleDestroy(comm_handle); +#endif + + return hypre_error_flag; +} + +#endif // #if defined(HYPRE_USING_CUDA) + + + +/* + cudaError_t cudaerr = cudaGetLastError(); + if (cudaerr != cudaSuccess) + { + hypre_printf("CUDA error: %s\n",cudaGetErrorString(cudaerr)); + } + exit(0); +*/ diff -Nru hypre-2.16.0/src/parcsr_ls/par_coarse_parms.c hypre-2.18.2/src/parcsr_ls/par_coarse_parms.c --- hypre-2.16.0/src/parcsr_ls/par_coarse_parms.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_coarse_parms.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -61,12 +53,12 @@ /*--------------------------------------------------------------------------*/ HYPRE_Int -hypre_BoomerAMGCoarseParms(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_BoomerAMGCoarseParms(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) { #ifdef HYPRE_PROFILE diff -Nru hypre-2.16.0/src/parcsr_ls/par_coordinates.c hypre-2.18.2/src/parcsr_ls/par_coordinates.c --- hypre-2.16.0/src/parcsr_ls/par_coordinates.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_coordinates.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,19 +1,10 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ - - #include "_hypre_parcsr_ls.h" /*-------------------------------------------------------------------------- diff -Nru hypre-2.16.0/src/parcsr_ls/par_cr.c hypre-2.18.2/src/parcsr_ls/par_cr.c --- hypre-2.16.0/src/parcsr_ls/par_cr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_cr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*==================== * Functions to run cr diff -Nru hypre-2.16.0/src/parcsr_ls/par_csr_block_matrix.h hypre-2.18.2/src/parcsr_ls/par_csr_block_matrix.h --- hypre-2.16.0/src/parcsr_ls/par_csr_block_matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_csr_block_matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/par_cycle.c hypre-2.18.2/src/parcsr_ls/par_cycle.c --- hypre-2.16.0/src/parcsr_ls/par_cycle.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_cycle.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -59,24 +50,25 @@ HYPRE_Real *Ztemp_data; HYPRE_Real *Ptemp_data; - HYPRE_Int **CF_marker_array; + HYPRE_Int **CF_marker_array; /* HYPRE_Int **unknown_map_array; HYPRE_Int **point_map_array; HYPRE_Int **v_at_point_array; */ - HYPRE_Real cycle_op_count; + HYPRE_Real cycle_op_count; HYPRE_Int cycle_type; + HYPRE_Int fcycle, fcycle_lev; HYPRE_Int num_levels; HYPRE_Int max_levels; - HYPRE_Real *num_coeffs; + HYPRE_Real *num_coeffs; HYPRE_Int *num_grid_sweeps; HYPRE_Int *grid_relax_type; HYPRE_Int **grid_relax_points; HYPRE_Int block_mode; - HYPRE_Int cheby_order; + HYPRE_Int cheby_order; /* Local variables */ HYPRE_Int *lev_counter; @@ -104,9 +96,6 @@ HYPRE_Int smooth_type; HYPRE_Int smooth_num_levels; HYPRE_Int my_id; -#if !( defined(HYPRE_USING_GPU)|| defined(HYPRE_USING_OPENMP_OFFLOAD) || defined(HYPRE_USING_MAPPED_OPENMP_OFFLOAD) ) - HYPRE_Int num_threads = hypre_NumThreads(); -#endif HYPRE_Int restri_type; HYPRE_Real alpha; HYPRE_Real **l1_norms = NULL; @@ -138,6 +127,7 @@ num_levels = hypre_ParAMGDataNumLevels(amg_data); max_levels = hypre_ParAMGDataMaxLevels(amg_data); cycle_type = hypre_ParAMGDataCycleType(amg_data); + fcycle = hypre_ParAMGDataFCycle(amg_data); A_block_array = hypre_ParAMGDataABlockArray(amg_data); P_block_array = hypre_ParAMGDataPBlockArray(amg_data); @@ -164,7 +154,7 @@ cycle_op_count = hypre_ParAMGDataCycleOpCount(amg_data); - lev_counter = hypre_CTAlloc(HYPRE_Int, num_levels, HYPRE_MEMORY_HOST); + lev_counter = hypre_CTAlloc(HYPRE_Int, num_levels, HYPRE_MEMORY_HOST); if (hypre_ParAMGDataParticipate(amg_data)) seq_cg = 1; @@ -177,18 +167,22 @@ num_coeffs = hypre_CTAlloc(HYPRE_Real, num_levels, HYPRE_MEMORY_HOST); num_coeffs[0] = hypre_ParCSRMatrixDNumNonzeros(A_array[0]); comm = hypre_ParCSRMatrixComm(A_array[0]); - hypre_MPI_Comm_rank(comm,&my_id); + hypre_MPI_Comm_rank(comm, &my_id); if (block_mode) { for (j = 1; j < num_levels; j++) + { num_coeffs[j] = hypre_ParCSRBlockMatrixNumNonzeros(A_block_array[j]); + } } else { - for (j = 1; j < num_levels; j++) + for (j = 1; j < num_levels; j++) + { num_coeffs[j] = hypre_ParCSRMatrixDNumNonzeros(A_array[j]); + } } /*--------------------------------------------------------------------- @@ -214,8 +208,17 @@ lev_counter[0] = 1; for (k = 1; k < num_levels; ++k) { - lev_counter[k] = cycle_type; + if (fcycle) + { + lev_counter[k] = 1; + + } + else + { + lev_counter[k] = cycle_type; + } } + fcycle_lev = num_levels - 2; level = 0; cycle_param = 1; @@ -230,7 +233,7 @@ { HYPRE_Int actual_local_size = hypre_ParVectorActualLocalSize(Vtemp); Utemp = hypre_ParVectorCreate(comm,hypre_ParVectorGlobalSize(Vtemp), - hypre_ParVectorPartitioning(Vtemp)); + hypre_ParVectorPartitioning(Vtemp)); hypre_ParVectorOwnsPartitioning(Utemp) = 0; local_size = hypre_VectorSize(hypre_ParVectorLocalVector(Vtemp)); @@ -241,7 +244,9 @@ hypre_ParVectorActualLocalSize(Utemp) = actual_local_size; } else + { hypre_ParVectorInitialize(Utemp); + } } } @@ -258,66 +263,73 @@ { if (num_levels > 1) { - local_size - = hypre_VectorSize(hypre_ParVectorLocalVector(F_array[level])); - hypre_VectorSize(hypre_ParVectorLocalVector(Vtemp)) = local_size; - if (smooth_num_levels <= level) - { - cg_num_sweep = 1; - num_sweep = num_grid_sweeps[cycle_param]; - Aux_U = U_array[level]; - Aux_F = F_array[level]; - } - else if (smooth_type > 9) - { - hypre_VectorSize(hypre_ParVectorLocalVector(Ztemp)) = local_size; - hypre_VectorSize(hypre_ParVectorLocalVector(Rtemp)) = local_size; - hypre_VectorSize(hypre_ParVectorLocalVector(Ptemp)) = local_size; - Ztemp_data = hypre_VectorData(hypre_ParVectorLocalVector(Ztemp)); - Ptemp_data = hypre_VectorData(hypre_ParVectorLocalVector(Ptemp)); - hypre_ParVectorSetConstantValues(Ztemp,0); - alpha = -1.0; - beta = 1.0; - //printf("par_cycle.c 1 %d\n",level); - hypre_ParCSRMatrixMatvecOutOfPlace(alpha, A_array[level], - U_array[level], beta, F_array[level], Rtemp); - //printf("par_cycle.c 1 Done\n"); - cg_num_sweep = hypre_ParAMGDataSmoothNumSweeps(amg_data); - num_sweep = num_grid_sweeps[cycle_param]; - Aux_U = Ztemp; - Aux_F = Rtemp; - } - else - { - cg_num_sweep = 1; - num_sweep = hypre_ParAMGDataSmoothNumSweeps(amg_data); - Aux_U = U_array[level]; - Aux_F = F_array[level]; - } - relax_type = grid_relax_type[cycle_param]; + local_size = hypre_VectorSize(hypre_ParVectorLocalVector(F_array[level])); + hypre_VectorSize(hypre_ParVectorLocalVector(Vtemp)) = local_size; + + if (smooth_num_levels <= level) + { + cg_num_sweep = 1; + num_sweep = num_grid_sweeps[cycle_param]; + Aux_U = U_array[level]; + Aux_F = F_array[level]; + } + else if (smooth_type > 9) + { + hypre_VectorSize(hypre_ParVectorLocalVector(Ztemp)) = local_size; + hypre_VectorSize(hypre_ParVectorLocalVector(Rtemp)) = local_size; + hypre_VectorSize(hypre_ParVectorLocalVector(Ptemp)) = local_size; + Ztemp_data = hypre_VectorData(hypre_ParVectorLocalVector(Ztemp)); + Ptemp_data = hypre_VectorData(hypre_ParVectorLocalVector(Ptemp)); + hypre_ParVectorSetConstantValues(Ztemp,0); + alpha = -1.0; + beta = 1.0; + + hypre_ParCSRMatrixMatvecOutOfPlace(alpha, A_array[level], + U_array[level], beta, F_array[level], Rtemp); + + cg_num_sweep = hypre_ParAMGDataSmoothNumSweeps(amg_data); + num_sweep = num_grid_sweeps[cycle_param]; + Aux_U = Ztemp; + Aux_F = Rtemp; + } + else + { + cg_num_sweep = 1; + num_sweep = hypre_ParAMGDataSmoothNumSweeps(amg_data); + Aux_U = U_array[level]; + Aux_F = F_array[level]; + } + relax_type = grid_relax_type[cycle_param]; } else /* AB: 4/08: removed the max_levels > 1 check - should do this when max-levels = 1 also */ { - /* If no coarsening occurred, apply a simple smoother once */ - Aux_U = U_array[level]; - Aux_F = F_array[level]; - num_sweep = 1; - /* TK: Use the user relax type (instead of 0) to allow for setting a + /* If no coarsening occurred, apply a simple smoother once */ + Aux_U = U_array[level]; + Aux_F = F_array[level]; + num_sweep = 1; + /* TK: Use the user relax type (instead of 0) to allow for setting a convergent smoother (e.g. in the solution of singular problems). */ - relax_type = hypre_ParAMGDataUserRelaxType(amg_data); - if (relax_type == -1) relax_type = 6; + relax_type = hypre_ParAMGDataUserRelaxType(amg_data); + if (relax_type == -1) + { + relax_type = 6; + } } if (l1_norms != NULL) + { l1_norms_level = l1_norms[level]; + } else + { l1_norms_level = NULL; + } if (cycle_param == 3 && seq_cg) { hypre_seqAMGCycle(amg_data, level, F_array, U_array); } -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU else if (cycle_param == 3 && hypre_ParAMGDataDSLUSolver(amg_data) != NULL) { hypre_SLUDistSolve(hypre_ParAMGDataDSLUSolver(amg_data), Aux_F, Aux_U); @@ -325,126 +337,135 @@ #endif else { - - /*------------------------------------------------------------------ + /*------------------------------------------------------------------ * Do the relaxation num_sweep times *-----------------------------------------------------------------*/ for (jj = 0; jj < cg_num_sweep; jj++) { if (smooth_num_levels > level && smooth_type > 9) - hypre_ParVectorSetConstantValues(Aux_U,0); + { + hypre_ParVectorSetConstantValues(Aux_U, 0); + } + + for (j = 0; j < num_sweep; j++) + { + if (num_levels == 1 && max_levels > 1) + { + relax_points = 0; + relax_local = 0; + } + else + { + if (old_version) + { + relax_points = grid_relax_points[cycle_param][j]; + } + relax_local = relax_order; + } + + /*----------------------------------------------- + * VERY sloppy approximation to cycle complexity + *-----------------------------------------------*/ + if (old_version && level < num_levels -1) + { + switch (relax_points) + { + case 1: + cycle_op_count += num_coeffs[level+1]; + break; + + case -1: + cycle_op_count += (num_coeffs[level]-num_coeffs[level+1]); + break; + } + } + else + { + cycle_op_count += num_coeffs[level]; + } - for (j = 0; j < num_sweep; j++) - { - if (num_levels == 1 && max_levels > 1) - { - relax_points = 0; - relax_local = 0; - } - else - { - if (old_version) - relax_points = grid_relax_points[cycle_param][j]; - relax_local = relax_order; - } - - /*----------------------------------------------- - * VERY sloppy approximation to cycle complexity - *-----------------------------------------------*/ - if (old_version && level < num_levels -1) - { - switch (relax_points) - { - case 1: - cycle_op_count += num_coeffs[level+1]; - break; - - case -1: - cycle_op_count += (num_coeffs[level]-num_coeffs[level+1]); - break; - } - } - else - { - cycle_op_count += num_coeffs[level]; - } - /*----------------------------------------------- + /*----------------------------------------------- Choose Smoother -----------------------------------------------*/ - - if (smooth_num_levels > level && - (smooth_type == 7 || smooth_type == 8 || - smooth_type == 9 || smooth_type == 19 || - smooth_type == 17 || smooth_type == 18)) - { - hypre_VectorSize(hypre_ParVectorLocalVector(Utemp)) = local_size; - alpha = -1.0; - beta = 1.0; - //printf("par_cycle.c 2 %d\n",level); - hypre_ParCSRMatrixMatvecOutOfPlace(alpha, A_array[level], - U_array[level], beta, Aux_F, Vtemp); - if (smooth_type == 8 || smooth_type == 18) - HYPRE_ParCSRParaSailsSolve(smoother[level], - (HYPRE_ParCSRMatrix) A_array[level], - (HYPRE_ParVector) Vtemp, - (HYPRE_ParVector) Utemp); - else if (smooth_type == 7 || smooth_type == 17) - HYPRE_ParCSRPilutSolve(smoother[level], - (HYPRE_ParCSRMatrix) A_array[level], - (HYPRE_ParVector) Vtemp, - (HYPRE_ParVector) Utemp); - else if (smooth_type == 9 || smooth_type == 19) - HYPRE_EuclidSolve(smoother[level], - (HYPRE_ParCSRMatrix) A_array[level], - (HYPRE_ParVector) Vtemp, - (HYPRE_ParVector) Utemp); - hypre_ParVectorAxpy(relax_weight[level],Utemp,Aux_U); - } - else if (smooth_num_levels > level && - (smooth_type == 6 || smooth_type == 16)) - { - HYPRE_SchwarzSolve(smoother[level], - (HYPRE_ParCSRMatrix) A_array[level], - (HYPRE_ParVector) Aux_F, - (HYPRE_ParVector) Aux_U); - } - /*else if (relax_type == 99)*/ - else if (relax_type == 9 || relax_type == 99) - { /* Gaussian elimination */ - hypre_GaussElimSolve(amg_data, level, relax_type); - } - else if (relax_type == 18) - { /* L1 - Jacobi*/ - if (relax_order == 1 && cycle_param < 3) - { - /* need to do CF - so can't use the AMS one */ - HYPRE_Int i; - HYPRE_Int loc_relax_points[2]; - if (cycle_type < 2) - { - loc_relax_points[0] = 1; - loc_relax_points[1] = -1; - } - else - { - loc_relax_points[0] = -1; - loc_relax_points[1] = 1; - } - for (i=0; i < 2; i++) - hypre_ParCSRRelax_L1_Jacobi(A_array[level], - Aux_F, - CF_marker_array[level], - loc_relax_points[i], - relax_weight[level], - l1_norms[level], - Aux_U, - Vtemp); - } - else /* not CF - so use through AMS */ - { -#if defined(HYPRE_USING_GPU)|| defined(HYPRE_USING_OPENMP_OFFLOAD) || defined(HYPRE_USING_MAPPED_OPENMP_OFFLOAD) - //printf("par_cycle.c 3 %d\n",level); - hypre_ParCSRRelax(A_array[level], + if (smooth_num_levels > level && + (smooth_type == 7 || smooth_type == 8 || + smooth_type == 9 || smooth_type == 19 || + smooth_type == 17 || smooth_type == 18)) + { + hypre_VectorSize(hypre_ParVectorLocalVector(Utemp)) = local_size; + alpha = -1.0; + beta = 1.0; + //printf("par_cycle.c 2 %d\n",level); + hypre_ParCSRMatrixMatvecOutOfPlace(alpha, A_array[level], + U_array[level], beta, Aux_F, Vtemp); + if (smooth_type == 8 || smooth_type == 18) + { + HYPRE_ParCSRParaSailsSolve(smoother[level], + (HYPRE_ParCSRMatrix) A_array[level], + (HYPRE_ParVector) Vtemp, + (HYPRE_ParVector) Utemp); + } + else if (smooth_type == 7 || smooth_type == 17) + { + HYPRE_ParCSRPilutSolve(smoother[level], + (HYPRE_ParCSRMatrix) A_array[level], + (HYPRE_ParVector) Vtemp, + (HYPRE_ParVector) Utemp); + } + else if (smooth_type == 9 || smooth_type == 19) + { + HYPRE_EuclidSolve(smoother[level], + (HYPRE_ParCSRMatrix) A_array[level], + (HYPRE_ParVector) Vtemp, + (HYPRE_ParVector) Utemp); + } + hypre_ParVectorAxpy(relax_weight[level],Utemp,Aux_U); + } + else if (smooth_num_levels > level && + (smooth_type == 6 || smooth_type == 16)) + { + HYPRE_SchwarzSolve(smoother[level], + (HYPRE_ParCSRMatrix) A_array[level], + (HYPRE_ParVector) Aux_F, + (HYPRE_ParVector) Aux_U); + } + else if (relax_type == 9 || relax_type == 99 || relax_type == 199) + { /* Gaussian elimination */ + hypre_GaussElimSolve(amg_data, level, relax_type); + } + else if (relax_type == 18) + { /* L1 - Jacobi*/ + if (relax_order == 1 && cycle_param < 3) + { + /* need to do CF - so can't use the AMS one */ + HYPRE_Int i; + HYPRE_Int loc_relax_points[2]; + if (cycle_type < 2) + { + loc_relax_points[0] = 1; + loc_relax_points[1] = -1; + } + else + { + loc_relax_points[0] = -1; + loc_relax_points[1] = 1; + } + for (i=0; i < 2; i++) + { + hypre_ParCSRRelax_L1_Jacobi(A_array[level], + Aux_F, + CF_marker_array[level], + loc_relax_points[i], + relax_weight[level], + l1_norms[level], + Aux_U, + Vtemp); + } + } + else /* not CF - so use through AMS */ + { +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + hypre_ParCSRRelax(A_array[level], Aux_F, 1, 1, @@ -454,84 +475,96 @@ Aux_U, Vtemp, Ztemp); - //printf("par_cycle.c 3 done %d\n",level); #else - if (num_threads == 1) - hypre_ParCSRRelax(A_array[level], - Aux_F, - 1, - 1, - l1_norms_level, - relax_weight[level], - omega[level],0,0,0,0, - Aux_U, - Vtemp, - Ztemp); - - else - hypre_ParCSRRelaxThreads(A_array[level], - Aux_F, - 1, - 1, - l1_norms_level, - relax_weight[level], - omega[level], - Aux_U, - Vtemp, - Ztemp); + if ( hypre_NumThreads() == 1 ) + { + hypre_ParCSRRelax(A_array[level], + Aux_F, + 1, + 1, + l1_norms_level, + relax_weight[level], + omega[level],0,0,0,0, + Aux_U, + Vtemp, + Ztemp); + } + else + { + hypre_ParCSRRelaxThreads(A_array[level], + Aux_F, + 1, + 1, + l1_norms_level, + relax_weight[level], + omega[level], + Aux_U, + Vtemp, + Ztemp); + } #endif - } - } - else if (relax_type == 15) - { /* CG */ - if (j ==0) /* do num sweep iterations of CG */ - hypre_ParCSRRelax_CG( smoother[level], - A_array[level], - Aux_F, - Aux_U, - num_sweep); - } - else if (relax_type == 16) - { /* scaled Chebyshev */ - HYPRE_Int scale = hypre_ParAMGDataChebyScale(amg_data); - HYPRE_Int variant = hypre_ParAMGDataChebyVariant(amg_data); - hypre_ParCSRRelax_Cheby_Solve(A_array[level], Aux_F, - ds[level], coefs[level], - cheby_order, scale, - variant, Aux_U, Vtemp, Ztemp ); - } - else if (relax_type ==17) - { - hypre_BoomerAMGRelax_FCFJacobi(A_array[level], - Aux_F, - CF_marker_array[level], - relax_weight[level], - Aux_U, - Vtemp); - } - else if (old_version) - { - /* - printf("cycle %d: relax_type %d, relax_points %d\n", - cycle_param, relax_type, relax_points); - */ - Solve_err_flag = hypre_BoomerAMGRelax(A_array[level], - Aux_F, - CF_marker_array[level], - relax_type, - relax_points, - relax_weight[level], - omega[level], - l1_norms_level, - Aux_U, - Vtemp, - Ztemp); - } - else - { - /* smoother than can have CF ordering */ - if (block_mode) - { + } + } + else if (relax_type == 15) + { /* CG */ + if (j ==0) /* do num sweep iterations of CG */ + { + hypre_ParCSRRelax_CG( smoother[level], + A_array[level], + Aux_F, + Aux_U, + num_sweep); + } + } + else if (relax_type == 16) + { /* scaled Chebyshev */ + HYPRE_Int scale = hypre_ParAMGDataChebyScale(amg_data); + HYPRE_Int variant = hypre_ParAMGDataChebyVariant(amg_data); + hypre_ParCSRRelax_Cheby_Solve(A_array[level], Aux_F, + ds[level], coefs[level], + cheby_order, scale, + variant, Aux_U, Vtemp, Ztemp ); + } + else if (relax_type == 17) + { + //printf("Proc %d: level %d, n %d, CF %p\n", my_id, level, local_size, CF_marker_array[level]); + if (level == num_levels - 1) + { + /* if we are on the coarsest level ,the cf_marker will be null + and we just do one sweep regular jacobi */ + hypre_assert(cycle_param == 3); + hypre_BoomerAMGRelax(A_array[level], Aux_F, CF_marker_array[level], 0, 0, relax_weight[level], + 0.0, NULL, Aux_U, Vtemp, NULL); + } + else + { + hypre_BoomerAMGRelax_FCFJacobi(A_array[level], Aux_F, CF_marker_array[level], relax_weight[level], + Aux_U, Vtemp); + } + } + else if (old_version) + { + /* + printf("cycle %d: relax_type %d, relax_points %d\n", + cycle_param, relax_type, relax_points); + */ + Solve_err_flag = hypre_BoomerAMGRelax(A_array[level], + Aux_F, + CF_marker_array[level], + relax_type, + relax_points, + relax_weight[level], + omega[level], + l1_norms_level, + Aux_U, + Vtemp, + Ztemp); + } + else + { + /* smoother than can have CF ordering */ + if (block_mode) + { Solve_err_flag = hypre_BoomerAMGBlockRelaxIF(A_block_array[level], Aux_F, CF_marker_array[level], @@ -542,46 +575,52 @@ omega[level], Aux_U, Vtemp); - } - else - { - Solve_err_flag = hypre_BoomerAMGRelaxIF(A_array[level], - Aux_F, - CF_marker_array[level], - relax_type, - relax_local, - cycle_param, - relax_weight[level], - omega[level], - l1_norms_level, - Aux_U, - Vtemp, - Ztemp); - } - } - - if (Solve_err_flag != 0) - return(Solve_err_flag); - } - if (smooth_num_levels > level && smooth_type > 9) - { - gammaold = gamma; - gamma = hypre_ParVectorInnerProd(Rtemp,Ztemp); - if (jj == 0) - hypre_ParVectorCopy(Ztemp,Ptemp); - else - { - beta = gamma/gammaold; - for (i=0; i < local_size; i++) - Ptemp_data[i] = Ztemp_data[i] + beta*Ptemp_data[i]; - } - - hypre_ParCSRMatrixMatvec(1.0,A_array[level],Ptemp,0.0,Vtemp); - alfa = gamma /hypre_ParVectorInnerProd(Ptemp,Vtemp); - hypre_ParVectorAxpy(alfa,Ptemp,U_array[level]); - hypre_ParVectorAxpy(-alfa,Vtemp,Rtemp); - } - } + } + else + { + Solve_err_flag = hypre_BoomerAMGRelaxIF(A_array[level], + Aux_F, + CF_marker_array[level], + relax_type, + relax_local, + cycle_param, + relax_weight[level], + omega[level], + l1_norms_level, + Aux_U, + Vtemp, + Ztemp); + } + } + + if (Solve_err_flag != 0) + { + return(Solve_err_flag); + } + } + if (smooth_num_levels > level && smooth_type > 9) + { + gammaold = gamma; + gamma = hypre_ParVectorInnerProd(Rtemp,Ztemp); + if (jj == 0) + { + hypre_ParVectorCopy(Ztemp,Ptemp); + } + else + { + beta = gamma/gammaold; + for (i=0; i < local_size; i++) + { + Ptemp_data[i] = Ztemp_data[i] + beta*Ptemp_data[i]; + } + } + + hypre_ParCSRMatrixMatvec(1.0,A_array[level],Ptemp,0.0,Vtemp); + alfa = gamma /hypre_ParVectorInnerProd(Ptemp,Vtemp); + hypre_ParVectorAxpy(alfa,Ptemp,U_array[level]); + hypre_ParVectorAxpy(-alfa,Vtemp,Rtemp); + } + } } /*------------------------------------------------------------------ @@ -590,9 +629,9 @@ --lev_counter[level]; + //if ( level != num_levels-1 && lev_counter[level] >= 0 ) if (lev_counter[level] >= 0 && level != num_levels-1) { - /*--------------------------------------------------------------- * Visit coarser level next. * Compute residual using hypre_ParCSRMatrixMatvec. @@ -617,11 +656,8 @@ else { // JSP: avoid unnecessary copy using out-of-place version of SpMV - //printf("par_cycle.c 4 %d\n",level); hypre_ParCSRMatrixMatvecOutOfPlace(alpha, A_array[fine_grid], U_array[fine_grid], beta, F_array[fine_grid], Vtemp); - //printf("par_cycle.c 4 done %d\n",level); - //SyncVectorToHost(hypre_ParVectorLocalVector(Vtemp)); } alpha = 1.0; @@ -630,7 +666,7 @@ if (block_mode) { hypre_ParCSRBlockMatrixMatvecT(alpha,R_block_array[fine_grid],Vtemp, - beta,F_array[coarse_grid]); + beta,F_array[coarse_grid]); } else { @@ -642,27 +678,22 @@ } else { - //SyncVectorToHost(hypre_ParVectorLocalVector(Vtemp)); - //SyncVectorToHost(hypre_ParVectorLocalVector(F_array[coarse_grid])); - //printf("par_cycle.c 5 %d\n",level,PrintPointerAttributes( hypre_ParCSRMatrixDiag(R_array[fine_grid])->data)); - hypre_ParCSRMatrixMatvecT(alpha,R_array[fine_grid],Vtemp, - beta,F_array[coarse_grid]); - //printf("par_cycle.c 5 Done %d\n",level); - //UpdateDRC(hypre_ParVectorLocalVector(F_array[coarse_grid])); - //SyncVectorToHost(hypre_ParVectorLocalVector(F_array[coarse_grid])); + hypre_ParCSRMatrixMatvecT(alpha, R_array[fine_grid],Vtemp, + beta, F_array[coarse_grid]); } } ++level; - lev_counter[level] = hypre_max(lev_counter[level],cycle_type); + lev_counter[level] = hypre_max(lev_counter[level], cycle_type); cycle_param = 1; - if (level == num_levels-1) cycle_param = 3; - + if (level == num_levels-1) + { + cycle_param = 3; + } #ifdef HYPRE_USING_CALIPER cali_set_int(iter_attr, level); /* set the level for caliper here */ #endif } - else if (level != 0) { /*--------------------------------------------------------------- @@ -670,7 +701,6 @@ * Interpolate and add correction using hypre_ParCSRMatrixMatvec. * Reset counters and cycling parameters for finer level. *--------------------------------------------------------------*/ - fine_grid = level - 1; coarse_grid = level; alpha = 1.0; @@ -678,19 +708,26 @@ if (block_mode) { hypre_ParCSRBlockMatrixMatvec(alpha, P_block_array[fine_grid], - U_array[coarse_grid], - beta, U_array[fine_grid]); + U_array[coarse_grid], + beta, U_array[fine_grid]); } else { - //printf("par_cycle.c 6 %d\n",level); + /* printf("Proc %d: level %d, n %d, Interpolation\n", my_id, level, local_size); */ hypre_ParCSRMatrixMatvec(alpha, P_array[fine_grid], U_array[coarse_grid], beta, U_array[fine_grid]); - //printf("par_cycle.c 6 done %d\n",level); + /* printf("Proc %d: level %d, n %d, Interpolation done\n", my_id, level, local_size); */ } --level; + + if (fcycle && fcycle_lev == level) + { + lev_counter[level] = hypre_max(lev_counter[level], 1); + fcycle_lev --; + } + cycle_param = 2; #ifdef HYPRE_USING_CALIPER @@ -701,7 +738,7 @@ { Not_Finished = 0; } - } + } /* main loop: while (Not_Finished) */ #ifdef HYPRE_USING_CALIPER cali_end(iter_attr); /* unset "iter" */ @@ -711,12 +748,16 @@ hypre_TFree(lev_counter, HYPRE_MEMORY_HOST); hypre_TFree(num_coeffs, HYPRE_MEMORY_HOST); + if (smooth_num_levels > 0) { - if (smooth_type == 7 || smooth_type == 8 || smooth_type == 9 || - smooth_type == 17 || smooth_type == 18 || smooth_type == 19 ) - hypre_ParVectorDestroy(Utemp); + if (smooth_type == 7 || smooth_type == 8 || smooth_type == 9 || + smooth_type == 17 || smooth_type == 18 || smooth_type == 19 ) + { + hypre_ParVectorDestroy(Utemp); + } } - //printf("HYPRE_BoomerAMGCycle END\n"); + return(Solve_err_flag); } + diff -Nru hypre-2.16.0/src/parcsr_ls/par_difconv.c hypre-2.18.2/src/parcsr_ls/par_difconv.c --- hypre-2.16.0/src/parcsr_ls/par_difconv.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_difconv.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,19 +1,10 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ - - #include "_hypre_parcsr_ls.h" /*-------------------------------------------------------------------------- diff -Nru hypre-2.16.0/src/parcsr_ls/par_gauss_elim.c hypre-2.18.2/src/parcsr_ls/par_gauss_elim.c --- hypre-2.16.0/src/parcsr_ls/par_gauss_elim.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_gauss_elim.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,420 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#include "_hypre_parcsr_ls.h" +#include "Common.h" +#include "_hypre_blas.h" +#include "_hypre_lapack.h" +#include "../sstruct_ls/gselim.h" + +/*------------------------------------------------------------------------- + * + * Gaussian Elimination + * + *------------------------------------------------------------------------ */ + +HYPRE_Int hypre_GaussElimSetup (hypre_ParAMGData *amg_data, HYPRE_Int level, HYPRE_Int relax_type) +{ +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_GS_ELIM_SETUP] -= hypre_MPI_Wtime(); +#endif + + /* Par Data Structure variables */ + hypre_ParCSRMatrix *A = hypre_ParAMGDataAArray(amg_data)[level]; + hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + + HYPRE_Int num_rows = hypre_CSRMatrixNumRows(A_diag); + HYPRE_Int global_num_rows = (HYPRE_Int) hypre_ParCSRMatrixGlobalNumRows(A); + MPI_Comm comm = hypre_ParCSRMatrixComm(A); + MPI_Comm new_comm; + + HYPRE_Int memory_location = hypre_GetActualMemLocation(hypre_CSRMatrixMemoryLocation(A_diag)); + + hypre_CSRMatrix *A_diag_host, *A_offd_host; + if (memory_location != HYPRE_MEMORY_HOST) + { + A_diag_host = hypre_CSRMatrixClone_v2(A_diag, 1, HYPRE_MEMORY_HOST); + A_offd_host = hypre_CSRMatrixClone_v2(A_offd, 1, HYPRE_MEMORY_HOST); + } + else + { + A_diag_host = A_diag; + A_offd_host = A_offd; + } + + /* Generate sub communicator: processes that have nonzero num_rows */ + hypre_GenerateSubComm(comm, num_rows, &new_comm); + + if (num_rows) + { + HYPRE_BigInt *col_map_offd = hypre_ParCSRMatrixColMapOffd(A); + HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag_host); + HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd_host); + HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag_host); + HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd_host); + HYPRE_Real *A_diag_data = hypre_CSRMatrixData(A_diag_host); + HYPRE_Real *A_offd_data = hypre_CSRMatrixData(A_offd_host); + + HYPRE_Real *A_mat, *A_mat_local; + HYPRE_Int *comm_info, *info, *displs; + HYPRE_Int *mat_info, *mat_displs; + HYPRE_Int new_num_procs, A_mat_local_size, i, jj, column; + HYPRE_BigInt first_row_index = hypre_ParCSRMatrixFirstRowIndex(A); + + hypre_MPI_Comm_size(new_comm, &new_num_procs); + + comm_info = hypre_CTAlloc(HYPRE_Int, 2*new_num_procs+1, HYPRE_MEMORY_HOST); + mat_info = hypre_CTAlloc(HYPRE_Int, new_num_procs, HYPRE_MEMORY_HOST); + mat_displs = hypre_CTAlloc(HYPRE_Int, new_num_procs+1, HYPRE_MEMORY_HOST); + info = &comm_info[0]; + displs = &comm_info[new_num_procs]; + + hypre_MPI_Allgather(&num_rows, 1, HYPRE_MPI_INT, info, 1, HYPRE_MPI_INT, new_comm); + + displs[0] = 0; + mat_displs[0] = 0; + for (i = 0; i < new_num_procs; i++) + { + displs[i+1] = displs[i] + info[i]; + mat_displs[i+1] = global_num_rows * displs[i+1]; + mat_info[i] = global_num_rows * info[i]; + } + + hypre_ParAMGDataBVec(amg_data) = hypre_CTAlloc(HYPRE_Real, global_num_rows, HYPRE_MEMORY_HOST); + + A_mat_local_size = global_num_rows * num_rows; + A_mat_local = hypre_CTAlloc(HYPRE_Real, A_mat_local_size, HYPRE_MEMORY_HOST); + A_mat = hypre_CTAlloc(HYPRE_Real, global_num_rows*global_num_rows, HYPRE_MEMORY_HOST); + + /* load local matrix into A_mat_local */ + for (i = 0; i < num_rows; i++) + { + for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + { + /* need col major */ + column = A_diag_j[jj]+first_row_index; + A_mat_local[i*global_num_rows + column] = A_diag_data[jj]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + /* need col major */ + column = col_map_offd[A_offd_j[jj]]; + A_mat_local[i*global_num_rows + column] = A_offd_data[jj]; + } + } + + hypre_MPI_Allgatherv(A_mat_local, A_mat_local_size, HYPRE_MPI_REAL, A_mat, mat_info, + mat_displs, HYPRE_MPI_REAL, new_comm); + + if (relax_type == 99) + { + HYPRE_Real *AT_mat = hypre_CTAlloc(HYPRE_Real, global_num_rows*global_num_rows, HYPRE_MEMORY_HOST); + for (i = 0; i < global_num_rows; i++) + { + for (jj = 0; jj < global_num_rows; jj++) + { + AT_mat[i*global_num_rows + jj] = A_mat[i + jj*global_num_rows]; + } + } + hypre_ParAMGDataAMat(amg_data) = AT_mat; + hypre_TFree(A_mat, HYPRE_MEMORY_HOST); + } + else if (relax_type == 9) + { + hypre_ParAMGDataAMat(amg_data) = A_mat; + } + else if (relax_type == 199) + { + HYPRE_Real *AT_mat = hypre_TAlloc(HYPRE_Real, global_num_rows*global_num_rows, HYPRE_MEMORY_HOST); + HYPRE_Real *Ainv = hypre_TAlloc(HYPRE_Real, num_rows*global_num_rows, HYPRE_MEMORY_HOST); + for (i = 0; i < global_num_rows; i++) + { + for (jj = 0; jj < global_num_rows; jj++) + { + AT_mat[i*global_num_rows + jj] = A_mat[i + jj*global_num_rows]; + } + } + HYPRE_Int *ipiv, info, query = -1, lwork; + HYPRE_Real lwork_opt, *work; + ipiv = hypre_TAlloc(HYPRE_Int, global_num_rows, HYPRE_MEMORY_HOST); + hypre_dgetrf(&global_num_rows, &global_num_rows, AT_mat, &global_num_rows, ipiv, &info); + hypre_assert(info == 0); + hypre_dgetri(&global_num_rows, AT_mat, &global_num_rows, ipiv, &lwork_opt, &query, &info); + hypre_assert(info == 0); + lwork = lwork_opt; + work = hypre_TAlloc(HYPRE_Real, lwork, HYPRE_MEMORY_HOST); + hypre_dgetri(&global_num_rows, AT_mat, &global_num_rows, ipiv, work, &lwork, &info); + hypre_assert(info == 0); + + for (i = 0; i < global_num_rows; i++) + { + for (jj = 0; jj < num_rows; jj++) + { + Ainv[i*num_rows+jj] = AT_mat[i*global_num_rows+jj+first_row_index]; + } + } + + hypre_TFree(ipiv, HYPRE_MEMORY_HOST); + hypre_TFree(A_mat, HYPRE_MEMORY_HOST); + hypre_TFree(AT_mat, HYPRE_MEMORY_HOST); + hypre_TFree(work, HYPRE_MEMORY_HOST); + + hypre_ParAMGDataAInv(amg_data) = Ainv; + } + + hypre_ParAMGDataCommInfo(amg_data) = comm_info; + hypre_ParAMGDataNewComm(amg_data) = new_comm; + + hypre_TFree(mat_info, HYPRE_MEMORY_HOST); + hypre_TFree(mat_displs, HYPRE_MEMORY_HOST); + hypre_TFree(A_mat_local, HYPRE_MEMORY_HOST); + + if (A_diag_host != A_diag) + { + hypre_CSRMatrixDestroy(A_diag_host); + } + + if (A_offd_host != A_offd) + { + hypre_CSRMatrixDestroy(A_offd_host); + } + } + + hypre_ParAMGDataGSSetup(amg_data) = 1; + +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_GS_ELIM_SETUP] += hypre_MPI_Wtime(); +#endif + + return hypre_error_flag; +} + + +HYPRE_Int hypre_GaussElimSolve (hypre_ParAMGData *amg_data, HYPRE_Int level, HYPRE_Int relax_type) +{ +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_GS_ELIM_SOLVE] -= hypre_MPI_Wtime(); +#endif + + hypre_ParCSRMatrix *A = hypre_ParAMGDataAArray(amg_data)[level]; + hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); + HYPRE_Int n = hypre_CSRMatrixNumRows(A_diag); + HYPRE_Int error_flag = 0; + + if (hypre_ParAMGDataGSSetup(amg_data) == 0) + { + hypre_GaussElimSetup(amg_data, level, relax_type); + } + + if (n) + { + MPI_Comm new_comm = hypre_ParAMGDataNewComm(amg_data); + hypre_ParVector *f = hypre_ParAMGDataFArray(amg_data)[level]; + hypre_ParVector *u = hypre_ParAMGDataUArray(amg_data)[level]; + HYPRE_Real *b_vec = hypre_ParAMGDataBVec(amg_data); + HYPRE_Real *f_data = hypre_VectorData(hypre_ParVectorLocalVector(f)); + HYPRE_Real *u_data = hypre_VectorData(hypre_ParVectorLocalVector(u)); + HYPRE_Int *comm_info = hypre_ParAMGDataCommInfo(amg_data); + HYPRE_Int *displs, *info; + HYPRE_Int n_global = (HYPRE_Int) hypre_ParCSRMatrixGlobalNumRows(A); + HYPRE_Int new_num_procs; + HYPRE_Int first_row_index = (HYPRE_Int) hypre_ParCSRMatrixFirstRowIndex(A); + HYPRE_Int one_i = 1; + + hypre_MPI_Comm_size(new_comm, &new_num_procs); + info = &comm_info[0]; + displs = &comm_info[new_num_procs]; + + HYPRE_Int memory_location = hypre_GetActualMemLocation(hypre_CSRMatrixMemoryLocation(A_diag)); + HYPRE_Real *f_data_host, *u_data_host; + + if (memory_location != HYPRE_MEMORY_HOST) + { + f_data_host = hypre_TAlloc(HYPRE_Real, n, HYPRE_MEMORY_HOST); + u_data_host = hypre_TAlloc(HYPRE_Real, n, HYPRE_MEMORY_HOST); + + hypre_TMemcpy(f_data_host, f_data, HYPRE_Real, n, HYPRE_MEMORY_HOST, memory_location); + } + else + { + f_data_host = f_data; + u_data_host = u_data; + } + + hypre_MPI_Allgatherv (f_data_host, n, HYPRE_MPI_REAL, b_vec, info, + displs, HYPRE_MPI_REAL, new_comm); + + if (f_data_host != f_data) + { + hypre_TFree(f_data_host, HYPRE_MEMORY_HOST); + } + + if (relax_type == 9 || relax_type == 19) + { + HYPRE_Real *A_mat = hypre_ParAMGDataAMat(amg_data); + HYPRE_Real *A_tmp; + HYPRE_Int i, my_info; + + A_tmp = hypre_CTAlloc(HYPRE_Real, n_global*n_global, HYPRE_MEMORY_HOST); + for (i = 0; i < n_global*n_global; i++) + { + A_tmp[i] = A_mat[i]; + } + + if (relax_type == 9) + { + hypre_gselim(A_tmp, b_vec, n_global, error_flag); + } + else if (relax_type == 99) /* use pivoting */ + { + HYPRE_Int *piv = hypre_CTAlloc(HYPRE_Int, n_global, HYPRE_MEMORY_HOST); + + /* write over A with LU */ + hypre_dgetrf(&n_global, &n_global, A_tmp, &n_global, piv, &my_info); + + /* now b_vec = inv(A)*b_vec */ + hypre_dgetrs("N", &n_global, &one_i, A_tmp, &n_global, piv, b_vec, &n_global, &my_info); + + hypre_TFree(piv, HYPRE_MEMORY_HOST); + } + + for (i = 0; i < n; i++) + { + u_data_host[i] = b_vec[first_row_index+i]; + } + + hypre_TFree(A_tmp, HYPRE_MEMORY_HOST); + } + else if (relax_type == 199) + { + HYPRE_Real *Ainv = hypre_ParAMGDataAInv(amg_data); + + char cN = 'N'; + HYPRE_Real one = 1.0, zero = 0.0; + hypre_dgemv(&cN, &n, &n_global, &one, Ainv, &n, b_vec, &one_i, &zero, u_data_host, &one_i); + } + + if (u_data_host != u_data) + { + hypre_TMemcpy(u_data, u_data_host, HYPRE_Real, n, memory_location, HYPRE_MEMORY_HOST); + hypre_TFree(u_data_host, HYPRE_MEMORY_HOST); + } + } + + if (error_flag) + { + hypre_error(HYPRE_ERROR_GENERIC); + } + +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_GS_ELIM_SOLVE] += hypre_MPI_Wtime(); +#endif + + return hypre_error_flag; +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#if 0 +#include "HYPRE_config.h" +#ifndef HYPRE_SEQUENTIAL +#define HYPRE_SEQUENTIAL +#endif +#include "_hypre_utilities.h" +#include "_hypre_blas.h" + +#if defined(HYPRE_USING_CUDA) + +#define BLOCK_SIZE 512 + +__global__ void +hypreCUDAKernel_dgemv(HYPRE_Int m, + HYPRE_Int n, + HYPRE_Int lda, + HYPRE_Real *a, + HYPRE_Real *x, + HYPRE_Real *y) +{ + __shared__ HYPRE_Real sh_x[BLOCK_SIZE]; + + HYPRE_Int row = hypre_cuda_get_grid_thread_id<1,1>(); + HYPRE_Int tid = hypre_cuda_get_thread_id<1>(); + + HYPRE_Real y_row = 0.0; + + for (HYPRE_Int k = 0; k < n; k += BLOCK_SIZE) + { + if (k + tid < n) + { + sh_x[tid] = read_only_load(&x[k+tid]); + } + + __syncthreads(); + + if (row < m) + { +#pragma unroll + for (HYPRE_Int j = 0; j < BLOCK_SIZE; j++) + { + const HYPRE_Int col = k + j; + if (col < n) + { + y_row += a[row + col*lda] * sh_x[j]; + } + } + } + + __syncthreads(); + } + + if (row < m) + { + y[row] = y_row; + } +} + +HYPRE_Int hypre_dgemv_device(HYPRE_Int m, HYPRE_Int n, HYPRE_Int lda, HYPRE_Real *a, HYPRE_Real *x, HYPRE_Real *y) +{ + dim3 bDim(BLOCK_SIZE, 1, 1); + dim3 gDim = hypre_GetDefaultCUDAGridDimension(m, "thread", bDim); + + HYPRE_CUDA_LAUNCH( hypreCUDAKernel_dgemv, gDim, bDim, m, n, lda, a, x, y ); + + return hypre_error_flag; +} + +#endif +#endif diff -Nru hypre-2.16.0/src/parcsr_ls/par_gsmg.c hypre-2.18.2/src/parcsr_ls/par_gsmg.c --- hypre-2.16.0/src/parcsr_ls/par_gsmg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_gsmg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -51,42 +46,6 @@ } /*-------------------------------------------------------------------------- - * hypre_ParCSRMatrixClone - *--------------------------------------------------------------------------*/ - -HYPRE_Int -hypre_ParCSRMatrixClone(hypre_ParCSRMatrix *A, hypre_ParCSRMatrix **Sp, - HYPRE_Int copy_data) -{ - MPI_Comm comm = hypre_ParCSRMatrixComm(A); - - hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); - HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); - hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); - HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); - - HYPRE_BigInt *row_starts = hypre_ParCSRMatrixRowStarts(A); - HYPRE_BigInt n = (HYPRE_BigInt) hypre_CSRMatrixNumRows(A_diag); - - HYPRE_Int num_cols_offd = hypre_CSRMatrixNumCols(A_offd); - HYPRE_Int num_nonzeros_diag = A_diag_i[n]; - HYPRE_Int num_nonzeros_offd = A_offd_i[n]; - - hypre_ParCSRMatrix *S; - - S = hypre_ParCSRMatrixCreate(comm, n, n, row_starts, row_starts, - num_cols_offd, num_nonzeros_diag, num_nonzeros_offd); - hypre_ParCSRMatrixSetRowStartsOwner(S,0); - hypre_ParCSRMatrixInitialize(S); /* allocate memory */ - - hypre_ParCSRMatrixCopy(A,S,copy_data); - - *Sp = S; - - return 0; -} - -/*-------------------------------------------------------------------------- * hypre_ParCSRMatrixFillSmooth * - fill in smooth matrix * - this function will scale the smooth vectors @@ -101,18 +60,18 @@ hypre_ParCSRCommHandle *comm_handle; hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); - HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); - HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); + HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); + HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); HYPRE_Real *S_diag_data = hypre_CSRMatrixData(S_diag); hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); - HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); - HYPRE_Int *S_offd_j = hypre_CSRMatrixJ(S_offd); + HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); + HYPRE_Int *S_offd_j = hypre_CSRMatrixJ(S_offd); HYPRE_Real *S_offd_data = hypre_CSRMatrixData(S_offd); hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); HYPRE_Real *A_diag_data = hypre_CSRMatrixData(A_diag); hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); HYPRE_Real *A_offd_data = hypre_CSRMatrixData(A_offd); - HYPRE_Int n = hypre_CSRMatrixNumRows(S_diag); + HYPRE_Int n = hypre_CSRMatrixNumRows(S_diag); HYPRE_Int i, j, k, ii, index, start; HYPRE_Int num_cols_offd; HYPRE_Int num_sends; @@ -295,11 +254,11 @@ hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); - HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); - HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); + HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); + HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); HYPRE_Real *S_diag_data = hypre_CSRMatrixData(S_diag); HYPRE_Real *S_offd_data = hypre_CSRMatrixData(S_offd); - HYPRE_Int n = hypre_CSRMatrixNumRows(S_diag); + HYPRE_Int n = hypre_CSRMatrixNumRows(S_diag); HYPRE_Int i, j; HYPRE_Real mx, minimax = 1.e+10; HYPRE_Real minmin; @@ -329,25 +288,25 @@ hypre_ParCSRMatrixThreshold(hypre_ParCSRMatrix *A, HYPRE_Real thresh) { hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); - HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); - HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); + HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); + HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); HYPRE_Real *A_diag_data = hypre_CSRMatrixData(A_diag); hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); - HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); - HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); + HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); + HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); HYPRE_Real *A_offd_data = hypre_CSRMatrixData(A_offd); - HYPRE_Int n = hypre_CSRMatrixNumRows(A_diag); + HYPRE_Int n = hypre_CSRMatrixNumRows(A_diag); - HYPRE_Int num_nonzeros_diag = A_diag_i[n]; - HYPRE_Int num_nonzeros_offd = A_offd_i[n]; + HYPRE_Int num_nonzeros_diag = A_diag_i[n]; + HYPRE_Int num_nonzeros_offd = A_offd_i[n]; - HYPRE_Int *S_diag_i; - HYPRE_Int *S_diag_j; + HYPRE_Int *S_diag_i; + HYPRE_Int *S_diag_j; HYPRE_Real *S_diag_data; - HYPRE_Int *S_offd_i; - HYPRE_Int *S_offd_j; + HYPRE_Int *S_offd_i; + HYPRE_Int *S_offd_j; HYPRE_Real *S_offd_data; HYPRE_Int count, i, jS, jA; @@ -443,8 +402,8 @@ HYPRE_Int hypre_BoomerAMGCreateSmoothVecs(void *data, hypre_ParCSRMatrix *A, - HYPRE_Int num_sweeps, - HYPRE_Int level, + HYPRE_Int num_sweeps, + HYPRE_Int level, HYPRE_Real **SmoothVecs_p) { hypre_ParAMGData *amg_data = (hypre_ParAMGData*) data; @@ -588,8 +547,8 @@ hypre_ParCSRMatrix *A, HYPRE_Real *SmoothVecs, HYPRE_Real thresh, - HYPRE_Int num_functions, - HYPRE_Int *dof_func, + HYPRE_Int num_functions, + HYPRE_Int *dof_func, hypre_ParCSRMatrix **S_ptr) { hypre_ParAMGData *amg_data = (hypre_ParAMGData*) data; @@ -597,7 +556,7 @@ HYPRE_Real minimax; HYPRE_Int debug_flag = hypre_ParAMGDataDebugFlag(amg_data); - hypre_ParCSRMatrixClone(A, &S, 0); + S = hypre_ParCSRMatrixClone(A, 0); /* Traverse S and fill in differences */ hypre_ParCSRMatrixFillSmooth( @@ -673,11 +632,11 @@ { HYPRE_Real *a, *b; HYPRE_Real *ap; - HYPRE_Int i, j; + HYPRE_Int i, j; HYPRE_Real *work; - HYPRE_Int work_size; - HYPRE_Int info; - HYPRE_Int temp; + HYPRE_Int work_size; + HYPRE_Int info; + HYPRE_Int temp; /* hypre_printf("Fit: row %d, n %d num %d, nc = %d ", ip, n, num, nc); @@ -738,17 +697,17 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_BoomerAMGBuildInterpLS( hypre_ParCSRMatrix *A, - HYPRE_Int *CF_marker, - hypre_ParCSRMatrix *S, +hypre_BoomerAMGBuildInterpLS( hypre_ParCSRMatrix *A, + HYPRE_Int *CF_marker, + hypre_ParCSRMatrix *S, HYPRE_BigInt *num_cpts_global, - HYPRE_Int num_functions, - HYPRE_Int *dof_func, - HYPRE_Int debug_flag, - HYPRE_Real trunc_factor, - HYPRE_Int num_smooth, - HYPRE_Real *SmoothVecs, - hypre_ParCSRMatrix **P_ptr) + HYPRE_Int num_functions, + HYPRE_Int *dof_func, + HYPRE_Int debug_flag, + HYPRE_Real trunc_factor, + HYPRE_Int num_smooth, + HYPRE_Real *SmoothVecs, + hypre_ParCSRMatrix **P_ptr) { MPI_Comm comm = hypre_ParCSRMatrixComm(S); @@ -757,23 +716,23 @@ hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); /* HYPRE_Real *S_diag_data = hypre_CSRMatrixData(S_diag); */ - HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); - HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); + HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); + HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); /* HYPRE_Real *S_offd_data = hypre_CSRMatrixData(S_offd); HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); HYPRE_Int *S_offd_j = hypre_CSRMatrixJ(S_offd); */ - HYPRE_Int num_cols_S_offd = hypre_CSRMatrixNumCols(S_offd); + HYPRE_Int num_cols_S_offd = hypre_CSRMatrixNumCols(S_offd); /* HYPRE_Int *col_map_offd = hypre_ParCSRMatrixColMapOffd(S); */ hypre_ParCSRMatrix *P; HYPRE_BigInt *col_map_offd_P; HYPRE_Int *tmp_map_offd; - HYPRE_Int *CF_marker_offd; - HYPRE_Int *dof_func_offd = NULL; + HYPRE_Int *CF_marker_offd; + HYPRE_Int *dof_func_offd = NULL; hypre_CSRMatrix *S_ext; @@ -781,52 +740,52 @@ //HYPRE_Int *S_ext_i; //HYPRE_BigInt *S_ext_j; - hypre_CSRMatrix *P_diag; - hypre_CSRMatrix *P_offd; + hypre_CSRMatrix *P_diag; + hypre_CSRMatrix *P_offd; HYPRE_Real *P_diag_data; - HYPRE_Int *P_diag_i; - HYPRE_Int *P_diag_j; + HYPRE_Int *P_diag_i; + HYPRE_Int *P_diag_j; HYPRE_Real *P_offd_data; - HYPRE_Int *P_offd_i; - HYPRE_Int *P_offd_j; + HYPRE_Int *P_offd_i; + HYPRE_Int *P_offd_j; HYPRE_Int P_diag_size; HYPRE_Int P_offd_size; - HYPRE_Int *P_marker; + HYPRE_Int *P_marker; /* HYPRE_Int *P_marker_offd; */ - HYPRE_Int jj_counter,jj_counter_offd; - HYPRE_Int *jj_count, *jj_count_offd; + HYPRE_Int jj_counter,jj_counter_offd; + HYPRE_Int *jj_count, *jj_count_offd; /* HYPRE_Int jj_begin_row,jj_begin_row_offd; HYPRE_Int jj_end_row,jj_end_row_offd; */ - HYPRE_Int start_indexing = 0; /* start indexing for P_data at 0 */ + HYPRE_Int start_indexing = 0; /* start indexing for P_data at 0 */ - HYPRE_Int n_fine = hypre_CSRMatrixNumRows(S_diag); + HYPRE_Int n_fine = hypre_CSRMatrixNumRows(S_diag); - HYPRE_Int *fine_to_coarse; + HYPRE_Int *fine_to_coarse; //HYPRE_BigInt *fine_to_coarse_offd; - HYPRE_Int *coarse_counter; - HYPRE_Int coarse_shift; + HYPRE_Int *coarse_counter; + HYPRE_Int coarse_shift; HYPRE_BigInt total_global_cpts; HYPRE_Int num_cols_P_offd; //HYPRE_BigInt my_first_cpt; - HYPRE_Int i,i1; - HYPRE_Int j,jl,jj; - HYPRE_Int start; + HYPRE_Int i,i1; + HYPRE_Int j,jl,jj; + HYPRE_Int start; HYPRE_Real one = 1.0; - HYPRE_Int my_id; - HYPRE_Int num_procs; - HYPRE_Int num_threads; - HYPRE_Int num_sends; - HYPRE_Int index; - HYPRE_Int ns, ne, size, rest; - HYPRE_Int *int_buf_data; + HYPRE_Int my_id; + HYPRE_Int num_procs; + HYPRE_Int num_threads; + HYPRE_Int num_sends; + HYPRE_Int index; + HYPRE_Int ns, ne, size, rest; + HYPRE_Int *int_buf_data; //HYPRE_BigInt *big_buf_data; HYPRE_Real wall_time; /* for debugging instrumentation */ @@ -843,9 +802,9 @@ if (debug_flag==4) wall_time = time_getWallclockSeconds(); - CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_S_offd, HYPRE_MEMORY_HOST); + CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_S_offd, HYPRE_MEMORY_HOST); if (num_functions > 1 && num_cols_S_offd) - dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_S_offd, HYPRE_MEMORY_HOST); + dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_S_offd, HYPRE_MEMORY_HOST); if (!comm_pkg) { @@ -854,7 +813,7 @@ } num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, + int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); index = 0; @@ -903,7 +862,6 @@ if (debug_flag==4) wall_time = time_getWallclockSeconds(); - if (num_procs > 1) { S_ext = hypre_ParCSRMatrixExtractBExt(S,S,1); @@ -911,7 +869,6 @@ //S_ext_j = hypre_CSRMatrixBigJ(S_ext); //S_ext_data = hypre_CSRMatrixData(S_ext); } - if (debug_flag==4) { @@ -1292,15 +1249,15 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_BoomerAMGBuildInterpGSMG( hypre_ParCSRMatrix *A, +hypre_BoomerAMGBuildInterpGSMG( hypre_ParCSRMatrix *A, HYPRE_Int *CF_marker, - hypre_ParCSRMatrix *S, + hypre_ParCSRMatrix *S, HYPRE_BigInt *num_cpts_global, HYPRE_Int num_functions, HYPRE_Int *dof_func, HYPRE_Int debug_flag, - HYPRE_Real trunc_factor, - hypre_ParCSRMatrix **P_ptr) + HYPRE_Real trunc_factor, + hypre_ParCSRMatrix **P_ptr) { MPI_Comm comm = hypre_ParCSRMatrixComm(S); @@ -1309,67 +1266,67 @@ hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); HYPRE_Real *S_diag_data = hypre_CSRMatrixData(S_diag); - HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); - HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); + HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); + HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); HYPRE_Real *S_offd_data = hypre_CSRMatrixData(S_offd); - HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); - HYPRE_Int *S_offd_j = hypre_CSRMatrixJ(S_offd); + HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); + HYPRE_Int *S_offd_j = hypre_CSRMatrixJ(S_offd); - HYPRE_Int num_cols_S_offd = hypre_CSRMatrixNumCols(S_offd); + HYPRE_Int num_cols_S_offd = hypre_CSRMatrixNumCols(S_offd); HYPRE_BigInt *col_map_offd = hypre_ParCSRMatrixColMapOffd(S); HYPRE_Int *tmp_map_offd = NULL; hypre_ParCSRMatrix *P; HYPRE_BigInt *col_map_offd_P; - HYPRE_Int *CF_marker_offd; - HYPRE_Int *dof_func_offd = NULL; + HYPRE_Int *CF_marker_offd; + HYPRE_Int *dof_func_offd = NULL; hypre_CSRMatrix *S_ext; HYPRE_Real *S_ext_data; - HYPRE_Int *S_ext_i; + HYPRE_Int *S_ext_i; HYPRE_BigInt *S_ext_j; - hypre_CSRMatrix *P_diag; - hypre_CSRMatrix *P_offd; + hypre_CSRMatrix *P_diag; + hypre_CSRMatrix *P_offd; HYPRE_Real *P_diag_data; - HYPRE_Int *P_diag_i; - HYPRE_Int *P_diag_j; + HYPRE_Int *P_diag_i; + HYPRE_Int *P_diag_j; HYPRE_Real *P_offd_data; - HYPRE_Int *P_offd_i; - HYPRE_Int *P_offd_j; + HYPRE_Int *P_offd_i; + HYPRE_Int *P_offd_j; + + HYPRE_Int P_diag_size, P_offd_size; + + HYPRE_Int *P_marker, *P_marker_offd; - HYPRE_Int P_diag_size, P_offd_size; - - HYPRE_Int *P_marker, *P_marker_offd; - - HYPRE_Int jj_counter,jj_counter_offd; - HYPRE_Int *jj_count, *jj_count_offd; - HYPRE_Int jj_begin_row,jj_begin_row_offd; - HYPRE_Int jj_end_row,jj_end_row_offd; + HYPRE_Int jj_counter,jj_counter_offd; + HYPRE_Int *jj_count, *jj_count_offd; + HYPRE_Int jj_begin_row,jj_begin_row_offd; + HYPRE_Int jj_end_row,jj_end_row_offd; - HYPRE_Int start_indexing = 0; /* start indexing for P_data at 0 */ + HYPRE_Int start_indexing = 0; /* start indexing for P_data at 0 */ - HYPRE_Int n_fine = hypre_CSRMatrixNumRows(S_diag); + HYPRE_Int n_fine = hypre_CSRMatrixNumRows(S_diag); - HYPRE_Int strong_f_marker; + HYPRE_Int strong_f_marker; - HYPRE_Int *fine_to_coarse; - HYPRE_Int *coarse_counter; + HYPRE_Int *fine_to_coarse; + HYPRE_Int *coarse_counter; //HYPRE_Int coarse_shift; HYPRE_BigInt total_global_cpts; HYPRE_Int num_cols_P_offd; //HYPRE_BigInt my_first_cpt; HYPRE_BigInt big_i2; - HYPRE_Int i,i1,i2; - HYPRE_Int j,jl,jj,jj1; - HYPRE_Int start; - HYPRE_Int c_num; + HYPRE_Int i,i1,i2; + HYPRE_Int j,jl,jj,jj1; + HYPRE_Int start; + HYPRE_Int c_num; HYPRE_Real sum; HYPRE_Real distribute; @@ -1377,13 +1334,13 @@ HYPRE_Real zero = 0.0; HYPRE_Real one = 1.0; - HYPRE_Int my_id; - HYPRE_Int num_procs; - HYPRE_Int num_threads; - HYPRE_Int num_sends; - HYPRE_Int index; - HYPRE_Int ns, ne, size, rest; - HYPRE_Int *int_buf_data; + HYPRE_Int my_id; + HYPRE_Int num_procs; + HYPRE_Int num_threads; + HYPRE_Int num_sends; + HYPRE_Int index; + HYPRE_Int ns, ne, size, rest; + HYPRE_Int *int_buf_data; HYPRE_BigInt col_1 = hypre_ParCSRMatrixFirstRowIndex(S); HYPRE_Int local_numrows = hypre_CSRMatrixNumRows(S_diag); @@ -1412,9 +1369,9 @@ if (debug_flag==4) wall_time = time_getWallclockSeconds(); - CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_S_offd, HYPRE_MEMORY_HOST); + CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_S_offd, HYPRE_MEMORY_HOST); if (num_functions > 1 && num_cols_S_offd) - dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_S_offd, HYPRE_MEMORY_HOST); + dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_S_offd, HYPRE_MEMORY_HOST); if (!comm_pkg) { @@ -1423,7 +1380,7 @@ } num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, + int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); index = 0; @@ -1494,11 +1451,11 @@ * Intialize counters and allocate mapping vector. *-----------------------------------------------------------------------*/ - coarse_counter = hypre_CTAlloc(HYPRE_Int, num_threads, HYPRE_MEMORY_HOST); - jj_count = hypre_CTAlloc(HYPRE_Int, num_threads, HYPRE_MEMORY_HOST); - jj_count_offd = hypre_CTAlloc(HYPRE_Int, num_threads, HYPRE_MEMORY_HOST); + coarse_counter = hypre_CTAlloc(HYPRE_Int, num_threads, HYPRE_MEMORY_HOST); + jj_count = hypre_CTAlloc(HYPRE_Int, num_threads, HYPRE_MEMORY_HOST); + jj_count_offd = hypre_CTAlloc(HYPRE_Int, num_threads, HYPRE_MEMORY_HOST); - fine_to_coarse = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_HOST); + fine_to_coarse = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_HOST); #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif @@ -1591,18 +1548,18 @@ P_diag_size = jj_counter; - P_diag_i = hypre_CTAlloc(HYPRE_Int, n_fine+1, HYPRE_MEMORY_HOST); - P_diag_j = hypre_CTAlloc(HYPRE_Int, P_diag_size, HYPRE_MEMORY_HOST); - P_diag_data = hypre_CTAlloc(HYPRE_Real, P_diag_size, HYPRE_MEMORY_HOST); + P_diag_i = hypre_CTAlloc(HYPRE_Int, n_fine+1, HYPRE_MEMORY_HOST); + P_diag_j = hypre_CTAlloc(HYPRE_Int, P_diag_size, HYPRE_MEMORY_HOST); + P_diag_data = hypre_CTAlloc(HYPRE_Real, P_diag_size, HYPRE_MEMORY_HOST); P_diag_i[n_fine] = jj_counter; P_offd_size = jj_counter_offd; - P_offd_i = hypre_CTAlloc(HYPRE_Int, n_fine+1, HYPRE_MEMORY_HOST); - P_offd_j = hypre_CTAlloc(HYPRE_Int, P_offd_size, HYPRE_MEMORY_HOST); - P_offd_data = hypre_CTAlloc(HYPRE_Real, P_offd_size, HYPRE_MEMORY_HOST); + P_offd_i = hypre_CTAlloc(HYPRE_Int, n_fine+1, HYPRE_MEMORY_HOST); + P_offd_j = hypre_CTAlloc(HYPRE_Int, P_offd_size, HYPRE_MEMORY_HOST); + P_offd_data = hypre_CTAlloc(HYPRE_Real, P_offd_size, HYPRE_MEMORY_HOST); /*----------------------------------------------------------------------- * Intialize some stuff. @@ -1651,8 +1608,8 @@ jj_counter_offd = 0; if (jl > 0) jj_counter_offd = jj_count_offd[jl-1]; - P_marker = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_HOST); - P_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_S_offd, HYPRE_MEMORY_HOST); + P_marker = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_HOST); + P_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_S_offd, HYPRE_MEMORY_HOST); for (i = 0; i < n_fine; i++) { diff -Nru hypre-2.16.0/src/parcsr_ls/par_indepset.c hypre-2.18.2/src/parcsr_ls/par_indepset.c --- hypre-2.16.0/src/parcsr_ls/par_indepset.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_indepset.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -39,24 +31,29 @@ HYPRE_Int hypre_BoomerAMGIndepSetInit( hypre_ParCSRMatrix *S, - HYPRE_Real *measure_array , + HYPRE_Real *measure_array, HYPRE_Int seq_rand) { hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); MPI_Comm comm = hypre_ParCSRMatrixComm(S); - HYPRE_Int S_num_nodes = hypre_CSRMatrixNumRows(S_diag); - HYPRE_BigInt big_i; - HYPRE_Int i, my_id; - HYPRE_Int ierr = 0; + HYPRE_Int S_num_nodes = hypre_CSRMatrixNumRows(S_diag); + HYPRE_BigInt big_i; + HYPRE_Int i, my_id; + HYPRE_Int ierr = 0; hypre_MPI_Comm_rank(comm,&my_id); - i = 2747+my_id; - if (seq_rand) i = 2747; + i = 2747 + my_id; + if (seq_rand) + { + i = 2747; + } hypre_SeedRand(i); if (seq_rand) { for (big_i = 0; big_i < hypre_ParCSRMatrixFirstRowIndex(S); big_i++) - hypre_Rand(); + { + hypre_Rand(); + } } for (i = 0; i < S_num_nodes; i++) { @@ -114,16 +111,16 @@ HYPRE_Int *IS_marker, HYPRE_Int *IS_marker_offd ) { - hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); - HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); - HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); - hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); - HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); + hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); + HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); + HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); + hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); + HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); HYPRE_Int *S_offd_j = NULL; - HYPRE_Int local_num_vars = hypre_CSRMatrixNumRows(S_diag); + HYPRE_Int local_num_vars = hypre_CSRMatrixNumRows(S_diag); HYPRE_Int i, j, ig, jS, jj; - + /*------------------------------------------------------- * Initialize IS_marker by putting all nodes in * the independent set. @@ -131,7 +128,7 @@ if (hypre_CSRMatrixNumCols(S_offd)) { - S_offd_j = hypre_CSRMatrixJ(S_offd); + S_offd_j = hypre_CSRMatrixJ(S_offd); } for (ig = 0; ig < graph_array_size; ig++) @@ -163,11 +160,14 @@ for (jS = S_diag_i[i]; jS < S_diag_i[i+1]; jS++) { j = S_diag_j[jS]; - if (j < 0) j = -j-1; - + if (j < 0) + { + j = -j-1; + } + /* only consider valid graph edges */ /* if ( (measure_array[j] > 1) && (S_diag_data[jS]) ) */ - if (measure_array[j] > 1) + if (measure_array[j] > 1) { if (measure_array[i] > measure_array[j]) { @@ -182,12 +182,15 @@ for (jS = S_offd_i[i]; jS < S_offd_i[i+1]; jS++) { jj = S_offd_j[jS]; - if (jj < 0) jj = -jj-1; + if (jj < 0) + { + jj = -jj-1; + } j = local_num_vars+jj; - + /* only consider valid graph edges */ /* if ( (measure_array[j] > 1) && (S_offd_data[jS]) ) */ - if (measure_array[j] > 1) + if (measure_array[j] > 1) { if (measure_array[i] > measure_array[j]) { @@ -201,7 +204,7 @@ } } } - + return hypre_error_flag; } - + diff -Nru hypre-2.16.0/src/parcsr_ls/par_indepset_device.c hypre-2.18.2/src/parcsr_ls/par_indepset_device.c --- hypre-2.16.0/src/parcsr_ls/par_indepset_device.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_indepset_device.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,250 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +/****************************************************************************** + * + *****************************************************************************/ + +#include "_hypre_parcsr_ls.h" + +#if defined(HYPRE_USING_CUDA) +__global__ void +hypreCUDAKernel_IndepSetMain(HYPRE_Int graph_diag_size, + HYPRE_Int *graph_diag, + HYPRE_Real *measure_diag, + HYPRE_Real *measure_offd, + HYPRE_Int *S_diag_i, + HYPRE_Int *S_diag_j, + HYPRE_Int *S_offd_i, + HYPRE_Int *S_offd_j, + HYPRE_Int *IS_marker_diag, + HYPRE_Int *IS_marker_offd, + HYPRE_Int IS_offd_temp_mark) +{ + HYPRE_Int warp_id = hypre_cuda_get_grid_warp_id<1,1>(); + + if (warp_id >= graph_diag_size) + { + return; + } + + HYPRE_Int lane = hypre_cuda_get_lane_id<1>(); + HYPRE_Int row, row_start, row_end; + HYPRE_Int i, j; + HYPRE_Real t, measure_row; + HYPRE_Int marker_row = 1; + + if (lane < 2) + { + row = read_only_load(graph_diag + warp_id); + i = read_only_load(S_diag_i + row + lane); + } + + row_start = __shfl_sync(HYPRE_WARP_FULL_MASK, i, 0); + row_end = __shfl_sync(HYPRE_WARP_FULL_MASK, i, 1); + + if (lane == 0) + { + t = read_only_load(measure_diag + row); + } + + measure_row = __shfl_sync(HYPRE_WARP_FULL_MASK, t, 0); + + for (i = row_start + lane; i < row_end; i += HYPRE_WARP_SIZE) + { + j = read_only_load(S_diag_j + i); + t = read_only_load(measure_diag + j); + if (t > 1.0) + { + if (measure_row > t) + { + IS_marker_diag[j] = 0; + } + else if (t > measure_row) + { + marker_row = 0; + } + } + } + + if (lane < 2) + { + i = read_only_load(S_offd_i + row + lane); + } + + row_start = __shfl_sync(HYPRE_WARP_FULL_MASK, i, 0); + row_end = __shfl_sync(HYPRE_WARP_FULL_MASK, i, 1); + + for (i = row_start + lane; i < row_end; i += HYPRE_WARP_SIZE) + { + j = read_only_load(S_offd_j + i); + t = read_only_load(measure_offd + j); + if (t > 1.0) + { + if (measure_row > t) + { + IS_marker_offd[j] = IS_offd_temp_mark; + } + else if (t > measure_row) + { + marker_row = 0; + } + } + } + + marker_row = warp_reduce_min(marker_row); + + if (lane == 0 && marker_row == 0) + { + IS_marker_diag[row] = 0; + } +} + +__global__ void +hypreCUDAKernel_IndepSetFixMarker(HYPRE_Int *IS_marker_diag, + HYPRE_Int num_elmts_send, + HYPRE_Int *send_map_elmts, + HYPRE_Int *int_send_buf, + HYPRE_Int IS_offd_temp_mark) +{ + HYPRE_Int thread_id = hypre_cuda_get_grid_thread_id<1,1>(); + + if (thread_id >= num_elmts_send) + { + return; + } + + if (int_send_buf[thread_id] == IS_offd_temp_mark) + { + IS_marker_diag[send_map_elmts[thread_id]] = 0; + } +} + +/* Find IS in the graph whose vertices are in graph_diag, on exit + * mark the vertices in IS by 1 and those not in IS by 0 in IS_marker_diag + * Note: IS_marker_offd will not be sync'ed on exit */ +HYPRE_Int +hypre_BoomerAMGIndepSetDevice( hypre_ParCSRMatrix *S, + HYPRE_Real *measure_diag, + HYPRE_Real *measure_offd, + HYPRE_Int graph_diag_size, + HYPRE_Int *graph_diag, + HYPRE_Int *IS_marker_diag, + HYPRE_Int *IS_marker_offd, + hypre_ParCSRCommPkg *comm_pkg, + HYPRE_Int *int_send_buf ) +{ + /* This a temporary mark used in PMIS alg. to mark the *offd* nodes that + * should not be in the final IS + * Must make sure that this number does NOT exist in IS_marker_offd on input + */ + HYPRE_Int IS_offd_temp_mark = 9999; + + hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); + HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); + HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); + hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); + HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); + HYPRE_Int *S_offd_j = hypre_CSRMatrixJ(S_offd); + + HYPRE_Int num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + HYPRE_Int num_elmts_send = hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends); + HYPRE_Int *send_map_elmts = hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg); + + dim3 bDim, gDim; + hypre_ParCSRCommHandle *comm_handle; + + /*------------------------------------------------------------------ + * Initialize IS_marker by putting all nodes in the IS (marked by 1) + *------------------------------------------------------------------*/ + hypreDevice_ScatterConstant(IS_marker_diag, graph_diag_size, graph_diag, 1); + + /*------------------------------------------------------- + * Remove nodes from the initial independent set + *-------------------------------------------------------*/ + bDim = hypre_GetDefaultCUDABlockDimension(); + gDim = hypre_GetDefaultCUDAGridDimension(graph_diag_size, "warp", bDim); + + HYPRE_CUDA_LAUNCH( hypreCUDAKernel_IndepSetMain, gDim, bDim, + graph_diag_size, graph_diag, measure_diag, measure_offd, + S_diag_i, S_diag_j, S_offd_i, S_offd_j, + IS_marker_diag, IS_marker_offd, IS_offd_temp_mark ); + + /*-------------------------------------------------------------------- + * Exchange boundary data for IS_marker: send external IS to internal + *-------------------------------------------------------------------*/ + comm_handle = hypre_ParCSRCommHandleCreate_v2(12, comm_pkg, + HYPRE_MEMORY_DEVICE, IS_marker_offd, + HYPRE_MEMORY_DEVICE, int_send_buf); + hypre_ParCSRCommHandleDestroy(comm_handle); + + /* adjust IS_marker_diag from the received */ + gDim = hypre_GetDefaultCUDAGridDimension(num_elmts_send, "thread", bDim); + + HYPRE_CUDA_LAUNCH( hypreCUDAKernel_IndepSetFixMarker, gDim, bDim, + IS_marker_diag, num_elmts_send, send_map_elmts, + int_send_buf, IS_offd_temp_mark ); + + /* Note that IS_marker_offd is not sync'ed (communicated) here */ + + return hypre_error_flag; +} + +/* Augments measures by some random value between 0 and 1 + * aug_rand: 1: CURAND; 11: SEQ CURAND (TODO) + * 2: CPU RAND; 12: CPU SEQ RAND + */ +HYPRE_Int +hypre_BoomerAMGIndepSetInitDevice( hypre_ParCSRMatrix *S, + HYPRE_Real *measure_array, + HYPRE_Int aug_rand) +{ + MPI_Comm comm = hypre_ParCSRMatrixComm(S); + hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); + HYPRE_Int num_rows_diag = hypre_CSRMatrixNumRows(S_diag); + HYPRE_Int my_id; + HYPRE_Real *urand; + + hypre_MPI_Comm_rank(comm, &my_id); + + urand = hypre_TAlloc(HYPRE_Real, num_rows_diag, HYPRE_MEMORY_DEVICE); + + if (aug_rand == 2 || aug_rand == 12) + { + HYPRE_Real *h_urand; + h_urand = hypre_CTAlloc(HYPRE_Real, num_rows_diag, HYPRE_MEMORY_HOST); + hypre_BoomerAMGIndepSetInit(S, h_urand, aug_rand == 12); + hypre_TMemcpy(urand, h_urand, HYPRE_Real, num_rows_diag, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_HOST); + hypre_TFree(h_urand, HYPRE_MEMORY_HOST); + } + else + { + curandGenerator_t gen = hypre_HandleCurandGenerator(hypre_handle); + + HYPRE_CURAND_CALL( curandSetPseudoRandomGeneratorSeed(gen, 2747 + my_id) ); + + if (sizeof(HYPRE_Real) == sizeof(hypre_double)) + { + HYPRE_CURAND_CALL( curandGenerateUniformDouble(gen, (hypre_double *) urand, num_rows_diag) ); + } + else if (sizeof(HYPRE_Real) == sizeof(float)) + { + HYPRE_CURAND_CALL( curandGenerateUniform(gen, (float *) urand, num_rows_diag) ); + } + } + + thrust::plus op; + HYPRE_THRUST_CALL(transform, measure_array, measure_array + num_rows_diag, + urand, measure_array, op); + + hypre_TFree(urand, HYPRE_MEMORY_DEVICE); + + return hypre_error_flag; +} + +#endif // #if defined(HYPRE_USING_CUDA) + diff -Nru hypre-2.16.0/src/parcsr_ls/par_interp.c hypre-2.18.2/src/parcsr_ls/par_interp.c --- hypre-2.16.0/src/parcsr_ls/par_interp.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_interp.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" @@ -28,12 +20,11 @@ HYPRE_Int *dof_func, HYPRE_Int debug_flag, HYPRE_Real trunc_factor, - HYPRE_Int max_elmts, - HYPRE_Int *col_offd_S_to_A, - hypre_ParCSRMatrix **P_ptr) + HYPRE_Int max_elmts, + HYPRE_Int *col_offd_S_to_A, + hypre_ParCSRMatrix **P_ptr) { - - MPI_Comm comm = hypre_ParCSRMatrixComm(A); + MPI_Comm comm = hypre_ParCSRMatrixComm(A); hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); hypre_ParCSRCommHandle *comm_handle; @@ -42,7 +33,7 @@ HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); - hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); HYPRE_Real *A_offd_data = hypre_CSRMatrixData(A_offd); HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); @@ -53,25 +44,25 @@ HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); - hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); + hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); HYPRE_Int *S_offd_j = hypre_CSRMatrixJ(S_offd); hypre_ParCSRMatrix *P; - HYPRE_BigInt *col_map_offd_P; - HYPRE_Int *tmp_map_offd = NULL; + HYPRE_BigInt *col_map_offd_P; + HYPRE_Int *tmp_map_offd = NULL; HYPRE_Int *CF_marker_offd = NULL; HYPRE_Int *dof_func_offd = NULL; hypre_CSRMatrix *A_ext; - + HYPRE_Real *A_ext_data = NULL; HYPRE_Int *A_ext_i = NULL; HYPRE_BigInt *A_ext_j = NULL; hypre_CSRMatrix *P_diag; - hypre_CSRMatrix *P_offd; + hypre_CSRMatrix *P_offd; HYPRE_Real *P_diag_data; HYPRE_Int *P_diag_i; @@ -81,14 +72,14 @@ HYPRE_Int *P_offd_j; HYPRE_Int P_diag_size, P_offd_size; - + HYPRE_Int *P_marker, *P_marker_offd; HYPRE_Int jj_counter,jj_counter_offd; HYPRE_Int *jj_count, *jj_count_offd; HYPRE_Int jj_begin_row,jj_begin_row_offd; HYPRE_Int jj_end_row,jj_end_row_offd; - + HYPRE_Int start_indexing = 0; /* start indexing for P_data at 0 */ HYPRE_Int n_fine = hypre_CSRMatrixNumRows(A_diag); @@ -110,14 +101,14 @@ HYPRE_Int start; HYPRE_Int sgn; HYPRE_Int c_num; - + HYPRE_Real diagonal; HYPRE_Real sum; - HYPRE_Real distribute; - + HYPRE_Real distribute; + HYPRE_Real zero = 0.0; HYPRE_Real one = 1.0; - + HYPRE_Int my_id; HYPRE_Int num_procs; HYPRE_Int num_threads; @@ -133,7 +124,7 @@ HYPRE_Real wall_time; /* for debugging instrumentation */ - hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_size(comm, &num_procs); hypre_MPI_Comm_rank(comm,&my_id); num_threads = hypre_NumThreads(); @@ -160,53 +151,53 @@ if (num_cols_A_offd) CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); if (num_functions > 1 && num_cols_A_offd) - dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); + { + dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); + } if (!comm_pkg) { - hypre_MatvecCommPkgCreate(A); - comm_pkg = hypre_ParCSRMatrixCommPkg(A); + hypre_MatvecCommPkgCreate(A); + comm_pkg = hypre_ParCSRMatrixCommPkg(A); } num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, - num_sends), HYPRE_MEMORY_HOST); + int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + HYPRE_MEMORY_HOST); index = 0; for (i = 0; i < num_sends; i++) { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, - CF_marker_offd); + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + { + int_buf_data[index++] = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } + } - hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, CF_marker_offd); + + hypre_ParCSRCommHandleDestroy(comm_handle); if (num_functions > 1) { index = 0; for (i = 0; i < num_sends; i++) { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = dof_func[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, - dof_func_offd); + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + int_buf_data[index++] = dof_func[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } + + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, dof_func_offd); - hypre_ParCSRCommHandleDestroy(comm_handle); + hypre_ParCSRCommHandleDestroy(comm_handle); } if (debug_flag==4) { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Interp: Comm 1 CF_marker = %f\n", - my_id, wall_time); + my_id, wall_time); fflush(NULL); } @@ -250,12 +241,12 @@ for (i = num_cols_A_offd; i > 0; i--) A_ext_i[i] = A_ext_i[i-1]; if (num_procs > 1) A_ext_i[0] = 0; - + if (debug_flag==4) { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Interp: Comm 2 Get A_ext = %f\n", - my_id, wall_time); + my_id, wall_time); fflush(NULL); } @@ -280,87 +271,87 @@ jj_counter = start_indexing; jj_counter_offd = start_indexing; - + /*----------------------------------------------------------------------- * Loop over fine grid. *-----------------------------------------------------------------------*/ -/* RDF: this looks a little tricky, but doable */ + /* RDF: this looks a little tricky, but doable */ #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,j,i1,jj,ns,ne,size,rest) HYPRE_SMP_SCHEDULE #endif for (j = 0; j < num_threads; j++) { - size = n_fine/num_threads; - rest = n_fine - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) - { - - /*-------------------------------------------------------------------- - * If i is a C-point, interpolation is the identity. Also set up - * mapping vector. - *--------------------------------------------------------------------*/ - - if (CF_marker[i] >= 0) + size = n_fine/num_threads; + rest = n_fine - size*num_threads; + if (j < rest) { - jj_count[j]++; - fine_to_coarse[i] = coarse_counter[j]; - coarse_counter[j]++; + ns = j*size+j; + ne = (j+1)*size+j+1; } - - /*-------------------------------------------------------------------- - * If i is an F-point, interpolation is from the C-points that - * strongly influence i. - *--------------------------------------------------------------------*/ - else { - for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) + { + + /*-------------------------------------------------------------------- + * If i is a C-point, interpolation is the identity. Also set up + * mapping vector. + *--------------------------------------------------------------------*/ + + if (CF_marker[i] >= 0) { - i1 = S_diag_j[jj]; - if (CF_marker[i1] >= 0) - { - jj_count[j]++; - } + jj_count[j]++; + fine_to_coarse[i] = coarse_counter[j]; + coarse_counter[j]++; } - if (num_procs > 1) + /*-------------------------------------------------------------------- + * If i is an F-point, interpolation is from the C-points that + * strongly influence i. + *--------------------------------------------------------------------*/ + + else { - if (col_offd_S_to_A) - { - for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) { - i1 = col_offd_S_to_A[S_offd_j[jj]]; - if (CF_marker_offd[i1] >= 0) + i1 = S_diag_j[jj]; + if (CF_marker[i1] >= 0) { - jj_count_offd[j]++; + jj_count[j]++; } } - } - else - { - for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + + if (num_procs > 1) { - i1 = S_offd_j[jj]; - if (CF_marker_offd[i1] >= 0) + if (col_offd_S_to_A) + { + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + { + i1 = col_offd_S_to_A[S_offd_j[jj]]; + if (CF_marker_offd[i1] >= 0) + { + jj_count_offd[j]++; + } + } + } + else { - jj_count_offd[j]++; + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + { + i1 = S_offd_j[jj]; + if (CF_marker_offd[i1] >= 0) + { + jj_count_offd[j]++; + } + } } } - } } } - } } /*----------------------------------------------------------------------- @@ -383,7 +374,7 @@ P_diag_j = hypre_CTAlloc(HYPRE_Int, P_diag_size, HYPRE_MEMORY_SHARED); P_diag_data = hypre_CTAlloc(HYPRE_Real, P_diag_size, HYPRE_MEMORY_SHARED); - P_diag_i[n_fine] = jj_counter; + P_diag_i[n_fine] = jj_counter; P_offd_size = jj_counter_offd; @@ -403,316 +394,283 @@ { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Interp: Internal work 1 = %f\n", - my_id, wall_time); + my_id, wall_time); fflush(NULL); } /*----------------------------------------------------------------------- * Send and receive fine_to_coarse info. - *-----------------------------------------------------------------------*/ + *-----------------------------------------------------------------------*/ if (debug_flag==4) wall_time = time_getWallclockSeconds(); - //fine_to_coarse_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); + //fine_to_coarse_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,j,ns,ne,size,rest,coarse_shift) HYPRE_SMP_SCHEDULE #endif for (j = 0; j < num_threads; j++) { - coarse_shift = 0; - if (j > 0) coarse_shift = coarse_counter[j-1]; - size = n_fine/num_threads; - rest = n_fine - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) - fine_to_coarse[i] += coarse_shift; - //fine_to_coarse[i] += my_first_cpt+coarse_shift; + coarse_shift = 0; + if (j > 0) coarse_shift = coarse_counter[j-1]; + size = n_fine/num_threads; + rest = n_fine - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) + { + fine_to_coarse[i] += coarse_shift; + } + //fine_to_coarse[i] += my_first_cpt+coarse_shift; } /*index = 0; - for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = fine_to_coarse[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, - fine_to_coarse_offd); + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + int_buf_data[index++] + = fine_to_coarse[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } - hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, fine_to_coarse_offd); - if (debug_flag==4) - { - wall_time = time_getWallclockSeconds() - wall_time; - hypre_printf("Proc = %d Interp: Comm 4 FineToCoarse = %f\n", - my_id, wall_time); - fflush(NULL); - }*/ + hypre_ParCSRCommHandleDestroy(comm_handle); + + if (debug_flag==4) + { + wall_time = time_getWallclockSeconds() - wall_time; + hypre_printf("Proc = %d Interp: Comm 4 FineToCoarse = %f\n", + my_id, wall_time); + fflush(NULL); + }*/ if (debug_flag==4) wall_time = time_getWallclockSeconds(); -/*#ifdef HYPRE_USING_OPENMP + /*#ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n_fine; i++) fine_to_coarse[i] -= my_first_cpt; */ +for (i = 0; i < n_fine; i++) fine_to_coarse[i] -= my_first_cpt; */ /*----------------------------------------------------------------------- * Loop over fine grid points. *-----------------------------------------------------------------------*/ - + #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,j,jl,i1,i2,jj,jj1,ns,ne,size,rest,sum,diagonal,distribute,P_marker,P_marker_offd,strong_f_marker,jj_counter,jj_counter_offd,sgn,c_num,jj_begin_row,jj_end_row,jj_begin_row_offd,jj_end_row_offd) HYPRE_SMP_SCHEDULE #endif for (jl = 0; jl < num_threads; jl++) { - size = n_fine/num_threads; - rest = n_fine - size*num_threads; - if (jl < rest) - { - ns = jl*size+jl; - ne = (jl+1)*size+jl+1; - } - else - { - ns = jl*size+rest; - ne = (jl+1)*size+rest; - } - jj_counter = 0; - if (jl > 0) jj_counter = jj_count[jl-1]; - jj_counter_offd = 0; - if (jl > 0) jj_counter_offd = jj_count_offd[jl-1]; - - P_marker = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_HOST); - if (num_cols_A_offd) - P_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); - else - P_marker_offd = NULL; - - for (i = 0; i < n_fine; i++) - { - P_marker[i] = -1; - } - for (i = 0; i < num_cols_A_offd; i++) - { - P_marker_offd[i] = -1; - } - strong_f_marker = -2; - - for (i = ns; i < ne; i++) - { - - /*-------------------------------------------------------------------- - * If i is a c-point, interpolation is the identity. - *--------------------------------------------------------------------*/ - - if (CF_marker[i] >= 0) + size = n_fine/num_threads; + rest = n_fine - size*num_threads; + if (jl < rest) { - P_diag_i[i] = jj_counter; - P_diag_j[jj_counter] = fine_to_coarse[i]; - P_diag_data[jj_counter] = one; - jj_counter++; + ns = jl*size+jl; + ne = (jl+1)*size+jl+1; } - - /*-------------------------------------------------------------------- - * If i is an F-point, build interpolation. - *--------------------------------------------------------------------*/ - else - { - /* Diagonal part of P */ - P_diag_i[i] = jj_counter; - jj_begin_row = jj_counter; - - for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) - { - i1 = S_diag_j[jj]; + { + ns = jl*size+rest; + ne = (jl+1)*size+rest; + } + jj_counter = 0; + if (jl > 0) jj_counter = jj_count[jl-1]; + jj_counter_offd = 0; + if (jl > 0) jj_counter_offd = jj_count_offd[jl-1]; + + P_marker = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_HOST); + if (num_cols_A_offd) + P_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); + else + P_marker_offd = NULL; - /*-------------------------------------------------------------- - * If neighbor i1 is a C-point, set column number in P_diag_j - * and initialize interpolation weight to zero. - *--------------------------------------------------------------*/ + for (i = 0; i < n_fine; i++) + { + P_marker[i] = -1; + } + for (i = 0; i < num_cols_A_offd; i++) + { + P_marker_offd[i] = -1; + } + strong_f_marker = -2; - if (CF_marker[i1] >= 0) - { - P_marker[i1] = jj_counter; - P_diag_j[jj_counter] = fine_to_coarse[i1]; - P_diag_data[jj_counter] = zero; - jj_counter++; - } + for (i = ns; i < ne; i++) + { - /*-------------------------------------------------------------- - * If neighbor i1 is an F-point, mark it as a strong F-point - * whose connection needs to be distributed. - *--------------------------------------------------------------*/ + /*-------------------------------------------------------------------- + * If i is a c-point, interpolation is the identity. + *--------------------------------------------------------------------*/ - else if (CF_marker[i1] != -3) - { - P_marker[i1] = strong_f_marker; - } + if (CF_marker[i] >= 0) + { + P_diag_i[i] = jj_counter; + P_diag_j[jj_counter] = fine_to_coarse[i]; + P_diag_data[jj_counter] = one; + jj_counter++; } - jj_end_row = jj_counter; - - /* Off-Diagonal part of P */ - P_offd_i[i] = jj_counter_offd; - jj_begin_row_offd = jj_counter_offd; + /*-------------------------------------------------------------------- + * If i is an F-point, build interpolation. + *--------------------------------------------------------------------*/ - if (num_procs > 1) + else { - if (col_offd_S_to_A) - { - for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + /* Diagonal part of P */ + P_diag_i[i] = jj_counter; + jj_begin_row = jj_counter; + + for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) { - i1 = col_offd_S_to_A[S_offd_j[jj]]; + i1 = S_diag_j[jj]; - /*----------------------------------------------------------- - * If neighbor i1 is a C-point, set column number in P_offd_j + /*-------------------------------------------------------------- + * If neighbor i1 is a C-point, set column number in P_diag_j * and initialize interpolation weight to zero. - *-----------------------------------------------------------*/ + *--------------------------------------------------------------*/ - if (CF_marker_offd[i1] >= 0) + if (CF_marker[i1] >= 0) { - P_marker_offd[i1] = jj_counter_offd; - /*P_offd_j[jj_counter_offd] = fine_to_coarse_offd[i1];*/ - P_offd_j[jj_counter_offd] = i1; - P_offd_data[jj_counter_offd] = zero; - jj_counter_offd++; + P_marker[i1] = jj_counter; + P_diag_j[jj_counter] = fine_to_coarse[i1]; + P_diag_data[jj_counter] = zero; + jj_counter++; } - /*----------------------------------------------------------- + /*-------------------------------------------------------------- * If neighbor i1 is an F-point, mark it as a strong F-point * whose connection needs to be distributed. - *-----------------------------------------------------------*/ + *--------------------------------------------------------------*/ - else if (CF_marker_offd[i1] != -3) + else if (CF_marker[i1] != -3) { - P_marker_offd[i1] = strong_f_marker; - } + P_marker[i1] = strong_f_marker; + } } - } - else - { - for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) - { - i1 = S_offd_j[jj]; + jj_end_row = jj_counter; - /*----------------------------------------------------------- - * If neighbor i1 is a C-point, set column number in P_offd_j - * and initialize interpolation weight to zero. - *-----------------------------------------------------------*/ + /* Off-Diagonal part of P */ + P_offd_i[i] = jj_counter_offd; + jj_begin_row_offd = jj_counter_offd; - if (CF_marker_offd[i1] >= 0) + + if (num_procs > 1) + { + if (col_offd_S_to_A) { - P_marker_offd[i1] = jj_counter_offd; - /*P_offd_j[jj_counter_offd] = fine_to_coarse_offd[i1];*/ - P_offd_j[jj_counter_offd] = i1; - P_offd_data[jj_counter_offd] = zero; - jj_counter_offd++; - } + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + { + i1 = col_offd_S_to_A[S_offd_j[jj]]; - /*----------------------------------------------------------- - * If neighbor i1 is an F-point, mark it as a strong F-point - * whose connection needs to be distributed. - *-----------------------------------------------------------*/ + /*----------------------------------------------------------- + * If neighbor i1 is a C-point, set column number in P_offd_j + * and initialize interpolation weight to zero. + *-----------------------------------------------------------*/ + + if (CF_marker_offd[i1] >= 0) + { + P_marker_offd[i1] = jj_counter_offd; + /*P_offd_j[jj_counter_offd] = fine_to_coarse_offd[i1];*/ + P_offd_j[jj_counter_offd] = i1; + P_offd_data[jj_counter_offd] = zero; + jj_counter_offd++; + } + + /*----------------------------------------------------------- + * If neighbor i1 is an F-point, mark it as a strong F-point + * whose connection needs to be distributed. + *-----------------------------------------------------------*/ - else if (CF_marker_offd[i1] != -3) + else if (CF_marker_offd[i1] != -3) + { + P_marker_offd[i1] = strong_f_marker; + } + } + } + else { - P_marker_offd[i1] = strong_f_marker; - } - } - } - } - - jj_end_row_offd = jj_counter_offd; - - diagonal = A_diag_data[A_diag_i[i]]; + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + { + i1 = S_offd_j[jj]; - - /* Loop over ith row of A. First, the diagonal part of A */ + /*----------------------------------------------------------- + * If neighbor i1 is a C-point, set column number in P_offd_j + * and initialize interpolation weight to zero. + *-----------------------------------------------------------*/ - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - i1 = A_diag_j[jj]; + if (CF_marker_offd[i1] >= 0) + { + P_marker_offd[i1] = jj_counter_offd; + /*P_offd_j[jj_counter_offd] = fine_to_coarse_offd[i1];*/ + P_offd_j[jj_counter_offd] = i1; + P_offd_data[jj_counter_offd] = zero; + jj_counter_offd++; + } - /*-------------------------------------------------------------- - * Case 1: neighbor i1 is a C-point and strongly influences i, - * accumulate a_{i,i1} into the interpolation weight. - *--------------------------------------------------------------*/ + /*----------------------------------------------------------- + * If neighbor i1 is an F-point, mark it as a strong F-point + * whose connection needs to be distributed. + *-----------------------------------------------------------*/ - if (P_marker[i1] >= jj_begin_row) - { - P_diag_data[P_marker[i1]] += A_diag_data[jj]; + else if (CF_marker_offd[i1] != -3) + { + P_marker_offd[i1] = strong_f_marker; + } + } + } } - /*-------------------------------------------------------------- - * Case 2: neighbor i1 is an F-point and strongly influences i, - * distribute a_{i,i1} to C-points that strongly infuence i. - * Note: currently no distribution to the diagonal in this case. - *--------------------------------------------------------------*/ - - else if (P_marker[i1] == strong_f_marker) + jj_end_row_offd = jj_counter_offd; + + diagonal = A_diag_data[A_diag_i[i]]; + + + /* Loop over ith row of A. First, the diagonal part of A */ + + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) { - sum = zero; - - /*----------------------------------------------------------- - * Loop over row of A for point i1 and calculate the sum - * of the connections to c-points that strongly influence i. - *-----------------------------------------------------------*/ - sgn = 1; - if (A_diag_data[A_diag_i[i1]] < 0) sgn = -1; - /* Diagonal block part of row i1 */ - for (jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) + i1 = A_diag_j[jj]; + + /*-------------------------------------------------------------- + * Case 1: neighbor i1 is a C-point and strongly influences i, + * accumulate a_{i,i1} into the interpolation weight. + *--------------------------------------------------------------*/ + + if (P_marker[i1] >= jj_begin_row) { - i2 = A_diag_j[jj1]; - if (P_marker[i2] >= jj_begin_row && - (sgn*A_diag_data[jj1]) < 0) - { - sum += A_diag_data[jj1]; - } + P_diag_data[P_marker[i1]] += A_diag_data[jj]; } - /* Off-Diagonal block part of row i1 */ - if (num_procs > 1) - { - for (jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) - { - i2 = A_offd_j[jj1]; - if (P_marker_offd[i2] >= jj_begin_row_offd - && (sgn*A_offd_data[jj1]) < 0) - { - sum += A_offd_data[jj1]; - } - } - } + /*-------------------------------------------------------------- + * Case 2: neighbor i1 is an F-point and strongly influences i, + * distribute a_{i,i1} to C-points that strongly infuence i. + * Note: currently no distribution to the diagonal in this case. + *--------------------------------------------------------------*/ + + else if (P_marker[i1] == strong_f_marker) + { + sum = zero; - if (sum != 0) - { - distribute = A_diag_data[jj] / sum; - /*----------------------------------------------------------- - * Loop over row of A for point i1 and do the distribution. + * Loop over row of A for point i1 and calculate the sum + * of the connections to c-points that strongly influence i. *-----------------------------------------------------------*/ - + sgn = 1; + if (A_diag_data[A_diag_i[i1]] < 0) sgn = -1; /* Diagonal block part of row i1 */ for (jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) { i2 = A_diag_j[jj1]; - if (P_marker[i2] >= jj_begin_row - && (sgn*A_diag_data[jj1]) < 0) + if (P_marker[i2] >= jj_begin_row && + (sgn*A_diag_data[jj1]) < 0) { - P_diag_data[P_marker[i2]] - += distribute * A_diag_data[jj1]; + sum += A_diag_data[jj1]; } } @@ -723,214 +681,248 @@ { i2 = A_offd_j[jj1]; if (P_marker_offd[i2] >= jj_begin_row_offd - && (sgn*A_offd_data[jj1]) < 0) + && (sgn*A_offd_data[jj1]) < 0) + { + sum += A_offd_data[jj1]; + } + } + } + + if (sum != 0) + { + distribute = A_diag_data[jj] / sum; + + /*----------------------------------------------------------- + * Loop over row of A for point i1 and do the distribution. + *-----------------------------------------------------------*/ + + /* Diagonal block part of row i1 */ + for (jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) + { + i2 = A_diag_j[jj1]; + if (P_marker[i2] >= jj_begin_row + && (sgn*A_diag_data[jj1]) < 0) + { + P_diag_data[P_marker[i2]] + += distribute * A_diag_data[jj1]; + } + } + + /* Off-Diagonal block part of row i1 */ + if (num_procs > 1) + { + for (jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) { - P_offd_data[P_marker_offd[i2]] - += distribute * A_offd_data[jj1]; + i2 = A_offd_j[jj1]; + if (P_marker_offd[i2] >= jj_begin_row_offd + && (sgn*A_offd_data[jj1]) < 0) + { + P_offd_data[P_marker_offd[i2]] + += distribute * A_offd_data[jj1]; + } } } } + else + { + if (num_functions == 1 || dof_func[i] == dof_func[i1]) + { + diagonal += A_diag_data[jj]; + } + } } - else + + /*-------------------------------------------------------------- + * Case 3: neighbor i1 weakly influences i, accumulate a_{i,i1} + * into the diagonal. + *--------------------------------------------------------------*/ + + else if (CF_marker[i1] != -3) { if (num_functions == 1 || dof_func[i] == dof_func[i1]) { diagonal += A_diag_data[jj]; } } - } - - /*-------------------------------------------------------------- - * Case 3: neighbor i1 weakly influences i, accumulate a_{i,i1} - * into the diagonal. - *--------------------------------------------------------------*/ - else if (CF_marker[i1] != -3) - { - if (num_functions == 1 || dof_func[i] == dof_func[i1]) - { - diagonal += A_diag_data[jj]; - } - } + } - } - - /*---------------------------------------------------------------- - * Still looping over ith row of A. Next, loop over the - * off-diagonal part of A - *---------------------------------------------------------------*/ + /*---------------------------------------------------------------- + * Still looping over ith row of A. Next, loop over the + * off-diagonal part of A + *---------------------------------------------------------------*/ - if (num_procs > 1) - { - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + if (num_procs > 1) { - i1 = A_offd_j[jj]; - - /*-------------------------------------------------------------- - * Case 1: neighbor i1 is a C-point and strongly influences i, - * accumulate a_{i,i1} into the interpolation weight. - *--------------------------------------------------------------*/ - - if (P_marker_offd[i1] >= jj_begin_row_offd) + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) { - P_offd_data[P_marker_offd[i1]] += A_offd_data[jj]; - } + i1 = A_offd_j[jj]; - /*------------------------------------------------------------ - * Case 2: neighbor i1 is an F-point and strongly influences i, - * distribute a_{i,i1} to C-points that strongly infuence i. - * Note: currently no distribution to the diagonal in this case. - *-----------------------------------------------------------*/ - - else if (P_marker_offd[i1] == strong_f_marker) - { - sum = zero; - - /*--------------------------------------------------------- - * Loop over row of A_ext for point i1 and calculate the sum - * of the connections to c-points that strongly influence i. - *---------------------------------------------------------*/ - - /* find row number */ - c_num = A_offd_j[jj]; - - sgn = 1; - if (A_ext_data[A_ext_i[c_num]] < 0) sgn = -1; - for (jj1 = A_ext_i[c_num]; jj1 < A_ext_i[c_num+1]; jj1++) - { - i2 = (HYPRE_Int)A_ext_j[jj1]; - - if (i2 > -1) - { - /* in the diagonal block */ - if (P_marker[i2] >= jj_begin_row - && (sgn*A_ext_data[jj1]) < 0) - { - sum += A_ext_data[jj1]; - } - } - else - { - /* in the off_diagonal block */ - if (P_marker_offd[-i2-1] >= jj_begin_row_offd - && (sgn*A_ext_data[jj1]) < 0) - { - sum += A_ext_data[jj1]; - } - - } + /*-------------------------------------------------------------- + * Case 1: neighbor i1 is a C-point and strongly influences i, + * accumulate a_{i,i1} into the interpolation weight. + *--------------------------------------------------------------*/ + if (P_marker_offd[i1] >= jj_begin_row_offd) + { + P_offd_data[P_marker_offd[i1]] += A_offd_data[jj]; } - if (sum != 0) - { - distribute = A_offd_data[jj] / sum; + /*------------------------------------------------------------ + * Case 2: neighbor i1 is an F-point and strongly influences i, + * distribute a_{i,i1} to C-points that strongly infuence i. + * Note: currently no distribution to the diagonal in this case. + *-----------------------------------------------------------*/ + + else if (P_marker_offd[i1] == strong_f_marker) + { + sum = zero; + /*--------------------------------------------------------- - * Loop over row of A_ext for point i1 and do - * the distribution. - *--------------------------------------------------------*/ + * Loop over row of A_ext for point i1 and calculate the sum + * of the connections to c-points that strongly influence i. + *---------------------------------------------------------*/ - /* Diagonal block part of row i1 */ - + /* find row number */ + c_num = A_offd_j[jj]; + + sgn = 1; + if (A_ext_data[A_ext_i[c_num]] < 0) sgn = -1; for (jj1 = A_ext_i[c_num]; jj1 < A_ext_i[c_num+1]; jj1++) { i2 = (HYPRE_Int)A_ext_j[jj1]; - if (i2 > -1) /* in the diagonal block */ + if (i2 > -1) { + /* in the diagonal block */ if (P_marker[i2] >= jj_begin_row - && (sgn*A_ext_data[jj1]) < 0) + && (sgn*A_ext_data[jj1]) < 0) { - P_diag_data[P_marker[i2]] - += distribute * A_ext_data[jj1]; + sum += A_ext_data[jj1]; } } else { /* in the off_diagonal block */ if (P_marker_offd[-i2-1] >= jj_begin_row_offd - && (sgn*A_ext_data[jj1]) < 0) - P_offd_data[P_marker_offd[-i2-1]] - += distribute * A_ext_data[jj1]; + && (sgn*A_ext_data[jj1]) < 0) + { + sum += A_ext_data[jj1]; + } + } + } - } - else - { - if (num_functions == 1 || dof_func[i] == dof_func_offd[i1]) + + if (sum != 0) { - diagonal += A_offd_data[jj]; - } - } - } - - /*----------------------------------------------------------- - * Case 3: neighbor i1 weakly influences i, accumulate a_{i,i1} - * into the diagonal. - *-----------------------------------------------------------*/ + distribute = A_offd_data[jj] / sum; + /*--------------------------------------------------------- + * Loop over row of A_ext for point i1 and do + * the distribution. + *--------------------------------------------------------*/ - else if (CF_marker_offd[i1] != -3) - { - if (num_functions == 1 || dof_func[i] == dof_func_offd[i1]) - { - diagonal += A_offd_data[jj]; - } - } + /* Diagonal block part of row i1 */ - } - } + for (jj1 = A_ext_i[c_num]; jj1 < A_ext_i[c_num+1]; jj1++) + { + i2 = (HYPRE_Int)A_ext_j[jj1]; - /*----------------------------------------------------------------- - * Set interpolation weight by dividing by the diagonal. - *-----------------------------------------------------------------*/ + if (i2 > -1) /* in the diagonal block */ + { + if (P_marker[i2] >= jj_begin_row + && (sgn*A_ext_data[jj1]) < 0) + { + P_diag_data[P_marker[i2]] + += distribute * A_ext_data[jj1]; + } + } + else + { + /* in the off_diagonal block */ + if (P_marker_offd[-i2-1] >= jj_begin_row_offd + && (sgn*A_ext_data[jj1]) < 0) + P_offd_data[P_marker_offd[-i2-1]] + += distribute * A_ext_data[jj1]; + } + } + } + else + { + if (num_functions == 1 || dof_func[i] == dof_func_offd[i1]) + { + diagonal += A_offd_data[jj]; + } + } + } - if (diagonal == 0.0) - { - if (print_level) - { - hypre_printf(" Warning! zero diagonal! Proc id %d row %d\n", my_id,i); - } - for (jj = jj_begin_row; jj < jj_end_row; jj++) - { - P_diag_data[jj] = 0.0; - } - for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) - { - P_offd_data[jj] = 0.0; + /*----------------------------------------------------------- + * Case 3: neighbor i1 weakly influences i, accumulate a_{i,i1} + * into the diagonal. + *-----------------------------------------------------------*/ + + else if (CF_marker_offd[i1] != -3) + { + if (num_functions == 1 || dof_func[i] == dof_func_offd[i1]) + { + diagonal += A_offd_data[jj]; + } + } + + } } - } - else - { - for (jj = jj_begin_row; jj < jj_end_row; jj++) + + /*----------------------------------------------------------------- + * Set interpolation weight by dividing by the diagonal. + *-----------------------------------------------------------------*/ + + if (diagonal == 0.0) { - P_diag_data[jj] /= -diagonal; + if (print_level) + { + hypre_printf(" Warning! zero diagonal! Proc id %d row %d\n", my_id,i); + } + for (jj = jj_begin_row; jj < jj_end_row; jj++) + { + P_diag_data[jj] = 0.0; + } + for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) + { + P_offd_data[jj] = 0.0; + } } - for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) + else { - P_offd_data[jj] /= -diagonal; + for (jj = jj_begin_row; jj < jj_end_row; jj++) + { + P_diag_data[jj] /= -diagonal; + } + for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) + { + P_offd_data[jj] /= -diagonal; + } } + } - - } - strong_f_marker--; + strong_f_marker--; - P_offd_i[i+1] = jj_counter_offd; - } - hypre_TFree(P_marker, HYPRE_MEMORY_HOST); - hypre_TFree(P_marker_offd, HYPRE_MEMORY_HOST); + P_offd_i[i+1] = jj_counter_offd; + } + hypre_TFree(P_marker, HYPRE_MEMORY_HOST); + hypre_TFree(P_marker_offd, HYPRE_MEMORY_HOST); } P = hypre_ParCSRMatrixCreate(comm, - hypre_ParCSRMatrixGlobalNumRows(A), - total_global_cpts, - hypre_ParCSRMatrixColStarts(A), - num_cpts_global, - 0, - P_diag_i[n_fine], - P_offd_i[n_fine]); - + hypre_ParCSRMatrixGlobalNumRows(A), + total_global_cpts, + hypre_ParCSRMatrixColStarts(A), + num_cpts_global, + 0, + P_diag_i[n_fine], + P_offd_i[n_fine]); + P_diag = hypre_ParCSRMatrixDiag(P); hypre_CSRMatrixData(P_diag) = P_diag_data; hypre_CSRMatrixI(P_diag) = P_diag_i; @@ -965,17 +957,19 @@ #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif for (i=0; i < num_cols_A_offd; i++) - P_marker[i] = 0; + { + P_marker[i] = 0; + } num_cols_P_offd = 0; for (i=0; i < P_offd_size; i++) { - index = P_offd_j[i]; - if (!P_marker[index]) - { - num_cols_P_offd++; - P_marker[index] = 1; - } + index = P_offd_j[i]; + if (!P_marker[index]) + { + num_cols_P_offd++; + P_marker[index] = 1; + } } col_map_offd_P = hypre_CTAlloc(HYPRE_BigInt, num_cols_P_offd, HYPRE_MEMORY_HOST); @@ -992,10 +986,10 @@ #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif for (i=0; i < P_offd_size; i++) - P_offd_j[i] = hypre_BinarySearch(tmp_map_offd, - P_offd_j[i], - num_cols_P_offd); - hypre_TFree(P_marker, HYPRE_MEMORY_HOST); + P_offd_j[i] = hypre_BinarySearch(tmp_map_offd, + P_offd_j[i], + num_cols_P_offd); + hypre_TFree(P_marker, HYPRE_MEMORY_HOST); } for (i=0; i < n_fine; i++) @@ -1004,10 +998,10 @@ } if (num_cols_P_offd) - { + { hypre_ParCSRMatrixColMapOffd(P) = col_map_offd_P; hypre_CSRMatrixNumCols(P_offd) = num_cols_P_offd; - } + } hypre_GetCommPkgRTFromCommPkgA(P,A, fine_to_coarse, tmp_map_offd); @@ -1027,9 +1021,8 @@ if (num_procs > 1) hypre_CSRMatrixDestroy(A_ext); return hypre_error_flag; +} -} - /*--------------------------------------------------------------------------- * hypre_BoomerAMGBuildInterpHE @@ -1046,12 +1039,12 @@ HYPRE_Int *dof_func, HYPRE_Int debug_flag, HYPRE_Real trunc_factor, - HYPRE_Int max_elmts, - HYPRE_Int *col_offd_S_to_A, + HYPRE_Int max_elmts, + HYPRE_Int *col_offd_S_to_A, hypre_ParCSRMatrix **P_ptr) { - MPI_Comm comm = hypre_ParCSRMatrixComm(A); + MPI_Comm comm = hypre_ParCSRMatrixComm(A); hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); hypre_ParCSRCommHandle *comm_handle; @@ -1060,7 +1053,7 @@ HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); - hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); HYPRE_Real *A_offd_data = hypre_CSRMatrixData(A_offd); HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); @@ -1071,25 +1064,25 @@ HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); - hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); + hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); HYPRE_Int *S_offd_j = hypre_CSRMatrixJ(S_offd); hypre_ParCSRMatrix *P; - HYPRE_BigInt *col_map_offd_P; - HYPRE_Int *tmp_map_offd = NULL; + HYPRE_BigInt *col_map_offd_P; + HYPRE_Int *tmp_map_offd = NULL; HYPRE_Int *CF_marker_offd = NULL; HYPRE_Int *dof_func_offd = NULL; hypre_CSRMatrix *A_ext; - + HYPRE_Real *A_ext_data = NULL; HYPRE_Int *A_ext_i = NULL; HYPRE_BigInt *A_ext_j = NULL; hypre_CSRMatrix *P_diag; - hypre_CSRMatrix *P_offd; + hypre_CSRMatrix *P_offd; HYPRE_Real *P_diag_data; HYPRE_Int *P_diag_i; @@ -1099,14 +1092,14 @@ HYPRE_Int *P_offd_j; HYPRE_Int P_diag_size, P_offd_size; - + HYPRE_Int *P_marker, *P_marker_offd; HYPRE_Int jj_counter,jj_counter_offd; HYPRE_Int *jj_count, *jj_count_offd; HYPRE_Int jj_begin_row,jj_begin_row_offd; HYPRE_Int jj_end_row,jj_end_row_offd; - + HYPRE_Int start_indexing = 0; /* start indexing for P_data at 0 */ HYPRE_Int n_fine = hypre_CSRMatrixNumRows(A_diag); @@ -1126,14 +1119,14 @@ HYPRE_Int start; HYPRE_Int sgn; HYPRE_Int c_num; - + HYPRE_Real diagonal; HYPRE_Real sum; - HYPRE_Real distribute; - + HYPRE_Real distribute; + HYPRE_Real zero = 0.0; HYPRE_Real one = 1.0; - + HYPRE_Int my_id; HYPRE_Int num_procs; HYPRE_Int num_threads; @@ -1148,7 +1141,7 @@ HYPRE_Real wall_time; /* for debugging instrumentation */ - hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_size(comm, &num_procs); hypre_MPI_Comm_rank(comm,&my_id); num_threads = hypre_NumThreads(); @@ -1170,53 +1163,51 @@ if (num_cols_A_offd) CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); if (num_functions > 1 && num_cols_A_offd) - dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); + dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); if (!comm_pkg) { - hypre_MatvecCommPkgCreate(A); - comm_pkg = hypre_ParCSRMatrixCommPkg(A); + hypre_MatvecCommPkgCreate(A); + comm_pkg = hypre_ParCSRMatrixCommPkg(A); } num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, - num_sends), HYPRE_MEMORY_HOST); + int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + HYPRE_MEMORY_HOST); index = 0; for (i = 0; i < num_sends; i++) { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, - CF_marker_offd); + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + int_buf_data[index++] + = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } + + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, CF_marker_offd); - hypre_ParCSRCommHandleDestroy(comm_handle); + hypre_ParCSRCommHandleDestroy(comm_handle); if (num_functions > 1) { index = 0; for (i = 0; i < num_sends; i++) { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = dof_func[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, - dof_func_offd); + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + int_buf_data[index++] + = dof_func[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } + + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, dof_func_offd); - hypre_ParCSRCommHandleDestroy(comm_handle); + hypre_ParCSRCommHandleDestroy(comm_handle); } if (debug_flag==4) { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Interp: Comm 1 CF_marker = %f\n", - my_id, wall_time); + my_id, wall_time); fflush(NULL); } @@ -1260,12 +1251,12 @@ for (i = num_cols_A_offd; i > 0; i--) A_ext_i[i] = A_ext_i[i-1]; if (num_procs > 1) A_ext_i[0] = 0; - + if (debug_flag==4) { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Interp: Comm 2 Get A_ext = %f\n", - my_id, wall_time); + my_id, wall_time); fflush(NULL); } @@ -1289,87 +1280,87 @@ jj_counter = start_indexing; jj_counter_offd = start_indexing; - + /*----------------------------------------------------------------------- * Loop over fine grid. *-----------------------------------------------------------------------*/ -/* RDF: this looks a little tricky, but doable */ + /* RDF: this looks a little tricky, but doable */ #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,j,i1,jj,ns,ne,size,rest) HYPRE_SMP_SCHEDULE #endif for (j = 0; j < num_threads; j++) { - size = n_fine/num_threads; - rest = n_fine - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) - { - - /*-------------------------------------------------------------------- - * If i is a C-point, interpolation is the identity. Also set up - * mapping vector. - *--------------------------------------------------------------------*/ - - if (CF_marker[i] >= 0) + size = n_fine/num_threads; + rest = n_fine - size*num_threads; + if (j < rest) { - jj_count[j]++; - fine_to_coarse[i] = coarse_counter[j]; - coarse_counter[j]++; + ns = j*size+j; + ne = (j+1)*size+j+1; } - - /*-------------------------------------------------------------------- - * If i is an F-point, interpolation is from the C-points that - * strongly influence i. - *--------------------------------------------------------------------*/ - else { - for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) + { + + /*-------------------------------------------------------------------- + * If i is a C-point, interpolation is the identity. Also set up + * mapping vector. + *--------------------------------------------------------------------*/ + + if (CF_marker[i] >= 0) { - i1 = S_diag_j[jj]; - if (CF_marker[i1] >= 0) - { - jj_count[j]++; - } + jj_count[j]++; + fine_to_coarse[i] = coarse_counter[j]; + coarse_counter[j]++; } - if (num_procs > 1) + /*-------------------------------------------------------------------- + * If i is an F-point, interpolation is from the C-points that + * strongly influence i. + *--------------------------------------------------------------------*/ + + else { - if (col_offd_S_to_A) - { - for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) { - i1 = col_offd_S_to_A[S_offd_j[jj]]; - if (CF_marker_offd[i1] >= 0) + i1 = S_diag_j[jj]; + if (CF_marker[i1] >= 0) { - jj_count_offd[j]++; + jj_count[j]++; } } - } - else - { - for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + + if (num_procs > 1) { - i1 = S_offd_j[jj]; - if (CF_marker_offd[i1] >= 0) + if (col_offd_S_to_A) + { + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + { + i1 = col_offd_S_to_A[S_offd_j[jj]]; + if (CF_marker_offd[i1] >= 0) + { + jj_count_offd[j]++; + } + } + } + else { - jj_count_offd[j]++; + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + { + i1 = S_offd_j[jj]; + if (CF_marker_offd[i1] >= 0) + { + jj_count_offd[j]++; + } + } } } - } } } - } } /*----------------------------------------------------------------------- @@ -1392,7 +1383,7 @@ P_diag_j = hypre_CTAlloc(HYPRE_Int, P_diag_size, HYPRE_MEMORY_HOST); P_diag_data = hypre_CTAlloc(HYPRE_Real, P_diag_size, HYPRE_MEMORY_HOST); - P_diag_i[n_fine] = jj_counter; + P_diag_i[n_fine] = jj_counter; P_offd_size = jj_counter_offd; @@ -1412,453 +1403,450 @@ { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Interp: Internal work 1 = %f\n", - my_id, wall_time); + my_id, wall_time); fflush(NULL); } /*----------------------------------------------------------------------- * Send and receive fine_to_coarse info. - *-----------------------------------------------------------------------*/ + *-----------------------------------------------------------------------*/ if (debug_flag==4) wall_time = time_getWallclockSeconds(); - //fine_to_coarse_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); + //fine_to_coarse_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,j,ns,ne,size,rest,coarse_shift) HYPRE_SMP_SCHEDULE #endif for (j = 0; j < num_threads; j++) { - coarse_shift = 0; - if (j > 0) coarse_shift = coarse_counter[j-1]; - size = n_fine/num_threads; - rest = n_fine - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) - fine_to_coarse[i] += coarse_shift; + coarse_shift = 0; + if (j > 0) coarse_shift = coarse_counter[j-1]; + size = n_fine/num_threads; + rest = n_fine - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) + fine_to_coarse[i] += coarse_shift; } /*index = 0; - for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = fine_to_coarse[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, - fine_to_coarse_offd); + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + int_buf_data[index++] + = fine_to_coarse[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } - hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, + fine_to_coarse_offd); - if (debug_flag==4) - { - wall_time = time_getWallclockSeconds() - wall_time; - hypre_printf("Proc = %d Interp: Comm 4 FineToCoarse = %f\n", - my_id, wall_time); - fflush(NULL); - }*/ + hypre_ParCSRCommHandleDestroy(comm_handle); + + if (debug_flag==4) + { + wall_time = time_getWallclockSeconds() - wall_time; + hypre_printf("Proc = %d Interp: Comm 4 FineToCoarse = %f\n", + my_id, wall_time); + fflush(NULL); + }*/ if (debug_flag==4) wall_time = time_getWallclockSeconds(); -/*#ifdef HYPRE_USING_OPENMP + /*#ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n_fine; i++) fine_to_coarse[i] -= my_first_cpt;*/ +for (i = 0; i < n_fine; i++) fine_to_coarse[i] -= my_first_cpt;*/ /*----------------------------------------------------------------------- * Loop over fine grid points. *-----------------------------------------------------------------------*/ - + #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,j,jl,i1,i2,jj,jj1,ns,ne,size,rest,sum,diagonal,distribute,P_marker,P_marker_offd,jj_counter,jj_counter_offd,sgn,c_num,jj_begin_row,jj_end_row,jj_begin_row_offd,jj_end_row_offd) HYPRE_SMP_SCHEDULE #endif for (jl = 0; jl < num_threads; jl++) { - size = n_fine/num_threads; - rest = n_fine - size*num_threads; - if (jl < rest) - { - ns = jl*size+jl; - ne = (jl+1)*size+jl+1; - } - else - { - ns = jl*size+rest; - ne = (jl+1)*size+rest; - } - jj_counter = 0; - if (jl > 0) jj_counter = jj_count[jl-1]; - jj_counter_offd = 0; - if (jl > 0) jj_counter_offd = jj_count_offd[jl-1]; - - P_marker = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_HOST); - if (num_cols_A_offd) - P_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); - else - P_marker_offd = NULL; - - for (i = 0; i < n_fine; i++) - { - P_marker[i] = -1; - } - for (i = 0; i < num_cols_A_offd; i++) - { - P_marker_offd[i] = -1; - } - - for (i = ns; i < ne; i++) - { - - /*-------------------------------------------------------------------- - * If i is a c-point, interpolation is the identity. - *--------------------------------------------------------------------*/ - - if (CF_marker[i] >= 0) + size = n_fine/num_threads; + rest = n_fine - size*num_threads; + if (jl < rest) { - P_diag_i[i] = jj_counter; - P_diag_j[jj_counter] = fine_to_coarse[i]; - P_diag_data[jj_counter] = one; - jj_counter++; + ns = jl*size+jl; + ne = (jl+1)*size+jl+1; } - - /*-------------------------------------------------------------------- - * If i is an F-point, build interpolation. - *--------------------------------------------------------------------*/ - else - { - /* Diagonal part of P */ - P_diag_i[i] = jj_counter; - jj_begin_row = jj_counter; + { + ns = jl*size+rest; + ne = (jl+1)*size+rest; + } + jj_counter = 0; + if (jl > 0) jj_counter = jj_count[jl-1]; + jj_counter_offd = 0; + if (jl > 0) jj_counter_offd = jj_count_offd[jl-1]; + + P_marker = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_HOST); + if (num_cols_A_offd) + P_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); + else + P_marker_offd = NULL; - for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) - { - i1 = S_diag_j[jj]; + for (i = 0; i < n_fine; i++) + { + P_marker[i] = -1; + } + for (i = 0; i < num_cols_A_offd; i++) + { + P_marker_offd[i] = -1; + } - /*-------------------------------------------------------------- - * If neighbor i1 is a C-point, set column number in P_diag_j - * and initialize interpolation weight to zero. - *--------------------------------------------------------------*/ + for (i = ns; i < ne; i++) + { - if (CF_marker[i1] >= 0) - { - P_marker[i1] = jj_counter; - P_diag_j[jj_counter] = fine_to_coarse[i1]; - P_diag_data[jj_counter] = zero; - jj_counter++; - } + /*-------------------------------------------------------------------- + * If i is a c-point, interpolation is the identity. + *--------------------------------------------------------------------*/ + if (CF_marker[i] >= 0) + { + P_diag_i[i] = jj_counter; + P_diag_j[jj_counter] = fine_to_coarse[i]; + P_diag_data[jj_counter] = one; + jj_counter++; } - jj_end_row = jj_counter; - - /* Off-Diagonal part of P */ - P_offd_i[i] = jj_counter_offd; - jj_begin_row_offd = jj_counter_offd; + /*-------------------------------------------------------------------- + * If i is an F-point, build interpolation. + *--------------------------------------------------------------------*/ - if (num_procs > 1) + else { - if (col_offd_S_to_A) - { - for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) - { - i1 = col_offd_S_to_A[S_offd_j[jj]]; - - /*----------------------------------------------------------- - * If neighbor i1 is a C-point, set column number in P_offd_j - * and initialize interpolation weight to zero. - *-----------------------------------------------------------*/ + /* Diagonal part of P */ + P_diag_i[i] = jj_counter; + jj_begin_row = jj_counter; - if (CF_marker_offd[i1] >= 0) - { - P_marker_offd[i1] = jj_counter_offd; - P_offd_j[jj_counter_offd] = i1; - P_offd_data[jj_counter_offd] = zero; - jj_counter_offd++; - } - } - } - else - { - for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) { - i1 = S_offd_j[jj]; + i1 = S_diag_j[jj]; - /*----------------------------------------------------------- - * If neighbor i1 is a C-point, set column number in P_offd_j + /*-------------------------------------------------------------- + * If neighbor i1 is a C-point, set column number in P_diag_j * and initialize interpolation weight to zero. - *-----------------------------------------------------------*/ + *--------------------------------------------------------------*/ - if (CF_marker_offd[i1] >= 0) + if (CF_marker[i1] >= 0) { - P_marker_offd[i1] = jj_counter_offd; - P_offd_j[jj_counter_offd] = i1; - P_offd_data[jj_counter_offd] = zero; - jj_counter_offd++; + P_marker[i1] = jj_counter; + P_diag_j[jj_counter] = fine_to_coarse[i1]; + P_diag_data[jj_counter] = zero; + jj_counter++; } - } - } - } - - jj_end_row_offd = jj_counter_offd; - - diagonal = A_diag_data[A_diag_i[i]]; - - /* Loop over ith row of A. First, the diagonal part of A */ - - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - i1 = A_diag_j[jj]; + } + jj_end_row = jj_counter; - /*-------------------------------------------------------------- - * Case 1: neighbor i1 is a C-point and strongly influences i, - * accumulate a_{i,i1} into the interpolation weight. - *--------------------------------------------------------------*/ + /* Off-Diagonal part of P */ + P_offd_i[i] = jj_counter_offd; + jj_begin_row_offd = jj_counter_offd; - if (P_marker[i1] >= jj_begin_row) - { - P_diag_data[P_marker[i1]] += A_diag_data[jj]; - } - /*-------------------------------------------------------------- - * Case 2: neighbor i1 is an F-point and influences i, - * distribute a_{i,i1} to C-points that strongly influence i. - * Note: currently no distribution to the diagonal in this case. - *--------------------------------------------------------------*/ - - else + if (num_procs > 1) { - sum = zero; - - /*----------------------------------------------------------- - * Loop over row of A for point i1 and calculate the sum - * of the connections to c-points that strongly influence i. - *-----------------------------------------------------------*/ - sgn = 1; - if (A_diag_data[A_diag_i[i1]] < 0) sgn = -1; - /* Diagonal block part of row i1 */ - for (jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) + if (col_offd_S_to_A) { - i2 = A_diag_j[jj1]; - if (P_marker[i2] >= jj_begin_row && - (sgn*A_diag_data[jj1]) < 0) + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { - sum += A_diag_data[jj1]; - } - } + i1 = col_offd_S_to_A[S_offd_j[jj]]; - /* Off-Diagonal block part of row i1 */ - if (num_procs > 1) - { - for (jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) - { - i2 = A_offd_j[jj1]; - if (P_marker_offd[i2] >= jj_begin_row_offd - && (sgn*A_offd_data[jj1]) < 0) + /*----------------------------------------------------------- + * If neighbor i1 is a C-point, set column number in P_offd_j + * and initialize interpolation weight to zero. + *-----------------------------------------------------------*/ + + if (CF_marker_offd[i1] >= 0) { - sum += A_offd_data[jj1]; + P_marker_offd[i1] = jj_counter_offd; + P_offd_j[jj_counter_offd] = i1; + P_offd_data[jj_counter_offd] = zero; + jj_counter_offd++; } } - } - - if (sum != 0) - { - distribute = A_diag_data[jj] / sum; - - /*----------------------------------------------------------- - * Loop over row of A for point i1 and do the distribution. - *-----------------------------------------------------------*/ - - /* Diagonal block part of row i1 */ - for (jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) - { - i2 = A_diag_j[jj1]; - if (P_marker[i2] >= jj_begin_row - && (sgn*A_diag_data[jj1]) < 0) - { - P_diag_data[P_marker[i2]] - += distribute * A_diag_data[jj1]; - } } - - /* Off-Diagonal block part of row i1 */ - if (num_procs > 1) + else { - for (jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { - i2 = A_offd_j[jj1]; - if (P_marker_offd[i2] >= jj_begin_row_offd - && (sgn*A_offd_data[jj1]) < 0) + i1 = S_offd_j[jj]; + + /*----------------------------------------------------------- + * If neighbor i1 is a C-point, set column number in P_offd_j + * and initialize interpolation weight to zero. + *-----------------------------------------------------------*/ + + if (CF_marker_offd[i1] >= 0) { - P_offd_data[P_marker_offd[i2]] - += distribute * A_offd_data[jj1]; + P_marker_offd[i1] = jj_counter_offd; + P_offd_j[jj_counter_offd] = i1; + P_offd_data[jj_counter_offd] = zero; + jj_counter_offd++; } } } - } - else - { - if (num_functions == 1 || dof_func[i] == dof_func[i1]) - diagonal += A_diag_data[jj]; - } } - - } - - /*---------------------------------------------------------------- - * Still looping over ith row of A. Next, loop over the - * off-diagonal part of A - *---------------------------------------------------------------*/ + jj_end_row_offd = jj_counter_offd; - if (num_procs > 1) - { - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + diagonal = A_diag_data[A_diag_i[i]]; + + + /* Loop over ith row of A. First, the diagonal part of A */ + + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) { - i1 = A_offd_j[jj]; + i1 = A_diag_j[jj]; - /*-------------------------------------------------------------- - * Case 1: neighbor i1 is a C-point and strongly influences i, - * accumulate a_{i,i1} into the interpolation weight. - *--------------------------------------------------------------*/ + /*-------------------------------------------------------------- + * Case 1: neighbor i1 is a C-point and strongly influences i, + * accumulate a_{i,i1} into the interpolation weight. + *--------------------------------------------------------------*/ - if (P_marker_offd[i1] >= jj_begin_row_offd) + if (P_marker[i1] >= jj_begin_row) { - P_offd_data[P_marker_offd[i1]] += A_offd_data[jj]; + P_diag_data[P_marker[i1]] += A_diag_data[jj]; } - /*------------------------------------------------------------ + /*-------------------------------------------------------------- * Case 2: neighbor i1 is an F-point and influences i, - * distribute a_{i,i1} to C-points that strongly infuence i. + * distribute a_{i,i1} to C-points that strongly influence i. * Note: currently no distribution to the diagonal in this case. - *-----------------------------------------------------------*/ - - else + *--------------------------------------------------------------*/ + + else { sum = zero; - - /*--------------------------------------------------------- - * Loop over row of A_ext for point i1 and calculate the sum - * of the connections to c-points that strongly influence i. - *---------------------------------------------------------*/ - - /* find row number */ - c_num = A_offd_j[jj]; - - sgn = 1; - if (A_ext_data[A_ext_i[c_num]] < 0) sgn = -1; - for (jj1 = A_ext_i[c_num]; jj1 < A_ext_i[c_num+1]; jj1++) - { - i2 = (HYPRE_Int)A_ext_j[jj1]; - - if (i2 > -1) - { - /* in the diagonal block */ - if (P_marker[i2] >= jj_begin_row - && (sgn*A_ext_data[jj1]) < 0) - { - sum += A_ext_data[jj1]; - } + + /*----------------------------------------------------------- + * Loop over row of A for point i1 and calculate the sum + * of the connections to c-points that strongly influence i. + *-----------------------------------------------------------*/ + sgn = 1; + if (A_diag_data[A_diag_i[i1]] < 0) sgn = -1; + /* Diagonal block part of row i1 */ + for (jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) + { + i2 = A_diag_j[jj1]; + if (P_marker[i2] >= jj_begin_row && + (sgn*A_diag_data[jj1]) < 0) + { + sum += A_diag_data[jj1]; } - else - { - /* in the off_diagonal block */ - if (P_marker_offd[-i2-1] >= jj_begin_row_offd - && (sgn*A_ext_data[jj1]) < 0) + } + + /* Off-Diagonal block part of row i1 */ + if (num_procs > 1) + { + for (jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) + { + i2 = A_offd_j[jj1]; + if (P_marker_offd[i2] >= jj_begin_row_offd + && (sgn*A_offd_data[jj1]) < 0) { - sum += A_ext_data[jj1]; + sum += A_offd_data[jj1]; } - } - } if (sum != 0) - { - distribute = A_offd_data[jj] / sum; - /*--------------------------------------------------------- - * Loop over row of A_ext for point i1 and do - * the distribution. - *--------------------------------------------------------*/ - - /* Diagonal block part of row i1 */ - - for (jj1 = A_ext_i[c_num]; jj1 < A_ext_i[c_num+1]; jj1++) { - i2 = (HYPRE_Int)A_ext_j[jj1]; + distribute = A_diag_data[jj] / sum; - if (i2 > -1) /* in the diagonal block */ + /*----------------------------------------------------------- + * Loop over row of A for point i1 and do the distribution. + *-----------------------------------------------------------*/ + + /* Diagonal block part of row i1 */ + for (jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) { + i2 = A_diag_j[jj1]; if (P_marker[i2] >= jj_begin_row - && (sgn*A_ext_data[jj1]) < 0) + && (sgn*A_diag_data[jj1]) < 0) { P_diag_data[P_marker[i2]] - += distribute * A_ext_data[jj1]; + += distribute * A_diag_data[jj1]; } } - else + + /* Off-Diagonal block part of row i1 */ + if (num_procs > 1) { - /* in the off_diagonal block */ - if (P_marker_offd[-i2-1] >= jj_begin_row_offd - && (sgn*A_ext_data[jj1]) < 0) - P_offd_data[P_marker_offd[-i2-1]] - += distribute * A_ext_data[jj1]; - } - } - } - else + for (jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) + { + i2 = A_offd_j[jj1]; + if (P_marker_offd[i2] >= jj_begin_row_offd + && (sgn*A_offd_data[jj1]) < 0) + { + P_offd_data[P_marker_offd[i2]] + += distribute * A_offd_data[jj1]; + } + } + } + } + else { - if (num_functions == 1 || dof_func[i] == dof_func_offd[i1]) - diagonal += A_offd_data[jj]; + if (num_functions == 1 || dof_func[i] == dof_func[i1]) + diagonal += A_diag_data[jj]; } } - + } - } - /*----------------------------------------------------------------- - * Set interpolation weight by dividing by the diagonal. - *-----------------------------------------------------------------*/ - for (jj = jj_begin_row; jj < jj_end_row; jj++) - { - P_diag_data[jj] /= -diagonal; - } + /*---------------------------------------------------------------- + * Still looping over ith row of A. Next, loop over the + * off-diagonal part of A + *---------------------------------------------------------------*/ - for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) - { - P_offd_data[jj] /= -diagonal; + if (num_procs > 1) + { + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + i1 = A_offd_j[jj]; + + /*-------------------------------------------------------------- + * Case 1: neighbor i1 is a C-point and strongly influences i, + * accumulate a_{i,i1} into the interpolation weight. + *--------------------------------------------------------------*/ + + if (P_marker_offd[i1] >= jj_begin_row_offd) + { + P_offd_data[P_marker_offd[i1]] += A_offd_data[jj]; + } + + /*------------------------------------------------------------ + * Case 2: neighbor i1 is an F-point and influences i, + * distribute a_{i,i1} to C-points that strongly infuence i. + * Note: currently no distribution to the diagonal in this case. + *-----------------------------------------------------------*/ + + else + { + sum = zero; + + /*--------------------------------------------------------- + * Loop over row of A_ext for point i1 and calculate the sum + * of the connections to c-points that strongly influence i. + *---------------------------------------------------------*/ + + /* find row number */ + c_num = A_offd_j[jj]; + + sgn = 1; + if (A_ext_data[A_ext_i[c_num]] < 0) sgn = -1; + for (jj1 = A_ext_i[c_num]; jj1 < A_ext_i[c_num+1]; jj1++) + { + i2 = (HYPRE_Int)A_ext_j[jj1]; + + if (i2 > -1) + { + /* in the diagonal block */ + if (P_marker[i2] >= jj_begin_row + && (sgn*A_ext_data[jj1]) < 0) + { + sum += A_ext_data[jj1]; + } + } + else + { + /* in the off_diagonal block */ + if (P_marker_offd[-i2-1] >= jj_begin_row_offd + && (sgn*A_ext_data[jj1]) < 0) + { + sum += A_ext_data[jj1]; + } + + } + + } + + if (sum != 0) + { + distribute = A_offd_data[jj] / sum; + /*--------------------------------------------------------- + * Loop over row of A_ext for point i1 and do + * the distribution. + *--------------------------------------------------------*/ + + /* Diagonal block part of row i1 */ + for (jj1 = A_ext_i[c_num]; jj1 < A_ext_i[c_num+1]; jj1++) + { + i2 = (HYPRE_Int)A_ext_j[jj1]; + + if (i2 > -1) /* in the diagonal block */ + { + if (P_marker[i2] >= jj_begin_row + && (sgn*A_ext_data[jj1]) < 0) + { + P_diag_data[P_marker[i2]] + += distribute * A_ext_data[jj1]; + } + } + else + { + /* in the off_diagonal block */ + if (P_marker_offd[-i2-1] >= jj_begin_row_offd + && (sgn*A_ext_data[jj1]) < 0) + P_offd_data[P_marker_offd[-i2-1]] + += distribute * A_ext_data[jj1]; + } + } + } + else + { + if (num_functions == 1 || dof_func[i] == dof_func_offd[i1]) + diagonal += A_offd_data[jj]; + } + } + } + } + + /*----------------------------------------------------------------- + * Set interpolation weight by dividing by the diagonal. + *-----------------------------------------------------------------*/ + + for (jj = jj_begin_row; jj < jj_end_row; jj++) + { + P_diag_data[jj] /= -diagonal; + } + + for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) + { + P_offd_data[jj] /= -diagonal; + } } - - } - P_offd_i[i+1] = jj_counter_offd; - } - hypre_TFree(P_marker, HYPRE_MEMORY_HOST); - hypre_TFree(P_marker_offd, HYPRE_MEMORY_HOST); + P_offd_i[i+1] = jj_counter_offd; + } + hypre_TFree(P_marker, HYPRE_MEMORY_HOST); + hypre_TFree(P_marker_offd, HYPRE_MEMORY_HOST); } - + P = hypre_ParCSRMatrixCreate(comm, - hypre_ParCSRMatrixGlobalNumRows(A), - total_global_cpts, - hypre_ParCSRMatrixColStarts(A), - num_cpts_global, - 0, - P_diag_i[n_fine], - P_offd_i[n_fine]); - - + hypre_ParCSRMatrixGlobalNumRows(A), + total_global_cpts, + hypre_ParCSRMatrixColStarts(A), + num_cpts_global, + 0, + P_diag_i[n_fine], + P_offd_i[n_fine]); + + P_diag = hypre_ParCSRMatrixDiag(P); hypre_CSRMatrixData(P_diag) = P_diag_data; hypre_CSRMatrixI(P_diag) = P_diag_i; @@ -1894,7 +1882,7 @@ #endif for (i=0; i < num_cols_A_offd; i++) P_marker[i] = 0; - + num_cols_P_offd = 0; for (i=0; i < P_offd_size; i++) { @@ -1905,10 +1893,10 @@ P_marker[index] = 1; } } - + col_map_offd_P = hypre_CTAlloc(HYPRE_BigInt, num_cols_P_offd, HYPRE_MEMORY_HOST); tmp_map_offd = hypre_CTAlloc(HYPRE_Int, num_cols_P_offd, HYPRE_MEMORY_HOST); - + index = 0; for (i=0; i < num_cols_P_offd; i++) { @@ -1920,20 +1908,20 @@ #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif for (i=0; i < P_offd_size; i++) - P_offd_j[i] = hypre_BinarySearch(tmp_map_offd, - P_offd_j[i], - num_cols_P_offd); - hypre_TFree(P_marker, HYPRE_MEMORY_HOST); + P_offd_j[i] = hypre_BinarySearch(tmp_map_offd, + P_offd_j[i], + num_cols_P_offd); + hypre_TFree(P_marker, HYPRE_MEMORY_HOST); } for (i=0; i < n_fine; i++) if (CF_marker[i] == -3) CF_marker[i] = -1; if (num_cols_P_offd) - { - hypre_ParCSRMatrixColMapOffd(P) = col_map_offd_P; - hypre_CSRMatrixNumCols(P_offd) = num_cols_P_offd; - } + { + hypre_ParCSRMatrixColMapOffd(P) = col_map_offd_P; + hypre_CSRMatrixNumCols(P_offd) = num_cols_P_offd; + } hypre_GetCommPkgRTFromCommPkgA(P,A,fine_to_coarse, tmp_map_offd); @@ -1948,19 +1936,21 @@ hypre_TFree(jj_count, HYPRE_MEMORY_HOST); hypre_TFree(jj_count_offd, HYPRE_MEMORY_HOST); - if (num_procs > 1) hypre_CSRMatrixDestroy(A_ext); + if (num_procs > 1) + { + hypre_CSRMatrixDestroy(A_ext); + } - return hypre_error_flag; + return hypre_error_flag; +} -} - /*--------------------------------------------------------------------------- * hypre_BoomerAMGBuildDirInterp *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_BoomerAMGBuildDirInterp( hypre_ParCSRMatrix *A, +hypre_BoomerAMGBuildDirInterpHost( hypre_ParCSRMatrix *A, HYPRE_Int *CF_marker, hypre_ParCSRMatrix *S, HYPRE_BigInt *num_cpts_global, @@ -1968,12 +1958,12 @@ HYPRE_Int *dof_func, HYPRE_Int debug_flag, HYPRE_Real trunc_factor, - HYPRE_Int max_elmts, - HYPRE_Int *col_offd_S_to_A, + HYPRE_Int max_elmts, + HYPRE_Int *col_offd_S_to_A, hypre_ParCSRMatrix **P_ptr) { - MPI_Comm comm = hypre_ParCSRMatrixComm(A); + MPI_Comm comm = hypre_ParCSRMatrixComm(A); hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); hypre_ParCSRCommHandle *comm_handle; @@ -1982,7 +1972,7 @@ HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); - hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); HYPRE_Real *A_offd_data = hypre_CSRMatrixData(A_offd); HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); @@ -1992,19 +1982,19 @@ HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); - hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); + hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); HYPRE_Int *S_offd_j = hypre_CSRMatrixJ(S_offd); hypre_ParCSRMatrix *P; - HYPRE_BigInt *col_map_offd_P; - HYPRE_Int *tmp_map_offd = NULL; + HYPRE_BigInt *col_map_offd_P; + HYPRE_Int *tmp_map_offd = NULL; HYPRE_Int *CF_marker_offd = NULL; HYPRE_Int *dof_func_offd = NULL; hypre_CSRMatrix *P_diag; - hypre_CSRMatrix *P_offd; + hypre_CSRMatrix *P_offd; HYPRE_Real *P_diag_data; HYPRE_Int *P_diag_i; @@ -2014,12 +2004,12 @@ HYPRE_Int *P_offd_j; HYPRE_Int P_diag_size, P_offd_size; - + HYPRE_Int jj_counter,jj_counter_offd; HYPRE_Int *jj_count, *jj_count_offd; HYPRE_Int jj_begin_row,jj_begin_row_offd; HYPRE_Int jj_end_row,jj_end_row_offd; - + HYPRE_Int start_indexing = 0; /* start indexing for P_data at 0 */ HYPRE_Int n_fine = hypre_CSRMatrixNumRows(A_diag); @@ -2034,16 +2024,16 @@ HYPRE_Int i,i1; HYPRE_Int j,jl,jj; HYPRE_Int start; - + HYPRE_Real diagonal; HYPRE_Real sum_N_pos, sum_P_pos; HYPRE_Real sum_N_neg, sum_P_neg; HYPRE_Real alfa = 1.0; HYPRE_Real beta = 1.0; - + HYPRE_Real zero = 0.0; HYPRE_Real one = 1.0; - + HYPRE_Int my_id; HYPRE_Int num_procs; HYPRE_Int num_threads; @@ -2054,7 +2044,7 @@ HYPRE_Real wall_time; /* for debugging instrumentation */ - hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_size(comm, &num_procs); hypre_MPI_Comm_rank(comm,&my_id); num_threads = hypre_NumThreads(); @@ -2075,53 +2065,53 @@ if (num_cols_A_offd) CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); if (num_functions > 1 && num_cols_A_offd) - dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); + dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); if (!comm_pkg) { - hypre_MatvecCommPkgCreate(A); - comm_pkg = hypre_ParCSRMatrixCommPkg(A); + hypre_MatvecCommPkgCreate(A); + comm_pkg = hypre_ParCSRMatrixCommPkg(A); } num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, - num_sends), HYPRE_MEMORY_HOST); + int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, + num_sends), HYPRE_MEMORY_HOST); index = 0; for (i = 0; i < num_sends; i++) { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, - CF_marker_offd); + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + int_buf_data[index++] + = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } - hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, + CF_marker_offd); + + hypre_ParCSRCommHandleDestroy(comm_handle); if (num_functions > 1) { index = 0; for (i = 0; i < num_sends; i++) { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = dof_func[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, - dof_func_offd); + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + int_buf_data[index++] + = dof_func[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } - hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, + dof_func_offd); + + hypre_ParCSRCommHandleDestroy(comm_handle); } if (debug_flag==4) { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Interp: Comm 1 CF_marker = %f\n", - my_id, wall_time); + my_id, wall_time); fflush(NULL); } @@ -2145,87 +2135,87 @@ jj_counter = start_indexing; jj_counter_offd = start_indexing; - + /*----------------------------------------------------------------------- * Loop over fine grid. *-----------------------------------------------------------------------*/ -/* RDF: this looks a little tricky, but doable */ + /* RDF: this looks a little tricky, but doable */ #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,j,i1,jj,ns,ne,size,rest) HYPRE_SMP_SCHEDULE #endif for (j = 0; j < num_threads; j++) { - size = n_fine/num_threads; - rest = n_fine - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) - { - - /*-------------------------------------------------------------------- - * If i is a C-point, interpolation is the identity. Also set up - * mapping vector. - *--------------------------------------------------------------------*/ - - if (CF_marker[i] >= 0) + size = n_fine/num_threads; + rest = n_fine - size*num_threads; + if (j < rest) { - jj_count[j]++; - fine_to_coarse[i] = coarse_counter[j]; - coarse_counter[j]++; + ns = j*size+j; + ne = (j+1)*size+j+1; } - - /*-------------------------------------------------------------------- - * If i is an F-point, interpolation is from the C-points that - * strongly influence i. - *--------------------------------------------------------------------*/ - else { - for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) + { + + /*-------------------------------------------------------------------- + * If i is a C-point, interpolation is the identity. Also set up + * mapping vector. + *--------------------------------------------------------------------*/ + + if (CF_marker[i] >= 0) { - i1 = S_diag_j[jj]; - if (CF_marker[i1] > 0) - { - jj_count[j]++; - } + jj_count[j]++; + fine_to_coarse[i] = coarse_counter[j]; + coarse_counter[j]++; } - if (num_procs > 1) + /*-------------------------------------------------------------------- + * If i is an F-point, interpolation is from the C-points that + * strongly influence i. + *--------------------------------------------------------------------*/ + + else { - if (col_offd_S_to_A) - { - for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) { - i1 = col_offd_S_to_A[S_offd_j[jj]]; - if (CF_marker_offd[i1] > 0) + i1 = S_diag_j[jj]; + if (CF_marker[i1] > 0) { - jj_count_offd[j]++; + jj_count[j]++; } } - } - else - { - for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + + if (num_procs > 1) { - i1 = S_offd_j[jj]; - if (CF_marker_offd[i1] > 0) + if (col_offd_S_to_A) { - jj_count_offd[j]++; + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + { + i1 = col_offd_S_to_A[S_offd_j[jj]]; + if (CF_marker_offd[i1] > 0) + { + jj_count_offd[j]++; + } + } + } + else + { + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + { + i1 = S_offd_j[jj]; + if (CF_marker_offd[i1] > 0) + { + jj_count_offd[j]++; + } + } } } - } } } - } } /*----------------------------------------------------------------------- @@ -2244,18 +2234,18 @@ P_diag_size = jj_counter; - P_diag_i = hypre_CTAlloc(HYPRE_Int, n_fine+1, HYPRE_MEMORY_HOST); - P_diag_j = hypre_CTAlloc(HYPRE_Int, P_diag_size, HYPRE_MEMORY_HOST); - P_diag_data = hypre_CTAlloc(HYPRE_Real, P_diag_size, HYPRE_MEMORY_HOST); + P_diag_i = hypre_CTAlloc(HYPRE_Int, n_fine+1, HYPRE_MEMORY_SHARED); + P_diag_j = hypre_CTAlloc(HYPRE_Int, P_diag_size, HYPRE_MEMORY_SHARED); + P_diag_data = hypre_CTAlloc(HYPRE_Real, P_diag_size, HYPRE_MEMORY_SHARED); - P_diag_i[n_fine] = jj_counter; + P_diag_i[n_fine] = jj_counter; P_offd_size = jj_counter_offd; - P_offd_i = hypre_CTAlloc(HYPRE_Int, n_fine+1, HYPRE_MEMORY_HOST); - P_offd_j = hypre_CTAlloc(HYPRE_Int, P_offd_size, HYPRE_MEMORY_HOST); - P_offd_data = hypre_CTAlloc(HYPRE_Real, P_offd_size, HYPRE_MEMORY_HOST); + P_offd_i = hypre_CTAlloc(HYPRE_Int, n_fine+1, HYPRE_MEMORY_SHARED); + P_offd_j = hypre_CTAlloc(HYPRE_Int, P_offd_size, HYPRE_MEMORY_SHARED); + P_offd_data = hypre_CTAlloc(HYPRE_Real, P_offd_size, HYPRE_MEMORY_SHARED); /*----------------------------------------------------------------------- * Intialize some stuff. @@ -2268,320 +2258,321 @@ { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Interp: Internal work 1 = %f\n", - my_id, wall_time); + my_id, wall_time); fflush(NULL); } /*----------------------------------------------------------------------- * Send and receive fine_to_coarse info. - *-----------------------------------------------------------------------*/ + *-----------------------------------------------------------------------*/ if (debug_flag==4) wall_time = time_getWallclockSeconds(); - //fine_to_coarse_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); + //fine_to_coarse_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,j,ns,ne,size,rest,coarse_shift) HYPRE_SMP_SCHEDULE #endif for (j = 0; j < num_threads; j++) { - coarse_shift = 0; - if (j > 0) coarse_shift = coarse_counter[j-1]; - size = n_fine/num_threads; - rest = n_fine - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) - fine_to_coarse[i] += coarse_shift; + coarse_shift = 0; + if (j > 0) coarse_shift = coarse_counter[j-1]; + size = n_fine/num_threads; + rest = n_fine - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) + { + fine_to_coarse[i] += coarse_shift; + } } /*index = 0; - for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = fine_to_coarse[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, - fine_to_coarse_offd); + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + int_buf_data[index++] + = fine_to_coarse[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } - hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, + fine_to_coarse_offd); - if (debug_flag==4) - { - wall_time = time_getWallclockSeconds() - wall_time; - hypre_printf("Proc = %d Interp: Comm 4 FineToCoarse = %f\n", - my_id, wall_time); - fflush(NULL); - }*/ + hypre_ParCSRCommHandleDestroy(comm_handle); + + if (debug_flag==4) + { + wall_time = time_getWallclockSeconds() - wall_time; + hypre_printf("Proc = %d Interp: Comm 4 FineToCoarse = %f\n", + my_id, wall_time); + fflush(NULL); + }*/ if (debug_flag==4) wall_time = time_getWallclockSeconds(); -/*#ifdef HYPRE_USING_OPENMP + /*#ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n_fine; i++) fine_to_coarse[i] -= my_first_cpt;*/ +for (i = 0; i < n_fine; i++) fine_to_coarse[i] -= my_first_cpt;*/ /*----------------------------------------------------------------------- * Loop over fine grid points. *-----------------------------------------------------------------------*/ - + #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,j,jl,i1,jj,ns,ne,size,rest,diagonal,jj_counter,jj_counter_offd,jj_begin_row,jj_end_row,jj_begin_row_offd,jj_end_row_offd,sum_P_pos,sum_P_neg,sum_N_pos,sum_N_neg,alfa,beta) HYPRE_SMP_SCHEDULE #endif for (jl = 0; jl < num_threads; jl++) { - HYPRE_Int *P_marker, *P_marker_offd; + HYPRE_Int *P_marker, *P_marker_offd; - size = n_fine/num_threads; - rest = n_fine - size*num_threads; - if (jl < rest) - { - ns = jl*size+jl; - ne = (jl+1)*size+jl+1; - } - else - { - ns = jl*size+rest; - ne = (jl+1)*size+rest; - } - jj_counter = 0; - if (jl > 0) jj_counter = jj_count[jl-1]; - jj_counter_offd = 0; - if (jl > 0) jj_counter_offd = jj_count_offd[jl-1]; - - P_marker = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_HOST); - if (num_cols_A_offd) - P_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); - else - P_marker_offd = NULL; - - for (i = 0; i < n_fine; i++) - { - P_marker[i] = -1; - } - for (i = 0; i < num_cols_A_offd; i++) - { - P_marker_offd[i] = -1; - } - - for (i = ns; i < ne; i++) - { - - /*-------------------------------------------------------------------- - * If i is a c-point, interpolation is the identity. - *--------------------------------------------------------------------*/ - - if (CF_marker[i] >= 0) + size = n_fine/num_threads; + rest = n_fine - size*num_threads; + if (jl < rest) { - P_diag_i[i] = jj_counter; - P_diag_j[jj_counter] = fine_to_coarse[i]; - P_diag_data[jj_counter] = one; - jj_counter++; + ns = jl*size+jl; + ne = (jl+1)*size+jl+1; } - - /*-------------------------------------------------------------------- - * If i is an F-point, build interpolation. - *--------------------------------------------------------------------*/ - else - { - /* Diagonal part of P */ - P_diag_i[i] = jj_counter; - jj_begin_row = jj_counter; + { + ns = jl*size+rest; + ne = (jl+1)*size+rest; + } + jj_counter = 0; + if (jl > 0) jj_counter = jj_count[jl-1]; + jj_counter_offd = 0; + if (jl > 0) jj_counter_offd = jj_count_offd[jl-1]; + + P_marker = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_HOST); + if (num_cols_A_offd) + P_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); + else + P_marker_offd = NULL; - for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) - { - i1 = S_diag_j[jj]; + for (i = 0; i < n_fine; i++) + { + P_marker[i] = -1; + } + for (i = 0; i < num_cols_A_offd; i++) + { + P_marker_offd[i] = -1; + } - /*-------------------------------------------------------------- - * If neighbor i1 is a C-point, set column number in P_diag_j - * and initialize interpolation weight to zero. - *--------------------------------------------------------------*/ + for (i = ns; i < ne; i++) + { - if (CF_marker[i1] >= 0) - { - P_marker[i1] = jj_counter; - P_diag_j[jj_counter] = fine_to_coarse[i1]; - P_diag_data[jj_counter] = zero; - jj_counter++; - } + /*-------------------------------------------------------------------- + * If i is a c-point, interpolation is the identity. + *--------------------------------------------------------------------*/ + if (CF_marker[i] >= 0) + { + P_diag_i[i] = jj_counter; + P_diag_j[jj_counter] = fine_to_coarse[i]; + P_diag_data[jj_counter] = one; + jj_counter++; } - jj_end_row = jj_counter; - - /* Off-Diagonal part of P */ - P_offd_i[i] = jj_counter_offd; - jj_begin_row_offd = jj_counter_offd; + /*-------------------------------------------------------------------- + * If i is an F-point, build interpolation. + *--------------------------------------------------------------------*/ - if (num_procs > 1) + else { - if (col_offd_S_to_A) - { - for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + /* Diagonal part of P */ + P_diag_i[i] = jj_counter; + jj_begin_row = jj_counter; + + for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) { - i1 = col_offd_S_to_A[S_offd_j[jj]]; + i1 = S_diag_j[jj]; - /*----------------------------------------------------------- - * If neighbor i1 is a C-point, set column number in P_offd_j + /*-------------------------------------------------------------- + * If neighbor i1 is a C-point, set column number in P_diag_j * and initialize interpolation weight to zero. - *-----------------------------------------------------------*/ + *--------------------------------------------------------------*/ - if (CF_marker_offd[i1] >= 0) + if (CF_marker[i1] >= 0) { - P_marker_offd[i1] = jj_counter_offd; - P_offd_j[jj_counter_offd] = i1; - P_offd_data[jj_counter_offd] = zero; - jj_counter_offd++; + P_marker[i1] = jj_counter; + P_diag_j[jj_counter] = fine_to_coarse[i1]; + P_diag_data[jj_counter] = zero; + jj_counter++; } } - } - else - { - for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) - { - i1 = S_offd_j[jj]; + jj_end_row = jj_counter; - /*----------------------------------------------------------- - * If neighbor i1 is a C-point, set column number in P_offd_j - * and initialize interpolation weight to zero. - *-----------------------------------------------------------*/ + /* Off-Diagonal part of P */ + P_offd_i[i] = jj_counter_offd; + jj_begin_row_offd = jj_counter_offd; - if (CF_marker_offd[i1] >= 0) + + if (num_procs > 1) + { + if (col_offd_S_to_A) { - P_marker_offd[i1] = jj_counter_offd; - P_offd_j[jj_counter_offd] = i1; - P_offd_data[jj_counter_offd] = zero; - jj_counter_offd++; + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + { + i1 = col_offd_S_to_A[S_offd_j[jj]]; + + /*----------------------------------------------------------- + * If neighbor i1 is a C-point, set column number in P_offd_j + * and initialize interpolation weight to zero. + *-----------------------------------------------------------*/ + + if (CF_marker_offd[i1] >= 0) + { + P_marker_offd[i1] = jj_counter_offd; + P_offd_j[jj_counter_offd] = i1; + P_offd_data[jj_counter_offd] = zero; + jj_counter_offd++; + } + + } } + else + { + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + { + i1 = S_offd_j[jj]; + /*----------------------------------------------------------- + * If neighbor i1 is a C-point, set column number in P_offd_j + * and initialize interpolation weight to zero. + *-----------------------------------------------------------*/ + + if (CF_marker_offd[i1] >= 0) + { + P_marker_offd[i1] = jj_counter_offd; + P_offd_j[jj_counter_offd] = i1; + P_offd_data[jj_counter_offd] = zero; + jj_counter_offd++; + } + + } + } } - } - } - - jj_end_row_offd = jj_counter_offd; - - diagonal = A_diag_data[A_diag_i[i]]; - - /* Loop over ith row of A. First, the diagonal part of A */ - sum_N_pos = 0; - sum_N_neg = 0; - sum_P_pos = 0; - sum_P_neg = 0; + jj_end_row_offd = jj_counter_offd; + + diagonal = A_diag_data[A_diag_i[i]]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - i1 = A_diag_j[jj]; - if (num_functions == 1 || dof_func[i1] == dof_func[i]) - { - if (A_diag_data[jj] > 0) - sum_N_pos += A_diag_data[jj]; - else - sum_N_neg += A_diag_data[jj]; - } - /*-------------------------------------------------------------- - * Case 1: neighbor i1 is a C-point and strongly influences i, - * accumulate a_{i,i1} into the interpolation weight. - *--------------------------------------------------------------*/ - if (P_marker[i1] >= jj_begin_row) + /* Loop over ith row of A. First, the diagonal part of A */ + sum_N_pos = 0; + sum_N_neg = 0; + sum_P_pos = 0; + sum_P_neg = 0; + + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) { - P_diag_data[P_marker[i1]] += A_diag_data[jj]; - if (A_diag_data[jj] > 0) - sum_P_pos += A_diag_data[jj]; - else - sum_P_neg += A_diag_data[jj]; + i1 = A_diag_j[jj]; + if (num_functions == 1 || dof_func[i1] == dof_func[i]) + { + if (A_diag_data[jj] > 0) + sum_N_pos += A_diag_data[jj]; + else + sum_N_neg += A_diag_data[jj]; + } + /*-------------------------------------------------------------- + * Case 1: neighbor i1 is a C-point and strongly influences i, + * accumulate a_{i,i1} into the interpolation weight. + *--------------------------------------------------------------*/ + + if (P_marker[i1] >= jj_begin_row) + { + P_diag_data[P_marker[i1]] += A_diag_data[jj]; + if (A_diag_data[jj] > 0) + sum_P_pos += A_diag_data[jj]; + else + sum_P_neg += A_diag_data[jj]; + } } - } - - /*---------------------------------------------------------------- - * Still looping over ith row of A. Next, loop over the - * off-diagonal part of A - *---------------------------------------------------------------*/ + /*---------------------------------------------------------------- + * Still looping over ith row of A. Next, loop over the + * off-diagonal part of A + *---------------------------------------------------------------*/ - if (num_procs > 1) - { - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + if (num_procs > 1) { - i1 = A_offd_j[jj]; - if (num_functions == 1 || dof_func_offd[i1] == dof_func[i]) - { - if (A_offd_data[jj] > 0) - sum_N_pos += A_offd_data[jj]; - else - sum_N_neg += A_offd_data[jj]; - } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + i1 = A_offd_j[jj]; + if (num_functions == 1 || dof_func_offd[i1] == dof_func[i]) + { + if (A_offd_data[jj] > 0) + sum_N_pos += A_offd_data[jj]; + else + sum_N_neg += A_offd_data[jj]; + } - /*-------------------------------------------------------------- - * Case 1: neighbor i1 is a C-point and strongly influences i, - * accumulate a_{i,i1} into the interpolation weight. - *--------------------------------------------------------------*/ + /*-------------------------------------------------------------- + * Case 1: neighbor i1 is a C-point and strongly influences i, + * accumulate a_{i,i1} into the interpolation weight. + *--------------------------------------------------------------*/ + + if (P_marker_offd[i1] >= jj_begin_row_offd) + { + P_offd_data[P_marker_offd[i1]] += A_offd_data[jj]; + if (A_offd_data[jj] > 0) + sum_P_pos += A_offd_data[jj]; + else + sum_P_neg += A_offd_data[jj]; + } - if (P_marker_offd[i1] >= jj_begin_row_offd) - { - P_offd_data[P_marker_offd[i1]] += A_offd_data[jj]; - if (A_offd_data[jj] > 0) - sum_P_pos += A_offd_data[jj]; - else - sum_P_neg += A_offd_data[jj]; } + } + if (sum_P_neg) alfa = sum_N_neg/sum_P_neg/diagonal; + if (sum_P_pos) beta = sum_N_pos/sum_P_pos/diagonal; + + /*----------------------------------------------------------------- + * Set interpolation weight by dividing by the diagonal. + *-----------------------------------------------------------------*/ + for (jj = jj_begin_row; jj < jj_end_row; jj++) + { + if (P_diag_data[jj]> 0) + P_diag_data[jj] *= -beta; + else + P_diag_data[jj] *= -alfa; } - } - if (sum_P_neg) alfa = sum_N_neg/sum_P_neg/diagonal; - if (sum_P_pos) beta = sum_N_pos/sum_P_pos/diagonal; - /*----------------------------------------------------------------- - * Set interpolation weight by dividing by the diagonal. - *-----------------------------------------------------------------*/ + for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) + { + if (P_offd_data[jj]> 0) + P_offd_data[jj] *= -beta; + else + P_offd_data[jj] *= -alfa; + } - for (jj = jj_begin_row; jj < jj_end_row; jj++) - { - if (P_diag_data[jj]> 0) - P_diag_data[jj] *= -beta; - else - P_diag_data[jj] *= -alfa; } - for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) - { - if (P_offd_data[jj]> 0) - P_offd_data[jj] *= -beta; - else - P_offd_data[jj] *= -alfa; - } - + P_offd_i[i+1] = jj_counter_offd; } - - P_offd_i[i+1] = jj_counter_offd; - } - hypre_TFree(P_marker, HYPRE_MEMORY_HOST); - hypre_TFree(P_marker_offd, HYPRE_MEMORY_HOST); + hypre_TFree(P_marker, HYPRE_MEMORY_HOST); + hypre_TFree(P_marker_offd, HYPRE_MEMORY_HOST); } - + P = hypre_ParCSRMatrixCreate(comm, - hypre_ParCSRMatrixGlobalNumRows(A), - total_global_cpts, - hypre_ParCSRMatrixColStarts(A), - num_cpts_global, - 0, - P_diag_i[n_fine], - P_offd_i[n_fine]); - - + hypre_ParCSRMatrixGlobalNumRows(A), + total_global_cpts, + hypre_ParCSRMatrixColStarts(A), + num_cpts_global, + 0, + P_diag_i[n_fine], + P_offd_i[n_fine]); + + P_diag = hypre_ParCSRMatrixDiag(P); hypre_CSRMatrixData(P_diag) = P_diag_data; hypre_CSRMatrixI(P_diag) = P_diag_i; @@ -2617,7 +2608,7 @@ #endif for (i=0; i < num_cols_A_offd; i++) P_marker[i] = 0; - + num_cols_P_offd = 0; for (i=0; i < P_offd_size; i++) { @@ -2628,10 +2619,10 @@ P_marker[index] = 1; } } - + col_map_offd_P = hypre_CTAlloc(HYPRE_BigInt, num_cols_P_offd, HYPRE_MEMORY_HOST); tmp_map_offd = hypre_CTAlloc(HYPRE_Int, num_cols_P_offd, HYPRE_MEMORY_HOST); - + index = 0; for (i=0; i < num_cols_P_offd; i++) { @@ -2643,22 +2634,24 @@ #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif for (i=0; i < P_offd_size; i++) - P_offd_j[i] = hypre_BinarySearch(tmp_map_offd, - P_offd_j[i], - num_cols_P_offd); - hypre_TFree(P_marker, HYPRE_MEMORY_HOST); + { + P_offd_j[i] = hypre_BinarySearch(tmp_map_offd, + P_offd_j[i], + num_cols_P_offd); + } + hypre_TFree(P_marker, HYPRE_MEMORY_HOST); } for (i=0; i < n_fine; i++) if (CF_marker[i] == -3) CF_marker[i] = -1; if (num_cols_P_offd) - { - hypre_ParCSRMatrixColMapOffd(P) = col_map_offd_P; - hypre_CSRMatrixNumCols(P_offd) = num_cols_P_offd; - } + { + hypre_ParCSRMatrixColMapOffd(P) = col_map_offd_P; + hypre_CSRMatrixNumCols(P_offd) = num_cols_P_offd; + } - hypre_GetCommPkgRTFromCommPkgA(P, A, fine_to_coarse, tmp_map_offd); + hypre_GetCommPkgRTFromCommPkgA(P, A, fine_to_coarse, tmp_map_offd); *P_ptr = P; @@ -2671,15 +2664,61 @@ hypre_TFree(jj_count, HYPRE_MEMORY_HOST); hypre_TFree(jj_count_offd, HYPRE_MEMORY_HOST); - return hypre_error_flag; + return hypre_error_flag; +} + +HYPRE_Int +hypre_BoomerAMGBuildDirInterp( hypre_ParCSRMatrix *A, + HYPRE_Int *CF_marker, + hypre_ParCSRMatrix *S, + HYPRE_BigInt *num_cpts_global, + HYPRE_Int num_functions, + HYPRE_Int *dof_func, + HYPRE_Int debug_flag, + HYPRE_Real trunc_factor, + HYPRE_Int max_elmts, + HYPRE_Int *col_offd_S_to_A, + hypre_ParCSRMatrix **P_ptr) +{ +#if defined(HYPRE_USING_CUDA) + //hypre_SetExecPolicy(HYPRE_EXEC_DEVICE); +#endif + + HYPRE_Int exec = hypre_GetExecPolicy1( hypre_CSRMatrixMemoryLocation(hypre_ParCSRMatrixDiag(A)) ); + + hypre_assert(exec != HYPRE_EXEC_UNSET); + + HYPRE_Int ierr = 0; + + if (exec == HYPRE_EXEC_HOST) + { + /* printf(" dir interp Host\n"); */ + ierr = hypre_BoomerAMGBuildDirInterpHost(A,CF_marker,S,num_cpts_global,num_functions,dof_func, + debug_flag,trunc_factor,max_elmts,col_offd_S_to_A, P_ptr); + /* printf(" done dir interp Host\n");*/ + } +#if defined(HYPRE_USING_CUDA) + else + { + /* printf(" dir interp Device\n");*/ + ierr = hypre_BoomerAMGBuildDirInterpDevice(A,CF_marker,S,num_cpts_global,num_functions,dof_func, + debug_flag,trunc_factor,max_elmts,col_offd_S_to_A, P_ptr); + /* printf(" done dir interp Device\n");*/ + } +#endif + +#if defined(HYPRE_USING_CUDA) + //hypre_SetExecPolicy(HYPRE_EXEC_HOST); +#endif -} + return ierr; +} HYPRE_Int hypre_BoomerAMGInterpTruncation( hypre_ParCSRMatrix *P, - HYPRE_Real trunc_factor, - HYPRE_Int max_elmts) + HYPRE_Real trunc_factor, + HYPRE_Int max_elmts) { #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_INTERP_TRUNC] -= hypre_MPI_Wtime(); @@ -2718,10 +2757,13 @@ HYPRE_Real max_coef; HYPRE_Real row_sum; HYPRE_Real scale; - + + HYPRE_Int mem_loc_diag = hypre_CSRMatrixMemoryLocation(P_diag); + HYPRE_Int mem_loc_offd = hypre_CSRMatrixMemoryLocation(P_offd); + /* Threading variables. Entry i of num_lost_(offd_)per_thread holds the * number of dropped entries over thread i's row range. Cum_lost_per_thread - * will temporarily store the cumulative number of dropped entries up to + * will temporarily store the cumulative number of dropped entries up to * each thread. */ HYPRE_Int my_thread_num, num_threads, start, stop; HYPRE_Int * max_num_threads = hypre_CTAlloc(HYPRE_Int, 1, HYPRE_MEMORY_HOST); @@ -2734,60 +2776,67 @@ cum_lost_per_thread = hypre_CTAlloc(HYPRE_Int, max_num_threads[0], HYPRE_MEMORY_HOST); num_lost_per_thread = hypre_CTAlloc(HYPRE_Int, max_num_threads[0], HYPRE_MEMORY_HOST); num_lost_offd_per_thread = hypre_CTAlloc(HYPRE_Int, max_num_threads[0], HYPRE_MEMORY_HOST); - for(i=0; i < max_num_threads[0]; i++) + for (i=0; i < max_num_threads[0]; i++) { - num_lost_per_thread[i] = 0; - num_lost_offd_per_thread[i] = 0; + num_lost_per_thread[i] = 0; + num_lost_offd_per_thread[i] = 0; } #ifdef HYPRE_USING_OPENMP #pragma omp parallel private(i,my_thread_num,num_threads,max_coef,j,start_j,row_sum,scale,num_lost,now_checking,next_open,num_lost_offd,now_checking_offd,next_open_offd,start,stop,cnt_diag,cnt_offd,num_elmts,cnt) #endif - { - my_thread_num = hypre_GetThreadNum(); - num_threads = hypre_NumActiveThreads(); - - /* Compute each thread's range of rows to truncate and compress. Note, - * that i, j and data are all compressed as entries are dropped, but - * that the compression only occurs locally over each thread's row - * range. P_diag_i is only made globally consistent at the end of this - * routine. During the dropping phases, P_diag_i[stop] will point to - * the start of the next thread's row range. */ - - /* my row range */ - start = (n_fine/num_threads)*my_thread_num; - if (my_thread_num == num_threads-1) - { stop = n_fine; } - else - { stop = (n_fine/num_threads)*(my_thread_num+1); } - - - /* - * Truncate based on truncation tolerance - */ - if (trunc_factor > 0) - { - num_lost = 0; - num_lost_offd = 0; - - next_open = P_diag_i[start]; - now_checking = P_diag_i[start]; - next_open_offd = P_offd_i[start];; - now_checking_offd = P_offd_i[start];; + { + my_thread_num = hypre_GetThreadNum(); + num_threads = hypre_NumActiveThreads(); - for (i = start; i < stop; i++) - { + /* Compute each thread's range of rows to truncate and compress. Note, + * that i, j and data are all compressed as entries are dropped, but + * that the compression only occurs locally over each thread's row + * range. P_diag_i is only made globally consistent at the end of this + * routine. During the dropping phases, P_diag_i[stop] will point to + * the start of the next thread's row range. */ + + /* my row range */ + start = (n_fine/num_threads)*my_thread_num; + if (my_thread_num == num_threads-1) + { + stop = n_fine; + } + else + { + stop = (n_fine/num_threads)*(my_thread_num+1); + } + + /* + * Truncate based on truncation tolerance + */ + if (trunc_factor > 0) + { + num_lost = 0; + num_lost_offd = 0; + + next_open = P_diag_i[start]; + now_checking = P_diag_i[start]; + next_open_offd = P_offd_i[start];; + now_checking_offd = P_offd_i[start];; + + for (i = start; i < stop; i++) + { max_coef = 0; for (j = P_diag_i[i]; j < P_diag_i[i+1]; j++) - max_coef = (max_coef < fabs(P_diag_data[j])) ? - fabs(P_diag_data[j]) : max_coef; + { + max_coef = (max_coef < fabs(P_diag_data[j])) ? + fabs(P_diag_data[j]) : max_coef; + } for (j = P_offd_i[i]; j < P_offd_i[i+1]; j++) - max_coef = (max_coef < fabs(P_offd_data[j])) ? - fabs(P_offd_data[j]) : max_coef; + { + max_coef = (max_coef < fabs(P_offd_data[j])) ? + fabs(P_offd_data[j]) : max_coef; + } max_coef *= trunc_factor; start_j = P_diag_i[i]; - if (num_lost) P_diag_i[i] -= num_lost; + if (num_lost) P_diag_i[i] -= num_lost; row_sum = 0; scale = 0; for (j = start_j; j < P_diag_i[i+1]; j++) @@ -2833,81 +2882,88 @@ { if (scale != row_sum) { - scale = row_sum/scale; - for (j = P_diag_i[i]; j < (P_diag_i[i+1]-num_lost); j++) - P_diag_data[j] *= scale; - for (j = P_offd_i[i]; j < (P_offd_i[i+1]-num_lost_offd); j++) - P_offd_data[j] *= scale; - } - } - } /* end loop for (i = 0; i < n_fine; i++) */ - - /* store number of dropped elements and number of threads */ - if(my_thread_num == 0) - { max_num_threads[0] = num_threads; } - num_lost_per_thread[my_thread_num] = num_lost; - num_lost_offd_per_thread[my_thread_num] = num_lost_offd; - - } /* end if (trunc_factor > 0) */ - - - /* - * Truncate based on capping the nnz per row - * - */ - if (max_elmts > 0) - { - HYPRE_Int P_mxnum, cnt1, last_index, last_index_offd; - HYPRE_Int *P_aux_j; - HYPRE_Real *P_aux_data; - - /* find maximum row length locally over this row range */ - P_mxnum = 0; - for (i=start; i P_mxnum) P_mxnum = cnt1; - } - - /* Some rows exceed max_elmts, and require truncation. Essentially, - * each thread truncates and compresses its range of rows locally. */ - if (P_mxnum > max_elmts) - { - - num_lost = 0; - num_lost_offd = 0; - - /* two temporary arrays to hold row i for temporary operations */ - P_aux_j = hypre_CTAlloc(HYPRE_Int, P_mxnum, HYPRE_MEMORY_HOST); - P_aux_data = hypre_CTAlloc(HYPRE_Real, P_mxnum, HYPRE_MEMORY_HOST); - cnt_diag = P_diag_i[start]; - cnt_offd = P_offd_i[start]; - - for (i = start; i < stop; i++) - { - /* Note P_diag_i[stop] is the starting point for the next thread - * in j and data, not the stop point for this thread */ - last_index = P_diag_i[i+1]; - last_index_offd = P_offd_i[i+1]; - if(i == stop-1) - { - last_index -= num_lost_per_thread[my_thread_num]; - last_index_offd -= num_lost_offd_per_thread[my_thread_num]; - } - - row_sum = 0; - num_elmts = last_index-P_diag_i[i] + last_index_offd-P_offd_i[i]; - if (max_elmts < num_elmts) - { + scale = row_sum/scale; + for (j = P_diag_i[i]; j < (P_diag_i[i+1]-num_lost); j++) + { + P_diag_data[j] *= scale; + } + for (j = P_offd_i[i]; j < (P_offd_i[i+1]-num_lost_offd); j++) + { + P_offd_data[j] *= scale; + } + } + } + } /* end loop for (i = 0; i < n_fine; i++) */ + + /* store number of dropped elements and number of threads */ + if (my_thread_num == 0) + { + max_num_threads[0] = num_threads; + } + num_lost_per_thread[my_thread_num] = num_lost; + num_lost_offd_per_thread[my_thread_num] = num_lost_offd; + + } /* end if (trunc_factor > 0) */ + + /* + * Truncate based on capping the nnz per row + * + */ + if (max_elmts > 0) + { + HYPRE_Int P_mxnum, cnt1, last_index, last_index_offd; + HYPRE_Int *P_aux_j; + HYPRE_Real *P_aux_data; + + /* find maximum row length locally over this row range */ + P_mxnum = 0; + for (i=start; i P_mxnum) + { + P_mxnum = cnt1; + } + } + + /* Some rows exceed max_elmts, and require truncation. Essentially, + * each thread truncates and compresses its range of rows locally. */ + if (P_mxnum > max_elmts) + { + num_lost = 0; + num_lost_offd = 0; + + /* two temporary arrays to hold row i for temporary operations */ + P_aux_j = hypre_CTAlloc(HYPRE_Int, P_mxnum, HYPRE_MEMORY_HOST); + P_aux_data = hypre_CTAlloc(HYPRE_Real, P_mxnum, HYPRE_MEMORY_HOST); + cnt_diag = P_diag_i[start]; + cnt_offd = P_offd_i[start]; + + for (i = start; i < stop; i++) + { + /* Note P_diag_i[stop] is the starting point for the next thread + * in j and data, not the stop point for this thread */ + last_index = P_diag_i[i+1]; + last_index_offd = P_offd_i[i+1]; + if (i == stop-1) + { + last_index -= num_lost_per_thread[my_thread_num]; + last_index_offd -= num_lost_offd_per_thread[my_thread_num]; + } + + row_sum = 0; + num_elmts = last_index-P_diag_i[i] + last_index_offd-P_offd_i[i]; + if (max_elmts < num_elmts) + { /* copy both diagonal and off-diag parts of row i to _aux_ arrays */ cnt = 0; for (j = P_diag_i[i]; j < last_index; j++) @@ -2925,7 +2981,7 @@ row_sum += P_offd_data[j]; } num_lost_offd += cnt-cnt1; - + /* sort data */ hypre_qsort2abs(P_aux_j,P_aux_data,0,cnt-1); scale = 0; @@ -2958,18 +3014,20 @@ { scale = row_sum/scale; for (j = P_diag_i[i]; j < cnt_diag; j++) - P_diag_data[j] *= scale; + { + P_diag_data[j] *= scale; + } for (j = P_offd_i[i]; j < cnt_offd; j++) - P_offd_data[j] *= scale; + { + P_offd_data[j] *= scale; + } } } - } /* end if (max_elmts < num_elmts) */ - - else - { + } /* end if (max_elmts < num_elmts) */ + else + { /* nothing dropped from this row, but still have to shift entries back * by the number dropped so far */ - if (P_diag_i[i] != cnt_diag) { start_j = P_diag_i[i]; @@ -2981,8 +3039,10 @@ } } else + { cnt_diag += last_index-P_diag_i[i]; - + } + if (P_offd_i[i] != cnt_offd) { start_j = P_offd_i[i]; @@ -2994,186 +3054,201 @@ } } else + { cnt_offd += last_index_offd-P_offd_i[i]; - } - } /* end for (i = 0; i < n_fine; i++) */ - - num_lost_per_thread[my_thread_num] += num_lost; - num_lost_offd_per_thread[my_thread_num] += num_lost_offd; - hypre_TFree(P_aux_j, HYPRE_MEMORY_HOST); - hypre_TFree(P_aux_data, HYPRE_MEMORY_HOST); + } + } + } /* end for (i = 0; i < n_fine; i++) */ + + num_lost_per_thread[my_thread_num] += num_lost; + num_lost_offd_per_thread[my_thread_num] += num_lost_offd; + hypre_TFree(P_aux_j, HYPRE_MEMORY_HOST); + hypre_TFree(P_aux_data, HYPRE_MEMORY_HOST); - } /* end if (P_mxnum > max_elmts) */ - } /* end if (max_elmts > 0) */ + } /* end if (P_mxnum > max_elmts) */ + } /* end if (max_elmts > 0) */ - /* Sum up num_lost_global */ + /* Sum up num_lost_global */ #ifdef HYPRE_USING_OPENMP #pragma omp barrier #endif - if(my_thread_num == 0) - { - num_lost_global = 0; - num_lost_global_offd = 0; - for(i = 0; i < max_num_threads[0]; i++) - { - num_lost_global += num_lost_per_thread[i]; - num_lost_global_offd += num_lost_offd_per_thread[i]; - } - } + if (my_thread_num == 0) + { + num_lost_global = 0; + num_lost_global_offd = 0; + for (i = 0; i < max_num_threads[0]; i++) + { + num_lost_global += num_lost_per_thread[i]; + num_lost_global_offd += num_lost_offd_per_thread[i]; + } + } #ifdef HYPRE_USING_OPENMP #pragma omp barrier #endif - /* - * Synchronize and create new diag data structures - */ - if (num_lost_global) - { - /* Each thread has it's own locally compressed CSR matrix from rows start - * to stop. Now, we have to copy each thread's chunk into the new - * process-wide CSR data structures + /* + * Synchronize and create new diag data structures + */ + if (num_lost_global) + { + /* Each thread has it's own locally compressed CSR matrix from rows start + * to stop. Now, we have to copy each thread's chunk into the new + * process-wide CSR data structures * * First, we compute the new process-wide number of nonzeros (i.e., - * P_diag_size), and compute cum_lost_per_thread[k] so that this - * entry holds the cumulative sum of entries dropped up to and + * P_diag_size), and compute cum_lost_per_thread[k] so that this + * entry holds the cumulative sum of entries dropped up to and * including thread k. */ - if(my_thread_num == 0) - { - P_diag_size = P_diag_i[n_fine]; + if (my_thread_num == 0) + { + P_diag_size = P_diag_i[n_fine]; - for(i = 0; i < max_num_threads[0]; i++) - { - P_diag_size -= num_lost_per_thread[i]; - if(i > 0) - { cum_lost_per_thread[i] = num_lost_per_thread[i] + cum_lost_per_thread[i-1]; } - else - { cum_lost_per_thread[i] = num_lost_per_thread[i]; } - } - - P_diag_j_new = hypre_CTAlloc(HYPRE_Int, P_diag_size, HYPRE_MEMORY_SHARED); - P_diag_data_new = hypre_CTAlloc(HYPRE_Real, P_diag_size, HYPRE_MEMORY_SHARED); - } + for (i = 0; i < max_num_threads[0]; i++) + { + P_diag_size -= num_lost_per_thread[i]; + if (i > 0) + { + cum_lost_per_thread[i] = num_lost_per_thread[i] + cum_lost_per_thread[i-1]; + } + else + { + cum_lost_per_thread[i] = num_lost_per_thread[i]; + } + } + + P_diag_j_new = hypre_CTAlloc(HYPRE_Int, P_diag_size, mem_loc_diag); + P_diag_data_new = hypre_CTAlloc(HYPRE_Real, P_diag_size, mem_loc_diag); + } #ifdef HYPRE_USING_OPENMP #pragma omp barrier #endif - - /* points to next open spot in new data structures for this thread */ - if(my_thread_num == 0) - { next_open = 0; } - else - { - /* remember, cum_lost_per_thread[k] stores the num dropped up to and - * including thread k */ - next_open = P_diag_i[start] - cum_lost_per_thread[my_thread_num-1]; - } - /* copy the j and data arrays over */ - for(i = P_diag_i[start]; i < P_diag_i[stop] - num_lost_per_thread[my_thread_num]; i++) - { - P_diag_j_new[next_open] = P_diag_j[i]; - P_diag_data_new[next_open] = P_diag_data[i]; - next_open += 1; - } - + + /* points to next open spot in new data structures for this thread */ + if (my_thread_num == 0) + { + next_open = 0; + } + else + { + /* remember, cum_lost_per_thread[k] stores the num dropped up to and + * including thread k */ + next_open = P_diag_i[start] - cum_lost_per_thread[my_thread_num-1]; + } + + /* copy the j and data arrays over */ + for (i = P_diag_i[start]; i < P_diag_i[stop] - num_lost_per_thread[my_thread_num]; i++) + { + P_diag_j_new[next_open] = P_diag_j[i]; + P_diag_data_new[next_open] = P_diag_data[i]; + next_open += 1; + } + #ifdef HYPRE_USING_OPENMP #pragma omp barrier #endif - /* update P_diag_i with number of dropped entries by all lower ranked - * threads */ - if(my_thread_num > 0) - { - for(i=start; i 0) + { + for (i=start; i 0) - { cum_lost_per_thread[i] = num_lost_offd_per_thread[i] + cum_lost_per_thread[i-1]; } - else - { cum_lost_per_thread[i] = num_lost_offd_per_thread[i]; } - } - - P_offd_j_new = hypre_CTAlloc(HYPRE_Int, P_offd_size, HYPRE_MEMORY_SHARED); - P_offd_data_new = hypre_CTAlloc(HYPRE_Real, P_offd_size, HYPRE_MEMORY_SHARED); - } + if (num_lost_global_offd) + { + /* Repeat process for off-diagonal */ + if (my_thread_num == 0) + { + P_offd_size = P_offd_i[n_fine]; + for (i = 0; i < max_num_threads[0]; i++) + { + P_offd_size -= num_lost_offd_per_thread[i]; + if (i > 0) + { + cum_lost_per_thread[i] = num_lost_offd_per_thread[i] + cum_lost_per_thread[i-1]; + } + else + { + cum_lost_per_thread[i] = num_lost_offd_per_thread[i]; + } + } + + P_offd_j_new = hypre_CTAlloc(HYPRE_Int, P_offd_size, mem_loc_offd); + P_offd_data_new = hypre_CTAlloc(HYPRE_Real, P_offd_size, mem_loc_offd); + } #ifdef HYPRE_USING_OPENMP #pragma omp barrier #endif - - /* points to next open spot in new data structures for this thread */ - if(my_thread_num == 0) - { next_open = 0; } - else - { - /* remember, cum_lost_per_thread[k] stores the num dropped up to and - * including thread k */ - next_open = P_offd_i[start] - cum_lost_per_thread[my_thread_num-1]; - } - /* copy the j and data arrays over */ - for(i = P_offd_i[start]; i < P_offd_i[stop] - num_lost_offd_per_thread[my_thread_num]; i++) - { - P_offd_j_new[next_open] = P_offd_j[i]; - P_offd_data_new[next_open] = P_offd_data[i]; - next_open += 1; - } - + /* points to next open spot in new data structures for this thread */ + if (my_thread_num == 0) + { + next_open = 0; + } + else + { + /* remember, cum_lost_per_thread[k] stores the num dropped up to and + * including thread k */ + next_open = P_offd_i[start] - cum_lost_per_thread[my_thread_num-1]; + } + + /* copy the j and data arrays over */ + for (i = P_offd_i[start]; i < P_offd_i[stop] - num_lost_offd_per_thread[my_thread_num]; i++) + { + P_offd_j_new[next_open] = P_offd_j[i]; + P_offd_data_new[next_open] = P_offd_data[i]; + next_open += 1; + } + #ifdef HYPRE_USING_OPENMP #pragma omp barrier #endif - /* update P_offd_i with number of dropped entries by all lower ranked - * threads */ - if(my_thread_num > 0) - { - for(i=start; i 0) + { + for (i=start; i= right) - return; - hypre_swap2( v, w, left, (left+right)/2); - last = left; - for (i = left+1; i <= right; i++) - if (fabs(w[i]) > fabs(w[left])) - { - hypre_swap2(v, w, ++last, i); - } - hypre_swap2(v, w, left, last); - hypre_qsort2abs(v, w, left, last-1); - hypre_qsort2abs(v, w, last+1, right); -} - - - /*--------------------------------------------------------------------------- - * hypre_BoomerAMGBuildInterpModUnk - this is a modified interpolation for the unknown approach. + * hypre_BoomerAMGBuildInterpModUnk - this is a modified interpolation for the unknown approach. * here we need to pass in a strength matrix built on the entire matrix. - * + * *--------------------------------------------------------------------------*/ HYPRE_Int @@ -3227,12 +3279,12 @@ HYPRE_Int *dof_func, HYPRE_Int debug_flag, HYPRE_Real trunc_factor, - HYPRE_Int max_elmts, - HYPRE_Int *col_offd_S_to_A, + HYPRE_Int max_elmts, + HYPRE_Int *col_offd_S_to_A, hypre_ParCSRMatrix **P_ptr) { - MPI_Comm comm = hypre_ParCSRMatrixComm(A); + MPI_Comm comm = hypre_ParCSRMatrixComm(A); hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); hypre_ParCSRCommHandle *comm_handle; @@ -3241,7 +3293,7 @@ HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); - hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); HYPRE_Real *A_offd_data = hypre_CSRMatrixData(A_offd); HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); @@ -3252,25 +3304,25 @@ HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); - hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); + hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); HYPRE_Int *S_offd_j = hypre_CSRMatrixJ(S_offd); hypre_ParCSRMatrix *P; - HYPRE_BigInt *col_map_offd_P; - HYPRE_Int *tmp_map_offd; + HYPRE_BigInt *col_map_offd_P; + HYPRE_Int *tmp_map_offd; HYPRE_Int *CF_marker_offd = NULL; HYPRE_Int *dof_func_offd = NULL; hypre_CSRMatrix *A_ext; - + HYPRE_Real *A_ext_data = NULL; HYPRE_Int *A_ext_i = NULL; HYPRE_BigInt *A_ext_j = NULL; hypre_CSRMatrix *P_diag; - hypre_CSRMatrix *P_offd; + hypre_CSRMatrix *P_offd; HYPRE_Real *P_diag_data; HYPRE_Int *P_diag_i; @@ -3280,14 +3332,14 @@ HYPRE_Int *P_offd_j; HYPRE_Int P_diag_size, P_offd_size; - + HYPRE_Int *P_marker, *P_marker_offd; HYPRE_Int jj_counter,jj_counter_offd; HYPRE_Int *jj_count, *jj_count_offd; HYPRE_Int jj_begin_row,jj_begin_row_offd; HYPRE_Int jj_end_row,jj_end_row_offd; - + HYPRE_Int start_indexing = 0; /* start indexing for P_data at 0 */ HYPRE_Int n_fine = hypre_CSRMatrixNumRows(A_diag); @@ -3309,14 +3361,14 @@ HYPRE_Int start; HYPRE_Int sgn; HYPRE_Int c_num; - + HYPRE_Real diagonal; HYPRE_Real sum; - HYPRE_Real distribute; - + HYPRE_Real distribute; + HYPRE_Real zero = 0.0; HYPRE_Real one = 1.0; - + HYPRE_Int my_id; HYPRE_Int num_procs; HYPRE_Int num_threads; @@ -3332,7 +3384,7 @@ HYPRE_Real wall_time; /* for debugging instrumentation */ - hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_size(comm, &num_procs); hypre_MPI_Comm_rank(comm,&my_id); num_threads = hypre_NumThreads(); @@ -3360,53 +3412,53 @@ if (num_cols_A_offd) CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); if (num_functions > 1 && num_cols_A_offd) - dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); + dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); if (!comm_pkg) { - hypre_MatvecCommPkgCreate(A); - comm_pkg = hypre_ParCSRMatrixCommPkg(A); + hypre_MatvecCommPkgCreate(A); + comm_pkg = hypre_ParCSRMatrixCommPkg(A); } num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, - num_sends), HYPRE_MEMORY_HOST); + int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, + num_sends), HYPRE_MEMORY_HOST); index = 0; for (i = 0; i < num_sends; i++) { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, - CF_marker_offd); + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + int_buf_data[index++] + = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } - hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, + CF_marker_offd); + + hypre_ParCSRCommHandleDestroy(comm_handle); if (num_functions > 1) { index = 0; for (i = 0; i < num_sends; i++) { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = dof_func[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, - dof_func_offd); + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + int_buf_data[index++] + = dof_func[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } - hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, + dof_func_offd); + + hypre_ParCSRCommHandleDestroy(comm_handle); } if (debug_flag==4) { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Interp: Comm 1 CF_marker = %f\n", - my_id, wall_time); + my_id, wall_time); fflush(NULL); } @@ -3450,12 +3502,12 @@ for (i = num_cols_A_offd; i > 0; i--) A_ext_i[i] = A_ext_i[i-1]; if (num_procs > 1) A_ext_i[0] = 0; - + if (debug_flag==4) { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Interp: Comm 2 Get A_ext = %f\n", - my_id, wall_time); + my_id, wall_time); fflush(NULL); } @@ -3480,87 +3532,87 @@ jj_counter = start_indexing; jj_counter_offd = start_indexing; - + /*----------------------------------------------------------------------- * Loop over fine grid. *-----------------------------------------------------------------------*/ -/* RDF: this looks a little tricky, but doable */ + /* RDF: this looks a little tricky, but doable */ #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,j,i1,jj,ns,ne,size,rest) HYPRE_SMP_SCHEDULE #endif for (j = 0; j < num_threads; j++) { - size = n_fine/num_threads; - rest = n_fine - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) - { - - /*-------------------------------------------------------------------- - * If i is a C-point, interpolation is the identity. Also set up - * mapping vector. - *--------------------------------------------------------------------*/ - - if (CF_marker[i] >= 0) + size = n_fine/num_threads; + rest = n_fine - size*num_threads; + if (j < rest) { - jj_count[j]++; - fine_to_coarse[i] = coarse_counter[j]; - coarse_counter[j]++; + ns = j*size+j; + ne = (j+1)*size+j+1; } - - /*-------------------------------------------------------------------- - * If i is an F-point, interpolation is from the C-points that - * strongly influence i. - *--------------------------------------------------------------------*/ - else { - for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) + { + + /*-------------------------------------------------------------------- + * If i is a C-point, interpolation is the identity. Also set up + * mapping vector. + *--------------------------------------------------------------------*/ + + if (CF_marker[i] >= 0) { - i1 = S_diag_j[jj]; - if (CF_marker[i1] >= 0) - { - jj_count[j]++; - } + jj_count[j]++; + fine_to_coarse[i] = coarse_counter[j]; + coarse_counter[j]++; } - if (num_procs > 1) + /*-------------------------------------------------------------------- + * If i is an F-point, interpolation is from the C-points that + * strongly influence i. + *--------------------------------------------------------------------*/ + + else { - if (col_offd_S_to_A) - { - for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) { - i1 = col_offd_S_to_A[S_offd_j[jj]]; - if (CF_marker_offd[i1] >= 0) + i1 = S_diag_j[jj]; + if (CF_marker[i1] >= 0) { - jj_count_offd[j]++; + jj_count[j]++; } } - } - else - { - for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + + if (num_procs > 1) { - i1 = S_offd_j[jj]; - if (CF_marker_offd[i1] >= 0) + if (col_offd_S_to_A) + { + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + { + i1 = col_offd_S_to_A[S_offd_j[jj]]; + if (CF_marker_offd[i1] >= 0) + { + jj_count_offd[j]++; + } + } + } + else { - jj_count_offd[j]++; + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + { + i1 = S_offd_j[jj]; + if (CF_marker_offd[i1] >= 0) + { + jj_count_offd[j]++; + } + } } } - } } } - } } /*----------------------------------------------------------------------- @@ -3583,7 +3635,7 @@ P_diag_j = hypre_CTAlloc(HYPRE_Int, P_diag_size, HYPRE_MEMORY_HOST); P_diag_data = hypre_CTAlloc(HYPRE_Real, P_diag_size, HYPRE_MEMORY_HOST); - P_diag_i[n_fine] = jj_counter; + P_diag_i[n_fine] = jj_counter; P_offd_size = jj_counter_offd; @@ -3602,333 +3654,292 @@ { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d Interp: Internal work 1 = %f\n", - my_id, wall_time); + my_id, wall_time); fflush(NULL); } /*----------------------------------------------------------------------- * Send and receive fine_to_coarse info. - *-----------------------------------------------------------------------*/ + *-----------------------------------------------------------------------*/ if (debug_flag==4) wall_time = time_getWallclockSeconds(); - //fine_to_coarse_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); + //fine_to_coarse_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,j,ns,ne,size,rest,coarse_shift) HYPRE_SMP_SCHEDULE #endif for (j = 0; j < num_threads; j++) { - coarse_shift = 0; - if (j > 0) coarse_shift = coarse_counter[j-1]; - size = n_fine/num_threads; - rest = n_fine - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) - fine_to_coarse[i] += coarse_shift; + coarse_shift = 0; + if (j > 0) coarse_shift = coarse_counter[j-1]; + size = n_fine/num_threads; + rest = n_fine - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) + fine_to_coarse[i] += coarse_shift; } /*index = 0; - for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = fine_to_coarse[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, - fine_to_coarse_offd); + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + int_buf_data[index++] + = fine_to_coarse[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } + + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, + fine_to_coarse_offd); - hypre_ParCSRCommHandleDestroy(comm_handle); + hypre_ParCSRCommHandleDestroy(comm_handle); - if (debug_flag==4) - { - wall_time = time_getWallclockSeconds() - wall_time; - hypre_printf("Proc = %d Interp: Comm 4 FineToCoarse = %f\n", - my_id, wall_time); - fflush(NULL); - }*/ + if (debug_flag==4) + { + wall_time = time_getWallclockSeconds() - wall_time; + hypre_printf("Proc = %d Interp: Comm 4 FineToCoarse = %f\n", + my_id, wall_time); + fflush(NULL); + }*/ if (debug_flag==4) wall_time = time_getWallclockSeconds(); -/*#ifdef HYPRE_USING_OPENMP + /*#ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n_fine; i++) fine_to_coarse[i] -= my_first_cpt;*/ +for (i = 0; i < n_fine; i++) fine_to_coarse[i] -= my_first_cpt;*/ /*----------------------------------------------------------------------- * Loop over fine grid points. *-----------------------------------------------------------------------*/ - + #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,j,jl,i1,i2,jj,jj1,ns,ne,size,rest,sum,diagonal,distribute,P_marker,P_marker_offd,strong_f_marker,jj_counter,jj_counter_offd,sgn,c_num,jj_begin_row,jj_end_row,jj_begin_row_offd,jj_end_row_offd) HYPRE_SMP_SCHEDULE #endif for (jl = 0; jl < num_threads; jl++) { - size = n_fine/num_threads; - rest = n_fine - size*num_threads; - if (jl < rest) - { - ns = jl*size+jl; - ne = (jl+1)*size+jl+1; - } - else - { - ns = jl*size+rest; - ne = (jl+1)*size+rest; - } - jj_counter = 0; - if (jl > 0) jj_counter = jj_count[jl-1]; - jj_counter_offd = 0; - if (jl > 0) jj_counter_offd = jj_count_offd[jl-1]; - - P_marker = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_HOST); - if (num_cols_A_offd) - P_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); - else - P_marker_offd = NULL; - - for (i = 0; i < n_fine; i++) - { - P_marker[i] = -1; - } - for (i = 0; i < num_cols_A_offd; i++) - { - P_marker_offd[i] = -1; - } - strong_f_marker = -2; - - for (i = ns; i < ne; i++) - { - - /*-------------------------------------------------------------------- - * If i is a c-point, interpolation is the identity. - *--------------------------------------------------------------------*/ - - if (CF_marker[i] >= 0) + size = n_fine/num_threads; + rest = n_fine - size*num_threads; + if (jl < rest) { - P_diag_i[i] = jj_counter; - P_diag_j[jj_counter] = fine_to_coarse[i]; - P_diag_data[jj_counter] = one; - jj_counter++; + ns = jl*size+jl; + ne = (jl+1)*size+jl+1; } - - /*-------------------------------------------------------------------- - * If i is an F-point, build interpolation. - *--------------------------------------------------------------------*/ - else - { - /* Diagonal part of P */ - P_diag_i[i] = jj_counter; - jj_begin_row = jj_counter; - - for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) - { - i1 = S_diag_j[jj]; + { + ns = jl*size+rest; + ne = (jl+1)*size+rest; + } + jj_counter = 0; + if (jl > 0) jj_counter = jj_count[jl-1]; + jj_counter_offd = 0; + if (jl > 0) jj_counter_offd = jj_count_offd[jl-1]; + + P_marker = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_HOST); + if (num_cols_A_offd) + P_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); + else + P_marker_offd = NULL; - /*-------------------------------------------------------------- - * If neighbor i1 is a C-point, set column number in P_diag_j - * and initialize interpolation weight to zero. - *--------------------------------------------------------------*/ + for (i = 0; i < n_fine; i++) + { + P_marker[i] = -1; + } + for (i = 0; i < num_cols_A_offd; i++) + { + P_marker_offd[i] = -1; + } + strong_f_marker = -2; - if (CF_marker[i1] >= 0) - { - P_marker[i1] = jj_counter; - P_diag_j[jj_counter] = fine_to_coarse[i1]; - P_diag_data[jj_counter] = zero; - jj_counter++; - } + for (i = ns; i < ne; i++) + { - /*-------------------------------------------------------------- - * If neighbor i1 is an F-point, mark it as a strong F-point - * whose connection needs to be distributed. - *--------------------------------------------------------------*/ + /*-------------------------------------------------------------------- + * If i is a c-point, interpolation is the identity. + *--------------------------------------------------------------------*/ - else if (CF_marker[i1] != -3) - { - P_marker[i1] = strong_f_marker; - } + if (CF_marker[i] >= 0) + { + P_diag_i[i] = jj_counter; + P_diag_j[jj_counter] = fine_to_coarse[i]; + P_diag_data[jj_counter] = one; + jj_counter++; } - jj_end_row = jj_counter; - - /* Off-Diagonal part of P */ - P_offd_i[i] = jj_counter_offd; - jj_begin_row_offd = jj_counter_offd; + /*-------------------------------------------------------------------- + * If i is an F-point, build interpolation. + *--------------------------------------------------------------------*/ - if (num_procs > 1) + else { - if (col_offd_S_to_A) - { - for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + /* Diagonal part of P */ + P_diag_i[i] = jj_counter; + jj_begin_row = jj_counter; + + for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) { - i1 = col_offd_S_to_A[S_offd_j[jj]]; + i1 = S_diag_j[jj]; - /*----------------------------------------------------------- - * If neighbor i1 is a C-point, set column number in P_offd_j + /*-------------------------------------------------------------- + * If neighbor i1 is a C-point, set column number in P_diag_j * and initialize interpolation weight to zero. - *-----------------------------------------------------------*/ + *--------------------------------------------------------------*/ - if (CF_marker_offd[i1] >= 0) + if (CF_marker[i1] >= 0) { - P_marker_offd[i1] = jj_counter_offd; - /*P_offd_j[jj_counter_offd] = fine_to_coarse_offd[i1];*/ - P_offd_j[jj_counter_offd] = i1; - P_offd_data[jj_counter_offd] = zero; - jj_counter_offd++; + P_marker[i1] = jj_counter; + P_diag_j[jj_counter] = fine_to_coarse[i1]; + P_diag_data[jj_counter] = zero; + jj_counter++; } - /*----------------------------------------------------------- + /*-------------------------------------------------------------- * If neighbor i1 is an F-point, mark it as a strong F-point * whose connection needs to be distributed. - *-----------------------------------------------------------*/ + *--------------------------------------------------------------*/ - else if (CF_marker_offd[i1] != -3) + else if (CF_marker[i1] != -3) { - P_marker_offd[i1] = strong_f_marker; - } + P_marker[i1] = strong_f_marker; + } } - } - else - { - for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) - { - i1 = S_offd_j[jj]; + jj_end_row = jj_counter; + + /* Off-Diagonal part of P */ + P_offd_i[i] = jj_counter_offd; + jj_begin_row_offd = jj_counter_offd; - /*----------------------------------------------------------- - * If neighbor i1 is a C-point, set column number in P_offd_j - * and initialize interpolation weight to zero. - *-----------------------------------------------------------*/ - if (CF_marker_offd[i1] >= 0) + if (num_procs > 1) + { + if (col_offd_S_to_A) { - P_marker_offd[i1] = jj_counter_offd; - /*P_offd_j[jj_counter_offd] = fine_to_coarse_offd[i1];*/ - P_offd_j[jj_counter_offd] = i1; - P_offd_data[jj_counter_offd] = zero; - jj_counter_offd++; - } + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + { + i1 = col_offd_S_to_A[S_offd_j[jj]]; - /*----------------------------------------------------------- - * If neighbor i1 is an F-point, mark it as a strong F-point - * whose connection needs to be distributed. - *-----------------------------------------------------------*/ + /*----------------------------------------------------------- + * If neighbor i1 is a C-point, set column number in P_offd_j + * and initialize interpolation weight to zero. + *-----------------------------------------------------------*/ + + if (CF_marker_offd[i1] >= 0) + { + P_marker_offd[i1] = jj_counter_offd; + /*P_offd_j[jj_counter_offd] = fine_to_coarse_offd[i1];*/ + P_offd_j[jj_counter_offd] = i1; + P_offd_data[jj_counter_offd] = zero; + jj_counter_offd++; + } - else if (CF_marker_offd[i1] != -3) + /*----------------------------------------------------------- + * If neighbor i1 is an F-point, mark it as a strong F-point + * whose connection needs to be distributed. + *-----------------------------------------------------------*/ + + else if (CF_marker_offd[i1] != -3) + { + P_marker_offd[i1] = strong_f_marker; + } + } + } + else { - P_marker_offd[i1] = strong_f_marker; - } - } - } - } - - jj_end_row_offd = jj_counter_offd; - - diagonal = A_diag_data[A_diag_i[i]]; + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + { + i1 = S_offd_j[jj]; - - /* Loop over ith row of A. First, the diagonal part of A */ + /*----------------------------------------------------------- + * If neighbor i1 is a C-point, set column number in P_offd_j + * and initialize interpolation weight to zero. + *-----------------------------------------------------------*/ - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - i1 = A_diag_j[jj]; + if (CF_marker_offd[i1] >= 0) + { + P_marker_offd[i1] = jj_counter_offd; + /*P_offd_j[jj_counter_offd] = fine_to_coarse_offd[i1];*/ + P_offd_j[jj_counter_offd] = i1; + P_offd_data[jj_counter_offd] = zero; + jj_counter_offd++; + } - /*-------------------------------------------------------------- - * Case 1: neighbor i1 is a C-point and strongly influences i, - * accumulate a_{i,i1} into the interpolation weight. - *--------------------------------------------------------------*/ + /*----------------------------------------------------------- + * If neighbor i1 is an F-point, mark it as a strong F-point + * whose connection needs to be distributed. + *-----------------------------------------------------------*/ - if (P_marker[i1] >= jj_begin_row) - { - P_diag_data[P_marker[i1]] += A_diag_data[jj]; + else if (CF_marker_offd[i1] != -3) + { + P_marker_offd[i1] = strong_f_marker; + } + } + } } - /*-------------------------------------------------------------- - * Case 2: neighbor i1 is an F-point and strongly influences i, - * distribute a_{i,i1} to C-points that strongly infuence i. - * Note: currently no distribution to the diagonal in this case. - - HERE, we only want to distribut to points of the SAME function type + jj_end_row_offd = jj_counter_offd; + + diagonal = A_diag_data[A_diag_i[i]]; + + + /* Loop over ith row of A. First, the diagonal part of A */ - *--------------------------------------------------------------*/ - - else if (P_marker[i1] == strong_f_marker) + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) { - sum = zero; - - /*----------------------------------------------------------- - * Loop over row of A for point i1 and calculate the sum - * of the connections to c-points that strongly influence i. - *-----------------------------------------------------------*/ - sgn = 1; - if (A_diag_data[A_diag_i[i1]] < 0) sgn = -1; - /* Diagonal block part of row i1 */ - for (jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) + i1 = A_diag_j[jj]; + + /*-------------------------------------------------------------- + * Case 1: neighbor i1 is a C-point and strongly influences i, + * accumulate a_{i,i1} into the interpolation weight. + *--------------------------------------------------------------*/ + + if (P_marker[i1] >= jj_begin_row) { - i2 = A_diag_j[jj1]; - if (num_functions == 1 || dof_func[i1] == dof_func[i2]) - { - - if (P_marker[i2] >= jj_begin_row && - (sgn*A_diag_data[jj1]) < 0 ) - { - sum += A_diag_data[jj1]; - } - } - + P_diag_data[P_marker[i1]] += A_diag_data[jj]; } - /* Off-Diagonal block part of row i1 */ - if (num_procs > 1) - { - for (jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) - { - i2 = A_offd_j[jj1]; - if (num_functions == 1 || dof_func[i1] == dof_func[i2]) - { - if (P_marker_offd[i2] >= jj_begin_row_offd - && (sgn*A_offd_data[jj1]) < 0) - { - sum += A_offd_data[jj1]; - } - } - } - } + /*-------------------------------------------------------------- + * Case 2: neighbor i1 is an F-point and strongly influences i, + * distribute a_{i,i1} to C-points that strongly infuence i. + * Note: currently no distribution to the diagonal in this case. + + HERE, we only want to distribut to points of the SAME function type - if (sum != 0) - { - distribute = A_diag_data[jj] / sum; - - /*----------------------------------------------------------- - * Loop over row of A for point i1 and do the distribution. - *-----------------------------------------------------------*/ + *--------------------------------------------------------------*/ - /* Diagonal block part of row i1 */ + else if (P_marker[i1] == strong_f_marker) + { + sum = zero; + + /*----------------------------------------------------------- + * Loop over row of A for point i1 and calculate the sum + * of the connections to c-points that strongly influence i. + *-----------------------------------------------------------*/ + sgn = 1; + if (A_diag_data[A_diag_i[i1]] < 0) sgn = -1; + /* Diagonal block part of row i1 */ for (jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) { i2 = A_diag_j[jj1]; if (num_functions == 1 || dof_func[i1] == dof_func[i2]) { - if (P_marker[i2] >= jj_begin_row - && (sgn*A_diag_data[jj1]) < 0) + + if (P_marker[i2] >= jj_begin_row && + (sgn*A_diag_data[jj1]) < 0 ) { - P_diag_data[P_marker[i2]] - += distribute * A_diag_data[jj1]; + sum += A_diag_data[jj1]; } } - + } - + /* Off-Diagonal block part of row i1 */ if (num_procs > 1) { @@ -3938,210 +3949,251 @@ if (num_functions == 1 || dof_func[i1] == dof_func[i2]) { if (P_marker_offd[i2] >= jj_begin_row_offd - && (sgn*A_offd_data[jj1]) < 0) + && (sgn*A_offd_data[jj1]) < 0) + { + sum += A_offd_data[jj1]; + } + } + } + } + + if (sum != 0) + { + distribute = A_diag_data[jj] / sum; + + /*----------------------------------------------------------- + * Loop over row of A for point i1 and do the distribution. + *-----------------------------------------------------------*/ + + /* Diagonal block part of row i1 */ + for (jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) + { + i2 = A_diag_j[jj1]; + if (num_functions == 1 || dof_func[i1] == dof_func[i2]) + { + if (P_marker[i2] >= jj_begin_row + && (sgn*A_diag_data[jj1]) < 0) + { + P_diag_data[P_marker[i2]] + += distribute * A_diag_data[jj1]; + } + } + + } + + /* Off-Diagonal block part of row i1 */ + if (num_procs > 1) + { + for (jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) + { + i2 = A_offd_j[jj1]; + if (num_functions == 1 || dof_func[i1] == dof_func[i2]) { - P_offd_data[P_marker_offd[i2]] - += distribute * A_offd_data[jj1]; + if (P_marker_offd[i2] >= jj_begin_row_offd + && (sgn*A_offd_data[jj1]) < 0) + { + P_offd_data[P_marker_offd[i2]] + += distribute * A_offd_data[jj1]; + } } } + } - + } + else /* sum = 0 - only add to diag if the same function type */ + { + if (num_functions == 1 || dof_func[i] == dof_func[i1]) + diagonal += A_diag_data[jj]; } } - else /* sum = 0 - only add to diag if the same function type */ + + /*-------------------------------------------------------------- + * Case 3: neighbor i1 weakly influences i, accumulate a_{i,i1} + * into the diagonal. (only if the same function type) + *--------------------------------------------------------------*/ + + else if (CF_marker[i1] != -3) { - if (num_functions == 1 || dof_func[i] == dof_func[i1]) + if (num_functions == 1 || dof_func[i] == dof_func[i1]) diagonal += A_diag_data[jj]; } - } - - /*-------------------------------------------------------------- - * Case 3: neighbor i1 weakly influences i, accumulate a_{i,i1} - * into the diagonal. (only if the same function type) - *--------------------------------------------------------------*/ - else if (CF_marker[i1] != -3) - { - if (num_functions == 1 || dof_func[i] == dof_func[i1]) - diagonal += A_diag_data[jj]; - } + } - } - - /*---------------------------------------------------------------- - * Still looping over ith row of A. Next, loop over the - * off-diagonal part of A - *---------------------------------------------------------------*/ + /*---------------------------------------------------------------- + * Still looping over ith row of A. Next, loop over the + * off-diagonal part of A + *---------------------------------------------------------------*/ - if (num_procs > 1) - { - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + if (num_procs > 1) { - i1 = A_offd_j[jj]; + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + i1 = A_offd_j[jj]; - /*-------------------------------------------------------------- - * Case 1: neighbor i1 is a C-point and strongly influences i, - * accumulate a_{i,i1} into the interpolation weight. - *--------------------------------------------------------------*/ + /*-------------------------------------------------------------- + * Case 1: neighbor i1 is a C-point and strongly influences i, + * accumulate a_{i,i1} into the interpolation weight. + *--------------------------------------------------------------*/ - if (P_marker_offd[i1] >= jj_begin_row_offd) - { - P_offd_data[P_marker_offd[i1]] += A_offd_data[jj]; - } + if (P_marker_offd[i1] >= jj_begin_row_offd) + { + P_offd_data[P_marker_offd[i1]] += A_offd_data[jj]; + } - /*------------------------------------------------------------ - * Case 2: neighbor i1 is an F-point and strongly influences i, - * distribute a_{i,i1} to C-points that strongly infuence i. - * Note: currently no distribution to the diagonal in this case. + /*------------------------------------------------------------ + * Case 2: neighbor i1 is an F-point and strongly influences i, + * distribute a_{i,i1} to C-points that strongly infuence i. + * Note: currently no distribution to the diagonal in this case. - AGAIN, we only want to distribut to points of the SAME function type + AGAIN, we only want to distribut to points of the SAME function type - *-----------------------------------------------------------*/ - - else if (P_marker_offd[i1] == strong_f_marker) - { - sum = zero; - - /*--------------------------------------------------------- - * Loop over row of A_ext for point i1 and calculate the sum - * of the connections to c-points that strongly influence i. - *---------------------------------------------------------*/ - - /* find row number */ - c_num = A_offd_j[jj]; - - sgn = 1; - if (A_ext_data[A_ext_i[c_num]] < 0) sgn = -1; - for (jj1 = A_ext_i[c_num]; jj1 < A_ext_i[c_num+1]; jj1++) + *-----------------------------------------------------------*/ + + else if (P_marker_offd[i1] == strong_f_marker) { - i2 = (HYPRE_Int)A_ext_j[jj1]; - if (num_functions == 1 || dof_func[i1] == dof_func[i2]) - { - if (i2 > -1) - { - /* in the diagonal block */ - if (P_marker[i2] >= jj_begin_row - && (sgn*A_ext_data[jj1]) < 0) - { - sum += A_ext_data[jj1]; - } - } - else - { - /* in the off_diagonal block */ - if (P_marker_offd[-i2-1] >= jj_begin_row_offd - && (sgn*A_ext_data[jj1]) < 0) - { - sum += A_ext_data[jj1]; - } - } - - } - } - if (sum != 0) - { - distribute = A_offd_data[jj] / sum; + sum = zero; + /*--------------------------------------------------------- - * Loop over row of A_ext for point i1 and do - * the distribution. - *--------------------------------------------------------*/ - - /* Diagonal block part of row i1 */ - + * Loop over row of A_ext for point i1 and calculate the sum + * of the connections to c-points that strongly influence i. + *---------------------------------------------------------*/ + + /* find row number */ + c_num = A_offd_j[jj]; + + sgn = 1; + if (A_ext_data[A_ext_i[c_num]] < 0) sgn = -1; for (jj1 = A_ext_i[c_num]; jj1 < A_ext_i[c_num+1]; jj1++) { i2 = (HYPRE_Int)A_ext_j[jj1]; if (num_functions == 1 || dof_func[i1] == dof_func[i2]) { - if (i2 > -1) /* in the diagonal block */ + if (i2 > -1) { + /* in the diagonal block */ if (P_marker[i2] >= jj_begin_row - && (sgn*A_ext_data[jj1]) < 0) + && (sgn*A_ext_data[jj1]) < 0) { - P_diag_data[P_marker[i2]] - += distribute * A_ext_data[jj1]; + sum += A_ext_data[jj1]; } } else { /* in the off_diagonal block */ if (P_marker_offd[-i2-1] >= jj_begin_row_offd - && (sgn*A_ext_data[jj1]) < 0) - P_offd_data[P_marker_offd[-i2-1]] - += distribute * A_ext_data[jj1]; + && (sgn*A_ext_data[jj1]) < 0) + { + sum += A_ext_data[jj1]; + } + } + + } + } + if (sum != 0) + { + distribute = A_offd_data[jj] / sum; + /*--------------------------------------------------------- + * Loop over row of A_ext for point i1 and do + * the distribution. + *--------------------------------------------------------*/ + + /* Diagonal block part of row i1 */ + + for (jj1 = A_ext_i[c_num]; jj1 < A_ext_i[c_num+1]; jj1++) + { + i2 = (HYPRE_Int)A_ext_j[jj1]; + if (num_functions == 1 || dof_func[i1] == dof_func[i2]) + { + if (i2 > -1) /* in the diagonal block */ + { + if (P_marker[i2] >= jj_begin_row + && (sgn*A_ext_data[jj1]) < 0) + { + P_diag_data[P_marker[i2]] + += distribute * A_ext_data[jj1]; + } + } + else + { + /* in the off_diagonal block */ + if (P_marker_offd[-i2-1] >= jj_begin_row_offd + && (sgn*A_ext_data[jj1]) < 0) + P_offd_data[P_marker_offd[-i2-1]] + += distribute * A_ext_data[jj1]; + } } } } + else /* sum = 0 */ + { + if (num_functions == 1 || dof_func[i] == dof_func_offd[i1]) + diagonal += A_offd_data[jj]; + } } - else /* sum = 0 */ + + /*----------------------------------------------------------- + * Case 3: neighbor i1 weakly influences i, accumulate a_{i,i1} + * into the diagonal. + *-----------------------------------------------------------*/ + + else if (CF_marker_offd[i1] != -3) { - if (num_functions == 1 || dof_func[i] == dof_func_offd[i1]) + if (num_functions == 1 || dof_func[i] == dof_func_offd[i1]) diagonal += A_offd_data[jj]; } - } - - /*----------------------------------------------------------- - * Case 3: neighbor i1 weakly influences i, accumulate a_{i,i1} - * into the diagonal. - *-----------------------------------------------------------*/ - - else if (CF_marker_offd[i1] != -3) - { - if (num_functions == 1 || dof_func[i] == dof_func_offd[i1]) - diagonal += A_offd_data[jj]; - } + } } - } - /*----------------------------------------------------------------- - * Set interpolation weight by dividing by the diagonal. - *-----------------------------------------------------------------*/ + /*----------------------------------------------------------------- + * Set interpolation weight by dividing by the diagonal. + *-----------------------------------------------------------------*/ - if (diagonal == 0.0) - { - if (print_level) - hypre_printf(" Warning! zero diagonal! Proc id %d row %d\n", my_id,i); - for (jj = jj_begin_row; jj < jj_end_row; jj++) - { - P_diag_data[jj] = 0.0; - } - for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) - { - P_offd_data[jj] = 0.0; - } - } - else - { - for (jj = jj_begin_row; jj < jj_end_row; jj++) + if (diagonal == 0.0) { - P_diag_data[jj] /= -diagonal; + if (print_level) + hypre_printf(" Warning! zero diagonal! Proc id %d row %d\n", my_id,i); + for (jj = jj_begin_row; jj < jj_end_row; jj++) + { + P_diag_data[jj] = 0.0; + } + for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) + { + P_offd_data[jj] = 0.0; + } } - for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) + else { - P_offd_data[jj] /= -diagonal; + for (jj = jj_begin_row; jj < jj_end_row; jj++) + { + P_diag_data[jj] /= -diagonal; + } + for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) + { + P_offd_data[jj] /= -diagonal; + } } } - } - strong_f_marker--; + strong_f_marker--; - P_offd_i[i+1] = jj_counter_offd; - } - hypre_TFree(P_marker, HYPRE_MEMORY_HOST); - hypre_TFree(P_marker_offd, HYPRE_MEMORY_HOST); + P_offd_i[i+1] = jj_counter_offd; + } + hypre_TFree(P_marker, HYPRE_MEMORY_HOST); + hypre_TFree(P_marker_offd, HYPRE_MEMORY_HOST); } P = hypre_ParCSRMatrixCreate(comm, - hypre_ParCSRMatrixGlobalNumRows(A), - total_global_cpts, - hypre_ParCSRMatrixColStarts(A), - num_cpts_global, - 0, - P_diag_i[n_fine], - P_offd_i[n_fine]); - + hypre_ParCSRMatrixGlobalNumRows(A), + total_global_cpts, + hypre_ParCSRMatrixColStarts(A), + num_cpts_global, + 0, + P_diag_i[n_fine], + P_offd_i[n_fine]); + P_diag = hypre_ParCSRMatrixDiag(P); hypre_CSRMatrixData(P_diag) = P_diag_data; hypre_CSRMatrixI(P_diag) = P_diag_i; @@ -4176,17 +4228,17 @@ #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif for (i=0; i < num_cols_A_offd; i++) - P_marker[i] = 0; + P_marker[i] = 0; num_cols_P_offd = 0; for (i=0; i < P_offd_size; i++) { - index = P_offd_j[i]; - if (!P_marker[index]) - { - num_cols_P_offd++; - P_marker[index] = 1; - } + index = P_offd_j[i]; + if (!P_marker[index]) + { + num_cols_P_offd++; + P_marker[index] = 1; + } } col_map_offd_P = hypre_CTAlloc(HYPRE_BigInt, num_cols_P_offd, HYPRE_MEMORY_HOST); @@ -4203,20 +4255,20 @@ #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif for (i=0; i < P_offd_size; i++) - P_offd_j[i] = hypre_BinarySearch(tmp_map_offd, - P_offd_j[i], - num_cols_P_offd); - hypre_TFree(P_marker, HYPRE_MEMORY_HOST); + P_offd_j[i] = hypre_BinarySearch(tmp_map_offd, + P_offd_j[i], + num_cols_P_offd); + hypre_TFree(P_marker, HYPRE_MEMORY_HOST); } for (i=0; i < n_fine; i++) if (CF_marker[i] == -3) CF_marker[i] = -1; if (num_cols_P_offd) - { - hypre_ParCSRMatrixColMapOffd(P) = col_map_offd_P; - hypre_CSRMatrixNumCols(P_offd) = num_cols_P_offd; - } + { + hypre_ParCSRMatrixColMapOffd(P) = col_map_offd_P; + hypre_CSRMatrixNumCols(P_offd) = num_cols_P_offd; + } hypre_GetCommPkgRTFromCommPkgA(P, A, fine_to_coarse, tmp_map_offd); @@ -4236,8 +4288,8 @@ return hypre_error_flag; -} - +} + /*--------------------------------------------------------------------------- * hypre_BoomerAMGTruncandBuild *--------------------------------------------------------------------------*/ @@ -4247,7 +4299,6 @@ HYPRE_Real trunc_factor, HYPRE_Int max_elmts) { - hypre_CSRMatrix *P_offd = hypre_ParCSRMatrixOffd(P); hypre_ParCSRCommPkg *commpkg_P = hypre_ParCSRMatrixCommPkg(P); HYPRE_BigInt *col_map_offd = hypre_ParCSRMatrixColMapOffd(P); @@ -4282,7 +4333,7 @@ { P_marker = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); -/*#define HYPRE_SMP_PRIVATE i + /*#define HYPRE_SMP_PRIVATE i #include "../utilities/hypre_smp_forloop.h"*/ for (i=0; i < num_cols_offd; i++) P_marker[i] = 0; @@ -4307,31 +4358,31 @@ tmp_map_offd[i] = index++; } -/*#define HYPRE_SMP_PRIVATE i + /*#define HYPRE_SMP_PRIVATE i #include "../utilities/hypre_smp_forloop.h"*/ for (i=0; i < P_offd_size; i++) - P_offd_j[i] = hypre_BinarySearch(tmp_map_offd, - P_offd_j[i], - new_num_cols_offd); + P_offd_j[i] = hypre_BinarySearch(tmp_map_offd, + P_offd_j[i], + new_num_cols_offd); } index = 0; - for(i = 0; i < new_num_cols_offd; i++) + for (i = 0; i < new_num_cols_offd; i++) { - while (P_marker[index] == 0) index++; + while (P_marker[index] == 0) index++; - new_col_map_offd[i] = col_map_offd[index]; - index++; + new_col_map_offd[i] = col_map_offd[index]; + index++; } if (P_offd_size) hypre_TFree(P_marker, HYPRE_MEMORY_HOST); if (new_num_cols_offd) { - hypre_TFree(tmp_map_offd, HYPRE_MEMORY_HOST); - hypre_TFree(col_map_offd, HYPRE_MEMORY_HOST); - hypre_ParCSRMatrixColMapOffd(P) = new_col_map_offd; - hypre_CSRMatrixNumCols(P_offd) = new_num_cols_offd; + hypre_TFree(tmp_map_offd, HYPRE_MEMORY_HOST); + hypre_TFree(col_map_offd, HYPRE_MEMORY_HOST); + hypre_ParCSRMatrixColMapOffd(P) = new_col_map_offd; + hypre_CSRMatrixNumCols(P_offd) = new_num_cols_offd; } if (commpkg_P != NULL) hypre_MatvecCommPkgDestroy(commpkg_P); @@ -4340,7 +4391,7 @@ return hypre_error_flag; } - + hypre_ParCSRMatrix *hypre_CreateC( hypre_ParCSRMatrix *A, HYPRE_Real w) { @@ -4382,7 +4433,7 @@ HYPRE_Real w_local = w; C = hypre_ParCSRMatrixCreate(comm, global_num_rows, global_num_rows, row_starts, - row_starts, num_cols_offd, A_diag_i[num_rows], A_offd_i[num_rows]); + row_starts, num_cols_offd, A_diag_i[num_rows], A_offd_i[num_rows]); hypre_ParCSRMatrixInitialize(C); @@ -4425,13 +4476,13 @@ C_offd_i[i] = A_offd_i[i]; for (j = index+1; j < A_diag_i[i+1]; j++) { - C_diag_data[j] = A_diag_data[j]*invdiag; - C_diag_j[j] = A_diag_j[j]; + C_diag_data[j] = A_diag_data[j]*invdiag; + C_diag_j[j] = A_diag_j[j]; } for (j = A_offd_i[i]; j < A_offd_i[i+1]; j++) { - C_offd_data[j] = A_offd_data[j]*invdiag; - C_offd_j[j] = A_offd_j[j]; + C_offd_data[j] = A_offd_data[j]*invdiag; + C_offd_j[j] = A_offd_j[j]; } } C_diag_i[num_rows] = A_diag_i[num_rows]; @@ -4452,7 +4503,7 @@ HYPRE_Int *col_offd_S_to_A, hypre_ParCSRMatrix **P_ptr) { - MPI_Comm comm = hypre_ParCSRMatrixComm(A); + MPI_Comm comm = hypre_ParCSRMatrixComm(A); hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); hypre_ParCSRCommHandle *comm_handle; @@ -4461,19 +4512,19 @@ HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); - hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); HYPRE_Real *A_offd_data = hypre_CSRMatrixData(A_offd); HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); HYPRE_Int num_cols_A_offd = hypre_CSRMatrixNumCols(A_offd); //HYPRE_Int *col_map_offd_A = hypre_ParCSRMatrixColMapOffd(A); - + hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); - hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); + hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); HYPRE_Int *S_offd_j = hypre_CSRMatrixJ(S_offd); @@ -4518,8 +4569,8 @@ HYPRE_Int *max_abs_cij; char *max_abs_diag_offd; HYPRE_Real max_abs_aij, vv; - - hypre_MPI_Comm_size(comm, &num_procs); + + hypre_MPI_Comm_size(comm, &num_procs); hypre_MPI_Comm_rank(comm,&my_id); @@ -4549,15 +4600,15 @@ if (!comm_pkg) { hypre_MatvecCommPkgCreate(A); - comm_pkg = hypre_ParCSRMatrixCommPkg(A); + comm_pkg = hypre_ParCSRMatrixCommPkg(A); } /* number of sends to do (number of procs) */ num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - /* send buffer, of size send_map_starts[num_sends]), + /* send buffer, of size send_map_starts[num_sends]), * i.e., number of entries to send */ int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends),HYPRE_MEMORY_HOST); - - /* copy CF markers of elements to send to buffer + + /* copy CF markers of elements to send to buffer * RL: why copy them with two for loops? Why not just loop through all in one */ index = 0; for (i = 0; i < num_sends; i++) @@ -4589,7 +4640,7 @@ } } comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, int_buf_data, dof_func_offd); - hypre_ParCSRCommHandleDestroy(comm_handle); + hypre_ParCSRCommHandleDestroy(comm_handle); } hypre_TFree(int_buf_data,HYPRE_MEMORY_HOST); @@ -4657,14 +4708,14 @@ /* !!! this is a hack just for code verification purpose !!! it basically says: 1. if we see |a_ij| < 1e-14, force it to be 1e-14 - 2. if we see |a_ij| == the max(|a_ij|) so far exactly, + 2. if we see |a_ij| == the max(|a_ij|) so far exactly, replace it if the j idx is smaller Reasons: 1. numerical round-off for eps-level values 2. entries in CSR rows may be listed in different orders */ vv = vv < 1e-14 ? 1e-14 : vv; - if (CF_marker[i1] >= 0 && marker_diag[i1] == MARK && + if (CF_marker[i1] >= 0 && marker_diag[i1] == MARK && vv == max_abs_aij && i1 < max_abs_cij[i]) { /* mark it as a 'd' */ @@ -4701,7 +4752,7 @@ } max_abs_diag_offd[i] = marker; - + if (marker == 'd') { cnt_diag ++; @@ -4714,13 +4765,13 @@ nnz_diag = cnt_diag + n_cpts; nnz_offd = cnt_offd; - + /*------------- allocate arrays */ P_diag_i = hypre_CTAlloc(HYPRE_Int, n_fine+1,HYPRE_MEMORY_HOST); P_diag_j = hypre_CTAlloc(HYPRE_Int, nnz_diag,HYPRE_MEMORY_HOST); P_diag_data = hypre_CTAlloc(HYPRE_Real, nnz_diag,HYPRE_MEMORY_HOST); - /* not in ``if num_procs > 1'', + /* not in ``if num_procs > 1'', * allocation needed even for empty CSR */ P_offd_i = hypre_CTAlloc(HYPRE_Int, n_fine+1,HYPRE_MEMORY_HOST); P_offd_j = hypre_CTAlloc(HYPRE_Int, nnz_offd,HYPRE_MEMORY_HOST); @@ -4736,8 +4787,8 @@ /*----------------------------------------------------------------------- * Send and receive fine_to_coarse info. - *-----------------------------------------------------------------------*/ - fine_to_coarse_offd = hypre_CTAlloc(HYPRE_BigInt, num_cols_A_offd,HYPRE_MEMORY_HOST); + *-----------------------------------------------------------------------*/ + fine_to_coarse_offd = hypre_CTAlloc(HYPRE_BigInt, num_cols_A_offd,HYPRE_MEMORY_HOST); big_int_buf_data = hypre_CTAlloc(HYPRE_BigInt, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends),HYPRE_MEMORY_HOST); index = 0; for (i = 0; i < num_sends; i++) @@ -4749,8 +4800,8 @@ +(HYPRE_BigInt)fine_to_coarse[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; } } - comm_handle = hypre_ParCSRCommHandleCreate(21, comm_pkg, big_int_buf_data, fine_to_coarse_offd); - hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = hypre_ParCSRCommHandleCreate(21, comm_pkg, big_int_buf_data, fine_to_coarse_offd); + hypre_ParCSRCommHandleDestroy(comm_handle); /*----------------------------------------------------------------------- * Second Pass: Populate P @@ -4760,7 +4811,7 @@ if (CF_marker[i] >= 0) { /*-------------------------------------------------------------------- - * If i is a C-point, interpolation is the identity. + * If i is a C-point, interpolation is the identity. *--------------------------------------------------------------------*/ //P_diag_j[cnt_diag] = fine_to_coarse[i] - my_first_cpt; P_diag_j[cnt_diag] = fine_to_coarse[i]; @@ -4794,10 +4845,10 @@ hypre_assert(cnt_diag == nnz_diag); hypre_assert(cnt_offd == nnz_offd); - + /* num of cols in the offd part of P */ num_cols_offd_P = 0; - + /* marker_offd: all -1 */ for (i = 0; i < num_cols_A_offd; i++) { @@ -4864,7 +4915,7 @@ hypre_CSRMatrixJ(P_offd) = P_offd_j; /* P does not own ColStarts, since A does */ hypre_ParCSRMatrixOwnsRowStarts(P) = 0; - + hypre_ParCSRMatrixColMapOffd(P) = col_map_offd_P; /* create CommPkg of P */ diff -Nru hypre-2.16.0/src/parcsr_ls/par_interp_device.c hypre-2.18.2/src/parcsr_ls/par_interp_device.c --- hypre-2.16.0/src/parcsr_ls/par_interp_device.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_interp_device.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,663 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#include "_hypre_parcsr_ls.h" + +#if defined(HYPRE_USING_CUDA) + +__global__ void hypre_BoomerAMGBuildDirInterp_dev1( HYPRE_Int nr_of_rows, + HYPRE_Int* S_diag_i, HYPRE_Int* S_diag_j, + HYPRE_Int* S_offd_i, HYPRE_Int* S_offd_j, + HYPRE_Int* A_offd_i, HYPRE_Int* A_offd_j, + HYPRE_Int* CF_marker, HYPRE_Int* CF_marker_offd, + HYPRE_Int num_functions, HYPRE_Int* dof_func, HYPRE_Int* dof_func_offd, + HYPRE_Int* P_diag_i, HYPRE_Int* P_offd_i, HYPRE_Int* col_offd_S_to_A, + HYPRE_Int* fine_to_coarse ); + +__global__ void hypre_BoomerAMGBuildDirInterp_dev2( HYPRE_Int nr_of_rows, + HYPRE_Int* A_diag_i, HYPRE_Int* A_diag_j, HYPRE_Real* A_diag_data, + HYPRE_Int* A_offd_i, HYPRE_Int* A_offd_j, HYPRE_Real* A_offd_data, + HYPRE_Int* S_diag_i, HYPRE_Int* S_diag_j, + HYPRE_Int* S_offd_i, HYPRE_Int* S_offd_j, + HYPRE_Int* CF_marker, HYPRE_Int* CF_marker_offd, + HYPRE_Int num_functions, HYPRE_Int* dof_func, HYPRE_Int* dof_func_offd, + HYPRE_Int* P_diag_i, HYPRE_Int* P_diag_j, HYPRE_Real* P_diag_data, + HYPRE_Int* P_offd_i, HYPRE_Int* P_offd_j, HYPRE_Real* P_offd_data, + HYPRE_Int* col_offd_S_to_A, HYPRE_Int* fine_to_coarse ); + + +__global__ void hypre_BoomerAMGBuildDirInterp_dev3( HYPRE_Int P_offd_size, + HYPRE_Int* P_offd_j, + HYPRE_Int* P_marker ); + +__global__ void hypre_BoomerAMGBuildDirInterp_dev4( HYPRE_Int num_cols_A_offd, + HYPRE_Int* P_marker, + HYPRE_Int* tmp_map_offd ); + +__global__ void hypre_BoomerAMGBuildDirInterp_dev5( HYPRE_Int P_offd_size, + HYPRE_Int* P_offd_j, + HYPRE_Int* P_marker ); + +/*--------------------------------------------------------------------------- + * hypre_BoomerAMGBuildDirInterp + *--------------------------------------------------------------------------*/ + +HYPRE_Int +hypre_BoomerAMGBuildDirInterpDevice( hypre_ParCSRMatrix *A, + HYPRE_Int *CF_marker, + hypre_ParCSRMatrix *S, + HYPRE_BigInt *num_cpts_global, + HYPRE_Int num_functions, + HYPRE_Int *dof_func, + HYPRE_Int debug_flag, + HYPRE_Real trunc_factor, + HYPRE_Int max_elmts, + HYPRE_Int *col_offd_S_to_A, + hypre_ParCSRMatrix **P_ptr) +{ + + MPI_Comm comm = hypre_ParCSRMatrixComm(A); + hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); + hypre_ParCSRCommHandle *comm_handle; + + hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); + HYPRE_Real *A_diag_data = hypre_CSRMatrixData(A_diag); + HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); + HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); + + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + HYPRE_Real *A_offd_data = hypre_CSRMatrixData(A_offd); + HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); + HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); + HYPRE_Int num_cols_A_offd = hypre_CSRMatrixNumCols(A_offd); + // HYPRE_BigInt *col_map_offd_A = hypre_ParCSRMatrixColMapOffd(A); + + hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); + HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); + HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); + + hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); + HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); + HYPRE_Int *S_offd_j = hypre_CSRMatrixJ(S_offd); + + hypre_ParCSRMatrix *P; + HYPRE_BigInt *col_map_offd_P; + HYPRE_Int *tmp_map_offd = NULL; + + HYPRE_Int *CF_marker_dev = NULL; + /* HYPRE_Int *CF_marker_host = NULL;*/ + HYPRE_Int *CF_marker_offd = NULL; + HYPRE_Int *dof_func_offd = NULL; + + hypre_CSRMatrix *P_diag; + hypre_CSRMatrix *P_offd; + + HYPRE_Real *P_diag_data; + HYPRE_Int *P_diag_i; + HYPRE_Int *P_diag_j; + HYPRE_Real *P_offd_data; + HYPRE_Int *P_offd_i; + HYPRE_Int *P_offd_j; + + HYPRE_Int P_diag_size, P_offd_size; + + HYPRE_Int n_fine = hypre_CSRMatrixNumRows(A_diag); + + HYPRE_Int *fine_to_coarse; + HYPRE_BigInt total_global_cpts; + HYPRE_Int num_cols_P_offd; + + HYPRE_Int i; + HYPRE_Int j; + HYPRE_Int start; + + // HYPRE_Int prproc=2; + HYPRE_Int my_id; + HYPRE_Int num_procs; + HYPRE_Int num_sends; + HYPRE_Int index; + HYPRE_Int *int_buf_data; + HYPRE_Int limit = 1048576; + + HYPRE_Real wall_time; /* for debugging instrumentation */ + + hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_rank(comm,&my_id); + +#ifdef HYPRE_NO_GLOBAL_PARTITION + if (my_id == (num_procs -1)) + total_global_cpts = num_cpts_global[1]; + hypre_MPI_Bcast( &total_global_cpts, 1, HYPRE_MPI_BIG_INT, num_procs-1, comm); +#else + total_global_cpts = num_cpts_global[num_procs]; +#endif + + if (!comm_pkg) + { + hypre_MatvecCommPkgCreate(A); + comm_pkg = hypre_ParCSRMatrixCommPkg(A); + } + if (debug_flag==4) wall_time = time_getWallclockSeconds(); + + ///* 0. Assume CF_marker has been allocated in device memory */ + // CF_marker_host = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_HOST); + // hypre_TMemcpy( CF_marker_host, CF_marker, HYPRE_Int, n_fine, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE ); +/* 0. Assume CF_marker has been allocated in host memory */ +// CF_marker_host = CF_marker; + CF_marker_dev = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_DEVICE); + hypre_TMemcpy( CF_marker_dev, CF_marker, HYPRE_Int, n_fine, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_HOST ); + + +/* 1. Communicate CF_marker to/from other processors */ + if (num_cols_A_offd) + CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_SHARED); + + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, + num_sends), HYPRE_MEMORY_HOST); + index = 0; + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + int_buf_data[index++] + // = CF_marker_host[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } + + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, CF_marker_offd); + hypre_ParCSRCommHandleDestroy(comm_handle); + // hypre_TFree(CF_marker_host, HYPRE_MEMORY_HOST); + + if (num_functions > 1) + { + /* 2. Communicate dof_func to/from other processors */ + if (num_cols_A_offd > 0) + dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_SHARED); + + index = 0; + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + int_buf_data[index++] + = dof_func[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, dof_func_offd); + hypre_ParCSRCommHandleDestroy(comm_handle); + } + + + if (debug_flag==4) + { + wall_time = time_getWallclockSeconds() - wall_time; + hypre_printf("Proc = %d Interp: Comm 1 CF_marker = %f\n", + my_id, wall_time); + fflush(NULL); + } + +/* 3. Figure out the size of the interpolation matrix, P, i.e., compute P_diag_i and P_offd_i */ +/* Also, compute fine_to_coarse array: When i is a coarse point, fine_to_coarse[i] will hold a */ +/* corresponding coarse point index in the range 0..n_coarse-1 */ + P_diag_i = hypre_CTAlloc(HYPRE_Int, n_fine+1, HYPRE_MEMORY_SHARED); + P_offd_i = hypre_CTAlloc(HYPRE_Int, n_fine+1, HYPRE_MEMORY_SHARED); + fine_to_coarse = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_SHARED); + + dim3 grid, block(32,1,1); + grid.x = n_fine/block.x; + if( n_fine % block.x != 0 ) + grid.x++; + if( grid.x > limit ) + grid.x = limit; + grid.y = 1; + grid.z = 1; + + HYPRE_CUDA_LAUNCH( hypre_BoomerAMGBuildDirInterp_dev1, grid, block, + n_fine, S_diag_i, S_diag_j, S_offd_i, S_offd_j, + A_offd_i, A_offd_j, + CF_marker_dev, CF_marker_offd, num_functions, + dof_func, dof_func_offd, P_diag_i, P_offd_i, + col_offd_S_to_A, fine_to_coarse ); + + /* The scans will transform P_diag_i and P_offd_i to the CSR I-vectors */ + HYPRE_THRUST_CALL(exclusive_scan, &P_diag_i[0], &P_diag_i[n_fine+1], &P_diag_i[0] ); + HYPRE_THRUST_CALL(exclusive_scan, &P_offd_i[0], &P_offd_i[n_fine+1], &P_offd_i[0] ); +/* The scan will make fine_to_coarse[i] for i a coarse point hold a coarse point index in the range from 0 to n_coarse-1 */ + HYPRE_THRUST_CALL(exclusive_scan, &fine_to_coarse[0], &fine_to_coarse[n_fine], &fine_to_coarse[0] ); + +/* 4. Compute the CSR arrays P_diag_j, P_diag_data, P_offd_j, and P_offd_data */ +/* P_diag_i and P_offd_i are now known, first allocate the remaining CSR arrays of P */ + + P_diag_size = P_diag_i[n_fine]; + P_diag_j = hypre_CTAlloc(HYPRE_Int, P_diag_size, HYPRE_MEMORY_SHARED); + P_diag_data = hypre_CTAlloc(HYPRE_Real, P_diag_size, HYPRE_MEMORY_SHARED); + + P_offd_size = P_offd_i[n_fine]; + P_offd_j = hypre_CTAlloc(HYPRE_Int, P_offd_size, HYPRE_MEMORY_SHARED); + P_offd_data = hypre_CTAlloc(HYPRE_Real, P_offd_size, HYPRE_MEMORY_SHARED); + + HYPRE_CUDA_LAUNCH( hypre_BoomerAMGBuildDirInterp_dev2, grid, block, + n_fine, A_diag_i, A_diag_j, A_diag_data, + A_offd_i, A_offd_j, A_offd_data, + S_diag_i, S_diag_j, S_offd_i, S_offd_j, + CF_marker_dev, CF_marker_offd, + num_functions, dof_func, dof_func_offd, + P_diag_i, P_diag_j, P_diag_data, + P_offd_i, P_offd_j, P_offd_data, + col_offd_S_to_A, fine_to_coarse ); + cudaDeviceSynchronize(); + +/* 5. Construct the result as a ParCSRMatrix. At this point, P's column indices */ +/* are defined with A's enumeration of columns */ + + P = hypre_ParCSRMatrixCreate(comm, + hypre_ParCSRMatrixGlobalNumRows(A), + total_global_cpts, + hypre_ParCSRMatrixColStarts(A), + num_cpts_global, + 0, + P_diag_size, + P_offd_size); + + P_diag = hypre_ParCSRMatrixDiag(P); + hypre_CSRMatrixData(P_diag) = P_diag_data; + hypre_CSRMatrixI(P_diag) = P_diag_i; + hypre_CSRMatrixJ(P_diag) = P_diag_j; + P_offd = hypre_ParCSRMatrixOffd(P); + hypre_CSRMatrixData(P_offd) = P_offd_data; + hypre_CSRMatrixI(P_offd) = P_offd_i; + hypre_CSRMatrixJ(P_offd) = P_offd_j; + hypre_ParCSRMatrixOwnsRowStarts(P) = 0; + + +/* 6. Compress P, removing coefficients smaller than trunc_factor * Max, and */ +/* make sure no row has more than max_elmts elements */ + + if (trunc_factor != 0.0 || max_elmts > 0) + { + hypre_BoomerAMGInterpTruncationDevice(P, trunc_factor, max_elmts); + + // P_diag_data = hypre_CSRMatrixData(P_diag); + // P_diag_i = hypre_CSRMatrixI(P_diag); + // P_diag_j = hypre_CSRMatrixJ(P_diag); + + + P_offd_data = hypre_CSRMatrixData(P_offd); + P_offd_i = hypre_CSRMatrixI(P_offd); + P_offd_j = hypre_CSRMatrixJ(P_offd); + P_offd_size=P_offd_i[n_fine]; + } + +/* 7. Translate P_offd's column indices from the values inherited from A_offd to a 0,1,2,3,... enumeration, */ +/* and construct the col_map array that translates these into the global 0..c-1 enumeration */ +/* (P is of size m x c) */ + num_cols_P_offd = 0; + if (P_offd_size) + { + /* Array P_marker has length equal to the number of A's offd columns+1, and will */ + /* store a translation code from A_offd's local column numbers to P_offd's local column numbers */ + /* Example: if A_offd has 6 columns, locally 0,1,..,5, and points 1 and 4 are coarse points, then + P_marker=[0,1,0,0,1,0,0], */ + + /* First, set P_marker[i] to 1 if A's column i is also present in P, otherwise P_marker[i] is 0 */ + HYPRE_Int *P_marker = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd+1, HYPRE_MEMORY_DEVICE); + HYPRE_CUDA_LAUNCH( hypre_BoomerAMGBuildDirInterp_dev5, grid, block, + P_offd_size, P_offd_j, P_marker ); + + /* Secondly, the sum over P_marker gives the number of different columns in P's offd part */ + num_cols_P_offd = HYPRE_THRUST_CALL(reduce, &P_marker[0], &P_marker[num_cols_A_offd]); + + /* Because P's columns correspond to P_marker[i]=1 (and =0 otherwise), the scan below will return */ + /* an enumeration of P's columns 0,1,... at the corresponding locations in P_marker. */ + /* P_marker[num_cols_A_offd] will contain num_cols_P_offd, so sum reduction above could */ + /* have been replaced by reading the last element of P_marker. */ + HYPRE_THRUST_CALL(exclusive_scan, &P_marker[0], &P_marker[num_cols_A_offd+1], &P_marker[0] ); + /* Example: P_marker becomes [0,0,1,1,1,2] so that P_marker[1]=0, P_marker[4]=1 */ + + /* Do the re-enumeration, P_offd_j are mapped, using P_marker as map */ + HYPRE_CUDA_LAUNCH( hypre_BoomerAMGBuildDirInterp_dev3, grid, block, + P_offd_size, P_offd_j, P_marker ); + + /* Create and define array tmp_map_offd. This array is the inverse of the P_marker mapping, */ + /* Example: num_cols_P_offd=2, tmp_map_offd[0] = 1, tmp_map_offd[1]=4 */ + tmp_map_offd = hypre_CTAlloc(HYPRE_Int, num_cols_P_offd, HYPRE_MEMORY_SHARED); + grid.x = num_cols_A_offd/block.x; + if( num_cols_A_offd % block.x != 0 ) + grid.x++; + if( grid.x > limit ) + grid.x = limit; + + HYPRE_CUDA_LAUNCH( hypre_BoomerAMGBuildDirInterp_dev4, grid, block, + num_cols_A_offd, P_marker, tmp_map_offd ); + + if (num_cols_P_offd) + { + col_map_offd_P = hypre_CTAlloc(HYPRE_BigInt, num_cols_P_offd, HYPRE_MEMORY_HOST); + // col_map_offd_P = hypre_CTAlloc(HYPRE_BigInt, num_cols_P_offd, HYPRE_MEMORY_SHARED); + hypre_ParCSRMatrixColMapOffd(P) = col_map_offd_P; + hypre_CSRMatrixNumCols(P_offd) = num_cols_P_offd; + } + + cudaDeviceSynchronize(); + hypre_TFree(P_marker, HYPRE_MEMORY_DEVICE); + } + + /* Not sure what this is for, moved it to Cuda kernel _dev2 */ + /* for (i=0; i < n_fine; i++) + if (CF_marker[i] == -3) CF_marker[i] = -1; */ + + +/* 8. P_offd_j now has a 0,1,2,3... local column index enumeration. */ +/* tmp_map_offd contains the index mapping from P's offd local columns to A's offd local columns.*/ +/* Below routine is in parcsr_ls/par_rap_communication.c. It sets col_map_offd in P, */ +/* comm_pkg in P, and perhaps more members of P ??? */ + hypre_GetCommPkgRTFromCommPkgA(P, A, fine_to_coarse, tmp_map_offd); + + *P_ptr = P; + + hypre_TFree(CF_marker_dev, HYPRE_MEMORY_DEVICE); + hypre_TFree(CF_marker_offd, HYPRE_MEMORY_SHARED); + hypre_TFree(dof_func_offd, HYPRE_MEMORY_SHARED); + hypre_TFree(int_buf_data, HYPRE_MEMORY_HOST); + hypre_TFree(fine_to_coarse, HYPRE_MEMORY_SHARED); + hypre_TFree(tmp_map_offd, HYPRE_MEMORY_SHARED); + + return hypre_error_flag; +} + + +/*-----------------------------------------------------------------------*/ + __global__ void hypre_BoomerAMGBuildDirInterp_dev1( HYPRE_Int nr_of_rows, + HYPRE_Int* S_diag_i, HYPRE_Int* S_diag_j, + HYPRE_Int* S_offd_i, HYPRE_Int* S_offd_j, + HYPRE_Int* A_offd_i, HYPRE_Int* A_offd_j, + HYPRE_Int* CF_marker, HYPRE_Int* CF_marker_offd, + HYPRE_Int num_functions, HYPRE_Int* dof_func, HYPRE_Int* dof_func_offd, + HYPRE_Int* P_diag_i, HYPRE_Int* P_offd_i, + HYPRE_Int* col_offd_S_to_A, HYPRE_Int* fine_to_coarse ) +{ + /*-----------------------------------------------------------------------*/ + /* Determine size of interpolation matrix, P + + If A is of size m x m, then P will be of size m x c where c is the + number of coarse points. + + It is assumed that S have the same global column enumeration as A + + Input: nr_of_rows - Number of rows in matrix (local in processor) + S_diag_i, S_diag_j - CSR representation of S_diag + S_offd_i, S_offd_j - CSR representation of S_offd + num_function - Number of degrees of freedom per grid point + dof_func - vector of length nr_of_rows, indicating the degree of freedom of vector element. + dof_func_offd - vector over nonzero elements of A_offd, indicating the degree of freedom. + + Output: P_diag_i - Vector where P_diag_i[i] holds the number of non-zero elements of P_diag on row i. + P_offd_i - Vector where P_offd_i[i] holds the number of non-zero elements of P_offd on row i. + fine_to_coarse - Vector of length nr_of_rows-1. + fine_to_coarse[i] is set to 1 if i is a coarse pt. + Eventually, fine_to_coarse[j] will map A's column j + to a re-enumerated column index in matrix P. + */ + /*-----------------------------------------------------------------------*/ + + HYPRE_Int myid= threadIdx.x + blockIdx.x * blockDim.x, i, jj, i1, jPd, jPo; + const HYPRE_Int nthreads = gridDim.x * blockDim.x; + + for( i = myid ; i < nr_of_rows ; i += nthreads ) + { + /*-------------------------------------------------------------------- + * If i is a C-point, interpolation is the identity. + *--------------------------------------------------------------------*/ + jPd = jPo = 0; + if (CF_marker[i] >= 0) + { + jPd++; + fine_to_coarse[i] = 1; + } + else + { + /*-------------------------------------------------------------------- + * If i is an F-point, interpolation is from the C-points that + * strongly influence i. + *--------------------------------------------------------------------*/ + for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) + { + i1 = S_diag_j[jj]; + if (CF_marker[i1] > 0 && (num_functions == 1 || (dof_func[i1]==dof_func[i])) ) + jPd++; + } + if (col_offd_S_to_A) + { + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + { + i1 = col_offd_S_to_A[S_offd_j[jj]]; + if (CF_marker_offd[i1] > 0 && ( num_functions == 1 || (dof_func_offd[i1]==dof_func[i])) ) + jPo++; + } + } + else + { + for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) + { + i1 = S_offd_j[jj]; /* CF_marker_offd[i1] requires i1 to be in A's column enumeration */ + if (CF_marker_offd[i1] > 0 && ( num_functions ==1 || (dof_func_offd[i1]==dof_func[i] )) ) + jPo++; + } + } + } + P_diag_i[i] = jPd; + P_offd_i[i] = jPo; + } +} + +/*-----------------------------------------------------------------------*/ + __global__ void hypre_BoomerAMGBuildDirInterp_dev2( HYPRE_Int nr_of_rows, + HYPRE_Int* A_diag_i, HYPRE_Int* A_diag_j, HYPRE_Real* A_diag_data, + HYPRE_Int* A_offd_i, HYPRE_Int* A_offd_j, HYPRE_Real* A_offd_data, + HYPRE_Int* S_diag_i, HYPRE_Int* S_diag_j, + HYPRE_Int* S_offd_i, HYPRE_Int* S_offd_j, + HYPRE_Int* CF_marker, HYPRE_Int* CF_marker_offd, + HYPRE_Int num_functions, HYPRE_Int* dof_func, HYPRE_Int* dof_func_offd, + HYPRE_Int* P_diag_i, HYPRE_Int* P_diag_j, HYPRE_Real* P_diag_data, + HYPRE_Int* P_offd_i, HYPRE_Int* P_offd_j, HYPRE_Real* P_offd_data, + HYPRE_Int* col_offd_S_to_A, HYPRE_Int* fine_to_coarse ) +{ + /*-----------------------------------------------------------------------*/ + /* Compute interpolation matrix, P + + Input: nr_of_rows - Number of rows in matrix (local in processor) + A_diag_i, A_diag_j, A_diag_data - CSR representation of A_diag + A_offd_i, A_offd_j, A_offd_data - CSR representation of A_offd + S_diag_i, S_diag_j - CSR representation of S_diag + S_offd_i, S_offd_j - CSR representation of S_offd + CF_marker - Coarse/Fine flags for indices (rows) in this processor + CF_marker_offd - Coarse/Fine flags for indices (rows) not in this processor + num_function - Number of degrees of freedom per grid point + dof_func - vector over nonzero elements of A_diag, indicating the degree of freedom + dof_func_offd - vector over nonzero elements of A_offd, indicating the degree of freedom + fine_to_coarse - Vector of length nr_of_rows-1. + + Output: P_diag_j - Column indices in CSR representation of P_diag + P_diag_data - Matrix elements in CSR representation of P_diag + P_offd_j - Column indices in CSR representation of P_offd + P_offd_data - Matrix elements in CSR representation of P_diag + */ + /*-----------------------------------------------------------------------*/ + + HYPRE_Int myid= threadIdx.x + blockIdx.x * blockDim.x, i, ind, indp, inds, i1; + HYPRE_Real diagonal, sum_N_pos, sum_N_neg, sum_P_pos, sum_P_neg, alfa, beta, aval; + const HYPRE_Int nthreads = gridDim.x * blockDim.x; + for( i = myid ; i < nr_of_rows ; i += nthreads ) + { + if( CF_marker[i] > 0 ) + { + /*-------------------------------------------------------------------- + * If i is a c-point, interpolation is the identity. + *--------------------------------------------------------------------*/ + ind = P_diag_i[i]; + P_diag_j[ind] = fine_to_coarse[i]; + P_diag_data[ind] = 1.0; + } + else + { + /*-------------------------------------------------------------------- + * Point is f-point, use direct interpolation + *--------------------------------------------------------------------*/ + sum_N_pos = sum_N_neg = sum_P_pos = sum_P_neg = 0; + inds=S_diag_i[i]; + indp=P_diag_i[i]; + diagonal = A_diag_data[A_diag_i[i]]; + + /* The loops below assume that the sparsity structure of S was obtained */ + /* by removing elements from the sparsity structure of A, but that no */ + /* reordering of S (or A) has been done */ + + for( ind=A_diag_i[i]+1; ind < A_diag_i[i+1] ; ind++ ) + { + i1 = A_diag_j[ind]; + aval = A_diag_data[ind]; + if (num_functions == 1 || dof_func[i1] == dof_func[i]) + { + if( aval > 0 ) + sum_N_pos += aval; + else + sum_N_neg += aval; + // if (A_diag_data[ind] > 0) + // sum_N_pos += A_diag_data[ind]; + // else + // sum_N_neg += A_diag_data[ind]; + } + if( inds < S_diag_i[i+1] && i1==S_diag_j[inds] ) + { + /* Element is in both A and S */ + if (CF_marker[i1] > 0 && ( num_functions==1 || dof_func[i1]==dof_func[i]) ) + { + // P_diag_data[indp] = A_diag_data[ind]; + P_diag_data[indp] = aval; + P_diag_j[indp++] = fine_to_coarse[i1]; + // if( A_diag_data[ind] > 0 ) + // sum_P_pos += A_diag_data[ind]; + // else + // sum_P_neg += A_diag_data[ind]; + if( aval > 0 ) + sum_P_pos += aval; + else + sum_P_neg += aval; + } + inds++; + } + } + inds=S_offd_i[i]; + indp=P_offd_i[i]; + for( ind=A_offd_i[i]; ind < A_offd_i[i+1] ; ind++ ) + { + i1 = A_offd_j[ind]; + aval = A_offd_data[ind]; + if (num_functions == 1 || dof_func_offd[i1] == dof_func[i]) + { + if (aval > 0) + sum_N_pos += aval; + else + sum_N_neg += aval; + } + if( col_offd_S_to_A ) + i1 = col_offd_S_to_A[S_offd_j[inds]]; + if( inds < S_offd_i[i+1] && i1==S_offd_j[inds] ) + { + /* Element is in both A and S */ + if (CF_marker_offd[i1] > 0 && ( num_functions == 1 || dof_func_offd[i1]==dof_func[i] ) ) + { + P_offd_data[indp] = aval; + P_offd_j[indp++] = i1; + if( aval > 0 ) + sum_P_pos += aval; + else + sum_P_neg += aval; + } + inds++; + } + } + alfa=beta=1.0; + if (sum_P_neg) alfa = sum_N_neg/(sum_P_neg*diagonal); + if (sum_P_pos) beta = sum_N_pos/(sum_P_pos*diagonal); + + for( indp=P_diag_i[i]; indp < P_diag_i[i+1] ; indp++ ) + { + P_diag_data[indp] *= (P_diag_data[indp]>0)*(alfa-beta)-alfa; + // if (P_diag_data[indp]> 0) + // P_diag_data[indp] *= -beta; + // else + // P_diag_data[indp] *= -alfa; + } + for( indp=P_offd_i[i]; indp < P_offd_i[i+1] ; indp++ ) + { + P_offd_data[indp] *= (P_offd_data[indp]>0)*(alfa-beta)-alfa; + // if (P_offd_data[indp]> 0) + // P_offd_data[indp] *= -beta; + // else + // P_offd_data[indp] *= -alfa; + } + if( CF_marker[i] == -3 ) + CF_marker[i] = -1; + } + } +} + +/*-----------------------------------------------------------------------*/ +__global__ void hypre_BoomerAMGBuildDirInterp_dev3( HYPRE_Int P_offd_size, + HYPRE_Int* P_offd_j, + HYPRE_Int* P_marker ) +/* + Re-enumerate the columns of P_offd according to the mapping given in P_marker + + */ +{ + HYPRE_Int myid= threadIdx.x + blockIdx.x * blockDim.x, i; + const HYPRE_Int nthreads = gridDim.x * blockDim.x; + + for( i = myid ; i < P_offd_size ; i += nthreads ) + P_offd_j[i] = P_marker[P_offd_j[i]]; +} + + +/*-----------------------------------------------------------------------*/ +__global__ void hypre_BoomerAMGBuildDirInterp_dev4( HYPRE_Int num_cols_A_offd, + HYPRE_Int* P_marker, + HYPRE_Int* tmp_map_offd ) +{ + /* Construct array tmp_map_offd + + Note: This is an inefficient kernel, its only purpose is to make it + possible to keep the arrays on device */ + HYPRE_Int myid= threadIdx.x + blockIdx.x * blockDim.x, i; + const HYPRE_Int nthreads = gridDim.x * blockDim.x; + + for( i = myid ; i < num_cols_A_offd ; i += nthreads ) + { + if( P_marker[i] < P_marker[i+1] ) + tmp_map_offd[P_marker[i]] = i; + } +} + +/*-----------------------------------------------------------------------*/ +__global__ void hypre_BoomerAMGBuildDirInterp_dev5( HYPRE_Int P_offd_size, + HYPRE_Int* P_offd_j, + HYPRE_Int* P_marker ) +/* + set P_marker[i] to 1 if A's column i is also present in P, otherwise P_marker[i] is 0 + */ +{ + HYPRE_Int myid= threadIdx.x + blockIdx.x * blockDim.x, i; + const HYPRE_Int nthreads = gridDim.x * blockDim.x; + for( i = myid ; i < P_offd_size ; i += nthreads ) + { + atomicOr(&P_marker[P_offd_j[i]],1); + } +} + +#endif + diff -Nru hypre-2.16.0/src/parcsr_ls/par_interp_trunc_device.c hypre-2.18.2/src/parcsr_ls/par_interp_trunc_device.c --- hypre-2.16.0/src/parcsr_ls/par_interp_trunc_device.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_interp_trunc_device.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,762 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#include "_hypre_parcsr_ls.h" + +#if defined(HYPRE_USING_CUDA) + +#if 1 + +__global__ void +hypreCUDAKernel_InterpTruncation( HYPRE_Int nrows, + HYPRE_Real trunc_factor, + HYPRE_Int max_elmts, + HYPRE_Int *P_i, + HYPRE_Int *P_j, + HYPRE_Real *P_a) +{ + HYPRE_Real row_max = 0.0, row_sum = 0.0, row_scal = 0.0; + HYPRE_Int row = hypre_cuda_get_grid_warp_id<1,1>(); + + if (row >= nrows) + { + return; + } + + HYPRE_Int lane = hypre_cuda_get_lane_id<1>(), p, q; + + /* 1. compute row max, rowsum */ + if (lane < 2) + { + p = read_only_load(P_i + row + lane); + } + q = __shfl_sync(HYPRE_WARP_FULL_MASK, p, 1); + p = __shfl_sync(HYPRE_WARP_FULL_MASK, p, 0); + + for (HYPRE_Int i = p + lane; __any_sync(HYPRE_WARP_FULL_MASK, i < q); i += HYPRE_WARP_SIZE) + { + if (i < q) + { + HYPRE_Real v = read_only_load(&P_a[i]); + row_max = hypre_max(row_max, fabs(v)); + row_sum += v; + } + } + + row_max = warp_allreduce_max(row_max) * trunc_factor; + row_sum = warp_allreduce_sum(row_sum); + + /* 2. mark dropped entries by -1 in P_j, and compute row_scal */ + HYPRE_Int last_pos = -1; + for (HYPRE_Int i = p + lane; __any_sync(HYPRE_WARP_FULL_MASK, i < q); i += HYPRE_WARP_SIZE) + { + HYPRE_Int cond = 0, cond_prev; + + cond_prev = i == p + lane || warp_allreduce_min(cond); + + if (i < q) + { + HYPRE_Real v; + cond = cond_prev && i < p + max_elmts; + if (cond) + { + v = read_only_load(&P_a[i]); + } + cond = cond && fabs(v) >= row_max; + + if (cond) + { + last_pos = i; + row_scal += v; + } + else + { + P_j[i] = -1; + } + } + } + + row_scal = row_sum / warp_allreduce_sum(row_scal); + + /* 3. scale the row */ + for (HYPRE_Int i = p + lane; i <= last_pos; i += HYPRE_WARP_SIZE) + { + P_a[i] *= row_scal; + } +} + +/*-----------------------------------------------------------------------*/ +HYPRE_Int +hypre_BoomerAMGInterpTruncationDevice( hypre_ParCSRMatrix *P, HYPRE_Real trunc_factor, HYPRE_Int max_elmts ) +{ +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_INTERP_TRUNC] -= hypre_MPI_Wtime(); +#endif + + hypre_CSRMatrix *P_diag = hypre_ParCSRMatrixDiag(P); + HYPRE_Int *P_diag_i = hypre_CSRMatrixI(P_diag); + HYPRE_Int *P_diag_j = hypre_CSRMatrixJ(P_diag); + HYPRE_Real *P_diag_a = hypre_CSRMatrixData(P_diag); + + hypre_CSRMatrix *P_offd = hypre_ParCSRMatrixOffd(P); + HYPRE_Int *P_offd_i = hypre_CSRMatrixI(P_offd); + HYPRE_Int *P_offd_j = hypre_CSRMatrixJ(P_offd); + HYPRE_Real *P_offd_a = hypre_CSRMatrixData(P_offd); + + //HYPRE_Int ncols = hypre_CSRMatrixNumCols(P_diag); + HYPRE_Int nrows = hypre_CSRMatrixNumRows(P_diag); + HYPRE_Int nnz_diag = hypre_CSRMatrixNumNonzeros(P_diag); + HYPRE_Int nnz_offd = hypre_CSRMatrixNumNonzeros(P_offd); + HYPRE_Int nnz_P = nnz_diag + nnz_offd; + HYPRE_Int *P_i = hypre_TAlloc(HYPRE_Int, nnz_P, HYPRE_MEMORY_DEVICE); + HYPRE_Int *P_j = hypre_TAlloc(HYPRE_Int, nnz_P, HYPRE_MEMORY_DEVICE); + HYPRE_Real *P_a = hypre_TAlloc(HYPRE_Real, nnz_P, HYPRE_MEMORY_DEVICE); + HYPRE_Int *P_rowptr = hypre_TAlloc(HYPRE_Int, nrows+1, HYPRE_MEMORY_DEVICE); + HYPRE_Int *tmp_rowid = hypre_TAlloc(HYPRE_Int, nnz_P, HYPRE_MEMORY_DEVICE); + + HYPRE_Int memory_loc = hypre_CSRMatrixMemoryLocation(P_diag); + HYPRE_Int new_nnz_diag = 0, new_nnz_offd = 0; + HYPRE_Int ierr = 0; + + /* + HYPRE_Int num_procs, my_id; + MPI_Comm comm = hypre_ParCSRMatrixComm(P); + hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_rank(comm, &my_id); + */ + + hypreDevice_CsrRowPtrsToIndices_v2(nrows, P_diag_i, P_i); + hypreDevice_CsrRowPtrsToIndices_v2(nrows, P_offd_i, P_i + nnz_diag); + + hypre_TMemcpy(P_j, P_diag_j, HYPRE_Int, nnz_diag, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_DEVICE); + /* offd col id := -2 - offd col id */ + HYPRE_THRUST_CALL(transform, P_offd_j, P_offd_j + nnz_offd, P_j + nnz_diag, -_1 - 2); + + hypre_TMemcpy(P_a, P_diag_a, HYPRE_Real, nnz_diag, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_DEVICE); + hypre_TMemcpy(P_a + nnz_diag, P_offd_a, HYPRE_Real, nnz_offd, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_DEVICE); + + /* sort rows based on (rowind, abs(P_a)) */ + hypreDevice_StableSortByTupleKey(nnz_P, P_i, P_a, P_j, 1); + + hypreDevice_CsrRowIndicesToPtrs_v2(nrows, nnz_P, P_i, P_rowptr); + + /* truncate P, unwanted entries are marked -1 in P_j */ + dim3 bDim = hypre_GetDefaultCUDABlockDimension(); + dim3 gDim = hypre_GetDefaultCUDAGridDimension(nrows, "warp", bDim); + + HYPRE_CUDA_LAUNCH( hypreCUDAKernel_InterpTruncation, gDim, bDim, + nrows, trunc_factor, max_elmts, P_rowptr, P_j, P_a ); + + /* build new P_diag and P_offd */ + if (nnz_diag) + { + auto new_end = HYPRE_THRUST_CALL( + copy_if, + thrust::make_zip_iterator(thrust::make_tuple(P_i, P_j, P_a)), + thrust::make_zip_iterator(thrust::make_tuple(P_i+nnz_P, P_j+nnz_P, P_a+nnz_P)), + P_j, + thrust::make_zip_iterator(thrust::make_tuple(tmp_rowid, P_diag_j, P_diag_a)), + is_nonnegative() ); + + new_nnz_diag = thrust::get<0>(new_end.get_iterator_tuple()) - tmp_rowid; + + hypre_assert(new_nnz_diag <= nnz_diag); + + hypreDevice_CsrRowIndicesToPtrs_v2(nrows, new_nnz_diag, tmp_rowid, P_diag_i); + } + + if (nnz_offd) + { + less_than pred(-1); + auto new_end = HYPRE_THRUST_CALL( + copy_if, + thrust::make_zip_iterator(thrust::make_tuple(P_i, P_j, P_a)), + thrust::make_zip_iterator(thrust::make_tuple(P_i+nnz_P, P_j+nnz_P, P_a+nnz_P)), + P_j, + thrust::make_zip_iterator(thrust::make_tuple(tmp_rowid, P_offd_j, P_offd_a)), + pred ); + + new_nnz_offd = thrust::get<0>(new_end.get_iterator_tuple()) - tmp_rowid; + + hypre_assert(new_nnz_offd <= nnz_offd); + + HYPRE_THRUST_CALL(transform, P_offd_j, P_offd_j + new_nnz_offd, P_offd_j, -_1 - 2); + + hypreDevice_CsrRowIndicesToPtrs_v2(nrows, new_nnz_offd, tmp_rowid, P_offd_i); + } + + /* + printf("nnz_diag %d, new nnz_diag %d\n", nnz_diag, new_nnz_diag); + printf("nnz_offd %d, new nnz_offd %d\n", nnz_offd, new_nnz_offd); + */ + + hypre_CSRMatrixJ (P_diag) = hypre_TReAlloc(P_diag_j, HYPRE_Int, new_nnz_diag, memory_loc); + hypre_CSRMatrixData(P_diag) = hypre_TReAlloc(P_diag_a, HYPRE_Real, new_nnz_diag, memory_loc); + hypre_CSRMatrixJ (P_offd) = hypre_TReAlloc(P_offd_j, HYPRE_Int, new_nnz_offd, memory_loc); + hypre_CSRMatrixData(P_offd) = hypre_TReAlloc(P_offd_a, HYPRE_Real, new_nnz_offd, memory_loc); + hypre_CSRMatrixNumNonzeros(P_diag) = new_nnz_diag; + hypre_CSRMatrixNumNonzeros(P_offd) = new_nnz_offd; + + hypre_TFree(P_i, HYPRE_MEMORY_DEVICE); + hypre_TFree(P_j, HYPRE_MEMORY_DEVICE); + hypre_TFree(P_a, HYPRE_MEMORY_DEVICE); + hypre_TFree(P_rowptr, HYPRE_MEMORY_DEVICE); + hypre_TFree(tmp_rowid, HYPRE_MEMORY_DEVICE); + +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_INTERP_TRUNC] += hypre_MPI_Wtime(); +#endif + + return ierr; +} + +#else + +__global__ void hypre_BoomerAMGInterpTruncationDevice_dev1( HYPRE_Int num_rows_P, + HYPRE_Int* P_diag_i, + HYPRE_Int* P_diag_j, + HYPRE_Real* P_diag_data, + HYPRE_Int* P_offd_i, + HYPRE_Int* P_offd_j, + HYPRE_Real* P_offd_data, + HYPRE_Int* P_aux_diag_i, + HYPRE_Int* P_aux_offd_i, + HYPRE_Real trunc_factor ); + +__global__ void hypre_BoomerAMGInterpTruncationDevice_dev2( HYPRE_Int num_rows_P, + HYPRE_Int* P_diag_i, + HYPRE_Int* P_offd_i, + HYPRE_Int* P_aux_diag_i, + HYPRE_Int* P_aux_offd_i ); + +__global__ void hypre_BoomerAMGInterpTruncationDevice_dev3( HYPRE_Int num_rows_P, + HYPRE_Int* P_diag_i, + HYPRE_Int* P_diag_j, + HYPRE_Real* P_diag_data, + HYPRE_Int* P_offd_i, + HYPRE_Int* P_offd_j, + HYPRE_Real* P_offd_data, + HYPRE_Int* P_aux_diag_i, + HYPRE_Int* P_aux_offd_i, + HYPRE_Int max_elements ); + +__global__ void hypre_BoomerAMGInterpTruncationDevice_dev4( HYPRE_Int num_rows_P, + HYPRE_Int* P_diag_i, + HYPRE_Int* P_diag_j, + HYPRE_Real* P_diag_data, + HYPRE_Int* P_diag_i_new, + HYPRE_Int* P_diag_j_new, + HYPRE_Real* P_diag_data_new, + HYPRE_Int* P_offd_i, + HYPRE_Int* P_offd_j, + HYPRE_Real* P_offd_data, + HYPRE_Int* P_offd_i_new, + HYPRE_Int* P_offd_j_new, + HYPRE_Real* P_offd_data_new ); + +__device__ void hypre_qsort2abs_dev( HYPRE_Int *v, + HYPRE_Real *w, + HYPRE_Int left, + HYPRE_Int right ); + +__device__ void hypre_isort2abs_dev( HYPRE_Int *v, + HYPRE_Real *w, + HYPRE_Int n ); + +/*-----------------------------------------------------------------------*/ +/* + typedef thrust::zip_iterator::iterator,thrust::device_vector::iterator > > ZIvec2Iterator; + struct compare_tuple + { + template + __host__ __device__ + bool operator()(Tuple lhs, Tuple rhs) + { + return thrust::get<0>(lhs)+thrust::get<1>(lhs) < thrust::get<0>(rhs)+thrust::get<1>(rhs); + } + }; +*/ + +/*-----------------------------------------------------------------------*/ +HYPRE_Int +hypre_BoomerAMGInterpTruncationDevice( hypre_ParCSRMatrix *P, HYPRE_Real trunc_factor, HYPRE_Int max_elmts) +{ +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_INTERP_TRUNC] -= hypre_MPI_Wtime(); +#endif + + hypre_CSRMatrix *P_diag = hypre_ParCSRMatrixDiag(P); + HYPRE_Int *P_diag_i = hypre_CSRMatrixI(P_diag); + HYPRE_Int *P_diag_j = hypre_CSRMatrixJ(P_diag); + HYPRE_Real *P_diag_data = hypre_CSRMatrixData(P_diag); + HYPRE_Int *P_diag_j_new; + HYPRE_Real *P_diag_data_new; + + hypre_CSRMatrix *P_offd = hypre_ParCSRMatrixOffd(P); + HYPRE_Int *P_offd_i = hypre_CSRMatrixI(P_offd); + HYPRE_Int *P_offd_j = hypre_CSRMatrixJ(P_offd); + HYPRE_Real *P_offd_data = hypre_CSRMatrixData(P_offd); + HYPRE_Int *P_offd_j_new; + HYPRE_Real *P_offd_data_new; + HYPRE_Int* P_aux_diag_i=NULL; + HYPRE_Int* P_aux_offd_i=NULL; + HYPRE_Int* nel_per_row; + + HYPRE_Int n_fine = hypre_CSRMatrixNumRows(P_diag); + HYPRE_Int P_diag_size; + HYPRE_Int P_offd_size; + HYPRE_Int mx_row; + HYPRE_Int limit=1048576;/* arbitrarily choosen limit on CUDA grid size, most devices seem to have 2^31 as grid size limit */ + bool truncated = false; + + dim3 grid, block(32,1,1); + grid.x = n_fine/block.x; + if( n_fine % block.x != 0 ) + grid.x++; + if( grid.x > limit ) + grid.x = limit; + grid.y = 1; + grid.z = 1; + + if( 0.0 < trunc_factor && trunc_factor < 1.0 ) + { + /* truncate with trunc_factor, return number of remaining elements/row in P_aux_diag_i and P_aux_offd_i */ + P_aux_diag_i = hypre_CTAlloc(HYPRE_Int, n_fine+1, HYPRE_MEMORY_SHARED); + P_aux_offd_i = hypre_CTAlloc(HYPRE_Int, n_fine+1, HYPRE_MEMORY_SHARED); + HYPRE_CUDA_LAUNCH( hypre_BoomerAMGInterpTruncationDevice_dev1, grid, block, + n_fine, P_diag_i, P_diag_j, P_diag_data, + P_offd_i, P_offd_j, P_offd_data, + P_aux_diag_i, P_aux_offd_i, trunc_factor ); + truncated = true; + } + + if( max_elmts > 0 ) + { + if( !truncated ) + { + /* If not previously truncated, set up P_aux_diag_i and P_aux_offd_i with full number of elements/row */ + P_aux_diag_i = hypre_CTAlloc(HYPRE_Int, n_fine+1, HYPRE_MEMORY_SHARED); + P_aux_offd_i = hypre_CTAlloc(HYPRE_Int, n_fine+1, HYPRE_MEMORY_SHARED); + HYPRE_CUDA_LAUNCH( hypre_BoomerAMGInterpTruncationDevice_dev2, grid,block, + n_fine, P_diag_i, P_offd_i, P_aux_diag_i, P_aux_offd_i ); + } + nel_per_row = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_DEVICE); + HYPRE_THRUST_CALL(transform,&P_aux_diag_i[0],&P_aux_diag_i[n_fine],&P_aux_offd_i[0],&nel_per_row[0],thrust::plus() ); + mx_row = HYPRE_THRUST_CALL(reduce,&nel_per_row[0],&nel_per_row[n_fine],0,thrust::maximum()); + hypre_TFree(nel_per_row,HYPRE_MEMORY_DEVICE); + + /* Use zip_iterator to avoid creating help array nel_per_row */ + /* + ZIvec2Iterator i = thrust::max_element(thrust::device,thrust::make_zip_iterator(&P_aux_diag_i[0],&P_aux_offd_i[0]), + thrust::make_zip_iterator(&P_aux_diag_i[n_fine],&P_aux_offd_i[n_fine],compare_tuple() )); + mx_row = thrust::get<0>(*i)+thrust::get<1>(*i); + */ + if( mx_row > max_elmts ) + { + /* Truncate with respect to maximum number of elements per row */ + HYPRE_CUDA_LAUNCH( hypre_BoomerAMGInterpTruncationDevice_dev3, grid, block, + n_fine, P_diag_i, P_diag_j, P_diag_data, + P_offd_i, P_offd_j, P_offd_data, P_aux_diag_i, + P_aux_offd_i, max_elmts ); + truncated = true; + } + } + + if( truncated ) + { + cudaDeviceSynchronize(); + /* Matrix has been truncated, reshuffle it into shorter arrays */ + HYPRE_THRUST_CALL(exclusive_scan, &P_aux_diag_i[0],&P_aux_diag_i[n_fine+1],&P_aux_diag_i[0]); + P_diag_size = P_aux_diag_i[n_fine]; + HYPRE_THRUST_CALL(exclusive_scan, &P_aux_offd_i[0],&P_aux_offd_i[n_fine+1],&P_aux_offd_i[0]); + P_offd_size = P_aux_offd_i[n_fine]; + + P_diag_j_new = hypre_CTAlloc(HYPRE_Int, P_diag_size, HYPRE_MEMORY_SHARED); + P_diag_data_new = hypre_CTAlloc(HYPRE_Real, P_diag_size, HYPRE_MEMORY_SHARED); + P_offd_j_new = hypre_CTAlloc(HYPRE_Int, P_offd_size, HYPRE_MEMORY_SHARED); + P_offd_data_new = hypre_CTAlloc(HYPRE_Real, P_offd_size, HYPRE_MEMORY_SHARED); + + HYPRE_CUDA_LAUNCH( hypre_BoomerAMGInterpTruncationDevice_dev4, grid,block, + n_fine, P_diag_i, P_diag_j, P_diag_data, P_aux_diag_i, + P_diag_j_new, P_diag_data_new, + P_offd_i, P_offd_j, P_offd_data, P_aux_offd_i, + P_offd_j_new, P_offd_data_new ); + cudaDeviceSynchronize(); + + // P_diag_i[n_fine] = P_diag_size ; + hypre_TFree(P_diag_i, HYPRE_MEMORY_SHARED); + hypre_TFree(P_diag_j, HYPRE_MEMORY_SHARED); + hypre_TFree(P_diag_data, HYPRE_MEMORY_SHARED); + hypre_CSRMatrixI(P_diag) = P_aux_diag_i; + hypre_CSRMatrixJ(P_diag) = P_diag_j_new; + hypre_CSRMatrixData(P_diag) = P_diag_data_new; + hypre_CSRMatrixNumNonzeros(P_diag) = P_diag_size; + + // P_offd_i[n_fine] = P_offd_size ; + hypre_TFree(P_offd_i, HYPRE_MEMORY_SHARED); + hypre_TFree(P_offd_j, HYPRE_MEMORY_SHARED); + hypre_TFree(P_offd_data, HYPRE_MEMORY_SHARED); + hypre_CSRMatrixI(P_offd) = P_aux_offd_i; + hypre_CSRMatrixJ(P_offd) = P_offd_j_new; + hypre_CSRMatrixData(P_offd) = P_offd_data_new; + hypre_CSRMatrixNumNonzeros(P_offd) = P_offd_size; + } + else if( P_aux_diag_i != NULL ) + { + hypre_TFree(P_aux_diag_i, HYPRE_MEMORY_SHARED); + hypre_TFree(P_aux_offd_i, HYPRE_MEMORY_SHARED); + } + return 0; +} + + +/* -----------------------------------------------------------------------*/ +__global__ void hypre_BoomerAMGInterpTruncationDevice_dev1( HYPRE_Int num_rows_P, + HYPRE_Int* P_diag_i, + HYPRE_Int* P_diag_j, + HYPRE_Real* P_diag_data, + HYPRE_Int* P_offd_i, + HYPRE_Int* P_offd_j, + HYPRE_Real* P_offd_data, + HYPRE_Int* P_aux_diag_i, + HYPRE_Int* P_aux_offd_i, + HYPRE_Real trunc_factor ) + /* + Perform truncation by eleminating all elements from row i whose absolute value is + smaller than trunc_factor*max_k|P_{i,k}|. + The matrix is rescaled after truncation to conserve its row sums. + + Input: num_rows_P - Number of rows of matrix in this MPI-task. + P_diag_i, P_diag_j, P_diag_data - CSR representation of block diagonal part of matrix. + P_offd_i, P_offd_j, P_offd_data - CSR representation of off-block diagonal part of matrix. + trunc_factor - Factor in truncation threshold. + + Output: P_aux_diag_i - P_aux_diag_i[i] holds the number of non-truncated elements on row i of P_diag. + P_aux_offd_i - P_aux_offd_i[i] holds the number of non-truncated elements on row i of P_offd. + P_diag_j, P_diag_data, P_offd_j, P_offd_data - For rows where truncation occurs, elements are + reordered to have the non-truncated elements first on each row, and the data arrays are rescaled. + + */ +{ + HYPRE_Int myid= threadIdx.x + blockIdx.x * blockDim.x, i, ind, indp,nel_diag, nel_offd; + HYPRE_Real max_coef, row_sum, row_sum_trunc; + const HYPRE_Int nthreads = gridDim.x * blockDim.x; + + for( i = myid ; i < num_rows_P ; i += nthreads ) + { + /* 1. Compute maximum absolute value element in row */ + max_coef = 0; + for (ind = P_diag_i[i]; ind < P_diag_i[i+1]; ind++) + max_coef = (max_coef < fabs(P_diag_data[ind])) ? + fabs(P_diag_data[ind]) : max_coef; + for (ind = P_offd_i[i]; ind < P_offd_i[i+1]; ind++) + max_coef = (max_coef < fabs(P_offd_data[ind])) ? + fabs(P_offd_data[ind]) : max_coef; + max_coef *= trunc_factor; + + /* 2. Eliminate small elements and compress row */ + nel_diag = 0; + row_sum = 0; + row_sum_trunc = 0; + indp = P_diag_i[i]; + for (ind = P_diag_i[i]; ind < P_diag_i[i+1]; ind++) + { + row_sum += P_diag_data[ind]; + if( fabs(P_diag_data[ind]) >= max_coef) + { + row_sum_trunc += P_diag_data[ind]; + P_diag_data[indp+nel_diag] = P_diag_data[ind]; + P_diag_j[indp+nel_diag++] = P_diag_j[ind]; + } + } + nel_offd = 0; + indp=P_offd_i[i]; + for (ind = P_offd_i[i]; ind < P_offd_i[i+1]; ind++) + { + row_sum += P_offd_data[ind]; + if( fabs(P_offd_data[ind]) >= max_coef) + { + row_sum_trunc += P_offd_data[ind]; + P_offd_data[indp+nel_offd] = P_offd_data[ind]; + P_offd_j[indp+nel_offd++] = P_offd_j[ind]; + } + } + + /* 3. Rescale row to conserve row sum */ + if( row_sum_trunc != 0 ) + { + if( row_sum_trunc != row_sum ) + { + row_sum_trunc = row_sum/row_sum_trunc; + for (ind = P_diag_i[i]; ind < P_diag_i[i]+nel_diag; ind++) + P_diag_data[ind] *= row_sum_trunc; + for (ind = P_offd_i[i]; ind < P_offd_i[i]+nel_offd; ind++) + P_offd_data[ind] *= row_sum_trunc; + } + } + /* 4. Remember number of elements of compressed matrix */ + P_aux_diag_i[i] = nel_diag; + P_aux_offd_i[i] = nel_offd; + } +} + +/*-----------------------------------------------------------------------*/ +__global__ void hypre_BoomerAMGInterpTruncationDevice_dev2( HYPRE_Int num_rows_P, + HYPRE_Int* P_diag_i, + HYPRE_Int* P_offd_i, + HYPRE_Int* P_aux_diag_i, + HYPRE_Int* P_aux_offd_i ) +/* + Construct P_aux_diag_i and P_aux_offd_i from a non-truncated matrix. + + Input: num_rows_P - Number of rows of matrix in this MPI-task. + P_diag_i - CSR vector I of P_diag. + P_offd_i - CSR vector I of P_offd. + + Output: P_aux_diag_i - P_aux_diag_i[i] holds the number of elements on row i in P_diag. + P_aux_offd_i - P_aux_offd_i[i] holds the number of elements on row i in P_offd. + */ +{ + HYPRE_Int myid= threadIdx.x + blockIdx.x * blockDim.x, i; + const HYPRE_Int nthreads = gridDim.x * blockDim.x; + for( i = myid ; i < num_rows_P ; i += nthreads ) + P_aux_diag_i[i] = P_diag_i[i+1]-P_diag_i[i]; + for( i = myid ; i < num_rows_P ; i += nthreads ) + P_aux_offd_i[i] = P_offd_i[i+1]-P_offd_i[i]; +} + +/*-----------------------------------------------------------------------*/ +__global__ void hypre_BoomerAMGInterpTruncationDevice_dev3( HYPRE_Int num_rows_P, + HYPRE_Int* P_diag_i, + HYPRE_Int* P_diag_j, + HYPRE_Real* P_diag_data, + HYPRE_Int* P_offd_i, + HYPRE_Int* P_offd_j, + HYPRE_Real* P_offd_data, + HYPRE_Int* P_aux_diag_i, + HYPRE_Int* P_aux_offd_i, + HYPRE_Int max_elements ) + /* + Perform truncation by retaining the max_elements largest (absolute value) elements of each row. + The matrix is rescaled after truncation to conserve its row sums. + + Input: num_rows_P - Number of rows of matrix in this MPI-task. + P_diag_i, P_diag_j, P_diag_data - CSR representation of block diagonal part of matrix + P_offd_i, P_offd_j, P_offd_data - CSR representation of off-block diagonal part of matrix + P_aux_diag_i - P_aux_diag_i[i] holds the number of non-truncated elements on row i in P_diag. + P_aux_offd_i - P_aux_offd_i[i] holds the number of non-truncated elements on row i in P_offd. + + Output: P_aux_diag_i, P_aux_offd_i - Updated with the new number of elements per row, after truncation. + P_diag_j, P_diag_data, P_offd_j, P_offd_data - Reordered so that the first P_aux_diag_i[i] and + the first P_aux_offd_i[i] elements on each row form the truncated matrix. +*/ +{ + HYPRE_Int myid= threadIdx.x + blockIdx.x * blockDim.x, i, nel, ind, indo; + HYPRE_Real row_sum, row_sum_trunc; + const HYPRE_Int nthreads = gridDim.x * blockDim.x; + + for( i = myid ; i < num_rows_P ; i += nthreads ) + { + /* count number of elements in row */ + nel = P_aux_diag_i[i]+P_aux_offd_i[i]; + + /* 0. Do we need to do anything ? */ + if( nel > max_elements ) + { + /* 1. Save row sum before truncation, for rescaling below */ + row_sum = 0; + for (ind = P_diag_i[i]; ind < P_diag_i[i]+P_aux_diag_i[i]; ind++) + row_sum += P_diag_data[ind]; + for (ind = P_offd_i[i]; ind < P_offd_i[i]+P_aux_offd_i[i]; ind++) + row_sum += P_offd_data[ind]; + + /* Sort in place, avoid allocation of extra array */ + hypre_isort2abs_dev(&P_diag_j[P_diag_i[i]], &P_diag_data[P_diag_i[i]], P_aux_diag_i[i] ); + if( P_aux_offd_i[i] > 0 ) + hypre_isort2abs_dev(&P_offd_j[P_offd_i[i]], &P_offd_data[P_offd_i[i]], P_aux_offd_i[i] ); + /* The routine hypre_qsort2abs(v,w,i0,i1) sorts (v,w) in decreasing order w.r.t w */ + /* hypre_qsort2abs_dev(&P_diag_j[i], &P_diag_data[i], 0, P_aux_diag_i[i]-1 ); + hypre_qsort2abs_dev(&P_offd_j[i], &P_offd_data[i], 0, P_aux_offd_i[i]-1 );*/ + + /* 2. Retain the max_elements largest elements, only index of last element + needs to be computed, since data is now sorted */ + nel = 0; + ind =P_diag_i[i]; + indo=P_offd_i[i]; + + /* 2a. Also, keep track of row sum of truncated matrix, for rescaling below */ + row_sum_trunc = 0; + while( nel < max_elements ) + { + if( ind < P_diag_i[i]+P_aux_diag_i[i] && indo < P_offd_i[i]+P_aux_offd_i[i] ) + { + if( fabs(P_diag_data[ind])>fabs(P_offd_data[indo]) ) + { + row_sum_trunc += P_diag_data[ind]; + ind++; + } + else + { + row_sum_trunc += P_offd_data[indo]; + indo++; + } + } + else if( ind < P_diag_i[i]+P_aux_diag_i[i] ) + { + row_sum_trunc += P_diag_data[ind]; + ind++; + } + else + { + row_sum_trunc += P_offd_data[indo]; + indo++; + } + nel++; + } + /* 3. Remember new row sizes */ + P_aux_diag_i[i] = ind-P_diag_i[i]; + P_aux_offd_i[i] = indo-P_offd_i[i]; + + /* 4. Rescale row to conserve row sum */ + if( row_sum_trunc != 0 ) + { + if( row_sum_trunc != row_sum ) + { + row_sum_trunc = row_sum/row_sum_trunc; + for (ind = P_diag_i[i]; ind < P_diag_i[i]+P_aux_diag_i[i]; ind++) + P_diag_data[ind] *= row_sum_trunc; + for (ind = P_offd_i[i]; ind < P_offd_i[i]+P_aux_offd_i[i]; ind++) + P_offd_data[ind] *= row_sum_trunc; + } + } + } + } +} + + +/*-----------------------------------------------------------------------*/ +__global__ void hypre_BoomerAMGInterpTruncationDevice_dev4( HYPRE_Int num_rows_P, + HYPRE_Int* P_diag_i, + HYPRE_Int* P_diag_j, + HYPRE_Real* P_diag_data, + HYPRE_Int* P_diag_i_new, + HYPRE_Int* P_diag_j_new, + HYPRE_Real* P_diag_data_new, + HYPRE_Int* P_offd_i, + HYPRE_Int* P_offd_j, + HYPRE_Real* P_offd_data, + HYPRE_Int* P_offd_i_new, + HYPRE_Int* P_offd_j_new, + HYPRE_Real* P_offd_data_new ) +/* + Copy truncated matrix to smaller storage. In the previous kernels, the number of elements per row + has been reduced, but the matrix is still stored in the old CSR arrays. + + Input: num_rows_P - Number of rows of matrix in this MPI-task. + P_diag_i, P_diag_j, P_diag_data - CSR representation of block diagonal part of matrix + P_offd_i, P_offd_j, P_offd_data - CSR representation of off-block diagonal part of matrix + P_diag_i_new - P_diag has been truncated, this is the new CSR I-vector, pointing to beginnings of rows. + P_offd_i_new - P_offd has been truncated, this is the new CSR I-vector, pointing to beginnings of rows. + + Output: P_diag_j_new, P_diag_data_new, P_offd_j_new, P_offd_data_new - These are the resized CSR arrays of the truncated matrix. + */ +{ + HYPRE_Int myid= threadIdx.x + blockIdx.x * blockDim.x, i, ind, indp, indo; + const HYPRE_Int nthreads = gridDim.x * blockDim.x; + + for( i = myid ; i < num_rows_P ; i += nthreads ) + { + // indp = P_diag_i[i]; + indp = P_diag_i[i]-P_diag_i_new[i]; + for( ind = P_diag_i_new[i] ; ind < P_diag_i_new[i+1]; ind++ ) + { + // P_diag_j_new[ind] = P_diag_j[indp]; + // P_diag_data_new[ind] = P_diag_data[indp++]; + P_diag_j_new[ind] = P_diag_j[indp+ind]; + P_diag_data_new[ind] = P_diag_data[indp+ind]; + } + // indo = P_offd_i[i]; + indo = P_offd_i[i]-P_offd_i_new[i]; + for( ind = P_offd_i_new[i] ; ind < P_offd_i_new[i+1]; ind++ ) + { + // P_offd_j_new[ind] = P_offd_j[indo]; + // P_offd_data_new[ind] = P_offd_data[indo++]; + P_offd_j_new[ind] = P_offd_j[indo+ind]; + P_offd_data_new[ind] = P_offd_data[indo+ind]; + } + } +} + +/*-----------------------------------------------------------------------*/ +__device__ void hypre_swap2_dev(HYPRE_Int *v, + HYPRE_Real *w, + HYPRE_Int i, + HYPRE_Int j ) +{ + HYPRE_Int temp; + HYPRE_Real temp2; + + temp = v[i]; + v[i] = v[j]; + v[j] = temp; + temp2 = w[i]; + w[i] = w[j]; + w[j] = temp2; +} + +/*-----------------------------------------------------------------------*/ +/* sort both v and w, in place, but based only on entries in w */ +/* Sorts in decreasing order */ +__device__ void hypre_qsort2abs_dev( HYPRE_Int *v, + HYPRE_Real *w, + HYPRE_Int left, + HYPRE_Int right ) +{ + HYPRE_Int i, last; + if (left >= right) + return; + hypre_swap2_dev( v, w, left, (left+right)/2); + last = left; + for (i = left+1; i <= right; i++) + if (fabs(w[i]) > fabs(w[left])) + { + hypre_swap2_dev(v, w, ++last, i); + } + hypre_swap2_dev(v, w, left, last); + hypre_qsort2abs_dev(v, w, left, last-1); + hypre_qsort2abs_dev(v, w, last+1, right); +} + +/*-----------------------------------------------------------------------*/ +/* sort both v and w, in place, but based only on entries in w + Sorts in decreasing order, insertion sort, slower than quicksort + but avoids compiler warning message on stack size limit unknown. */ +__device__ void hypre_isort2abs_dev( HYPRE_Int *v, + HYPRE_Real *w, + HYPRE_Int n ) +{ + HYPRE_Int i, j, y; + HYPRE_Real x; + for( i=1 ; i < n ; i++ ) + { + x = w[i]; + y = v[i]; + j = i-1; + while( j >= 0 && fabs(w[j]) < fabs(x) ) + { + w[j+1] = w[j]; + v[j+1] = v[j]; + j--; + } + w[j+1] = x; + v[j+1] = y; + } +} + +#endif + +#endif /* #if defined(HYPRE_USING_CUDA) */ diff -Nru hypre-2.16.0/src/parcsr_ls/par_jacobi_interp.c hypre-2.18.2/src/parcsr_ls/par_jacobi_interp.c --- hypre-2.16.0/src/parcsr_ls/par_jacobi_interp.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_jacobi_interp.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" #include "par_amg.h" diff -Nru hypre-2.16.0/src/parcsr_ls/par_laplace_27pt.c hypre-2.18.2/src/parcsr_ls/par_laplace_27pt.c --- hypre-2.16.0/src/parcsr_ls/par_laplace_27pt.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_laplace_27pt.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,19 +1,10 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ - - #include "_hypre_parcsr_ls.h" /*-------------------------------------------------------------------------- diff -Nru hypre-2.16.0/src/parcsr_ls/par_laplace_9pt.c hypre-2.18.2/src/parcsr_ls/par_laplace_9pt.c --- hypre-2.16.0/src/parcsr_ls/par_laplace_9pt.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_laplace_9pt.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,19 +1,10 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ - #include "_hypre_parcsr_ls.h" /*-------------------------------------------------------------------------- @@ -34,12 +25,12 @@ hypre_CSRMatrix *diag; hypre_CSRMatrix *offd; - HYPRE_Int *diag_i; - HYPRE_Int *diag_j; + HYPRE_Int *diag_i; + HYPRE_Int *diag_j; HYPRE_Real *diag_data; - HYPRE_Int *offd_i; - HYPRE_Int *offd_j; + HYPRE_Int *offd_i; + HYPRE_Int *offd_j; HYPRE_Real *offd_data; HYPRE_BigInt *global_part; @@ -178,7 +169,7 @@ } } } - if (ix > nx_part[p] ) + if (ix > nx_part[p]) diag_i[cnt]++; else { @@ -199,7 +190,7 @@ if (iy+1 < ny_part[q+1]) { diag_i[cnt]++; - if (ix > nx_part[p] ) + if (ix > nx_part[p]) { diag_i[cnt]++; } @@ -263,7 +254,7 @@ { diag_j[cnt] = row_index; diag_data[cnt++] = value[0]; - if (iy > ny_part[q] ) + if (iy > ny_part[q]) { if (ix > nx_part[p]) { diff -Nru hypre-2.16.0/src/parcsr_ls/par_laplace.c hypre-2.18.2/src/parcsr_ls/par_laplace.c --- hypre-2.16.0/src/parcsr_ls/par_laplace.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_laplace.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" diff -Nru hypre-2.16.0/src/parcsr_ls/par_lr_interp.c hypre-2.18.2/src/parcsr_ls/par_lr_interp.c --- hypre-2.16.0/src/parcsr_ls/par_lr_interp.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_lr_interp.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" #include "aux_interp.h" @@ -165,8 +160,8 @@ if (num_procs > 1) { hypre_exchange_interp_data( - &CF_marker_offd, &dof_func_offd, &A_ext, &full_off_procNodes, &Sop, &extend_comm_pkg, - A, CF_marker, S, num_functions, dof_func, 0); + &CF_marker_offd, &dof_func_offd, &A_ext, &full_off_procNodes, &Sop, &extend_comm_pkg, + A, CF_marker, S, num_functions, dof_func, 0); { #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_EXTENDED_I_INTERP] += hypre_MPI_Wtime(); @@ -205,8 +200,8 @@ } hypre_initialize_vecs(n_fine, full_off_procNodes, fine_to_coarse, - fine_to_coarse_offd, P_marker, P_marker_offd, - tmp_CF_marker_offd); + fine_to_coarse_offd, P_marker, P_marker_offd, + tmp_CF_marker_offd); jj_counter = start_indexing; jj_counter_offd = start_indexing; @@ -253,24 +248,24 @@ k1 = S_diag_j[kk]; if (CF_marker[k1] >= 0) { - if(P_marker[k1] < P_diag_i[i]) + if (P_marker[k1] < P_diag_i[i]) { P_marker[k1] = jj_counter; jj_counter++; } } } - if(num_procs > 1) + if (num_procs > 1) { for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; if (CF_marker_offd[k1] >= 0) { - if(P_marker_offd[k1] < P_offd_i[i]) + if (P_marker_offd[k1] < P_offd_i[i]) { tmp_CF_marker_offd[k1] = 1; P_marker_offd[k1] = jj_counter_offd; @@ -287,11 +282,11 @@ for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { i1 = S_offd_j[jj]; - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[i1]; if (CF_marker_offd[i1] >= 0) { - if(P_marker_offd[i1] < P_offd_i[i]) + if (P_marker_offd[i1] < P_offd_i[i]) { tmp_CF_marker_offd[i1] = 1; P_marker_offd[i1] = jj_counter_offd; @@ -302,15 +297,15 @@ { /* F point; look at neighbors of i1. Sop contains global col * numbers and entries that could be in S_diag or S_offd or * neither. */ - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { big_k1 = Sop_j[kk]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* In S_diag */ loc_col = (HYPRE_Int)(big_k1-col_1); - if(CF_marker[loc_col] >= 0) + if (CF_marker[loc_col] >= 0) { - if(P_marker[loc_col] < P_diag_i[i]) + if (P_marker[loc_col] < P_diag_i[i]) { P_marker[loc_col] = jj_counter; jj_counter++; @@ -320,9 +315,9 @@ else { loc_col = (HYPRE_Int)(-big_k1 - 1); - if(CF_marker_offd[loc_col] >= 0) + if (CF_marker_offd[loc_col] >= 0) { - if(P_marker_offd[loc_col] < P_offd_i[i]) + if (P_marker_offd[loc_col] < P_offd_i[i]) { P_marker_offd[loc_col] = jj_counter_offd; tmp_CF_marker_offd[loc_col] = 1; @@ -341,7 +336,7 @@ { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d determine structure %f\n", - my_id, wall_time); + my_id, wall_time); fflush(NULL); } /*----------------------------------------------------------------------- @@ -371,11 +366,11 @@ jj_counter_offd = start_indexing; /* Fine to coarse mapping */ - if(num_procs > 1) + if (num_procs > 1) { hypre_big_insert_new_nodes(comm_pkg, extend_comm_pkg, fine_to_coarse, - full_off_procNodes, my_first_cpt, - fine_to_coarse_offd); + full_off_procNodes, my_first_cpt, + fine_to_coarse_offd); } /* Initialize ahat, which is a modification to a, used in the standard @@ -412,7 +407,7 @@ for (i = 0; i < n_fine; i++) { jj_begin_row = jj_counter; - if(num_procs > 1) + if (num_procs > 1) jj_begin_row_offd = jj_counter_offd; /*-------------------------------------------------------------------- @@ -461,7 +456,7 @@ k1 = S_diag_j[kk]; if (CF_marker[k1] >= 0) { - if(P_marker[k1] < jj_begin_row) + if (P_marker[k1] < jj_begin_row) { P_marker[k1] = jj_counter; P_diag_j[jj_counter] = k1; @@ -470,17 +465,17 @@ } } } - if(num_procs > 1) + if (num_procs > 1) { for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; - if(CF_marker_offd[k1] >= 0) + if (CF_marker_offd[k1] >= 0) { - if(P_marker_offd[k1] < jj_begin_row_offd) + if (P_marker_offd[k1] < jj_begin_row_offd) { P_marker_offd[k1] = jj_counter_offd; P_offd_j[jj_counter_offd] = k1; @@ -498,11 +493,11 @@ for (jj=S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { i1 = S_offd_j[jj]; - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[i1]; if ( CF_marker_offd[i1] >= 0) { - if(P_marker_offd[i1] < jj_begin_row_offd) + if (P_marker_offd[i1] < jj_begin_row_offd) { P_marker_offd[i1] = jj_counter_offd; P_offd_j[jj_counter_offd]=i1; @@ -513,15 +508,15 @@ else if (CF_marker_offd[i1] != -3) { P_marker_offd[i1] = strong_f_marker; - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { big_k1 = Sop_j[kk]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { loc_col = (HYPRE_Int)(big_k1-col_1); - if(CF_marker[loc_col] >= 0) + if (CF_marker[loc_col] >= 0) { - if(P_marker[loc_col] < jj_begin_row) + if (P_marker[loc_col] < jj_begin_row) { P_marker[loc_col] = jj_counter; P_diag_j[jj_counter] = loc_col; @@ -533,9 +528,9 @@ else { loc_col = (HYPRE_Int)(-big_k1 - 1); - if(CF_marker_offd[loc_col] >= 0) + if (CF_marker_offd[loc_col] >= 0) { - if(P_marker_offd[loc_col] < jj_begin_row_offd) + if (P_marker_offd[loc_col] < jj_begin_row_offd) { P_marker_offd[loc_col] = jj_counter_offd; P_offd_j[jj_counter_offd]=loc_col; @@ -589,7 +584,7 @@ } else { - if(num_functions == 1 || dof_func[i] == dof_func[i1]) + if (num_functions == 1 || dof_func[i] == dof_func[i1]) { distribute = A_diag_data[jj]/A_diag_data[A_diag_i[i1]]; for (kk = A_diag_i[i1]+1; kk < A_diag_i[i1+1]; kk++) @@ -611,13 +606,13 @@ ahat[cnt_f++] -= A_diag_data[kk]*distribute; } } - if(num_procs > 1) + if (num_procs > 1) { for (kk = A_offd_i[i1]; kk < A_offd_i[i1+1]; kk++) { k1 = A_offd_j[kk]; indx = ihat_offd[k1]; - if(num_functions == 1 || dof_func[i1] == dof_func_offd[k1]) + if (num_functions == 1 || dof_func[i1] == dof_func_offd[k1]) { if (indx > -1) ahat_offd[indx] -= A_offd_data[kk]*distribute; @@ -639,12 +634,12 @@ } } } - if(num_procs > 1) + if (num_procs > 1) { - for(jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) { i1 = A_offd_j[jj]; - if(P_marker_offd[i1] != strong_f_marker) + if (P_marker_offd[i1] != strong_f_marker) { indx = ihat_offd[i1]; if (indx > -1) @@ -664,13 +659,13 @@ } else { - if(num_functions == 1 || dof_func[i] == dof_func_offd[i1]) + if (num_functions == 1 || dof_func[i] == dof_func_offd[i1]) { distribute = A_offd_data[jj]/A_ext_data[A_ext_i[i1]]; for (kk = A_ext_i[i1]+1; kk < A_ext_i[i1+1]; kk++) { big_k1 = A_ext_j[kk]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /*diag*/ loc_col = (HYPRE_Int)(big_k1 - col_1); indx = ihat[loc_col]; @@ -692,13 +687,13 @@ else { loc_col = (HYPRE_Int)(-big_k1 - 1); - if(num_functions == 1 || - dof_func_offd[loc_col] == dof_func_offd[i1]) + if (num_functions == 1 || + dof_func_offd[loc_col] == dof_func_offd[i1]) { indx = ihat_offd[loc_col]; if (indx > -1) ahat_offd[indx] -= A_ext_data[kk]*distribute; - else if(P_marker_offd[loc_col] >= jj_begin_row_offd) + else if (P_marker_offd[loc_col] >= jj_begin_row_offd) { ihat_offd[loc_col] = cnt_c_offd; ipnt_offd[cnt_c_offd] = loc_col; @@ -733,7 +728,7 @@ sum_neg_C = 0; sum = 0; sum_C = 0; - if(sep_weight == 1) + if (sep_weight == 1) { for (jj=0; jj < cnt_c; jj++) { @@ -746,7 +741,7 @@ sum_neg_C += ahat[jj]; } } - if(num_procs > 1) + if (num_procs > 1) { for (jj=0; jj < cnt_c_offd; jj++) { @@ -774,7 +769,7 @@ } ahat[jj] = 0; } - if(num_procs > 1) + if (num_procs > 1) { for (jj=cnt_c_offd; jj < cnt_f_offd; jj++) { @@ -809,7 +804,7 @@ } for (jj=0; jj < cnt_f; jj++) ihat[ipnt[jj]] = -1; - if(num_procs > 1) + if (num_procs > 1) { for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) { @@ -831,7 +826,7 @@ { sum_C += ahat[jj]; } - if(num_procs > 1) + if (num_procs > 1) { for (jj=0; jj < cnt_c_offd; jj++) { @@ -844,7 +839,7 @@ sum += ahat[jj]; ahat[jj] = 0; } - if(num_procs > 1) + if (num_procs > 1) { for (jj=cnt_c_offd; jj < cnt_f_offd; jj++) { @@ -867,7 +862,7 @@ } for (jj=0; jj < cnt_f; jj++) ihat[ipnt[jj]] = -1; - if(num_procs > 1) + if (num_procs > 1) { for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) { @@ -891,17 +886,17 @@ if (debug_flag==4) { hypre_printf("Proc = %d fill part 1 %f part 2 %f part 3 %f\n", - my_id, wall_1, wall_2, wall_3); + my_id, wall_1, wall_2, wall_3); fflush(NULL); } P = hypre_ParCSRMatrixCreate(comm, - hypre_ParCSRMatrixGlobalNumRows(A), - total_global_cpts, - hypre_ParCSRMatrixColStarts(A), - num_cpts_global, - 0, - P_diag_i[n_fine], - P_offd_i[n_fine]); + hypre_ParCSRMatrixGlobalNumRows(A), + total_global_cpts, + hypre_ParCSRMatrixColStarts(A), + num_cpts_global, + 0, + P_diag_i[n_fine], + P_offd_i[n_fine]); P_diag = hypre_ParCSRMatrixDiag(P); hypre_CSRMatrixData(P_diag) = P_diag_data; @@ -929,7 +924,7 @@ /* This builds col_map, col_map should be monotone increasing and contain * global numbers. */ - if(P_offd_size) + if (P_offd_size) { hypre_build_interp_colmap(P, full_off_procNodes, tmp_CF_marker_offd, fine_to_coarse_offd); } @@ -963,14 +958,13 @@ hypre_TFree(CF_marker_offd, HYPRE_MEMORY_HOST); hypre_TFree(tmp_CF_marker_offd, HYPRE_MEMORY_HOST); - if(num_functions > 1) + if (num_functions > 1) hypre_TFree(dof_func_offd, HYPRE_MEMORY_HOST); hypre_MatvecCommPkgDestroy(extend_comm_pkg); } - return hypre_error_flag; } @@ -979,11 +973,16 @@ * Comment: *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_BoomerAMGBuildExtPIInterp(hypre_ParCSRMatrix *A, HYPRE_Int *CF_marker, - hypre_ParCSRMatrix *S, HYPRE_BigInt *num_cpts_global, - HYPRE_Int num_functions, HYPRE_Int *dof_func, HYPRE_Int debug_flag, - HYPRE_Real trunc_factor, HYPRE_Int max_elmts, - HYPRE_Int *col_offd_S_to_A, +hypre_BoomerAMGBuildExtPIInterp(hypre_ParCSRMatrix *A, + HYPRE_Int *CF_marker, + hypre_ParCSRMatrix *S, + HYPRE_BigInt *num_cpts_global, + HYPRE_Int num_functions, + HYPRE_Int *dof_func, + HYPRE_Int debug_flag, + HYPRE_Real trunc_factor, + HYPRE_Int max_elmts, + HYPRE_Int *col_offd_S_to_A, hypre_ParCSRMatrix **P_ptr) { #ifdef HYPRE_PROFILE @@ -1121,8 +1120,8 @@ if (num_procs > 1) { hypre_exchange_interp_data( - &CF_marker_offd, &dof_func_offd, &A_ext, &full_off_procNodes, &Sop, &extend_comm_pkg, - A, CF_marker, S, num_functions, dof_func, 1); + &CF_marker_offd, &dof_func_offd, &A_ext, &full_off_procNodes, &Sop, &extend_comm_pkg, + A, CF_marker, S, num_functions, dof_func, 1); { #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_EXTENDED_I_INTERP] += hypre_MPI_Wtime(); @@ -1161,8 +1160,8 @@ /* This function is smart enough to check P_marker and P_marker_offd only, * and set them if they are not NULL. The other vectors are set regardless.*/ hypre_initialize_vecs(n_fine, full_off_procNodes, fine_to_coarse, - fine_to_coarse_offd, P_marker, P_marker_offd, - tmp_CF_marker_offd); + fine_to_coarse_offd, P_marker, P_marker_offd, + tmp_CF_marker_offd); /*----------------------------------------------------------------------- @@ -1172,7 +1171,7 @@ diag_offset = hypre_CTAlloc(HYPRE_Int, max_num_threads[0], HYPRE_MEMORY_HOST); fine_to_coarse_offset = hypre_CTAlloc(HYPRE_Int, max_num_threads[0], HYPRE_MEMORY_HOST); offd_offset = hypre_CTAlloc(HYPRE_Int, max_num_threads[0], HYPRE_MEMORY_HOST); - for(i=0; i < max_num_threads[0]; i++) + for (i=0; i < max_num_threads[0]; i++) { diag_offset[i] = 0; fine_to_coarse_offset[i] = 0; @@ -1231,6 +1230,9 @@ { stop = (n_fine/num_threads)*(my_thread_num+1); } /* loop over rows */ + /* This loop counts the number of elements in P */ + /* is done by counting the elmements in the index set C-hat */ + for (i = start; i < stop; i++) { P_diag_i[i] = jj_counter; @@ -1239,6 +1241,7 @@ if (CF_marker[i] >= 0) { + /* row in P corresponding to a coarse pt., will only require one element (1 on the diagonal). */ jj_counter++; fine_to_coarse[i] = coarse_counter; coarse_counter++; @@ -1269,24 +1272,24 @@ k1 = S_diag_j[kk]; if (CF_marker[k1] >= 0) { - if(P_marker[k1] < P_diag_i[i]) + if (P_marker[k1] < P_diag_i[i]) { P_marker[k1] = jj_counter; jj_counter++; } } } - if(num_procs > 1) + if (num_procs > 1) { for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; if (CF_marker_offd[k1] >= 0) { - if(P_marker_offd[k1] < P_offd_i[i]) + if (P_marker_offd[k1] < P_offd_i[i]) { tmp_CF_marker_offd[k1] = 1; P_marker_offd[k1] = jj_counter_offd; @@ -1303,11 +1306,11 @@ for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { i1 = S_offd_j[jj]; - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[i1]; if (CF_marker_offd[i1] >= 0) { - if(P_marker_offd[i1] < P_offd_i[i]) + if (P_marker_offd[i1] < P_offd_i[i]) { tmp_CF_marker_offd[i1] = 1; P_marker_offd[i1] = jj_counter_offd; @@ -1318,13 +1321,13 @@ { /* F point; look at neighbors of i1. Sop contains global col * numbers and entries that could be in S_diag or S_offd or * neither. */ - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { big_k1 = Sop_j[kk]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* In S_diag */ loc_col = (HYPRE_Int)(big_k1-col_1); - if(P_marker[loc_col] < P_diag_i[i]) + if (P_marker[loc_col] < P_diag_i[i]) { P_marker[loc_col] = jj_counter; jj_counter++; @@ -1333,7 +1336,7 @@ else { loc_col = (HYPRE_Int)(-big_k1 - 1); - if(P_marker_offd[loc_col] < P_offd_i[i]) + if (P_marker_offd[loc_col] < P_offd_i[i]) { P_marker_offd[loc_col] = jj_counter_offd; tmp_CF_marker_offd[loc_col] = 1; @@ -1362,7 +1365,7 @@ #ifdef HYPRE_USING_OPENMP #pragma omp barrier #endif - if(my_thread_num == 0) + if (my_thread_num == 0) { /* Calculate the offset for P_diag_i and P_offd_i for each thread */ for (i = 1; i < num_threads; i++) @@ -1376,7 +1379,7 @@ #pragma omp barrier #endif - if(my_thread_num > 0) + if (my_thread_num > 0) { /* update row pointer array with offset, * making sure to update the row stop index */ @@ -1389,7 +1392,7 @@ * from the preceding thread */ for (i = start; i < stop; i++) { - if(fine_to_coarse[i] >= 0) + if (fine_to_coarse[i] >= 0) { fine_to_coarse[i] += fine_to_coarse_offset[my_thread_num-1]; } } } @@ -1397,13 +1400,13 @@ #pragma omp barrier #endif - if(my_thread_num == 0) + if (my_thread_num == 0) { if (debug_flag==4) { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d determine structure %f\n", - my_id, wall_time); + my_id, wall_time); fflush(NULL); } /*----------------------------------------------------------------------- @@ -1429,11 +1432,11 @@ } /* Fine to coarse mapping */ - if(num_procs > 1 && my_thread_num == 0) + if (num_procs > 1 && my_thread_num == 0) { hypre_big_insert_new_nodes(comm_pkg, extend_comm_pkg, fine_to_coarse, - full_off_procNodes, my_first_cpt, - fine_to_coarse_offd); + full_off_procNodes, my_first_cpt, + fine_to_coarse_offd); } for (i = 0; i < n_fine; i++) @@ -1502,7 +1505,7 @@ k1 = S_diag_j[kk]; if (CF_marker[k1] >= 0) { - if(P_marker[k1] < jj_begin_row) + if (P_marker[k1] < jj_begin_row) { P_marker[k1] = jj_counter; P_diag_j[jj_counter] = fine_to_coarse[k1]; @@ -1511,17 +1514,17 @@ } } } - if(num_procs > 1) + if (num_procs > 1) { for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; - if(CF_marker_offd[k1] >= 0) + if (CF_marker_offd[k1] >= 0) { - if(P_marker_offd[k1] < jj_begin_row_offd) + if (P_marker_offd[k1] < jj_begin_row_offd) { P_marker_offd[k1] = jj_counter_offd; P_offd_j[jj_counter_offd] = k1; @@ -1539,11 +1542,11 @@ for (jj=S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { i1 = S_offd_j[jj]; - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[i1]; if ( CF_marker_offd[i1] >= 0) { - if(P_marker_offd[i1] < jj_begin_row_offd) + if (P_marker_offd[i1] < jj_begin_row_offd) { P_marker_offd[i1] = jj_counter_offd; P_offd_j[jj_counter_offd] = i1; @@ -1554,14 +1557,14 @@ else if (CF_marker_offd[i1] != -3) { P_marker_offd[i1] = strong_f_marker; - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { big_k1 = Sop_j[kk]; /* Find local col number */ - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { loc_col = (HYPRE_Int)(big_k1-col_1); - if(P_marker[loc_col] < jj_begin_row) + if (P_marker[loc_col] < jj_begin_row) { P_marker[loc_col] = jj_counter; P_diag_j[jj_counter] = fine_to_coarse[loc_col]; @@ -1572,7 +1575,7 @@ else { loc_col = (HYPRE_Int)(-big_k1 - 1); - if(P_marker_offd[loc_col] < jj_begin_row_offd) + if (P_marker_offd[loc_col] < jj_begin_row_offd) { P_marker_offd[loc_col] = jj_counter_offd; P_offd_j[jj_counter_offd]=loc_col; @@ -1598,49 +1601,49 @@ { P_diag_data[P_marker[i1]] += A_diag_data[jj]; } - else if(P_marker[i1] == strong_f_marker) + else if (P_marker[i1] == strong_f_marker) { sum = zero; sgn = 1; - if(A_diag_data[A_diag_i[i1]] < 0) sgn = -1; + if (A_diag_data[A_diag_i[i1]] < 0) sgn = -1; /* Loop over row of A for point i1 and calculate the sum * of the connections to c-points that strongly influence i. */ - for(jj1 = A_diag_i[i1]+1; jj1 < A_diag_i[i1+1]; jj1++) + for (jj1 = A_diag_i[i1]+1; jj1 < A_diag_i[i1+1]; jj1++) { i2 = A_diag_j[jj1]; - if((P_marker[i2] >= jj_begin_row || i2 == i) && (sgn*A_diag_data[jj1]) < 0) + if ((P_marker[i2] >= jj_begin_row || i2 == i) && (sgn*A_diag_data[jj1]) < 0) sum += A_diag_data[jj1]; } - if(num_procs > 1) + if (num_procs > 1) { - for(jj1 = A_offd_i[i1]; jj1< A_offd_i[i1+1]; jj1++) + for (jj1 = A_offd_i[i1]; jj1< A_offd_i[i1+1]; jj1++) { i2 = A_offd_j[jj1]; - if(P_marker_offd[i2] >= jj_begin_row_offd && - (sgn*A_offd_data[jj1]) < 0) + if (P_marker_offd[i2] >= jj_begin_row_offd && + (sgn*A_offd_data[jj1]) < 0) sum += A_offd_data[jj1]; } } - if(sum != 0) + if (sum != 0) { distribute = A_diag_data[jj]/sum; /* Loop over row of A for point i1 and do the distribution */ - for(jj1 = A_diag_i[i1]+1; jj1 < A_diag_i[i1+1]; jj1++) + for (jj1 = A_diag_i[i1]+1; jj1 < A_diag_i[i1+1]; jj1++) { i2 = A_diag_j[jj1]; - if(P_marker[i2] >= jj_begin_row && (sgn*A_diag_data[jj1]) < 0) + if (P_marker[i2] >= jj_begin_row && (sgn*A_diag_data[jj1]) < 0) P_diag_data[P_marker[i2]] += distribute*A_diag_data[jj1]; - if(i2 == i && (sgn*A_diag_data[jj1]) < 0) + if (i2 == i && (sgn*A_diag_data[jj1]) < 0) diagonal += distribute*A_diag_data[jj1]; } - if(num_procs > 1) + if (num_procs > 1) { - for(jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) + for (jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) { i2 = A_offd_j[jj1]; - if(P_marker_offd[i2] >= jj_begin_row_offd && - (sgn*A_offd_data[jj1]) < 0) + if (P_marker_offd[i2] >= jj_begin_row_offd && + (sgn*A_offd_data[jj1]) < 0) P_offd_data[P_marker_offd[i2]] += distribute*A_offd_data[jj1]; } @@ -1655,55 +1658,55 @@ * diagonal */ else if (CF_marker[i1] != -3) { - if(num_functions == 1 || dof_func[i] == dof_func[i1]) + if (num_functions == 1 || dof_func[i] == dof_func[i1]) diagonal += A_diag_data[jj]; } } - if(num_procs > 1) + if (num_procs > 1) { - for(jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) { i1 = A_offd_j[jj]; - if(P_marker_offd[i1] >= jj_begin_row_offd) + if (P_marker_offd[i1] >= jj_begin_row_offd) P_offd_data[P_marker_offd[i1]] += A_offd_data[jj]; - else if(P_marker_offd[i1] == strong_f_marker) + else if (P_marker_offd[i1] == strong_f_marker) { sum = zero; - for(jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) + for (jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) { big_k1 = A_ext_j[jj1]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* diag */ loc_col = (HYPRE_Int)(big_k1 - col_1); - if(P_marker[loc_col] >= jj_begin_row || loc_col == i) + if (P_marker[loc_col] >= jj_begin_row || loc_col == i) sum += A_ext_data[jj1]; } else { loc_col = (HYPRE_Int)(-big_k1 - 1); - if(P_marker_offd[loc_col] >= jj_begin_row_offd) + if (P_marker_offd[loc_col] >= jj_begin_row_offd) sum += A_ext_data[jj1]; } } - if(sum != 0) + if (sum != 0) { distribute = A_offd_data[jj] / sum; - for(jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) + for (jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) { big_k1 = A_ext_j[jj1]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* diag */ loc_col = (HYPRE_Int)(big_k1 - col_1); - if(P_marker[loc_col] >= jj_begin_row) + if (P_marker[loc_col] >= jj_begin_row) P_diag_data[P_marker[loc_col]] += distribute* A_ext_data[jj1]; - if(loc_col == i) + if (loc_col == i) diagonal += distribute*A_ext_data[jj1]; } else { loc_col = (HYPRE_Int)(-big_k1 - 1); - if(P_marker_offd[loc_col] >= jj_begin_row_offd) + if (P_marker_offd[loc_col] >= jj_begin_row_offd) P_offd_data[P_marker_offd[loc_col]] += distribute* A_ext_data[jj1]; } @@ -1716,16 +1719,16 @@ } else if (CF_marker_offd[i1] != -3) { - if(num_functions == 1 || dof_func[i] == dof_func_offd[i1]) + if (num_functions == 1 || dof_func[i] == dof_func_offd[i1]) diagonal += A_offd_data[jj]; } } } if (diagonal) { - for(jj = jj_begin_row; jj < jj_end_row; jj++) + for (jj = jj_begin_row; jj < jj_end_row; jj++) P_diag_data[jj] /= -diagonal; - for(jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) + for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) P_offd_data[jj] /= -diagonal; } } @@ -1748,7 +1751,7 @@ { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d fill structure %f\n", - my_id, wall_time); + my_id, wall_time); fflush(NULL); } /*----------------------------------------------------------------------- @@ -1756,13 +1759,13 @@ *-----------------------------------------------------------------------*/ P = hypre_ParCSRMatrixCreate(comm, - hypre_ParCSRMatrixGlobalNumRows(A), - total_global_cpts, - hypre_ParCSRMatrixColStarts(A), - num_cpts_global, - 0, - P_diag_i[n_fine], - P_offd_i[n_fine]); + hypre_ParCSRMatrixGlobalNumRows(A), + total_global_cpts, + hypre_ParCSRMatrixColStarts(A), + num_cpts_global, + 0, + P_diag_i[n_fine], + P_offd_i[n_fine]); P_diag = hypre_ParCSRMatrixDiag(P); hypre_CSRMatrixData(P_diag) = P_diag_data; @@ -1797,7 +1800,7 @@ /* This builds col_map, col_map should be monotone increasing and contain * global numbers. */ - if(P_offd_size) + if (P_offd_size) { hypre_build_interp_colmap(P, full_off_procNodes, tmp_CF_marker_offd, fine_to_coarse_offd); } @@ -1826,9 +1829,10 @@ hypre_TFree(fine_to_coarse_offd, HYPRE_MEMORY_HOST); hypre_TFree(CF_marker_offd, HYPRE_MEMORY_HOST); hypre_TFree(tmp_CF_marker_offd, HYPRE_MEMORY_HOST); - if(num_functions > 1) + if (num_functions > 1) + { hypre_TFree(dof_func_offd, HYPRE_MEMORY_HOST); - + } hypre_MatvecCommPkgDestroy(extend_comm_pkg); @@ -1980,8 +1984,8 @@ if (num_procs > 1) { hypre_exchange_interp_data( - &CF_marker_offd, &dof_func_offd, &A_ext, &full_off_procNodes, &Sop, &extend_comm_pkg, - A, CF_marker, S, num_functions, dof_func, 1); + &CF_marker_offd, &dof_func_offd, &A_ext, &full_off_procNodes, &Sop, &extend_comm_pkg, + A, CF_marker, S, num_functions, dof_func, 1); { #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_EXTENDED_I_INTERP] += hypre_MPI_Wtime(); @@ -2020,18 +2024,18 @@ } /*clist = hypre_CTAlloc(HYPRE_Int, MAX_C_CONNECTIONS); - for(i = 0; i < MAX_C_CONNECTIONS; i++) + for (i = 0; i < MAX_C_CONNECTIONS; i++) clist[i] = 0; - if(num_procs > 1) + if (num_procs > 1) { clist_offd = hypre_CTAlloc(HYPRE_Int, MAX_C_CONNECTIONS, HYPRE_MEMORY_HOST); - for(i = 0; i < MAX_C_CONNECTIONS; i++) + for (i = 0; i < MAX_C_CONNECTIONS; i++) clist_offd[i] = 0; }*/ hypre_initialize_vecs(n_fine, full_off_procNodes, fine_to_coarse, - fine_to_coarse_offd, P_marker, P_marker_offd, - tmp_CF_marker_offd); + fine_to_coarse_offd, P_marker, P_marker_offd, + tmp_CF_marker_offd); jj_counter = start_indexing; jj_counter_offd = start_indexing; @@ -2078,18 +2082,18 @@ } } /*qsort0(clist,0,ccounter-1);*/ - if(num_procs > 1) + if (num_procs > 1) { for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { /* search through offd to find all c neighbors */ - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[S_offd_j[jj]]; else i1 = S_offd_j[jj]; - if(CF_marker_offd[i1] > 0) + if (CF_marker_offd[i1] > 0) { /* i1 is a C point direct neighbor */ CF_marker_offd[i1] = 2; - if(P_marker_offd[i1] < P_offd_i[i]) + if (P_marker_offd[i1] < P_offd_i[i]) { /*clist_offd[ccounter_offd++] = i1;*/ tmp_CF_marker_offd[i1] = 1; @@ -2111,7 +2115,7 @@ k1 = S_diag_j[kk]; if (CF_marker[k1] == 2) { - /*if(hypre_BinarySearch(clist,k1,ccounter) >= 0) + /*if (hypre_BinarySearch(clist,k1,ccounter) >= 0) {*/ common_c = 1; break; @@ -2119,18 +2123,18 @@ }*/ } } - if(num_procs > 1 && common_c == 0) + if (num_procs > 1 && common_c == 0) { /* no common c point yet, check offd */ for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; if (CF_marker_offd[k1] == 2) { /* k1 is a c point check if it is common */ - /*if(hypre_BinarySearch(clist_offd,k1,ccounter_offd) >= 0) + /*if (hypre_BinarySearch(clist_offd,k1,ccounter_offd) >= 0) {*/ common_c = 1; break; @@ -2139,14 +2143,14 @@ } } } - if(!common_c) + if (!common_c) { /* No common c point, extend the interp set */ - for(kk = S_diag_i[i1]; kk < S_diag_i[i1+1]; kk++) + for (kk = S_diag_i[i1]; kk < S_diag_i[i1+1]; kk++) { k1 = S_diag_j[kk]; - if(CF_marker[k1] > 0) + if (CF_marker[k1] > 0) { - if(P_marker[k1] < P_diag_i[i]) + if (P_marker[k1] < P_diag_i[i]) { P_marker[k1] = jj_counter; jj_counter++; @@ -2154,17 +2158,17 @@ } } } - if(num_procs > 1) + if (num_procs > 1) { for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; if (CF_marker_offd[k1] > 0) { - if(P_marker_offd[k1] < P_offd_i[i]) + if (P_marker_offd[k1] < P_offd_i[i]) { tmp_CF_marker_offd[k1] = 1; P_marker_offd[k1] = jj_counter_offd; @@ -2183,22 +2187,22 @@ for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { i1 = S_offd_j[jj]; - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[i1]; if (CF_marker_offd[i1] == -1) { /* F point; look at neighbors of i1. Sop contains global col * numbers and entries that could be in S_diag or S_offd or * neither. */ common_c = 0; - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { /* Check if common c */ big_k1 = Sop_j[kk]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* In S_diag */ loc_col = (HYPRE_Int)(big_k1-col_1); - if(CF_marker[loc_col] == 2) + if (CF_marker[loc_col] == 2) { - /*if(hypre_BinarySearch(clist,loc_col,ccounter) >= 0) + /*if (hypre_BinarySearch(clist,loc_col,ccounter) >= 0) {*/ common_c = 1; break; @@ -2209,9 +2213,9 @@ else { loc_col = (HYPRE_BigInt)(-big_k1 - 1); - if(CF_marker_offd[loc_col] == 2) + if (CF_marker_offd[loc_col] == 2) { - /*if(hypre_BinarySearch(clist_offd,loc_col,ccounter_offd) >= + /*if (hypre_BinarySearch(clist_offd,loc_col,ccounter_offd) >= 0) {*/ common_c = 1; @@ -2221,15 +2225,15 @@ } } } - if(!common_c) + if (!common_c) { - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { /* Check if common c */ big_k1 = Sop_j[kk]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* In S_diag */ loc_col = (HYPRE_Int)(big_k1-col_1); - if(P_marker[loc_col] < P_diag_i[i]) + if (P_marker[loc_col] < P_diag_i[i]) { P_marker[loc_col] = jj_counter; jj_counter++; @@ -2239,7 +2243,7 @@ else { loc_col = (HYPRE_Int)(-big_k1 - 1); - if(P_marker_offd[loc_col] < P_offd_i[i]) + if (P_marker_offd[loc_col] < P_offd_i[i]) { P_marker_offd[loc_col] = jj_counter_offd; tmp_CF_marker_offd[loc_col] = 1; @@ -2258,15 +2262,15 @@ if (CF_marker[i1] == 2) CF_marker[i1] = 1; } - if(num_procs > 1) + if (num_procs > 1) { for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { /* search through offd to find all c neighbors */ - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[S_offd_j[jj]]; else i1 = S_offd_j[jj]; - if(CF_marker_offd[i1] == 2) + if (CF_marker_offd[i1] == 2) { /* i1 is a C point direct neighbor */ CF_marker_offd[i1] = 1; } @@ -2303,11 +2307,11 @@ ccounter_offd = start_indexing;*/ /* Fine to coarse mapping */ - if(num_procs > 1) + if (num_procs > 1) { hypre_big_insert_new_nodes(comm_pkg, extend_comm_pkg, fine_to_coarse, - full_off_procNodes, my_first_cpt, - fine_to_coarse_offd); + full_off_procNodes, my_first_cpt, + fine_to_coarse_offd); } for (i = 0; i < n_fine; i++) @@ -2322,7 +2326,7 @@ for (i = 0; i < n_fine; i++) { jj_begin_row = jj_counter; - if(num_procs > 1) + if (num_procs > 1) jj_begin_row_offd = jj_counter_offd; /*-------------------------------------------------------------------- @@ -2373,14 +2377,14 @@ { for (jj=S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[S_offd_j[jj]]; else i1 = S_offd_j[jj]; if ( CF_marker_offd[i1] > 0) { CF_marker_offd[i1] = 2; - if(P_marker_offd[i1] < jj_begin_row_offd) + if (P_marker_offd[i1] < jj_begin_row_offd) { P_marker_offd[i1] = jj_counter_offd; P_offd_j[jj_counter_offd] = i1; @@ -2393,10 +2397,10 @@ /*qsort0(clist_offd,0,ccounter_offd-1);*/ } - for(jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) + for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) { /* Search through F points */ i1 = S_diag_j[jj]; - if(CF_marker[i1] == -1) + if (CF_marker[i1] == -1) { P_marker[i1] = strong_f_marker; common_c = 0; @@ -2405,7 +2409,7 @@ k1 = S_diag_j[kk]; if (CF_marker[k1] == 2) { - /*if(hypre_BinarySearch(clist,k1,ccounter) >= 0) + /*if (hypre_BinarySearch(clist,k1,ccounter) >= 0) {*/ common_c = 1; break; @@ -2413,18 +2417,18 @@ }*/ } } - if(num_procs > 1 && common_c == 0) + if (num_procs > 1 && common_c == 0) { /* no common c point yet, check offd */ for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; if (CF_marker_offd[k1] == 2) { /* k1 is a c point check if it is common */ - /*if(hypre_BinarySearch(clist_offd,k1,ccounter_offd) >= 0) + /*if (hypre_BinarySearch(clist_offd,k1,ccounter_offd) >= 0) {*/ common_c = 1; break; @@ -2433,14 +2437,14 @@ } } } - if(!common_c) + if (!common_c) { /* No common c point, extend the interp set */ for (kk = S_diag_i[i1]; kk < S_diag_i[i1+1]; kk++) { k1 = S_diag_j[kk]; if (CF_marker[k1] >= 0) { - if(P_marker[k1] < jj_begin_row) + if (P_marker[k1] < jj_begin_row) { P_marker[k1] = jj_counter; P_diag_j[jj_counter] = fine_to_coarse[k1]; @@ -2450,17 +2454,17 @@ } } } - if(num_procs > 1) + if (num_procs > 1) { for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; - if(CF_marker_offd[k1] >= 0) + if (CF_marker_offd[k1] >= 0) { - if(P_marker_offd[k1] < jj_begin_row_offd) + if (P_marker_offd[k1] < jj_begin_row_offd) { P_marker_offd[k1] = jj_counter_offd; P_offd_j[jj_counter_offd] = k1; @@ -2479,21 +2483,21 @@ for (jj=S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { i1 = S_offd_j[jj]; - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[i1]; - if(CF_marker_offd[i1] == -1) + if (CF_marker_offd[i1] == -1) { /* F points that are off proc */ P_marker_offd[i1] = strong_f_marker; common_c = 0; - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { /* Check if common c */ big_k1 = Sop_j[kk]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* In S_diag */ loc_col = (HYPRE_Int)(big_k1-col_1); - if(CF_marker[loc_col] == 2) + if (CF_marker[loc_col] == 2) { - /*if(hypre_BinarySearch(clist,loc_col,ccounter) >= 0) + /*if (hypre_BinarySearch(clist,loc_col,ccounter) >= 0) {*/ common_c = 1; break; @@ -2504,9 +2508,9 @@ else { loc_col = (HYPRE_Int)(-big_k1 - 1); - if(CF_marker_offd[loc_col] == 2) + if (CF_marker_offd[loc_col] == 2) { - /*if(hypre_BinarySearch(clist_offd,loc_col,ccounter_offd) >= + /*if (hypre_BinarySearch(clist_offd,loc_col,ccounter_offd) >= 0) {*/ common_c = 1; @@ -2516,16 +2520,16 @@ } } } - if(!common_c) + if (!common_c) { - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { big_k1 = Sop_j[kk]; /* Find local col number */ - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { loc_col = (HYPRE_Int)(big_k1-col_1); - if(P_marker[loc_col] < jj_begin_row) + if (P_marker[loc_col] < jj_begin_row) { P_marker[loc_col] = jj_counter; P_diag_j[jj_counter] = fine_to_coarse[loc_col]; @@ -2537,7 +2541,7 @@ else { loc_col = (-big_k1 - 1); - if(P_marker_offd[loc_col] < jj_begin_row_offd) + if (P_marker_offd[loc_col] < jj_begin_row_offd) { P_marker_offd[loc_col] = jj_counter_offd; P_offd_j[jj_counter_offd]=loc_col; @@ -2569,7 +2573,7 @@ { for (jj=S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[S_offd_j[jj]]; else i1 = S_offd_j[jj]; @@ -2593,47 +2597,47 @@ { P_diag_data[P_marker[i1]] += A_diag_data[jj]; } - else if(P_marker[i1] == strong_f_marker) + else if (P_marker[i1] == strong_f_marker) { sum = zero; sgn = 1; - if(A_diag_data[A_diag_i[i1]] < 0) sgn = -1; - for(jj1 = A_diag_i[i1]+1; jj1 < A_diag_i[i1+1]; jj1++) + if (A_diag_data[A_diag_i[i1]] < 0) sgn = -1; + for (jj1 = A_diag_i[i1]+1; jj1 < A_diag_i[i1+1]; jj1++) { i2 = A_diag_j[jj1]; - if((P_marker[i2] >= jj_begin_row || i2 == i) && (sgn*A_diag_data[jj1]) < 0) + if ((P_marker[i2] >= jj_begin_row || i2 == i) && (sgn*A_diag_data[jj1]) < 0) sum += A_diag_data[jj1]; } - if(num_procs > 1) + if (num_procs > 1) { - for(jj1 = A_offd_i[i1]; jj1< A_offd_i[i1+1]; jj1++) + for (jj1 = A_offd_i[i1]; jj1< A_offd_i[i1+1]; jj1++) { i2 = A_offd_j[jj1]; - if(P_marker_offd[i2] >= jj_begin_row_offd && - (sgn*A_offd_data[jj1]) < 0) + if (P_marker_offd[i2] >= jj_begin_row_offd && + (sgn*A_offd_data[jj1]) < 0) sum += A_offd_data[jj1]; } } - if(sum != 0) + if (sum != 0) { distribute = A_diag_data[jj]/sum; /* Loop over row of A for point i1 and do the distribution */ - for(jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) + for (jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) { i2 = A_diag_j[jj1]; - if(P_marker[i2] >= jj_begin_row && (sgn*A_diag_data[jj1]) < 0) + if (P_marker[i2] >= jj_begin_row && (sgn*A_diag_data[jj1]) < 0) P_diag_data[P_marker[i2]] += distribute*A_diag_data[jj1]; - if(i2 == i && (sgn*A_diag_data[jj1]) < 0) + if (i2 == i && (sgn*A_diag_data[jj1]) < 0) diagonal += distribute*A_diag_data[jj1]; } - if(num_procs > 1) + if (num_procs > 1) { - for(jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) + for (jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) { i2 = A_offd_j[jj1]; - if(P_marker_offd[i2] >= jj_begin_row_offd && - (sgn*A_offd_data[jj1]) < 0) + if (P_marker_offd[i2] >= jj_begin_row_offd && + (sgn*A_offd_data[jj1]) < 0) P_offd_data[P_marker_offd[i2]] += distribute*A_offd_data[jj1]; } @@ -2646,56 +2650,56 @@ * diagonal */ else if (CF_marker[i1] != -3) { - if(num_functions == 1 || dof_func[i] == dof_func[i1]) + if (num_functions == 1 || dof_func[i] == dof_func[i1]) diagonal += A_diag_data[jj]; } } - if(num_procs > 1) + if (num_procs > 1) { - for(jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) { i1 = A_offd_j[jj]; - if(P_marker_offd[i1] >= jj_begin_row_offd) + if (P_marker_offd[i1] >= jj_begin_row_offd) P_offd_data[P_marker_offd[i1]] += A_offd_data[jj]; - else if(P_marker_offd[i1] == strong_f_marker) + else if (P_marker_offd[i1] == strong_f_marker) { sum = zero; sgn = 1; - for(jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) + for (jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) { big_k1 = A_ext_j[jj1]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* diag */ loc_col = (HYPRE_Int)(big_k1 - col_1); - if(P_marker[loc_col] >= jj_begin_row || loc_col == i) + if (P_marker[loc_col] >= jj_begin_row || loc_col == i) sum += A_ext_data[jj1]; } else { loc_col = (HYPRE_Int)(-big_k1 - 1); - if(P_marker_offd[loc_col] >= jj_begin_row_offd) + if (P_marker_offd[loc_col] >= jj_begin_row_offd) sum += A_ext_data[jj1]; } } - if(sum != 0) + if (sum != 0) { distribute = A_offd_data[jj] / sum; - for(jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) + for (jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) { big_k1 = A_ext_j[jj1]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* diag */ loc_col = (HYPRE_Int)(big_k1 - col_1); - if(P_marker[loc_col] >= jj_begin_row) + if (P_marker[loc_col] >= jj_begin_row) P_diag_data[P_marker[loc_col]] += distribute* A_ext_data[jj1]; - if(loc_col == i) + if (loc_col == i) diagonal += distribute*A_ext_data[jj1]; } else { loc_col = (HYPRE_Int)(-big_k1 - 1); - if(P_marker_offd[loc_col] >= jj_begin_row_offd) + if (P_marker_offd[loc_col] >= jj_begin_row_offd) P_offd_data[P_marker_offd[loc_col]] += distribute* A_ext_data[jj1]; } @@ -2706,16 +2710,16 @@ } else if (CF_marker_offd[i1] != -3) { - if(num_functions == 1 || dof_func[i] == dof_func_offd[i1]) + if (num_functions == 1 || dof_func[i] == dof_func_offd[i1]) diagonal += A_offd_data[jj]; } } } if (diagonal) { - for(jj = jj_begin_row; jj < jj_end_row; jj++) + for (jj = jj_begin_row; jj < jj_end_row; jj++) P_diag_data[jj] /= -diagonal; - for(jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) + for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) P_offd_data[jj] /= -diagonal; } } @@ -2723,13 +2727,13 @@ } P = hypre_ParCSRMatrixCreate(comm, - hypre_ParCSRMatrixGlobalNumRows(A), - total_global_cpts, - hypre_ParCSRMatrixColStarts(A), - num_cpts_global, - 0, - P_diag_i[n_fine], - P_offd_i[n_fine]); + hypre_ParCSRMatrixGlobalNumRows(A), + total_global_cpts, + hypre_ParCSRMatrixColStarts(A), + num_cpts_global, + 0, + P_diag_i[n_fine], + P_offd_i[n_fine]); P_diag = hypre_ParCSRMatrixDiag(P); hypre_CSRMatrixData(P_diag) = P_diag_data; @@ -2757,7 +2761,7 @@ /* This builds col_map, col_map should be monotone increasing and contain * global numbers. */ - if(P_offd_size) + if (P_offd_size) { hypre_build_interp_colmap(P, full_off_procNodes, tmp_CF_marker_offd, fine_to_coarse_offd); } @@ -2783,7 +2787,7 @@ hypre_TFree(P_marker_offd, HYPRE_MEMORY_HOST); hypre_TFree(CF_marker_offd, HYPRE_MEMORY_HOST); hypre_TFree(tmp_CF_marker_offd, HYPRE_MEMORY_HOST); - if(num_functions > 1) + if (num_functions > 1) hypre_TFree(dof_func_offd, HYPRE_MEMORY_HOST); hypre_MatvecCommPkgDestroy(extend_comm_pkg); @@ -2791,6 +2795,7 @@ return hypre_error_flag; } + /*--------------------------------------------------------------------------- * hypre_BoomerAMGBuildFFInterp * Comment: Only use FF when there is no common c point. @@ -2926,8 +2931,8 @@ if (num_procs > 1) { hypre_exchange_interp_data( - &CF_marker_offd, &dof_func_offd, &A_ext, &full_off_procNodes, &Sop, &extend_comm_pkg, - A, CF_marker, S, num_functions, dof_func, 1); + &CF_marker_offd, &dof_func_offd, &A_ext, &full_off_procNodes, &Sop, &extend_comm_pkg, + A, CF_marker, S, num_functions, dof_func, 1); { #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_EXTENDED_I_INTERP] += hypre_MPI_Wtime(); @@ -2966,8 +2971,8 @@ } hypre_initialize_vecs(n_fine, full_off_procNodes, fine_to_coarse, - fine_to_coarse_offd, P_marker, P_marker_offd, - tmp_CF_marker_offd); + fine_to_coarse_offd, P_marker, P_marker_offd, + tmp_CF_marker_offd); jj_counter = start_indexing; jj_counter_offd = start_indexing; @@ -3012,18 +3017,18 @@ } } } - if(num_procs > 1) + if (num_procs > 1) { for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { /* search through offd to find all c neighbors */ - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[S_offd_j[jj]]; else i1 = S_offd_j[jj]; - if(CF_marker_offd[i1] > 0) + if (CF_marker_offd[i1] > 0) { /* i1 is a C point direct neighbor */ CF_marker_offd[i1] = 2; - if(P_marker_offd[i1] < P_offd_i[i]) + if (P_marker_offd[i1] < P_offd_i[i]) { tmp_CF_marker_offd[i1] = 1; P_marker_offd[i1] = jj_counter_offd; @@ -3047,11 +3052,11 @@ break; } } - if(num_procs > 1 && common_c == 0) + if (num_procs > 1 && common_c == 0) { /* no common c point yet, check offd */ for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; @@ -3063,31 +3068,31 @@ } } } - if(!common_c) + if (!common_c) { /* No common c point, extend the interp set */ - for(kk = S_diag_i[i1]; kk < S_diag_i[i1+1]; kk++) + for (kk = S_diag_i[i1]; kk < S_diag_i[i1+1]; kk++) { k1 = S_diag_j[kk]; - if(CF_marker[k1] > 0) + if (CF_marker[k1] > 0) { - if(P_marker[k1] < P_diag_i[i]) + if (P_marker[k1] < P_diag_i[i]) { P_marker[k1] = jj_counter; jj_counter++; } } } - if(num_procs > 1) + if (num_procs > 1) { for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; if (CF_marker_offd[k1] > 0) { - if(P_marker_offd[k1] < P_offd_i[i]) + if (P_marker_offd[k1] < P_offd_i[i]) { tmp_CF_marker_offd[k1] = 1; P_marker_offd[k1] = jj_counter_offd; @@ -3105,20 +3110,20 @@ for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { i1 = S_offd_j[jj]; - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[i1]; if (CF_marker_offd[i1] < 0) { /* F point; look at neighbors of i1. Sop contains global col * numbers and entries that could be in S_diag or S_offd or * neither. */ common_c = 0; - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { /* Check if common c */ big_k1 = Sop_j[kk]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* In S_diag */ loc_col = (HYPRE_Int)(big_k1-col_1); - if(CF_marker[loc_col] == 2) + if (CF_marker[loc_col] == 2) { common_c = 1; break; @@ -3127,22 +3132,22 @@ else { loc_col = -(HYPRE_Int)big_k1 - 1; - if(CF_marker_offd[loc_col] == 2) + if (CF_marker_offd[loc_col] == 2) { common_c = 1; break; } } } - if(!common_c) + if (!common_c) { - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { /* Check if common c */ big_k1 = Sop_j[kk]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* In S_diag */ loc_col = (HYPRE_Int)(big_k1-col_1); - if(P_marker[loc_col] < P_diag_i[i]) + if (P_marker[loc_col] < P_diag_i[i]) { P_marker[loc_col] = jj_counter; jj_counter++; @@ -3151,7 +3156,7 @@ else { loc_col = -(HYPRE_Int)big_k1 - 1; - if(P_marker_offd[loc_col] < P_offd_i[i]) + if (P_marker_offd[loc_col] < P_offd_i[i]) { P_marker_offd[loc_col] = jj_counter_offd; tmp_CF_marker_offd[loc_col] = 1; @@ -3169,15 +3174,15 @@ if (CF_marker[i1] == 2) CF_marker[i1] = 1; } - if(num_procs > 1) + if (num_procs > 1) { for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { /* search through offd to find all c neighbors */ - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[S_offd_j[jj]]; else i1 = S_offd_j[jj]; - if(CF_marker_offd[i1] == 2) + if (CF_marker_offd[i1] == 2) { /* i1 is a C point direct neighbor */ CF_marker_offd[i1] = 1; } @@ -3214,11 +3219,11 @@ ccounter_offd = start_indexing;*/ /* Fine to coarse mapping */ - if(num_procs > 1) + if (num_procs > 1) { hypre_big_insert_new_nodes(comm_pkg, extend_comm_pkg, fine_to_coarse, - full_off_procNodes, my_first_cpt, - fine_to_coarse_offd); + full_off_procNodes, my_first_cpt, + fine_to_coarse_offd); } for (i = 0; i < n_fine; i++) @@ -3234,7 +3239,7 @@ for (i = 0; i < n_fine; i++) { jj_begin_row = jj_counter; - if(num_procs > 1) + if (num_procs > 1) jj_begin_row_offd = jj_counter_offd; /*-------------------------------------------------------------------- @@ -3283,14 +3288,14 @@ { for (jj=S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[S_offd_j[jj]]; else i1 = S_offd_j[jj]; if ( CF_marker_offd[i1] > 0) { CF_marker_offd[i1] = 2; - if(P_marker_offd[i1] < jj_begin_row_offd) + if (P_marker_offd[i1] < jj_begin_row_offd) { P_marker_offd[i1] = jj_counter_offd; P_offd_j[jj_counter_offd] = i1; @@ -3301,10 +3306,10 @@ } } - for(jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) + for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) { /* Search through F points */ i1 = S_diag_j[jj]; - if(CF_marker[i1] == -1) + if (CF_marker[i1] == -1) { P_marker[i1] = strong_f_marker; common_c = 0; @@ -3317,11 +3322,11 @@ break; } } - if(num_procs > 1 && common_c == 0) + if (num_procs > 1 && common_c == 0) { /* no common c point yet, check offd */ for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; @@ -3333,14 +3338,14 @@ } } } - if(!common_c) + if (!common_c) { /* No common c point, extend the interp set */ for (kk = S_diag_i[i1]; kk < S_diag_i[i1+1]; kk++) { k1 = S_diag_j[kk]; if (CF_marker[k1] >= 0) { - if(P_marker[k1] < jj_begin_row) + if (P_marker[k1] < jj_begin_row) { P_marker[k1] = jj_counter; P_diag_j[jj_counter] = fine_to_coarse[k1]; @@ -3349,17 +3354,17 @@ } } } - if(num_procs > 1) + if (num_procs > 1) { for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; - if(CF_marker_offd[k1] >= 0) + if (CF_marker_offd[k1] >= 0) { - if(P_marker_offd[k1] < jj_begin_row_offd) + if (P_marker_offd[k1] < jj_begin_row_offd) { P_marker_offd[k1] = jj_counter_offd; P_offd_j[jj_counter_offd] = k1; @@ -3377,19 +3382,19 @@ for (jj=S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { i1 = S_offd_j[jj]; - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[i1]; - if(CF_marker_offd[i1] == -1) + if (CF_marker_offd[i1] == -1) { /* F points that are off proc */ P_marker_offd[i1] = strong_f_marker; common_c = 0; - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { /* Check if common c */ big_k1 = Sop_j[kk]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* In S_diag */ loc_col = (HYPRE_Int)(big_k1-col_1); - if(CF_marker[loc_col] == 2) + if (CF_marker[loc_col] == 2) { common_c = 1; break; @@ -3398,23 +3403,23 @@ else { loc_col = -(HYPRE_Int)big_k1 - 1; - if(CF_marker_offd[loc_col] == 2) + if (CF_marker_offd[loc_col] == 2) { common_c = 1; break; } } } - if(!common_c) + if (!common_c) { - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { big_k1 = Sop_j[kk]; /* Find local col number */ - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { loc_col = (HYPRE_Int)(big_k1-col_1); - if(P_marker[loc_col] < jj_begin_row) + if (P_marker[loc_col] < jj_begin_row) { P_marker[loc_col] = jj_counter; P_diag_j[jj_counter] = fine_to_coarse[loc_col]; @@ -3425,7 +3430,7 @@ else { loc_col = -(HYPRE_Int)big_k1 - 1; - if(P_marker_offd[loc_col] < jj_begin_row_offd) + if (P_marker_offd[loc_col] < jj_begin_row_offd) { P_marker_offd[loc_col] = jj_counter_offd; P_offd_j[jj_counter_offd]=loc_col; @@ -3456,7 +3461,7 @@ { for (jj=S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[S_offd_j[jj]]; else i1 = S_offd_j[jj]; @@ -3480,46 +3485,46 @@ { P_diag_data[P_marker[i1]] += A_diag_data[jj]; } - else if(P_marker[i1] == strong_f_marker) + else if (P_marker[i1] == strong_f_marker) { sum = zero; - if(A_diag_data[A_diag_i[i1]] < 0) sgn = -1; + if (A_diag_data[A_diag_i[i1]] < 0) sgn = -1; /* Loop over row of A for point i1 and calculate the sum * of the connections to c-points that strongly incluence i. */ - for(jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) + for (jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) { i2 = A_diag_j[jj1]; - if(P_marker[i2] >= jj_begin_row && (sgn*A_diag_data[jj1]) < 0) + if (P_marker[i2] >= jj_begin_row && (sgn*A_diag_data[jj1]) < 0) sum += A_diag_data[jj1]; } - if(num_procs > 1) + if (num_procs > 1) { - for(jj1 = A_offd_i[i1]; jj1< A_offd_i[i1+1]; jj1++) + for (jj1 = A_offd_i[i1]; jj1< A_offd_i[i1+1]; jj1++) { i2 = A_offd_j[jj1]; - if(P_marker_offd[i2] >= jj_begin_row_offd && - (sgn*A_offd_data[jj1]) < 0) + if (P_marker_offd[i2] >= jj_begin_row_offd && + (sgn*A_offd_data[jj1]) < 0) sum += A_offd_data[jj1]; } } - if(sum != 0) + if (sum != 0) { distribute = A_diag_data[jj]/sum; /* Loop over row of A for point i1 and do the distribution */ - for(jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) + for (jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) { i2 = A_diag_j[jj1]; - if(P_marker[i2] >= jj_begin_row && (sgn*A_diag_data[jj1]) < 0) + if (P_marker[i2] >= jj_begin_row && (sgn*A_diag_data[jj1]) < 0) P_diag_data[P_marker[i2]] += distribute*A_diag_data[jj1]; } - if(num_procs > 1) + if (num_procs > 1) { - for(jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) + for (jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) { i2 = A_offd_j[jj1]; - if(P_marker_offd[i2] >= jj_begin_row_offd && - (sgn*A_offd_data[jj1]) < 0) + if (P_marker_offd[i2] >= jj_begin_row_offd && + (sgn*A_offd_data[jj1]) < 0) P_offd_data[P_marker_offd[i2]] += distribute*A_offd_data[jj1]; } @@ -3532,53 +3537,53 @@ * diagonal */ else if (CF_marker[i1] != -3) { - if(num_functions == 1 || dof_func[i] == dof_func[i1]) + if (num_functions == 1 || dof_func[i] == dof_func[i1]) diagonal += A_diag_data[jj]; } } - if(num_procs > 1) + if (num_procs > 1) { - for(jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) { i1 = A_offd_j[jj]; - if(P_marker_offd[i1] >= jj_begin_row_offd) + if (P_marker_offd[i1] >= jj_begin_row_offd) P_offd_data[P_marker_offd[i1]] += A_offd_data[jj]; - else if(P_marker_offd[i1] == strong_f_marker) + else if (P_marker_offd[i1] == strong_f_marker) { sum = zero; - for(jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) + for (jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) { big_k1 = A_ext_j[jj1]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* diag */ loc_col = (HYPRE_Int)(big_k1 - col_1); - if(P_marker[loc_col] >= jj_begin_row) + if (P_marker[loc_col] >= jj_begin_row) sum += A_ext_data[jj1]; } else { loc_col = -(HYPRE_Int)big_k1 - 1; - if(P_marker_offd[loc_col] >= jj_begin_row_offd) + if (P_marker_offd[loc_col] >= jj_begin_row_offd) sum += A_ext_data[jj1]; } } - if(sum != 0) + if (sum != 0) { distribute = A_offd_data[jj] / sum; - for(jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) + for (jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) { big_k1 = A_ext_j[jj1]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* diag */ loc_col = (HYPRE_Int)(big_k1 - col_1); - if(P_marker[loc_col] >= jj_begin_row) + if (P_marker[loc_col] >= jj_begin_row) P_diag_data[P_marker[loc_col]] += distribute* A_ext_data[jj1]; } else { loc_col = -(HYPRE_Int)big_k1 - 1; - if(P_marker_offd[loc_col] >= jj_begin_row_offd) + if (P_marker_offd[loc_col] >= jj_begin_row_offd) P_offd_data[P_marker_offd[loc_col]] += distribute* A_ext_data[jj1]; } @@ -3589,16 +3594,16 @@ } else if (CF_marker_offd[i1] != -3) { - if(num_functions == 1 || dof_func[i] == dof_func_offd[i1]) + if (num_functions == 1 || dof_func[i] == dof_func_offd[i1]) diagonal += A_offd_data[jj]; } } } if (diagonal) { - for(jj = jj_begin_row; jj < jj_end_row; jj++) + for (jj = jj_begin_row; jj < jj_end_row; jj++) P_diag_data[jj] /= -diagonal; - for(jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) + for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) P_offd_data[jj] /= -diagonal; } } @@ -3606,13 +3611,13 @@ } P = hypre_ParCSRMatrixCreate(comm, - hypre_ParCSRMatrixGlobalNumRows(A), - total_global_cpts, - hypre_ParCSRMatrixColStarts(A), - num_cpts_global, - 0, - P_diag_i[n_fine], - P_offd_i[n_fine]); + hypre_ParCSRMatrixGlobalNumRows(A), + total_global_cpts, + hypre_ParCSRMatrixColStarts(A), + num_cpts_global, + 0, + P_diag_i[n_fine], + P_offd_i[n_fine]); P_diag = hypre_ParCSRMatrixDiag(P); hypre_CSRMatrixData(P_diag) = P_diag_data; @@ -3640,7 +3645,7 @@ /* This builds col_map, col_map should be monotone increasing and contain * global numbers. */ - if(P_offd_size) + if (P_offd_size) { hypre_build_interp_colmap(P, full_off_procNodes, tmp_CF_marker_offd, fine_to_coarse_offd); } @@ -3664,7 +3669,7 @@ hypre_TFree(P_marker_offd, HYPRE_MEMORY_HOST); hypre_TFree(CF_marker_offd, HYPRE_MEMORY_HOST); hypre_TFree(tmp_CF_marker_offd, HYPRE_MEMORY_HOST); - if(num_functions > 1) + if (num_functions > 1) hypre_TFree(dof_func_offd, HYPRE_MEMORY_HOST); hypre_MatvecCommPkgDestroy(extend_comm_pkg); @@ -3673,6 +3678,7 @@ return hypre_error_flag; } + /*--------------------------------------------------------------------------- * hypre_BoomerAMGBuildFF1Interp * Comment: Only use FF when there is no common c point. @@ -3806,8 +3812,8 @@ if (num_procs > 1) { hypre_exchange_interp_data( - &CF_marker_offd, &dof_func_offd, &A_ext, &full_off_procNodes, &Sop, &extend_comm_pkg, - A, CF_marker, S, num_functions, dof_func, 1); + &CF_marker_offd, &dof_func_offd, &A_ext, &full_off_procNodes, &Sop, &extend_comm_pkg, + A, CF_marker, S, num_functions, dof_func, 1); { #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_EXTENDED_I_INTERP] += hypre_MPI_Wtime(); @@ -3846,8 +3852,8 @@ } hypre_initialize_vecs(n_fine, full_off_procNodes, fine_to_coarse, - fine_to_coarse_offd, P_marker, P_marker_offd, - tmp_CF_marker_offd); + fine_to_coarse_offd, P_marker, P_marker_offd, + tmp_CF_marker_offd); jj_counter = start_indexing; jj_counter_offd = start_indexing; @@ -3892,18 +3898,18 @@ } } } - if(num_procs > 1) + if (num_procs > 1) { for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { /* search through offd to find all c neighbors */ - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[S_offd_j[jj]]; else i1 = S_offd_j[jj]; - if(CF_marker_offd[i1] > 0) + if (CF_marker_offd[i1] > 0) { /* i1 is a C point direct neighbor */ CF_marker_offd[i1] = 2; - if(P_marker_offd[i1] < P_offd_i[i]) + if (P_marker_offd[i1] < P_offd_i[i]) { tmp_CF_marker_offd[i1] = 1; P_marker_offd[i1] = jj_counter_offd; @@ -3927,11 +3933,11 @@ break; } } - if(num_procs > 1 && common_c == 0) + if (num_procs > 1 && common_c == 0) { /* no common c point yet, check offd */ for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; @@ -3943,15 +3949,15 @@ } } } - if(!common_c) + if (!common_c) { /* No common c point, extend the interp set */ found_c = 0; - for(kk = S_diag_i[i1]; kk < S_diag_i[i1+1]; kk++) + for (kk = S_diag_i[i1]; kk < S_diag_i[i1+1]; kk++) { k1 = S_diag_j[kk]; - if(CF_marker[k1] > 0) + if (CF_marker[k1] > 0) { - if(P_marker[k1] < P_diag_i[i]) + if (P_marker[k1] < P_diag_i[i]) { P_marker[k1] = jj_counter; jj_counter++; @@ -3960,17 +3966,17 @@ } } } - if(num_procs > 1 && !found_c) + if (num_procs > 1 && !found_c) { for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; if (CF_marker_offd[k1] > 0) { - if(P_marker_offd[k1] < P_offd_i[i]) + if (P_marker_offd[k1] < P_offd_i[i]) { tmp_CF_marker_offd[k1] = 1; P_marker_offd[k1] = jj_counter_offd; @@ -3989,20 +3995,20 @@ for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { i1 = S_offd_j[jj]; - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[i1]; if (CF_marker_offd[i1] < 0) { /* F point; look at neighbors of i1. Sop contains global col * numbers and entries that could be in S_diag or S_offd or * neither. */ common_c = 0; - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { /* Check if common c */ big_k1 = Sop_j[kk]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* In S_diag */ loc_col = (HYPRE_Int)(big_k1-col_1); - if(CF_marker[loc_col] == 2) + if (CF_marker[loc_col] == 2) { common_c = 1; break; @@ -4011,22 +4017,22 @@ else { loc_col = -(HYPRE_Int)big_k1 - 1; - if(CF_marker_offd[loc_col] == 2) + if (CF_marker_offd[loc_col] == 2) { common_c = 1; break; } } } - if(!common_c) + if (!common_c) { - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { /* Check if common c */ big_k1 = Sop_j[kk]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* In S_diag */ loc_col = (HYPRE_Int)(big_k1-col_1); - if(P_marker[loc_col] < P_diag_i[i]) + if (P_marker[loc_col] < P_diag_i[i]) { P_marker[loc_col] = jj_counter; jj_counter++; @@ -4036,7 +4042,7 @@ else { loc_col = -(HYPRE_Int)big_k1 - 1; - if(P_marker_offd[loc_col] < P_offd_i[i]) + if (P_marker_offd[loc_col] < P_offd_i[i]) { P_marker_offd[loc_col] = jj_counter_offd; tmp_CF_marker_offd[loc_col] = 1; @@ -4055,15 +4061,15 @@ if (CF_marker[i1] == 2) CF_marker[i1] = 1; } - if(num_procs > 1) + if (num_procs > 1) { for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { /* search through offd to find all c neighbors */ - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[S_offd_j[jj]]; else i1 = S_offd_j[jj]; - if(CF_marker_offd[i1] == 2) + if (CF_marker_offd[i1] == 2) { /* i1 is a C point direct neighbor */ CF_marker_offd[i1] = 1; } @@ -4100,11 +4106,11 @@ ccounter_offd = start_indexing;*/ /* Fine to coarse mapping */ - if(num_procs > 1) + if (num_procs > 1) { hypre_big_insert_new_nodes(comm_pkg, extend_comm_pkg, fine_to_coarse, - full_off_procNodes, my_first_cpt, - fine_to_coarse_offd); + full_off_procNodes, my_first_cpt, + fine_to_coarse_offd); } for (i = 0; i < n_fine; i++) @@ -4120,7 +4126,7 @@ for (i = 0; i < n_fine; i++) { jj_begin_row = jj_counter; - if(num_procs > 1) + if (num_procs > 1) jj_begin_row_offd = jj_counter_offd; /*-------------------------------------------------------------------- @@ -4169,14 +4175,14 @@ { for (jj=S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[S_offd_j[jj]]; else i1 = S_offd_j[jj]; if ( CF_marker_offd[i1] > 0) { CF_marker_offd[i1] = 2; - if(P_marker_offd[i1] < jj_begin_row_offd) + if (P_marker_offd[i1] < jj_begin_row_offd) { P_marker_offd[i1] = jj_counter_offd; P_offd_j[jj_counter_offd] = i1; @@ -4187,10 +4193,10 @@ } } - for(jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) + for (jj = S_diag_i[i]; jj < S_diag_i[i+1]; jj++) { /* Search through F points */ i1 = S_diag_j[jj]; - if(CF_marker[i1] == -1) + if (CF_marker[i1] == -1) { P_marker[i1] = strong_f_marker; common_c = 0; @@ -4203,11 +4209,11 @@ break; } } - if(num_procs > 1 && common_c == 0) + if (num_procs > 1 && common_c == 0) { /* no common c point yet, check offd */ for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; @@ -4219,7 +4225,7 @@ } } } - if(!common_c) + if (!common_c) { /* No common c point, extend the interp set */ found_c = 0; for (kk = S_diag_i[i1]; kk < S_diag_i[i1+1]; kk++) @@ -4227,7 +4233,7 @@ k1 = S_diag_j[kk]; if (CF_marker[k1] >= 0) { - if(P_marker[k1] < jj_begin_row) + if (P_marker[k1] < jj_begin_row) { P_marker[k1] = jj_counter; P_diag_j[jj_counter] = fine_to_coarse[k1]; @@ -4238,17 +4244,17 @@ } } } - if(num_procs > 1 && !found_c) + if (num_procs > 1 && !found_c) { for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; - if(CF_marker_offd[k1] >= 0) + if (CF_marker_offd[k1] >= 0) { - if(P_marker_offd[k1] < jj_begin_row_offd) + if (P_marker_offd[k1] < jj_begin_row_offd) { P_marker_offd[k1] = jj_counter_offd; P_offd_j[jj_counter_offd] = k1; @@ -4267,19 +4273,19 @@ for (jj=S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { i1 = S_offd_j[jj]; - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[i1]; - if(CF_marker_offd[i1] == -1) + if (CF_marker_offd[i1] == -1) { /* F points that are off proc */ P_marker_offd[i1] = strong_f_marker; common_c = 0; - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { /* Check if common c */ big_k1 = Sop_j[kk]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* In S_diag */ loc_col = (HYPRE_Int)(big_k1-col_1); - if(CF_marker[loc_col] == 2) + if (CF_marker[loc_col] == 2) { common_c = 1; break; @@ -4288,23 +4294,23 @@ else { loc_col = -(HYPRE_Int)big_k1 - 1; - if(CF_marker_offd[loc_col] == 2) + if (CF_marker_offd[loc_col] == 2) { common_c = 1; break; } } } - if(!common_c) + if (!common_c) { - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { big_k1 = Sop_j[kk]; /* Find local col number */ - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { loc_col = (HYPRE_Int)(big_k1-col_1); - if(P_marker[loc_col] < jj_begin_row) + if (P_marker[loc_col] < jj_begin_row) { P_marker[loc_col] = jj_counter; P_diag_j[jj_counter] = fine_to_coarse[loc_col]; @@ -4316,7 +4322,7 @@ else { loc_col = -(HYPRE_Int)big_k1 - 1; - if(P_marker_offd[loc_col] < jj_begin_row_offd) + if (P_marker_offd[loc_col] < jj_begin_row_offd) { P_marker_offd[loc_col] = jj_counter_offd; P_offd_j[jj_counter_offd]=loc_col; @@ -4348,7 +4354,7 @@ { for (jj=S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[S_offd_j[jj]]; else i1 = S_offd_j[jj]; @@ -4372,46 +4378,46 @@ { P_diag_data[P_marker[i1]] += A_diag_data[jj]; } - else if(P_marker[i1] == strong_f_marker) + else if (P_marker[i1] == strong_f_marker) { sum = zero; - if(A_diag_data[A_diag_i[i1]] < 0) sgn = -1; + if (A_diag_data[A_diag_i[i1]] < 0) sgn = -1; /* Loop over row of A for point i1 and calculate the sum * of the connections to c-points that strongly incluence i. */ - for(jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) + for (jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) { i2 = A_diag_j[jj1]; - if(P_marker[i2] >= jj_begin_row && (sgn*A_diag_data[jj1]) < 0) + if (P_marker[i2] >= jj_begin_row && (sgn*A_diag_data[jj1]) < 0) sum += A_diag_data[jj1]; } - if(num_procs > 1) + if (num_procs > 1) { - for(jj1 = A_offd_i[i1]; jj1< A_offd_i[i1+1]; jj1++) + for (jj1 = A_offd_i[i1]; jj1< A_offd_i[i1+1]; jj1++) { i2 = A_offd_j[jj1]; - if(P_marker_offd[i2] >= jj_begin_row_offd && - (sgn*A_offd_data[jj1]) < 0) + if (P_marker_offd[i2] >= jj_begin_row_offd && + (sgn*A_offd_data[jj1]) < 0) sum += A_offd_data[jj1]; } } - if(sum != 0) + if (sum != 0) { distribute = A_diag_data[jj]/sum; /* Loop over row of A for point i1 and do the distribution */ - for(jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) + for (jj1 = A_diag_i[i1]; jj1 < A_diag_i[i1+1]; jj1++) { i2 = A_diag_j[jj1]; - if(P_marker[i2] >= jj_begin_row && (sgn*A_diag_data[jj1]) < 0) + if (P_marker[i2] >= jj_begin_row && (sgn*A_diag_data[jj1]) < 0) P_diag_data[P_marker[i2]] += distribute*A_diag_data[jj1]; } - if(num_procs > 1) + if (num_procs > 1) { - for(jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) + for (jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) { i2 = A_offd_j[jj1]; - if(P_marker_offd[i2] >= jj_begin_row_offd && - (sgn*A_offd_data[jj1]) < 0) + if (P_marker_offd[i2] >= jj_begin_row_offd && + (sgn*A_offd_data[jj1]) < 0) P_offd_data[P_marker_offd[i2]] += distribute*A_offd_data[jj1]; } @@ -4424,53 +4430,53 @@ * diagonal */ else if (CF_marker[i1] != -3) { - if(num_functions == 1 || dof_func[i] == dof_func[i1]) + if (num_functions == 1 || dof_func[i] == dof_func[i1]) diagonal += A_diag_data[jj]; } } - if(num_procs > 1) + if (num_procs > 1) { - for(jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) { i1 = A_offd_j[jj]; - if(P_marker_offd[i1] >= jj_begin_row_offd) + if (P_marker_offd[i1] >= jj_begin_row_offd) P_offd_data[P_marker_offd[i1]] += A_offd_data[jj]; - else if(P_marker_offd[i1] == strong_f_marker) + else if (P_marker_offd[i1] == strong_f_marker) { sum = zero; - for(jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) + for (jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) { big_k1 = A_ext_j[jj1]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* diag */ loc_col = (HYPRE_Int)(big_k1 - col_1); - if(P_marker[loc_col] >= jj_begin_row) + if (P_marker[loc_col] >= jj_begin_row) sum += A_ext_data[jj1]; } else { loc_col = -(HYPRE_Int)big_k1 - 1; - if(P_marker_offd[loc_col] >= jj_begin_row_offd) + if (P_marker_offd[loc_col] >= jj_begin_row_offd) sum += A_ext_data[jj1]; } } - if(sum != 0) + if (sum != 0) { distribute = A_offd_data[jj] / sum; - for(jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) + for (jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) { big_k1 = A_ext_j[jj1]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* diag */ loc_col = (HYPRE_Int)(big_k1 - col_1); - if(P_marker[loc_col] >= jj_begin_row) + if (P_marker[loc_col] >= jj_begin_row) P_diag_data[P_marker[loc_col]] += distribute* A_ext_data[jj1]; } else { loc_col = - (HYPRE_Int)big_k1 - 1; - if(P_marker_offd[loc_col] >= jj_begin_row_offd) + if (P_marker_offd[loc_col] >= jj_begin_row_offd) P_offd_data[P_marker_offd[loc_col]] += distribute* A_ext_data[jj1]; } @@ -4481,16 +4487,16 @@ } else if (CF_marker_offd[i1] != -3) { - if(num_functions == 1 || dof_func[i] == dof_func_offd[i1]) + if (num_functions == 1 || dof_func[i] == dof_func_offd[i1]) diagonal += A_offd_data[jj]; } } } if (diagonal) { - for(jj = jj_begin_row; jj < jj_end_row; jj++) + for (jj = jj_begin_row; jj < jj_end_row; jj++) P_diag_data[jj] /= -diagonal; - for(jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) + for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) P_offd_data[jj] /= -diagonal; } } @@ -4498,13 +4504,13 @@ } P = hypre_ParCSRMatrixCreate(comm, - hypre_ParCSRMatrixGlobalNumRows(A), - total_global_cpts, - hypre_ParCSRMatrixColStarts(A), - num_cpts_global, - 0, - P_diag_i[n_fine], - P_offd_i[n_fine]); + hypre_ParCSRMatrixGlobalNumRows(A), + total_global_cpts, + hypre_ParCSRMatrixColStarts(A), + num_cpts_global, + 0, + P_diag_i[n_fine], + P_offd_i[n_fine]); P_diag = hypre_ParCSRMatrixDiag(P); hypre_CSRMatrixData(P_diag) = P_diag_data; @@ -4532,7 +4538,7 @@ /* This builds col_map, col_map should be monotone increasing and contain * global numbers. */ - if(P_offd_size) + if (P_offd_size) { hypre_build_interp_colmap(P, full_off_procNodes, tmp_CF_marker_offd, fine_to_coarse_offd); } @@ -4559,7 +4565,7 @@ hypre_TFree(P_marker_offd, HYPRE_MEMORY_HOST); hypre_TFree(CF_marker_offd, HYPRE_MEMORY_HOST); hypre_TFree(tmp_CF_marker_offd, HYPRE_MEMORY_HOST); - if(num_functions > 1) + if (num_functions > 1) hypre_TFree(dof_func_offd, HYPRE_MEMORY_HOST); hypre_MatvecCommPkgDestroy(extend_comm_pkg); @@ -4705,8 +4711,8 @@ if (num_procs > 1) { hypre_exchange_interp_data( - &CF_marker_offd, &dof_func_offd, &A_ext, &full_off_procNodes, &Sop, &extend_comm_pkg, - A, CF_marker, S, num_functions, dof_func, 1); + &CF_marker_offd, &dof_func_offd, &A_ext, &full_off_procNodes, &Sop, &extend_comm_pkg, + A, CF_marker, S, num_functions, dof_func, 1); { #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_EXTENDED_I_INTERP] += hypre_MPI_Wtime(); @@ -4746,8 +4752,8 @@ } hypre_initialize_vecs(n_fine, full_off_procNodes, fine_to_coarse, - fine_to_coarse_offd, P_marker, P_marker_offd, - tmp_CF_marker_offd); + fine_to_coarse_offd, P_marker, P_marker_offd, + tmp_CF_marker_offd); jj_counter = start_indexing; jj_counter_offd = start_indexing; @@ -4794,24 +4800,24 @@ k1 = S_diag_j[kk]; if (CF_marker[k1] >= 0) { - if(P_marker[k1] < P_diag_i[i]) + if (P_marker[k1] < P_diag_i[i]) { P_marker[k1] = jj_counter; jj_counter++; } } } - if(num_procs > 1) + if (num_procs > 1) { for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; if (CF_marker_offd[k1] >= 0) { - if(P_marker_offd[k1] < P_offd_i[i]) + if (P_marker_offd[k1] < P_offd_i[i]) { tmp_CF_marker_offd[k1] = 1; P_marker_offd[k1] = jj_counter_offd; @@ -4828,11 +4834,11 @@ for (jj = S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { i1 = S_offd_j[jj]; - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[i1]; if (CF_marker_offd[i1] >= 0) { - if(P_marker_offd[i1] < P_offd_i[i]) + if (P_marker_offd[i1] < P_offd_i[i]) { tmp_CF_marker_offd[i1] = 1; P_marker_offd[i1] = jj_counter_offd; @@ -4843,13 +4849,13 @@ { /* F point; look at neighbors of i1. Sop contains global col * numbers and entries that could be in S_diag or S_offd or * neither. */ - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { big_k1 = Sop_j[kk]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* In S_diag */ loc_col = (HYPRE_Int)(big_k1-col_1); - if(P_marker[loc_col] < P_diag_i[i]) + if (P_marker[loc_col] < P_diag_i[i]) { P_marker[loc_col] = jj_counter; jj_counter++; @@ -4858,7 +4864,7 @@ else { loc_col = -(HYPRE_Int)big_k1 - 1; - if(P_marker_offd[loc_col] < P_offd_i[i]) + if (P_marker_offd[loc_col] < P_offd_i[i]) { P_marker_offd[loc_col] = jj_counter_offd; tmp_CF_marker_offd[loc_col] = 1; @@ -4876,7 +4882,7 @@ { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d determine structure %f\n", - my_id, wall_time); + my_id, wall_time); fflush(NULL); } /*----------------------------------------------------------------------- @@ -4907,11 +4913,11 @@ jj_counter_offd = start_indexing; /* Fine to coarse mapping */ - if(num_procs > 1) + if (num_procs > 1) { hypre_big_insert_new_nodes(comm_pkg, extend_comm_pkg, fine_to_coarse, - full_off_procNodes, my_first_cpt, - fine_to_coarse_offd); + full_off_procNodes, my_first_cpt, + fine_to_coarse_offd); } for (i = 0; i < n_fine; i++) @@ -4973,7 +4979,7 @@ k1 = S_diag_j[kk]; if (CF_marker[k1] >= 0) { - if(P_marker[k1] < jj_begin_row) + if (P_marker[k1] < jj_begin_row) { P_marker[k1] = jj_counter; P_diag_j[jj_counter] = fine_to_coarse[k1]; @@ -4982,17 +4988,17 @@ } } } - if(num_procs > 1) + if (num_procs > 1) { for (kk = S_offd_i[i1]; kk < S_offd_i[i1+1]; kk++) { - if(col_offd_S_to_A) + if (col_offd_S_to_A) k1 = col_offd_S_to_A[S_offd_j[kk]]; else k1 = S_offd_j[kk]; - if(CF_marker_offd[k1] >= 0) + if (CF_marker_offd[k1] >= 0) { - if(P_marker_offd[k1] < jj_begin_row_offd) + if (P_marker_offd[k1] < jj_begin_row_offd) { P_marker_offd[k1] = jj_counter_offd; P_offd_j[jj_counter_offd] = k1; @@ -5010,11 +5016,11 @@ for (jj=S_offd_i[i]; jj < S_offd_i[i+1]; jj++) { i1 = S_offd_j[jj]; - if(col_offd_S_to_A) + if (col_offd_S_to_A) i1 = col_offd_S_to_A[i1]; if ( CF_marker_offd[i1] >= 0) { - if(P_marker_offd[i1] < jj_begin_row_offd) + if (P_marker_offd[i1] < jj_begin_row_offd) { P_marker_offd[i1] = jj_counter_offd; P_offd_j[jj_counter_offd] = i1; @@ -5025,14 +5031,14 @@ else if (CF_marker_offd[i1] != -3) { P_marker_offd[i1] = strong_f_marker; - for(kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) + for (kk = Sop_i[i1]; kk < Sop_i[i1+1]; kk++) { big_k1 = Sop_j[kk]; /* Find local col number */ - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { loc_col = (HYPRE_Int)(big_k1-col_1); - if(P_marker[loc_col] < jj_begin_row) + if (P_marker[loc_col] < jj_begin_row) { P_marker[loc_col] = jj_counter; P_diag_j[jj_counter] = fine_to_coarse[loc_col]; @@ -5043,7 +5049,7 @@ else { loc_col = -(HYPRE_Int)big_k1 - 1; - if(P_marker_offd[loc_col] < jj_begin_row_offd) + if (P_marker_offd[loc_col] < jj_begin_row_offd) { P_marker_offd[loc_col] = jj_counter_offd; P_offd_j[jj_counter_offd]=loc_col; @@ -5069,47 +5075,47 @@ { P_diag_data[P_marker[i1]] += A_diag_data[jj]; } - else if(P_marker[i1] == strong_f_marker) + else if (P_marker[i1] == strong_f_marker) { sum = zero; sgn = 1; - if(A_diag_data[A_diag_i[i1]] < 0) sgn = -1; + if (A_diag_data[A_diag_i[i1]] < 0) sgn = -1; /* Loop over row of A for point i1 and calculate the sum * of the connections to c-points that strongly incluence i. */ - for(jj1 = A_diag_i[i1]+1; jj1 < A_diag_i[i1+1]; jj1++) + for (jj1 = A_diag_i[i1]+1; jj1 < A_diag_i[i1+1]; jj1++) { i2 = A_diag_j[jj1]; - if((P_marker[i2] >= jj_begin_row ) && (sgn*A_diag_data[jj1]) < 0) + if ((P_marker[i2] >= jj_begin_row ) && (sgn*A_diag_data[jj1]) < 0) sum += A_diag_data[jj1]; } - if(num_procs > 1) + if (num_procs > 1) { - for(jj1 = A_offd_i[i1]; jj1< A_offd_i[i1+1]; jj1++) + for (jj1 = A_offd_i[i1]; jj1< A_offd_i[i1+1]; jj1++) { i2 = A_offd_j[jj1]; - if(P_marker_offd[i2] >= jj_begin_row_offd && - (sgn*A_offd_data[jj1]) < 0) + if (P_marker_offd[i2] >= jj_begin_row_offd && + (sgn*A_offd_data[jj1]) < 0) sum += A_offd_data[jj1]; } } - if(sum != 0) + if (sum != 0) { distribute = A_diag_data[jj]/sum; /* Loop over row of A for point i1 and do the distribution */ - for(jj1 = A_diag_i[i1]+1; jj1 < A_diag_i[i1+1]; jj1++) + for (jj1 = A_diag_i[i1]+1; jj1 < A_diag_i[i1+1]; jj1++) { i2 = A_diag_j[jj1]; - if(P_marker[i2] >= jj_begin_row && (sgn*A_diag_data[jj1]) < 0) + if (P_marker[i2] >= jj_begin_row && (sgn*A_diag_data[jj1]) < 0) P_diag_data[P_marker[i2]] += distribute*A_diag_data[jj1]; } - if(num_procs > 1) + if (num_procs > 1) { - for(jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) + for (jj1 = A_offd_i[i1]; jj1 < A_offd_i[i1+1]; jj1++) { i2 = A_offd_j[jj1]; - if(P_marker_offd[i2] >= jj_begin_row_offd && - (sgn*A_offd_data[jj1]) < 0) + if (P_marker_offd[i2] >= jj_begin_row_offd && + (sgn*A_offd_data[jj1]) < 0) P_offd_data[P_marker_offd[i2]] += distribute*A_offd_data[jj1]; } @@ -5124,53 +5130,53 @@ * diagonal */ else if (CF_marker[i1] != -3) { - if(num_functions == 1 || dof_func[i] == dof_func[i1]) + if (num_functions == 1 || dof_func[i] == dof_func[i1]) diagonal += A_diag_data[jj]; } } - if(num_procs > 1) + if (num_procs > 1) { - for(jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) { i1 = A_offd_j[jj]; - if(P_marker_offd[i1] >= jj_begin_row_offd) + if (P_marker_offd[i1] >= jj_begin_row_offd) P_offd_data[P_marker_offd[i1]] += A_offd_data[jj]; - else if(P_marker_offd[i1] == strong_f_marker) + else if (P_marker_offd[i1] == strong_f_marker) { sum = zero; - for(jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) + for (jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) { big_k1 = A_ext_j[jj1]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* diag */ loc_col = (HYPRE_Int)(big_k1 - col_1); - if(P_marker[loc_col] >= jj_begin_row ) + if (P_marker[loc_col] >= jj_begin_row ) sum += A_ext_data[jj1]; } else { loc_col = -(HYPRE_Int)big_k1 - 1; - if(P_marker_offd[loc_col] >= jj_begin_row_offd) + if (P_marker_offd[loc_col] >= jj_begin_row_offd) sum += A_ext_data[jj1]; } } - if(sum != 0) + if (sum != 0) { distribute = A_offd_data[jj] / sum; - for(jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) + for (jj1 = A_ext_i[i1]; jj1 < A_ext_i[i1+1]; jj1++) { big_k1 = A_ext_j[jj1]; - if(big_k1 >= col_1 && big_k1 < col_n) + if (big_k1 >= col_1 && big_k1 < col_n) { /* diag */ loc_col = (HYPRE_Int)(big_k1 - col_1); - if(P_marker[loc_col] >= jj_begin_row) + if (P_marker[loc_col] >= jj_begin_row) P_diag_data[P_marker[loc_col]] += distribute* A_ext_data[jj1]; } else { loc_col = -(HYPRE_Int)big_k1 - 1; - if(P_marker_offd[loc_col] >= jj_begin_row_offd) + if (P_marker_offd[loc_col] >= jj_begin_row_offd) P_offd_data[P_marker_offd[loc_col]] += distribute* A_ext_data[jj1]; } @@ -5183,16 +5189,16 @@ } else if (CF_marker_offd[i1] != -3) { - if(num_functions == 1 || dof_func[i] == dof_func_offd[i1]) + if (num_functions == 1 || dof_func[i] == dof_func_offd[i1]) diagonal += A_offd_data[jj]; } } } if (diagonal) { - for(jj = jj_begin_row; jj < jj_end_row; jj++) + for (jj = jj_begin_row; jj < jj_end_row; jj++) P_diag_data[jj] /= -diagonal; - for(jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) + for (jj = jj_begin_row_offd; jj < jj_end_row_offd; jj++) P_offd_data[jj] /= -diagonal; } } @@ -5203,7 +5209,7 @@ { wall_time = time_getWallclockSeconds() - wall_time; hypre_printf("Proc = %d fill structure %f\n", - my_id, wall_time); + my_id, wall_time); fflush(NULL); } /*----------------------------------------------------------------------- @@ -5211,13 +5217,13 @@ *-----------------------------------------------------------------------*/ P = hypre_ParCSRMatrixCreate(comm, - hypre_ParCSRMatrixGlobalNumRows(A), - total_global_cpts, - hypre_ParCSRMatrixColStarts(A), - num_cpts_global, - 0, - P_diag_i[n_fine], - P_offd_i[n_fine]); + hypre_ParCSRMatrixGlobalNumRows(A), + total_global_cpts, + hypre_ParCSRMatrixColStarts(A), + num_cpts_global, + 0, + P_diag_i[n_fine], + P_offd_i[n_fine]); P_diag = hypre_ParCSRMatrixDiag(P); hypre_CSRMatrixData(P_diag) = P_diag_data; @@ -5229,6 +5235,9 @@ hypre_CSRMatrixJ(P_offd) = P_offd_j; hypre_ParCSRMatrixOwnsRowStarts(P) = 0; + hypre_CSRMatrixMemoryLocation(P_diag) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixMemoryLocation(P_offd) = HYPRE_MEMORY_HOST; + /* Compress P, removing coefficients smaller than trunc_factor * Max */ if (trunc_factor != 0.0 || max_elmts > 0) { @@ -5245,7 +5254,7 @@ /* This builds col_map, col_map should be monotone increasing and contain * global numbers. */ - if(P_offd_size) + if (P_offd_size) { hypre_build_interp_colmap(P, full_off_procNodes, tmp_CF_marker_offd, fine_to_coarse_offd); } @@ -5269,14 +5278,14 @@ hypre_TFree(P_marker_offd, HYPRE_MEMORY_HOST); hypre_TFree(CF_marker_offd, HYPRE_MEMORY_HOST); hypre_TFree(tmp_CF_marker_offd, HYPRE_MEMORY_HOST); - if(num_functions > 1) + if (num_functions > 1) + { hypre_TFree(dof_func_offd, HYPRE_MEMORY_HOST); - + } hypre_MatvecCommPkgDestroy(extend_comm_pkg); - - } return hypre_error_flag; } + diff -Nru hypre-2.16.0/src/parcsr_ls/par_lr_restr.c hypre-2.18.2/src/parcsr_ls/par_lr_restr.c --- hypre-2.16.0/src/parcsr_ls/par_lr_restr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_lr_restr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,27 +1,40 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" #include "_hypre_lapack.h" #include "_hypre_blas.h" + +// TODO : delete csrAi, csrAi_i, csrAi_j, +// csrAi_a, csrAiT_i, csrAiT_j, csrAiT_a +// Use +// hypre_dense_topo_sort(HYPRE_Real *L, HYPRE_Int *ordering, HYPRE_Int n) +// to get ordering for triangular solve. Can provide + + +HYPRE_Int AIR_TOT_SOL_SIZE = 0; +HYPRE_Int AIR_MAX_SOL_SIZE = 0; + #define AIR_DEBUG 0 +#define EPSILON 1e-18 +#define EPSIMAC 1e-16 + +void hypre_fgmresT(HYPRE_Int n, HYPRE_Complex *A, HYPRE_Complex *b, HYPRE_Real tol, HYPRE_Int kdim, HYPRE_Complex *x, HYPRE_Real *relres, HYPRE_Int *iter, HYPRE_Int job); +void hypre_ordered_GS(const HYPRE_Complex L[], const HYPRE_Complex rhs[], HYPRE_Complex x[], const HYPRE_Int n); -//HYPRE_Real time1 = 0.0; -//HYPRE_Real time2 = 0.0; -//HYPRE_Real time3 = 0.0; +/* +HYPRE_Real air_time0 = 0.0; +HYPRE_Real air_time_comm = 0.0; +HYPRE_Real air_time1 = 0.0; +HYPRE_Real air_time2 = 0.0; +HYPRE_Real air_time3 = 0.0; +HYPRE_Real air_time4 = 0.0; +*/ HYPRE_Int hypre_BoomerAMGBuildRestrDist2AIR( hypre_ParCSRMatrix *A, @@ -30,26 +43,30 @@ HYPRE_BigInt *num_cpts_global, HYPRE_Int num_functions, HYPRE_Int *dof_func, + HYPRE_Real filter_thresholdR, HYPRE_Int debug_flag, - HYPRE_Real trunc_factor, - HYPRE_Int max_elmts, HYPRE_Int *col_offd_S_to_A, - hypre_ParCSRMatrix **R_ptr) { - + hypre_ParCSRMatrix **R_ptr, + HYPRE_Int AIR1_5, + HYPRE_Int is_triangular, + HYPRE_Int gmres_switch) +{ + /* HYPRE_Real t0 = hypre_MPI_Wtime(); */ + MPI_Comm comm = hypre_ParCSRMatrixComm(A); hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); hypre_ParCSRCommHandle *comm_handle; hypre_ParCSRCommPkg *comm_pkg_SF; - + /* diag part of A */ hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); - HYPRE_Real *A_diag_a = hypre_CSRMatrixData(A_diag); + HYPRE_Complex *A_diag_a = hypre_CSRMatrixData(A_diag); HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); /* off-diag part of A */ - hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); - HYPRE_Real *A_offd_a = hypre_CSRMatrixData(A_offd); + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + HYPRE_Complex *A_offd_a = hypre_CSRMatrixData(A_offd); HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); @@ -61,7 +78,7 @@ HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); /* off-diag part of S */ - hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); + hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); HYPRE_Int *S_offd_j = hypre_CSRMatrixJ(S_offd); /* Restriction matrix R */ @@ -70,10 +87,10 @@ hypre_CSRMatrix *R_diag; hypre_CSRMatrix *R_offd; /* arrays */ - HYPRE_Real *R_diag_data; + HYPRE_Complex *R_diag_data; HYPRE_Int *R_diag_i; HYPRE_Int *R_diag_j; - HYPRE_Real *R_offd_data; + HYPRE_Complex *R_offd_data; HYPRE_Int *R_offd_i; HYPRE_Int *R_offd_j; HYPRE_BigInt *col_map_offd_R; @@ -82,22 +99,28 @@ HYPRE_Int *CF_marker_offd = NULL; /* func type off-diag part */ HYPRE_Int *dof_func_offd = NULL; - + HYPRE_BigInt big_i1, big_j1, big_k1; - HYPRE_Int i, j, j1, j2, k, i1, i2, k1, k2, k3, rr, cc, ic, index, start, end, + HYPRE_Int i, j, j1, j2, k, i1, i2, k1, k2, k3, rr, cc, ic, index, start, end, local_max_size, local_size, num_cols_offd_R; /*HYPRE_Int i6;*/ HYPRE_BigInt *FF2_offd; HYPRE_Int FF2_offd_len; /* LAPACK */ - HYPRE_Real *DAi, *Dbi; + HYPRE_Complex *DAi, *Dbi, *Dxi; #if AIR_DEBUG - HYPRE_Real *TMPA, *TMPb, *TMPd; + HYPRE_Complex *TMPA, *TMPb, *TMPd; + hypre_Vector *tmpv; #endif HYPRE_Int *Ipi, lapack_info, ione = 1, *RRi, *KKi; char charT = 'T'; + /* if the size of local system is larger than gmres_switch, use GMRES */ + char Aisol_method; + HYPRE_Int gmresAi_maxit = 50; + HYPRE_Real gmresAi_tol = 1e-3; + HYPRE_Int my_id, num_procs; HYPRE_BigInt total_global_cpts/*, my_first_cpt*/; HYPRE_Int nnz_diag, nnz_offd, cnt_diag, cnt_offd; @@ -107,16 +130,12 @@ /* local size, local num of C points */ HYPRE_Int n_fine = hypre_CSRMatrixNumRows(A_diag); HYPRE_Int n_cpts = 0; - /* my first column range */ - /* XXX is this also right? - HYPRE_Int col_start = hypre_ParCSRMatrixFirstColDiag(A); - HYPRE_Int col_end = hypre_ParCSRMatrixLastColDiag(A); - */ + /* my column range */ HYPRE_BigInt col_start = hypre_ParCSRMatrixFirstRowIndex(A); HYPRE_BigInt col_end = col_start + (HYPRE_BigInt)n_fine; HYPRE_Int *send_buf_i; - + /* recv_SF means the Strong F-neighbors of offd elements in col_map_offd */ HYPRE_Int *send_SF_i, send_SF_jlen; HYPRE_BigInt *send_SF_j; @@ -139,9 +158,13 @@ /* ghost rows: offd F and F2-pts */ hypre_CSRMatrix *A_offd_FF2 = NULL; - + + /* + HYPRE_Real tcomm = hypre_MPI_Wtime(); + */ + /* MPI size and rank*/ - hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_size(comm, &num_procs); hypre_MPI_Comm_rank(comm, &my_id); /*-------------- global number of C points and my start position */ @@ -156,7 +179,7 @@ /*my_first_cpt = num_cpts_global[my_id];*/ total_global_cpts = num_cpts_global[num_procs]; #endif - + /*------------------------------------------------------------------- * Get the CF_marker data for the off-processor columns *-------------------------------------------------------------------*/ @@ -174,7 +197,7 @@ if (!comm_pkg) { hypre_MatvecCommPkgCreate(A); - comm_pkg = hypre_ParCSRMatrixCommPkg(A); + comm_pkg = hypre_ParCSRMatrixCommPkg(A); } /* init markers to zeros */ @@ -186,15 +209,15 @@ /* number of recvs (number of procs) */ num_recvs = hypre_ParCSRCommPkgNumRecvs(comm_pkg); - + /* number of elements to send */ num_elems_send = hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends); - /* send buffer, of size send_map_starts[num_sends]), + /* send buffer, of size send_map_starts[num_sends]), * i.e., number of entries to send */ send_buf_i = hypre_CTAlloc(HYPRE_Int , num_elems_send, HYPRE_MEMORY_HOST); - - /* copy CF markers of elements to send to buffer + + /* copy CF markers of elements to send to buffer * RL: why copy them with two for loops? Why not just loop through all in one */ for (i = 0, index = 0; i < num_sends; i++) { @@ -224,7 +247,7 @@ } } comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, send_buf_i, dof_func_offd); - hypre_ParCSRCommHandleDestroy(comm_handle); + hypre_ParCSRCommHandleDestroy(comm_handle); } /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -233,7 +256,7 @@ *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ send_SF_i = hypre_CTAlloc(HYPRE_Int, num_elems_send, HYPRE_MEMORY_HOST); recv_SF_i = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd + 1, HYPRE_MEMORY_HOST); - + /* for each F-elem to send, find the number of strong F-neighbors */ for (i = 0, send_SF_jlen = 0; i < num_elems_send; i++) { @@ -272,7 +295,7 @@ comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, send_SF_i, recv_SF_i+1); /* ... */ hypre_ParCSRCommHandleDestroy(comm_handle); - + send_SF_j = hypre_CTAlloc(HYPRE_BigInt, send_SF_jlen, HYPRE_MEMORY_HOST); send_SF_jstarts = hypre_CTAlloc(HYPRE_Int, num_sends + 1, HYPRE_MEMORY_HOST); @@ -348,16 +371,24 @@ hypre_ParCSRCommHandleDestroy(comm_handle); /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * recv_SF_offd_list: a sorted list of offd elems in recv_SF_j + * recv_SF_offd_list: a sorted list of offd elems in recv_SF_j *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ recv_SF_offd_list = hypre_CTAlloc(HYPRE_BigInt, recv_SF_jlen, HYPRE_MEMORY_HOST); for (i = 0, j = 0; i < recv_SF_jlen; i++) { + HYPRE_Int flag = 1; big_i1 = recv_SF_j[i]; /* offd */ if (big_i1 < col_start || big_i1 >= col_end) { - recv_SF_offd_list[j++] = big_i1; + if (AIR1_5) + { + flag = hypre_BigBinarySearch(col_map_offd_A, big_i1, num_cols_A_offd) != -1; + } + if (flag) + { + recv_SF_offd_list[j++] = big_i1; + } } } @@ -381,7 +412,10 @@ if (big_i1 < col_start || big_i1 >= col_end) { j = hypre_BigBinarySearch(recv_SF_offd_list, big_i1, recv_SF_offd_list_len); - hypre_assert(j >= 0 && j < recv_SF_offd_list_len); + if (!AIR1_5) + { + hypre_assert(j >= 0 && j < recv_SF_offd_list_len); + } recv_SF_j2[i] = j; } else @@ -393,7 +427,7 @@ /* mapping to col_map_offd_A */ Mapper_recv_SF_offd_list = hypre_CTAlloc(HYPRE_Int, recv_SF_offd_list_len, HYPRE_MEMORY_HOST); Marker_recv_SF_offd_list = hypre_CTAlloc(HYPRE_Int, recv_SF_offd_list_len, HYPRE_MEMORY_HOST); - + /* create a mapping from recv_SF_offd_list to col_map_offd_A for their intersections */ for (i = 0; i < recv_SF_offd_list_len; i++) { @@ -401,7 +435,7 @@ hypre_assert(big_i1 < col_start || big_i1 >= col_end); j = hypre_BigBinarySearch(col_map_offd_A, big_i1, num_cols_A_offd); /* mapping to col_map_offd_A, if not found equal to -1 */ - Mapper_recv_SF_offd_list[i] = j; + Mapper_recv_SF_offd_list[i] = j; } /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -439,7 +473,7 @@ } } - /* offd(F) and offd(F)-offd(F) + /* offd(F) and offd(F)-offd(F) * NOTE: we are working with two marker arrays here: Marker_offd and Marker_recv_SF_offd_list * which may have overlap. * So, we always check the first marker array */ @@ -465,8 +499,13 @@ /* index in recv_SF_offd_list */ k2 = recv_SF_j2[k]; - hypre_assert(recv_SF_offd_list[k2] == k1); - + if (AIR1_5 && k2 == -1) + { + continue; + } + + hypre_assert(recv_SF_offd_list[k2] == big_k1); + /* map to offd_A */ k3 = Mapper_recv_SF_offd_list[k2]; if (k3 >= 0) @@ -535,7 +574,15 @@ *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* we will create TWO commPkg: one for row lengths and one for row data, * similar to what we have done above for SF_i, SF_j */ - hypre_ParCSRFindExtendCommPkg(A, FF2_offd_len, FF2_offd, &comm_pkg_FF2_i); + hypre_ParCSRFindExtendCommPkg(comm, + hypre_ParCSRMatrixGlobalNumCols(A), + hypre_ParCSRMatrixFirstColDiag(A), + hypre_CSRMatrixNumCols(A_diag), + hypre_ParCSRMatrixColStarts(A), + hypre_ParCSRMatrixAssumedPartition(A), + FF2_offd_len, + FF2_offd, + &comm_pkg_FF2_i); /* number of sends (#procs) */ num_sends_FF2 = hypre_ParCSRCommPkgNumSends(comm_pkg_FF2_i); /* number of rows to send */ @@ -552,10 +599,27 @@ for (i = 0, send_FF2_jlen = 0; i < send_FF2_ilen; i++) { j = hypre_ParCSRCommPkgSendMapElmt(comm_pkg_FF2_i, i); - send_FF2_i[i] = A_diag_i[j+1] - A_diag_i[j] + A_offd_i[j+1] - A_offd_i[j]; + for (k = A_diag_i[j]; k < A_diag_i[j+1]; k++) + { + if (CF_marker[A_diag_j[k]] < 0) + { + send_FF2_i[i]++; + } + } + if (num_procs > 1) + { + for (k = A_offd_i[j]; k < A_offd_i[j+1]; k++) + { + if (CF_marker_offd[A_offd_j[k]] < 0) + { + send_FF2_i[i]++; + } + } + } + //send_FF2_i[i] = A_diag_i[j+1] - A_diag_i[j] + A_offd_i[j+1] - A_offd_i[j]; send_FF2_jlen += send_FF2_i[i]; } - + /* do communication */ comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg_FF2_i, send_FF2_i, recv_FF2_i+1); /* ... */ @@ -564,7 +628,7 @@ send_FF2_j = hypre_CTAlloc(HYPRE_BigInt, send_FF2_jlen, HYPRE_MEMORY_HOST); send_FF2_a = hypre_CTAlloc(HYPRE_Complex, send_FF2_jlen, HYPRE_MEMORY_HOST); send_FF2_jstarts = hypre_CTAlloc(HYPRE_Int, num_sends_FF2 + 1, HYPRE_MEMORY_HOST); - + for (i = 0, i1 = 0; i < num_sends_FF2; i++) { start = hypre_ParCSRCommPkgSendMapStart(comm_pkg_FF2_i, i); @@ -576,24 +640,32 @@ /* open row j1 and fill ja and a */ for (k = A_diag_i[j1]; k < A_diag_i[j1+1]; k++) { - send_FF2_j[i1] = col_start + (HYPRE_BigInt) A_diag_j[k]; - send_FF2_a[i1] = A_diag_a[k]; - i1++; + HYPRE_Int k1 = A_diag_j[k]; + if (CF_marker[k1] < 0) + { + send_FF2_j[i1] = col_start + k1; + send_FF2_a[i1] = A_diag_a[k]; + i1++; + } } if (num_procs > 1) { for (k = A_offd_i[j1]; k < A_offd_i[j1+1]; k++) { - send_FF2_j[i1] = col_map_offd_A[A_offd_j[k]]; - send_FF2_a[i1] = A_offd_a[k]; - i1++; + HYPRE_Int k1 = A_offd_j[k]; + if (CF_marker_offd[k1] < 0) + { + send_FF2_j[i1] = col_map_offd_A[k1]; + send_FF2_a[i1] = A_offd_a[k]; + i1++; + } } } } send_FF2_jstarts[i+1] = i1; } hypre_assert(i1 == send_FF2_jlen); - + /* adjust recv_FF2_i to ptrs */ for (i = 1; i <= recv_FF2_ilen; i++) { @@ -620,13 +692,13 @@ hypre_ParCSRCommPkgNumRecvs (comm_pkg_FF2_j) = num_recvs_FF2; hypre_ParCSRCommPkgRecvProcs (comm_pkg_FF2_j) = hypre_ParCSRCommPkgRecvProcs(comm_pkg_FF2_i); hypre_ParCSRCommPkgRecvVecStarts(comm_pkg_FF2_j) = recv_FF2_jstarts; - + /* do communication */ /* ja */ comm_handle = hypre_ParCSRCommHandleCreate(21, comm_pkg_FF2_j, send_FF2_j, recv_FF2_j); /* ... */ hypre_ParCSRCommHandleDestroy(comm_handle); - + /* a */ comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg_FF2_j, send_FF2_a, recv_FF2_a); /* ... */ @@ -639,7 +711,7 @@ A_offd_FF2 = hypre_CSRMatrixCreate(recv_FF2_ilen, recv_FF2_ilen, recv_FF2_jlen); - hypre_CSRMatrixI (A_offd_FF2) = recv_FF2_i; + hypre_CSRMatrixI (A_offd_FF2) = recv_FF2_i; hypre_CSRMatrixBigJ (A_offd_FF2) = recv_FF2_j; hypre_CSRMatrixData(A_offd_FF2) = recv_FF2_a; @@ -683,7 +755,7 @@ { Mapper_offd_A[i] = hypre_BigBinarySearch(FF2_offd, col_map_offd_A[i], FF2_offd_len); } - + /* Mapping from recv_SF_offd_list, overwrite the old one*/ for (i = 0; i < recv_SF_offd_list_len; i++) { @@ -693,6 +765,13 @@ /* marker */ Marker_FF2_offd = hypre_CTAlloc(HYPRE_Int, FF2_offd_len, HYPRE_MEMORY_HOST); + /* + tcomm = hypre_MPI_Wtime() - tcomm; + air_time_comm += tcomm; + + HYPRE_Real t1 = hypre_MPI_Wtime(); + */ + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * First Pass: Determine the nnz of R and the max local size *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ @@ -701,7 +780,7 @@ cnt_offd = 0; /* maximum size of local system: will allocate space of this size */ local_max_size = 0; - + for (i = 0; i < n_fine; i++) { HYPRE_Int MARK = i + 1; @@ -711,7 +790,7 @@ { continue; } - + /* size of the local dense problem */ local_size = 0; @@ -749,7 +828,7 @@ for (k = S_offd_i[j1]; k < S_offd_i[j1+1]; k++) { k1 = col_offd_S_to_A ? col_offd_S_to_A[S_offd_j[k]] : S_offd_j[k]; - + if (CF_marker_offd[k1] < 0) { /* map to FF2_offd */ @@ -778,7 +857,7 @@ { continue; } - + /* map to FF2_offd */ j2 = Mapper_offd_A[j1]; @@ -816,14 +895,19 @@ /* index in recv_SF_offd_list */ k2 = recv_SF_j2[k]; + if (AIR1_5 && k2 == -1) + { + continue; + } + hypre_assert(recv_SF_offd_list[k2] == big_k1); /* map to FF2_offd */ k3 = Mapper_recv_SF_offd_list[k2]; - + /* this mapping must be successful */ hypre_assert(k3 >= 0 && k3 < FF2_offd_len); - + if (Marker_FF2_offd[k3] != MARK) { Marker_FF2_offd[k3] = MARK; @@ -837,24 +921,29 @@ /* keep ths max size */ local_max_size = hypre_max(local_max_size, local_size); } /* for (i=0,...) */ - + + /* + t1 = hypre_MPI_Wtime() - t1; + air_time1 += t1; + */ + /* this is because of the indentity matrix in C part * each C-pt has an entry 1.0 */ cnt_diag += n_cpts; - + nnz_diag = cnt_diag; nnz_offd = cnt_offd; - + /*------------- allocate arrays */ R_diag_i = hypre_CTAlloc(HYPRE_Int, n_cpts+1, HYPRE_MEMORY_HOST); R_diag_j = hypre_CTAlloc(HYPRE_Int, nnz_diag, HYPRE_MEMORY_HOST); - R_diag_data = hypre_CTAlloc(HYPRE_Real, nnz_diag, HYPRE_MEMORY_HOST); + R_diag_data = hypre_CTAlloc(HYPRE_Complex, nnz_diag, HYPRE_MEMORY_HOST); - /* not in ``if num_procs > 1'', + /* not in ``if num_procs > 1'', * allocation needed even for empty CSR */ R_offd_i = hypre_CTAlloc(HYPRE_Int, n_cpts+1, HYPRE_MEMORY_HOST); R_offd_j = hypre_CTAlloc(HYPRE_Int, nnz_offd, HYPRE_MEMORY_HOST); - R_offd_data = hypre_CTAlloc(HYPRE_Real, nnz_offd, HYPRE_MEMORY_HOST); + R_offd_data = hypre_CTAlloc(HYPRE_Complex, nnz_offd, HYPRE_MEMORY_HOST); /* redundant */ R_diag_i[0] = 0; @@ -877,6 +966,7 @@ } Marker_FF2_offd_j = hypre_CTAlloc(HYPRE_Int, FF2_offd_len, HYPRE_MEMORY_HOST); + // TODO bs : what is this for? Should we remove? //for (i = 0; i < num_cols_A_offd; i++) //{ // Marker_offd[i] = -1; @@ -885,31 +975,42 @@ //{ // Marker_recv_SF_list[i] = -1; //} + //printf("AIR: max local dense solve size %d\n", local_max_size); + + // Allocate the rhs and dense local matrix in column-major form (for LAPACK) + DAi = hypre_CTAlloc(HYPRE_Complex, local_max_size*local_max_size, HYPRE_MEMORY_HOST); + Dbi = hypre_CTAlloc(HYPRE_Complex, local_max_size, HYPRE_MEMORY_HOST); + Dxi = hypre_CTAlloc(HYPRE_Complex, local_max_size, HYPRE_MEMORY_HOST); + Ipi = hypre_CTAlloc(HYPRE_Int, local_max_size, HYPRE_MEMORY_HOST); // pivot matrix + + // Allocate memory for GMRES if it will be used + HYPRE_Int kdim_max = hypre_min(gmresAi_maxit, local_max_size); + if (gmres_switch < local_max_size) + { + hypre_fgmresT(local_max_size, NULL, NULL, 0.0, kdim_max, NULL, NULL, NULL, -1); + } - /* the local matrix and rhs (dense) - * column-major as always by BLAS/LAPACK */ - /* matrix */ - DAi = hypre_CTAlloc(HYPRE_Real, local_max_size * local_max_size, HYPRE_MEMORY_HOST); - /* rhs */ - Dbi = hypre_CTAlloc(HYPRE_Real, local_max_size, HYPRE_MEMORY_HOST); - /* pivot */ - Ipi = hypre_CTAlloc(HYPRE_Int, local_max_size, HYPRE_MEMORY_HOST); #if AIR_DEBUG /* FOR DEBUG */ - TMPA = hypre_CTAlloc(HYPRE_Real, local_max_size * local_max_size, HYPRE_MEMORY_HOST); - TMPb = hypre_CTAlloc(HYPRE_Real, local_max_size, HYPRE_MEMORY_HOST); - TMPd = hypre_CTAlloc(HYPRE_Real, local_max_size, HYPRE_MEMORY_HOST); + TMPA = hypre_CTAlloc(HYPRE_Complex, local_max_size * local_max_size, HYPRE_MEMORY_HOST); + TMPb = hypre_CTAlloc(HYPRE_Complex, local_max_size, HYPRE_MEMORY_HOST); + TMPd = hypre_CTAlloc(HYPRE_Complex, local_max_size, HYPRE_MEMORY_HOST); #endif - /*- - - - - - - - - - - - - - - - - - - - - - - - - + + /*- - - - - - - - - - - - - - - - - - - - - - - - - * space to save row indices of the local problem, * if diag, save the local indices, - * if offd, save the indices in FF2_offd, + * if offd, save the indices in FF2_offd, * since we will use it to access A_offd_FF2 *- - - - - - - - - - - - - - - - - - - - - - - - - */ RRi = hypre_CTAlloc(HYPRE_Int, local_max_size, HYPRE_MEMORY_HOST); /* indicators for RRi of being local (0) or offd (1) */ KKi = hypre_CTAlloc(HYPRE_Int, local_max_size, HYPRE_MEMORY_HOST); + /* + HYPRE_Real t2 = hypre_MPI_Wtime(); + */ + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Second Pass: Populate R *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ @@ -926,10 +1027,9 @@ /* size of Ai, bi */ local_size = 0; - + /* Access matrices for the First time, mark the points we want */ /* diag part of row i */ -//HYPRE_Real t1 = hypre_MPI_Wtime(); for (j = S_diag_i[i]; j < S_diag_i[i+1]; j++) { j1 = S_diag_j[j]; @@ -967,10 +1067,10 @@ { /* map to FF2_offd */ k2 = Mapper_offd_A[k1]; - + /* this mapping must be successful */ hypre_assert(k2 >= 0 && k2 < FF2_offd_len); - + /* an F-pt and never seen before */ if (Marker_FF2_offd[k2] == -1) { @@ -1038,6 +1138,11 @@ /* index in recv_SF_offd_list */ k2 = recv_SF_j2[k]; + if (AIR1_5 && k2 == -1) + { + continue; + } + hypre_assert(recv_SF_offd_list[k2] == big_k1); /* map to FF2_offd */ @@ -1059,19 +1164,17 @@ } } -//t1 = hypre_MPI_Wtime() - t1; -//time1 += t1; - hypre_assert(local_size <= local_max_size); /* Second, copy values to local system: Ai and bi from A */ - /* now we have marked all rows/cols we want. next we extract the entries + /* now we have marked all rows/cols we want. next we extract the entries * we need from these rows and put them in Ai and bi*/ -//HYPRE_Real t2 = hypre_MPI_Wtime(); /* clear DAi and bi */ - memset(DAi, 0, local_size * local_size * sizeof(HYPRE_Real)); - memset(Dbi, 0, local_size * sizeof(HYPRE_Real)); + memset(DAi, 0, local_size * local_size * sizeof(HYPRE_Complex)); + memset(Dxi, 0, local_size * sizeof(HYPRE_Complex)); + memset(Dbi, 0, local_size * sizeof(HYPRE_Complex)); + /* we will populate Ai row-by-row */ for (rr = 0; rr < local_size; rr++) @@ -1099,7 +1202,9 @@ hypre_assert(CF_marker[j2] < 0); /* copy the value */ /* rr and cc: local dense ids */ - DAi[rr + cc * local_size] = hypre_CSRMatrixData(A_offd_FF2)[j]; + HYPRE_Complex vv = hypre_CSRMatrixData(A_offd_FF2)[j]; + DAi[rr + cc*local_size] = vv; + } } else @@ -1114,7 +1219,8 @@ { /* copy the value */ /* rr and cc: local dense ids */ - DAi[rr + cc * local_size] = hypre_CSRMatrixData(A_offd_FF2)[j]; + HYPRE_Complex vv = hypre_CSRMatrixData(A_offd_FF2)[j]; + DAi[rr + cc * local_size] = vv; } } } @@ -1131,10 +1237,12 @@ if ((cc = Marker_diag[j1]) >= 0) { hypre_assert(CF_marker[j1] < 0); - + /* copy the value */ /* rr and cc: local dense ids */ - DAi[rr + cc * local_size] = A_diag_a[j]; + HYPRE_Complex vv = A_diag_a[j]; + DAi[rr + cc * local_size] = vv; + } } @@ -1154,15 +1262,18 @@ hypre_assert(CF_marker_offd[j1] < 0); /* copy the value */ /* rr and cc: local dense ids */ - DAi[rr + cc * local_size] = A_offd_a[j]; + HYPRE_Complex vv = A_offd_a[j]; + DAi[rr + cc * local_size] = vv; + } } } } } + /* done with row rr */ } - /* + /* TODO bs: remove? { char Buf[4096]; char Buf2[4096]; @@ -1234,51 +1345,97 @@ hypre_assert(rr <= local_size); -//t2 = hypre_MPI_Wtime() - t2; -//time2 += t2; - + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * We have Ai and bi built. Solve the linear system by: + * - forward solve for triangular matrix + * - LU factorization (LAPACK) for local_size <= gmres_switch + * - Dense GMRES for local_size > gmres_switch + *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + Aisol_method = local_size <= gmres_switch ? 'L' : 'G'; if (local_size > 0) { - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * we have Ai and bi build - * Solve the linear system by LAPACK : LU factorization - *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + if (is_triangular) { + hypre_ordered_GS(DAi, Dbi, Dxi, local_size); #if AIR_DEBUG - memcpy(TMPA, DAi, local_size*local_size*sizeof(HYPRE_Real)); - memcpy(TMPb, Dbi, local_size*sizeof(HYPRE_Real)); + HYPRE_Real alp = -1.0, err; + colmaj_mvT(DAi, Dxi, TMPd, local_size); + hypre_daxpy(&local_size, &alp, Dbi, &ione, TMPd, &ione); + err = hypre_dnrm2(&local_size, TMPd, &ione); + if (err > 1e-8) + { + hypre_printf("triangular solve res: %e\n", err); + exit(0); + } #endif - - hypre_dgetrf(&local_size, &local_size, DAi, &local_size, Ipi, - &lapack_info); - - hypre_assert(lapack_info == 0); - - if (lapack_info == 0) - { - /* solve A_i^T x_i = b_i, - * solution is saved in b_i on return */ - hypre_dgetrs(&charT, &local_size, &ione, DAi, &local_size, - Ipi, Dbi, &local_size, &lapack_info); - - hypre_assert(lapack_info == 0); } + // Solve using LAPACK and LU factorization + else if (Aisol_method == 'L') + { +#if AIR_DEBUG + memcpy(TMPA, DAi, local_size*local_size*sizeof(HYPRE_Complex)); + memcpy(TMPb, Dbi, local_size*sizeof(HYPRE_Complex)); +#endif + hypre_dgetrf(&local_size, &local_size, DAi, &local_size, Ipi, + &lapack_info); + hypre_assert(lapack_info == 0); + if (lapack_info == 0) + { + /* solve A_i^T x_i = b_i, + * solution is saved in b_i on return */ + hypre_dgetrs(&charT, &local_size, &ione, DAi, &local_size, + Ipi, Dbi, &local_size, &lapack_info); + hypre_assert(lapack_info == 0); + } #if AIR_DEBUG - HYPRE_Int one = 1; - HYPRE_Real alp = 1.0, bet = 0.0; - hypre_dgemv(&charT, &local_size, &local_size, &alp, TMPA, &local_size, Dbi, - &one, &bet, TMPd, &one); - alp = -1.0; - hypre_daxpy(&local_size, &alp, TMPb, &one, TMPd, &one); - HYPRE_Real err = hypre_dnrm2(&local_size, TMPd, &one); - if (err > 1e-8) - { - hypre_printf("local res norm %e\n", err); + HYPRE_Real alp = 1.0, bet = 0.0, err; + hypre_dgemv(&charT, &local_size, &local_size, &alp, TMPA, &local_size, Dbi, + &ione, &bet, TMPd, &ione); + alp = -1.0; + hypre_daxpy(&local_size, &alp, TMPb, &ione, TMPd, &ione); + err = hypre_dnrm2(&local_size, TMPd, &ione); + if (err > 1e-8) + { + hypre_printf("dense: local res norm %e\n", err); + exit(0); + } +#endif } + // Solve by GMRES + else + { + HYPRE_Real gmresAi_res; + HYPRE_Int gmresAi_niter; + HYPRE_Int kdim = hypre_min(gmresAi_maxit, local_size); + + hypre_fgmresT(local_size, DAi, Dbi, gmresAi_tol, kdim, Dxi, + &gmresAi_res, &gmresAi_niter, 0); + + if (gmresAi_res > gmresAi_tol) + { + hypre_printf("gmres/jacobi not converge to %e: final_res %e\n", gmresAi_tol, gmresAi_res); + } + +#if AIR_DEBUG + HYPRE_Real err, nrmb; + colmaj_mvT(DAi, Dxi, TMPd, local_size); + HYPRE_Real alp = -1.0; + nrmb = hypre_dnrm2(&local_size, Dbi, &ione); + hypre_daxpy(&local_size, &alp, Dbi, &ione, TMPd, &ione); + err = hypre_dnrm2(&local_size, TMPd, &ione); + if (err/nrmb > gmresAi_tol) + { + hypre_printf("GMRES/Jacobi: res norm %e, nrmb %e, relative %e\n", err, nrmb, err/nrmb); + hypre_printf("GMRES/Jacobi: relative %e\n", gmresAi_res); + exit(0); + } #endif + } } + HYPRE_Complex *Soli = (is_triangular || (Aisol_method=='G')) ? Dxi : Dbi; + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Now we are ready to fill this row of R *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ @@ -1297,7 +1454,7 @@ * and you will see why later (very soon!) */ R_offd_j[cnt_offd] = i1; /* copy the value */ - R_offd_data[cnt_offd++] = Dbi[rr]; + R_offd_data[cnt_offd++] = Soli[rr]; } else /* diag */ { @@ -1306,7 +1463,7 @@ /* col idx: use local index i1 */ R_diag_j[cnt_diag] = i1; /* copy the value */ - R_diag_data[cnt_diag++] = Dbi[rr]; + R_diag_data[cnt_diag++] = Soli[rr]; } } @@ -1320,7 +1477,6 @@ R_offd_i[ic+1] = cnt_offd; -//HYPRE_Real t3 = hypre_MPI_Wtime(); /* RESET marker arrays */ for (j = 0; j < Marker_diag_count; j++) { @@ -1332,31 +1488,24 @@ Marker_FF2_offd[Marker_FF2_offd_j[j]] = -1; } - /* never turn them on !!! */ - /* - for (j = 0; j < n_fine; j++) - { - hypre_assert(Marker_diag[j] == -1); - } - - for (j = 0; j < FF2_offd_len; j++) - { - hypre_assert(Marker_FF2_offd[j] == -1); - } - */ - -//t3 = hypre_MPI_Wtime() - t3; -//time3 += t3; - /* next C-pt */ ic++; } /* outermost loop, for (i=0,...), for each C-pt find restriction */ + /* + hypre_MPI_Barrier(comm); + t2 = hypre_MPI_Wtime() - t2; + air_time2 += t2; + */ hypre_assert(ic == n_cpts) hypre_assert(cnt_diag == nnz_diag) hypre_assert(cnt_offd == nnz_offd) - + + /* + HYPRE_Real t3 = hypre_MPI_Wtime(); + */ + /* num of cols in the offd part of R */ num_cols_offd_R = 0; /* to this point, Marker_FF2_offd should be all -1 */ @@ -1407,10 +1556,10 @@ /* change col_map_offd_R to global ids [guaranteed to be sorted] */ for (i = 0; i < num_cols_offd_R; i++) { - col_map_offd_R[i] = FF2_offd[col_map_offd_R[i]]; + col_map_offd_R[i] = FF2_offd[tmp_map_offd[i]]; } - /* Now, we should have everything of Parcsr matrix R */ + /* Now, we should have everything of Parcsr matrix R */ R = hypre_ParCSRMatrixCreate(comm, total_global_cpts, /* global num of rows */ hypre_ParCSRMatrixGlobalNumRows(A), /* global num of cols */ @@ -1431,12 +1580,31 @@ hypre_CSRMatrixJ(R_offd) = R_offd_j; /* R does not own ColStarts, since A does */ hypre_ParCSRMatrixOwnsColStarts(R) = 0; - + hypre_ParCSRMatrixColMapOffd(R) = col_map_offd_R; + /* + t3 = hypre_MPI_Wtime() - t3; + air_time3 += t3; + + HYPRE_Real t4 = hypre_MPI_Wtime(); + */ + /* create CommPkg of R */ + hypre_ParCSRMatrixAssumedPartition(R) = hypre_ParCSRMatrixAssumedPartition(A); + hypre_ParCSRMatrixOwnsAssumedPartition(R) = 0; hypre_MatvecCommPkgCreate(R); + /* + t4 = hypre_MPI_Wtime() - t4; + air_time4 += t4; + */ + + /* Filter small entries from R */ + if (filter_thresholdR > 0) { + hypre_ParCSRMatrixDropSmallEntries(R, filter_thresholdR, -1); + } + *R_ptr = R; hypre_TFree(tmp_map_offd, HYPRE_MEMORY_HOST); @@ -1474,15 +1642,393 @@ hypre_TFree(Marker_FF2_offd_j, HYPRE_MEMORY_HOST); hypre_TFree(DAi, HYPRE_MEMORY_HOST); hypre_TFree(Dbi, HYPRE_MEMORY_HOST); + hypre_TFree(Dxi, HYPRE_MEMORY_HOST); hypre_TFree(Ipi, HYPRE_MEMORY_HOST); #if AIR_DEBUG hypre_TFree(TMPA, HYPRE_MEMORY_HOST); hypre_TFree(TMPb, HYPRE_MEMORY_HOST); hypre_TFree(TMPd, HYPRE_MEMORY_HOST); + hypre_SeqVectorDestroy(tmpv); #endif hypre_TFree(RRi, HYPRE_MEMORY_HOST); hypre_TFree(KKi, HYPRE_MEMORY_HOST); + if (gmres_switch < local_max_size) + { + hypre_fgmresT(0, NULL, NULL, 0.0, 0, NULL, NULL, NULL, -2); + } + + /* + t0 = hypre_MPI_Wtime() - t0; + air_time0 += t0; + */ + + return 0; +} + +HYPRE_Int +hypre_BoomerAMGBuildRestrNeumannAIR( hypre_ParCSRMatrix *A, + HYPRE_Int *CF_marker, + HYPRE_BigInt *num_cpts_global, + HYPRE_Int num_functions, + HYPRE_Int *dof_func, + HYPRE_Int NeumannDeg, + HYPRE_Real strong_thresholdR, + HYPRE_Real filter_thresholdR, + HYPRE_Int debug_flag, + HYPRE_Int *col_offd_S_to_A, + hypre_ParCSRMatrix **R_ptr) +{ + /* HYPRE_Real t0 = hypre_MPI_Wtime(); */ + MPI_Comm comm = hypre_ParCSRMatrixComm(A); + hypre_ParCSRCommHandle *comm_handle; + + /* diag part of A */ + hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); + + /* Restriction matrix R and CSR's */ + hypre_ParCSRMatrix *R; + hypre_CSRMatrix *R_diag; + hypre_CSRMatrix *R_offd; + + /* arrays */ + HYPRE_Complex *R_diag_a; + HYPRE_Int *R_diag_i; + HYPRE_Int *R_diag_j; + HYPRE_Complex *R_offd_a; + HYPRE_Int *R_offd_i; + HYPRE_Int *R_offd_j; + HYPRE_BigInt *col_map_offd_R; + + HYPRE_Int i, j, j1, i1, ic, + num_cols_offd_R; + HYPRE_Int my_id, num_procs; + HYPRE_BigInt total_global_cpts/*, my_first_cpt*/; + HYPRE_Int nnz_diag, nnz_offd, cnt_diag, cnt_offd; + HYPRE_BigInt *send_buf_i; + + /* local size */ + HYPRE_Int n_fine = hypre_CSRMatrixNumRows(A_diag); + HYPRE_BigInt col_start = hypre_ParCSRMatrixFirstRowIndex(A); + + /* MPI size and rank*/ + hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_rank(comm, &my_id); + + /*-------------- global number of C points and my start position */ +#ifdef HYPRE_NO_GLOBAL_PARTITION + /*my_first_cpt = num_cpts_global[0];*/ + if (my_id == (num_procs -1)) + { + total_global_cpts = num_cpts_global[1]; + } + hypre_MPI_Bcast(&total_global_cpts, 1, HYPRE_MPI_BIG_INT, num_procs-1, comm); +#else + /*my_first_cpt = num_cpts_global[my_id];*/ + total_global_cpts = num_cpts_global[num_procs]; +#endif + + /*------------------------------------------------------------------- + * Get the CF_marker data for the off-processor columns + *-------------------------------------------------------------------*/ + /* CF marker for the off-diag columns */ +#if 0 + if (num_cols_A_offd) + { + CF_marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); + } + /* function type indicator for the off-diag columns */ + if (num_functions > 1 && num_cols_A_offd) + { + dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); + } + + /* if CommPkg of A is not present, create it */ + if (!comm_pkg) + { + hypre_MatvecCommPkgCreate(A); + comm_pkg = hypre_ParCSRMatrixCommPkg(A); + } + + /* number of sends (number of procs) */ + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + + /* number of recvs (number of procs) */ + num_recvs = hypre_ParCSRCommPkgNumRecvs(comm_pkg); + + /* number of elements to send */ + num_elems_send = hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends); + + /* send buffer, of size send_map_starts[num_sends]), + * i.e., number of entries to send */ + send_buf_i = hypre_CTAlloc(HYPRE_Int, num_elems_send, HYPRE_MEMORY_HOST); + + /* copy CF markers of elements to send to buffer */ + for (i = 0; i < num_elems_send; i++) + { + send_buf_i[i] = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,i)]; + } + /* create a handle to start communication. 11: for integer */ + comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, send_buf_i, CF_marker_offd); + /* destroy the handle to finish communication */ + hypre_ParCSRCommHandleDestroy(comm_handle); + + /* do a similar communication for dof_func */ + if (num_functions > 1) + { + for (i = 0; i < num_elems_send; i++) + { + send_buf_i[i] = dof_func[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,i)]; + } + comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, send_buf_i, dof_func_offd); + hypre_ParCSRCommHandleDestroy(comm_handle); + } + + /* init markers to zeros */ + Marker_diag = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_HOST); + Marker_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); +#endif + + hypre_ParCSRMatrix *AFF, *ACF, *X, *X2, *Z, *Z2; + hypre_ParCSRMatrixExtractSubmatrixFC(A, CF_marker, num_cpts_global, "FF", &AFF, strong_thresholdR); + hypre_ParCSRMatrixExtractSubmatrixFC(A, CF_marker, num_cpts_global, "CF", &ACF, strong_thresholdR); + + /* A_FF := I - D^{-1}*A_FF */ + hypre_CSRMatrix *AFF_diag = hypre_ParCSRMatrixDiag(AFF); + hypre_CSRMatrix *AFF_offd = hypre_ParCSRMatrixOffd(AFF); + HYPRE_Complex *AFF_diag_a = hypre_CSRMatrixData(AFF_diag); + HYPRE_Int *AFF_diag_i = hypre_CSRMatrixI(AFF_diag); + HYPRE_Int *AFF_diag_j = hypre_CSRMatrixJ(AFF_diag); + HYPRE_Complex *AFF_offd_a = hypre_CSRMatrixData(AFF_offd); + HYPRE_Int *AFF_offd_i = hypre_CSRMatrixI(AFF_offd); + HYPRE_Int *AFF_offd_j = hypre_CSRMatrixJ(AFF_offd); + HYPRE_Int n_fpts = hypre_CSRMatrixNumRows(AFF_diag); + HYPRE_Int n_cpts = n_fine - n_fpts; + hypre_assert(n_cpts == hypre_CSRMatrixNumRows(hypre_ParCSRMatrixDiag(ACF))); + HYPRE_Int *Fmap = hypre_TAlloc(HYPRE_Int, n_fpts, HYPRE_MEMORY_HOST); + + /* map from F-pts to all points */ + for (i = 0, j = 0; i < n_fine; i++) + { + if (CF_marker[i] < 0) + { + Fmap[j++] = i; + } + } + + hypre_assert(j == n_fpts); + + HYPRE_Complex *diag_entries = hypre_TAlloc(HYPRE_Complex, n_fpts, HYPRE_MEMORY_HOST); + + for (i = 0; i < n_fpts; i++) + { + i1 = AFF_diag_i[i]; + + /* make sure the first entry is diagonal */ + hypre_assert(AFF_diag_j[i1] == i); + + /* !!! store the inverse */ + HYPRE_Complex di = 1.0 / AFF_diag_a[i1]; + diag_entries[i] = di; + di = -di; + AFF_diag_a[i1] = 0.0; + for (j = i1+1; j < AFF_diag_i[i+1]; j++) + { + AFF_diag_a[j] *= di; + } + if (num_procs > 1) + { + for (j = AFF_offd_i[i]; j < AFF_offd_i[i+1]; j++) + { + hypre_assert( hypre_ParCSRMatrixColMapOffd(AFF)[AFF_offd_j[j]] != \ + i + hypre_ParCSRMatrixFirstRowIndex(AFF) ); + + AFF_offd_a[j] *= di; + } + } + } + + /* Z = Acf * (I + N + N^2 + ... + N^k] * D^{-1} + * N = I - D^{-1} * A_FF (computed above) + * the last D^{-1} will not be done here (but later) + */ + if (NeumannDeg < 1) + { + Z = ACF; + } + else if (NeumannDeg == 1) + { + X = hypre_ParMatmul(ACF, AFF); + hypre_ParcsrAdd(1.0, ACF, 1.0, X, &Z); + hypre_ParCSRMatrixDestroy(X); + } + else + { + X = hypre_ParMatmul(AFF, AFF); + hypre_ParcsrAdd(1.0, AFF, 1.0, X, &Z); + for (i = 2; i < NeumannDeg; i++) + { + X2 = hypre_ParMatmul(X, AFF); + hypre_ParcsrAdd(1.0, Z, 1.0, X2, &Z2); + hypre_ParCSRMatrixDestroy(X); + hypre_ParCSRMatrixDestroy(Z); + Z = Z2; + X = X2; + } + hypre_ParCSRMatrixDestroy(X); + X = hypre_ParMatmul(ACF, Z); + hypre_ParCSRMatrixDestroy(Z); + hypre_ParcsrAdd(1.0, ACF, 1.0, X, &Z); + hypre_ParCSRMatrixDestroy(X); + } + + hypre_ParCSRMatrixDestroy(AFF); + if (NeumannDeg >= 1) + { + hypre_ParCSRMatrixDestroy(ACF); + } + + hypre_CSRMatrix *Z_diag = hypre_ParCSRMatrixDiag(Z); + hypre_CSRMatrix *Z_offd = hypre_ParCSRMatrixOffd(Z); + HYPRE_Complex *Z_diag_a = hypre_CSRMatrixData(Z_diag); + HYPRE_Int *Z_diag_i = hypre_CSRMatrixI(Z_diag); + HYPRE_Int *Z_diag_j = hypre_CSRMatrixJ(Z_diag); + HYPRE_Complex *Z_offd_a = hypre_CSRMatrixData(Z_offd); + HYPRE_Int *Z_offd_i = hypre_CSRMatrixI(Z_offd); + HYPRE_Int *Z_offd_j = hypre_CSRMatrixJ(Z_offd); + HYPRE_Int num_cols_offd_Z = hypre_CSRMatrixNumCols(Z_offd); + /* + HYPRE_BigInt *col_map_offd_Z = hypre_ParCSRMatrixColMapOffd(Z); + */ + /* send and recv diagonal entries (wrt Z) */ + HYPRE_Complex *diag_entries_offd = hypre_TAlloc(HYPRE_Complex, num_cols_offd_Z, HYPRE_MEMORY_HOST); + hypre_ParCSRCommPkg *comm_pkg_Z = hypre_ParCSRMatrixCommPkg(Z); + HYPRE_Int num_sends_Z = hypre_ParCSRCommPkgNumSends(comm_pkg_Z); + HYPRE_Int num_elems_send_Z = hypre_ParCSRCommPkgSendMapStart(comm_pkg_Z, num_sends_Z); + HYPRE_Complex *send_buf_Z = hypre_TAlloc(HYPRE_Complex, num_elems_send_Z, HYPRE_MEMORY_HOST); + for (i = 0; i < num_elems_send_Z; i++) + { + send_buf_Z[i] = diag_entries[hypre_ParCSRCommPkgSendMapElmt(comm_pkg_Z, i)]; + } + comm_handle = hypre_ParCSRCommHandleCreate(1, comm_pkg_Z, send_buf_Z, diag_entries_offd); + hypre_ParCSRCommHandleDestroy(comm_handle); + + /* send and recv Fmap (wrt Z): global */ + HYPRE_BigInt *Fmap_offd_global = hypre_TAlloc(HYPRE_BigInt, num_cols_offd_Z, HYPRE_MEMORY_HOST); + send_buf_i = hypre_TAlloc(HYPRE_BigInt, num_elems_send_Z, HYPRE_MEMORY_HOST); + for (i = 0; i < num_elems_send_Z; i++) + { + send_buf_i[i] = Fmap[hypre_ParCSRCommPkgSendMapElmt(comm_pkg_Z, i)] + col_start; + } + comm_handle = hypre_ParCSRCommHandleCreate(21, comm_pkg_Z, send_buf_i, Fmap_offd_global); + hypre_ParCSRCommHandleDestroy(comm_handle); + + nnz_diag = hypre_CSRMatrixNumNonzeros(Z_diag) + n_cpts; + nnz_offd = hypre_CSRMatrixNumNonzeros(Z_offd); + + /*------------- allocate arrays */ + R_diag_i = hypre_CTAlloc(HYPRE_Int, n_cpts+1, HYPRE_MEMORY_HOST); + R_diag_j = hypre_CTAlloc(HYPRE_Int, nnz_diag, HYPRE_MEMORY_HOST); + R_diag_a = hypre_CTAlloc(HYPRE_Complex, nnz_diag, HYPRE_MEMORY_HOST); + + /* not in ``if num_procs > 1'', + * allocation needed even for empty CSR */ + R_offd_i = hypre_CTAlloc(HYPRE_Int, n_cpts+1, HYPRE_MEMORY_HOST); + R_offd_j = hypre_CTAlloc(HYPRE_Int, nnz_offd, HYPRE_MEMORY_HOST); + R_offd_a = hypre_CTAlloc(HYPRE_Complex, nnz_offd, HYPRE_MEMORY_HOST); + + /* redundant */ + R_diag_i[0] = 0; + R_offd_i[0] = 0; + + /* reset counters */ + cnt_diag = 0; + cnt_offd = 0; + + for (i = 0, ic = 0; i < n_fine; i++) + { + /* ignore F-points */ + if (CF_marker[i] < 0) + { + continue; + } + + for (j = Z_diag_i[ic]; j < Z_diag_i[ic+1]; j++) + { + j1 = Z_diag_j[j]; + R_diag_j[cnt_diag] = Fmap[j1]; + R_diag_a[cnt_diag++] = -Z_diag_a[j] * diag_entries[j1]; + } + + /* identity */ + R_diag_j[cnt_diag] = i; + R_diag_a[cnt_diag++] = 1.0; + + for (j = Z_offd_i[ic]; j < Z_offd_i[ic+1]; j++) + { + j1 = Z_offd_j[j]; + R_offd_j[cnt_offd] = j1; + R_offd_a[cnt_offd++] = -Z_offd_a[j] * diag_entries_offd[j1]; + } + + R_diag_i[ic+1] = cnt_diag; + R_offd_i[ic+1] = cnt_offd; + + ic++; + } + + hypre_assert(ic == n_cpts); + hypre_assert(cnt_diag == nnz_diag); + hypre_assert(cnt_offd == nnz_offd); + + num_cols_offd_R = num_cols_offd_Z; + col_map_offd_R = Fmap_offd_global; + + /* Now, we should have everything of Parcsr matrix R */ + R = hypre_ParCSRMatrixCreate(comm, + total_global_cpts, /* global num of rows */ + hypre_ParCSRMatrixGlobalNumRows(A), /* global num of cols */ + num_cpts_global, /* row_starts */ + hypre_ParCSRMatrixRowStarts(A), /* col_starts */ + num_cols_offd_R, /* num cols offd */ + nnz_diag, + nnz_offd); + + R_diag = hypre_ParCSRMatrixDiag(R); + hypre_CSRMatrixData(R_diag) = R_diag_a; + hypre_CSRMatrixI(R_diag) = R_diag_i; + hypre_CSRMatrixJ(R_diag) = R_diag_j; + + R_offd = hypre_ParCSRMatrixOffd(R); + hypre_CSRMatrixData(R_offd) = R_offd_a; + hypre_CSRMatrixI(R_offd) = R_offd_i; + hypre_CSRMatrixJ(R_offd) = R_offd_j; + /* R does not own ColStarts, since A does */ + hypre_ParCSRMatrixOwnsColStarts(R) = 0; + + hypre_ParCSRMatrixColMapOffd(R) = col_map_offd_R; + + /* create CommPkg of R */ + hypre_ParCSRMatrixAssumedPartition(R) = hypre_ParCSRMatrixAssumedPartition(A); + hypre_ParCSRMatrixOwnsAssumedPartition(R) = 0; + hypre_MatvecCommPkgCreate(R); + + /* Filter small entries from R */ + if (filter_thresholdR > 0) { + hypre_ParCSRMatrixDropSmallEntries(R, filter_thresholdR, -1); + } + + *R_ptr = R; + + hypre_ParCSRMatrixDestroy(Z); + hypre_TFree(Fmap, HYPRE_MEMORY_HOST); + hypre_TFree(diag_entries, HYPRE_MEMORY_HOST); + hypre_TFree(diag_entries_offd, HYPRE_MEMORY_HOST); + hypre_TFree(send_buf_i, HYPRE_MEMORY_HOST); + hypre_TFree(send_buf_Z, HYPRE_MEMORY_HOST); + return 0; } + + diff -Nru hypre-2.16.0/src/parcsr_ls/par_mgr.c hypre-2.18.2/src/parcsr_ls/par_mgr.c --- hypre-2.16.0/src/parcsr_ls/par_mgr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_mgr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2015, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/par_mgr.h hypre-2.18.2/src/parcsr_ls/par_mgr.h --- hypre-2.16.0/src/parcsr_ls/par_mgr.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_mgr.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_ParMGR_DATA_HEADER #define hypre_ParMGR_DATA_HEADER diff -Nru hypre-2.16.0/src/parcsr_ls/par_mgr_setup.c hypre-2.18.2/src/parcsr_ls/par_mgr_setup.c --- hypre-2.16.0/src/parcsr_ls/par_mgr_setup.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_mgr_setup.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,10 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + #include "_hypre_parcsr_ls.h" #include "par_mgr.h" #include "par_amg.h" diff -Nru hypre-2.16.0/src/parcsr_ls/par_mgr_solve.c hypre-2.18.2/src/parcsr_ls/par_mgr_solve.c --- hypre-2.16.0/src/parcsr_ls/par_mgr_solve.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_mgr_solve.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_ls/par_multi_interp.c hypre-2.18.2/src/parcsr_ls/par_multi_interp.c --- hypre-2.16.0/src/parcsr_ls/par_multi_interp.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_multi_interp.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" diff -Nru hypre-2.16.0/src/parcsr_ls/par_nodal_systems.c hypre-2.18.2/src/parcsr_ls/par_nodal_systems.c --- hypre-2.16.0/src/parcsr_ls/par_nodal_systems.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_nodal_systems.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -33,12 +25,12 @@ _hypre_parcsr_ls.h @return Error code. - + @param A [IN] coefficient matrix @param AN_ptr [OUT] nodal norm matrix - + @see */ /*--------------------------------------------------------------------------*/ @@ -47,10 +39,10 @@ HYPRE_Int num_functions, HYPRE_Int *dof_func, HYPRE_Int option, - HYPRE_Int diag_option, + HYPRE_Int diag_option, hypre_ParCSRMatrix **AN_ptr) { - MPI_Comm comm = hypre_ParCSRMatrixComm(A); + MPI_Comm comm = hypre_ParCSRMatrixComm(A); hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); HYPRE_Real *A_diag_data = hypre_CSRMatrixData(A_diag); @@ -62,67 +54,67 @@ HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); - HYPRE_BigInt *row_starts = hypre_ParCSRMatrixRowStarts(A); - HYPRE_BigInt *col_map_offd = hypre_ParCSRMatrixColMapOffd(A); + HYPRE_BigInt *row_starts = hypre_ParCSRMatrixRowStarts(A); + HYPRE_BigInt *col_map_offd = hypre_ParCSRMatrixColMapOffd(A); HYPRE_Int num_variables = hypre_CSRMatrixNumRows(A_diag); - HYPRE_Int num_nonzeros_offd = 0; - HYPRE_Int num_cols_offd = 0; - + HYPRE_Int num_nonzeros_offd = 0; + HYPRE_Int num_cols_offd = 0; + hypre_ParCSRMatrix *AN; hypre_CSRMatrix *AN_diag; HYPRE_Int *AN_diag_i; HYPRE_Int *AN_diag_j; - HYPRE_Real *AN_diag_data; + HYPRE_Real *AN_diag_data; hypre_CSRMatrix *AN_offd; HYPRE_Int *AN_offd_i; HYPRE_Int *AN_offd_j; - HYPRE_Real *AN_offd_data; - HYPRE_BigInt *col_map_offd_AN; - HYPRE_BigInt *new_col_map_offd; - HYPRE_BigInt *row_starts_AN; - HYPRE_Int AN_num_nonzeros_diag = 0; - HYPRE_Int AN_num_nonzeros_offd = 0; - HYPRE_Int num_cols_offd_AN; - HYPRE_Int new_num_cols_offd; - + HYPRE_Real *AN_offd_data; + HYPRE_BigInt *col_map_offd_AN; + HYPRE_BigInt *new_col_map_offd; + HYPRE_BigInt *row_starts_AN; + HYPRE_Int AN_num_nonzeros_diag = 0; + HYPRE_Int AN_num_nonzeros_offd = 0; + HYPRE_Int num_cols_offd_AN; + HYPRE_Int new_num_cols_offd; + hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); - HYPRE_Int num_sends; - HYPRE_Int num_recvs; - HYPRE_Int *send_procs; - HYPRE_Int *send_map_starts; - HYPRE_Int *send_map_elmts = NULL; - HYPRE_Int *new_send_map_elmts; - HYPRE_Int *recv_procs; - HYPRE_Int *recv_vec_starts; + HYPRE_Int num_sends; + HYPRE_Int num_recvs; + HYPRE_Int *send_procs; + HYPRE_Int *send_map_starts; + HYPRE_Int *send_map_elmts = NULL; + HYPRE_Int *new_send_map_elmts; + HYPRE_Int *recv_procs; + HYPRE_Int *recv_vec_starts; hypre_ParCSRCommPkg *comm_pkg_AN; - HYPRE_Int *send_procs_AN; - HYPRE_Int *send_map_starts_AN; - HYPRE_Int *send_map_elmts_AN; - HYPRE_Int *recv_procs_AN; - HYPRE_Int *recv_vec_starts_AN; + HYPRE_Int *send_procs_AN; + HYPRE_Int *send_map_starts_AN; + HYPRE_Int *send_map_elmts_AN; + HYPRE_Int *recv_procs_AN; + HYPRE_Int *recv_vec_starts_AN; HYPRE_Int i, j, k, k_map; - - HYPRE_Int index, row; - HYPRE_Int start_index; - HYPRE_Int num_procs; - HYPRE_Int node, cnt; - HYPRE_Int mode; - HYPRE_BigInt big_node; - HYPRE_Int new_send_elmts_size; - - HYPRE_BigInt global_num_nodes; - HYPRE_Int num_nodes; - HYPRE_Int num_fun2; - HYPRE_BigInt *big_map_to_node = NULL; - HYPRE_Int *map_to_node; - HYPRE_Int *map_to_map; - HYPRE_Int *counter; + + HYPRE_Int index, row; + HYPRE_Int start_index; + HYPRE_Int num_procs; + HYPRE_Int node, cnt; + HYPRE_Int mode; + HYPRE_BigInt big_node; + HYPRE_Int new_send_elmts_size; + + HYPRE_BigInt global_num_nodes; + HYPRE_Int num_nodes; + HYPRE_Int num_fun2; + HYPRE_BigInt *big_map_to_node = NULL; + HYPRE_Int *map_to_node; + HYPRE_Int *map_to_map; + HYPRE_Int *counter; HYPRE_Real sum; HYPRE_Real *data; - + hypre_MPI_Comm_size(comm,&num_procs); @@ -145,11 +137,11 @@ row_starts_AN[i] = row_starts[i]/(HYPRE_BigInt)num_functions; if (row_starts_AN[i]*(HYPRE_BigInt)num_functions < row_starts[i]) { - hypre_error_w_msg(HYPRE_ERROR_GENERIC,"nodes not properly aligned or incomplete info!\n"); - return hypre_error_flag; + hypre_error_w_msg(HYPRE_ERROR_GENERIC,"nodes not properly aligned or incomplete info!\n"); + return hypre_error_flag; } } - + global_num_nodes = hypre_ParCSRMatrixGlobalNumRows(A)/(HYPRE_BigInt)num_functions; @@ -161,16 +153,16 @@ row_starts_AN[i] = row_starts[i]/(HYPRE_BigInt)num_functions; if (row_starts_AN[i]*(HYPRE_BigInt)num_functions < row_starts[i]) { - hypre_error_w_msg(HYPRE_ERROR_GENERIC,"nodes not properly aligned or incomplete info!\n"); - return hypre_error_flag; + hypre_error_w_msg(HYPRE_ERROR_GENERIC,"nodes not properly aligned or incomplete info!\n"); + return hypre_error_flag; } } - + global_num_nodes = row_starts_AN[num_procs]; #endif - + num_nodes = num_variables/num_functions; num_fun2 = num_functions*num_functions; @@ -189,28 +181,28 @@ AN_diag_i[i] = AN_num_nonzeros_diag; for (j=0; j < num_functions; j++) { - for (k=A_diag_i[row]; k < A_diag_i[row+1]; k++) - { - k_map = map_to_node[A_diag_j[k]]; - if (counter[k_map] < i) - { - counter[k_map] = i; - AN_num_nonzeros_diag++; - } - } - row++; + for (k=A_diag_i[row]; k < A_diag_i[row+1]; k++) + { + k_map = map_to_node[A_diag_j[k]]; + if (counter[k_map] < i) + { + counter[k_map] = i; + AN_num_nonzeros_diag++; + } + } + row++; } } AN_diag_i[num_nodes] = AN_num_nonzeros_diag; - AN_diag_j = hypre_CTAlloc(HYPRE_Int, AN_num_nonzeros_diag, HYPRE_MEMORY_HOST); - AN_diag_data = hypre_CTAlloc(HYPRE_Real, AN_num_nonzeros_diag, HYPRE_MEMORY_HOST); + AN_diag_j = hypre_CTAlloc(HYPRE_Int, AN_num_nonzeros_diag, HYPRE_MEMORY_HOST); + AN_diag_data = hypre_CTAlloc(HYPRE_Real, AN_num_nonzeros_diag, HYPRE_MEMORY_HOST); AN_diag = hypre_CSRMatrixCreate(num_nodes,num_nodes,AN_num_nonzeros_diag); hypre_CSRMatrixI(AN_diag) = AN_diag_i; hypre_CSRMatrixJ(AN_diag) = AN_diag_j; hypre_CSRMatrixData(AN_diag) = AN_diag_data; - + for (i=0; i < num_nodes; i++) counter[i] = -1; index = 0; @@ -225,23 +217,23 @@ { for (j=0; j < num_functions; j++) { - for (k=A_diag_i[row]; k < A_diag_i[row+1]; k++) - { - k_map = map_to_node[A_diag_j[k]]; - if (counter[k_map] < start_index) - { - counter[k_map] = index; - AN_diag_j[index] = k_map; - AN_diag_data[index] = A_diag_data[k]*A_diag_data[k]; - index++; - } - else - { - AN_diag_data[counter[k_map]] += - A_diag_data[k]*A_diag_data[k]; - } - } - row++; + for (k=A_diag_i[row]; k < A_diag_i[row+1]; k++) + { + k_map = map_to_node[A_diag_j[k]]; + if (counter[k_map] < start_index) + { + counter[k_map] = index; + AN_diag_j[index] = k_map; + AN_diag_data[index] = A_diag_data[k]*A_diag_data[k]; + index++; + } + else + { + AN_diag_data[counter[k_map]] += + A_diag_data[k]*A_diag_data[k]; + } + } + row++; } start_index = index; } @@ -250,29 +242,29 @@ } break; - + case 2: /* sum of abs. value of all elements in each block */ { for (i=0; i < num_nodes; i++) { for (j=0; j < num_functions; j++) { - for (k=A_diag_i[row]; k < A_diag_i[row+1]; k++) - { - k_map = map_to_node[A_diag_j[k]]; - if (counter[k_map] < start_index) - { - counter[k_map] = index; - AN_diag_j[index] = k_map; - AN_diag_data[index] = fabs(A_diag_data[k]); - index++; - } - else - { - AN_diag_data[counter[k_map]] += fabs(A_diag_data[k]); - } - } - row++; + for (k=A_diag_i[row]; k < A_diag_i[row+1]; k++) + { + k_map = map_to_node[A_diag_j[k]]; + if (counter[k_map] < start_index) + { + counter[k_map] = index; + AN_diag_j[index] = k_map; + AN_diag_data[index] = fabs(A_diag_data[k]); + index++; + } + else + { + AN_diag_data[counter[k_map]] += fabs(A_diag_data[k]); + } + } + row++; } start_index = index; } @@ -288,24 +280,24 @@ { for (j=0; j < num_functions; j++) { - for (k=A_diag_i[row]; k < A_diag_i[row+1]; k++) - { - k_map = map_to_node[A_diag_j[k]]; - if (counter[k_map] < start_index) - { - counter[k_map] = index; - AN_diag_j[index] = k_map; - AN_diag_data[index] = A_diag_data[k]; - index++; - } - else - { - if (fabs(A_diag_data[k]) > - fabs(AN_diag_data[counter[k_map]])) - AN_diag_data[counter[k_map]] = A_diag_data[k]; - } - } - row++; + for (k=A_diag_i[row]; k < A_diag_i[row+1]; k++) + { + k_map = map_to_node[A_diag_j[k]]; + if (counter[k_map] < start_index) + { + counter[k_map] = index; + AN_diag_j[index] = k_map; + AN_diag_data[index] = A_diag_data[k]; + index++; + } + else + { + if (fabs(A_diag_data[k]) > + fabs(AN_diag_data[counter[k_map]])) + AN_diag_data[counter[k_map]] = A_diag_data[k]; + } + } + row++; } start_index = index; } @@ -321,36 +313,36 @@ { for (j=0; j < num_functions; j++) { - for (k=A_diag_i[row]; k < A_diag_i[row+1]; k++) - { - k_map = map_to_node[A_diag_j[k]]; - if (counter[k_map] < start_index) - { - counter[k_map] = index; - AN_diag_j[index] = k_map; - data[index*num_functions + j] = fabs(A_diag_data[k]); - index++; - } - else - { - data[(counter[k_map])*num_functions + j] += fabs(A_diag_data[k]); - } - } - row++; + for (k=A_diag_i[row]; k < A_diag_i[row+1]; k++) + { + k_map = map_to_node[A_diag_j[k]]; + if (counter[k_map] < start_index) + { + counter[k_map] = index; + AN_diag_j[index] = k_map; + data[index*num_functions + j] = fabs(A_diag_data[k]); + index++; + } + else + { + data[(counter[k_map])*num_functions + j] += fabs(A_diag_data[k]); + } + } + row++; } start_index = index; } for (i=0; i < AN_num_nonzeros_diag; i++) { AN_diag_data[i] = data[i*num_functions]; - + for (j=1; j< num_functions; j++) { AN_diag_data[i] = hypre_max( AN_diag_data[i],data[i*num_functions+j]); } } hypre_TFree(data, HYPRE_MEMORY_HOST); - + } break; @@ -360,22 +352,22 @@ { for (j=0; j < num_functions; j++) { - for (k=A_diag_i[row]; k < A_diag_i[row+1]; k++) - { - k_map = map_to_node[A_diag_j[k]]; - if (counter[k_map] < start_index) - { - counter[k_map] = index; - AN_diag_j[index] = k_map; - AN_diag_data[index] = (A_diag_data[k]); - index++; - } - else - { - AN_diag_data[counter[k_map]] += (A_diag_data[k]); - } - } - row++; + for (k=A_diag_i[row]; k < A_diag_i[row+1]; k++) + { + k_map = map_to_node[A_diag_j[k]]; + if (counter[k_map] < start_index) + { + counter[k_map] = index; + AN_diag_j[index] = k_map; + AN_diag_data[index] = (A_diag_data[k]); + index++; + } + else + { + AN_diag_data[counter[k_map]] += (A_diag_data[k]); + } + } + row++; } start_index = index; } @@ -389,23 +381,23 @@ /* make the diag entry the negative of the sum of off-diag entries (DO MORE BELOW) */ for (i=0; i < num_nodes; i++) { - index = AN_diag_i[i]; + index = AN_diag_i[i]; sum = 0.0; for (k = AN_diag_i[i]+1; k < AN_diag_i[i+1]; k++) { sum += AN_diag_data[k]; - + } AN_diag_data[index] = -sum; } - + } else if (diag_option == 2) { - + /* make all diagonal entries negative */ /* the diagonal is the first element listed in each row - */ - + for (i=0; i < num_nodes; i++) { index = AN_diag_i[i]; @@ -413,11 +405,6 @@ } } - - - - - num_nonzeros_offd = A_offd_i[num_variables]; AN_offd_i = hypre_CTAlloc(HYPRE_Int, num_nodes+1, HYPRE_MEMORY_HOST); @@ -438,10 +425,10 @@ recv_vec_starts = hypre_ParCSRCommPkgRecvVecStarts(comm_pkg); send_procs_AN = NULL; send_map_elmts_AN = NULL; - if (num_sends) + if (num_sends) { send_procs_AN = hypre_CTAlloc(HYPRE_Int, num_sends, HYPRE_MEMORY_HOST); - send_map_elmts_AN = hypre_CTAlloc(HYPRE_Int, send_map_starts[num_sends], HYPRE_MEMORY_SHARED); + send_map_elmts_AN = hypre_CTAlloc(HYPRE_Int, send_map_starts[num_sends], HYPRE_MEMORY_HOST); } send_map_starts_AN = hypre_CTAlloc(HYPRE_Int, num_sends+1, HYPRE_MEMORY_HOST); recv_vec_starts_AN = hypre_CTAlloc(HYPRE_Int, num_recvs+1, HYPRE_MEMORY_HOST); @@ -456,14 +443,14 @@ cnt = 0; for (i=0; i < num_sends; i++) { - k_map = send_map_starts[i]; - if (send_map_starts[i+1]-k_map) + k_map = send_map_starts[i]; + if (send_map_starts[i+1]-k_map) send_map_elmts_AN[cnt++] = send_map_elmts[k_map]/num_functions; for (j=send_map_starts[i]+1; j < send_map_starts[i+1]; j++) { node = send_map_elmts[j]/num_functions; if (node > send_map_elmts_AN[cnt-1]) - send_map_elmts_AN[cnt++] = node; + send_map_elmts_AN[cnt++] = node; } send_map_starts_AN[i+1] = cnt; } @@ -487,7 +474,7 @@ big_map_to_node[i] = col_map_offd[i]/(HYPRE_BigInt)num_functions; if (big_map_to_node[i] > big_map_to_node[i-1]) num_cols_offd_AN++; } - + if (num_cols_offd_AN > num_nodes) { hypre_TFree(counter, HYPRE_MEMORY_HOST); @@ -506,11 +493,11 @@ for (j=recv_vec_starts[i]; j < recv_vec_starts[i+1]; j++) { big_node = big_map_to_node[j]; - if (big_node > col_map_offd_AN[cnt-1]) - { - col_map_offd_AN[cnt++] = big_node; - } - map_to_map[j] = cnt-1; + if (big_node > col_map_offd_AN[cnt-1]) + { + col_map_offd_AN[cnt++] = big_node; + } + map_to_map[j] = cnt-1; } recv_vec_starts_AN[i+1] = cnt; } @@ -525,32 +512,32 @@ AN_offd_i[i] = AN_num_nonzeros_offd; for (j=0; j < num_functions; j++) { - for (k=A_offd_i[row]; k < A_offd_i[row+1]; k++) - { - k_map = map_to_map[A_offd_j[k]]; - if (counter[k_map] < i) - { - counter[k_map] = i; - AN_num_nonzeros_offd++; - } - } - row++; + for (k=A_offd_i[row]; k < A_offd_i[row+1]; k++) + { + k_map = map_to_map[A_offd_j[k]]; + if (counter[k_map] < i) + { + counter[k_map] = i; + AN_num_nonzeros_offd++; + } + } + row++; } } AN_offd_i[num_nodes] = AN_num_nonzeros_offd; } - - AN_offd = hypre_CSRMatrixCreate(num_nodes,num_cols_offd_AN, - AN_num_nonzeros_offd); + + AN_offd = hypre_CSRMatrixCreate(num_nodes,num_cols_offd_AN, + AN_num_nonzeros_offd); hypre_CSRMatrixI(AN_offd) = AN_offd_i; if (AN_num_nonzeros_offd) { - AN_offd_j = hypre_CTAlloc(HYPRE_Int, AN_num_nonzeros_offd, HYPRE_MEMORY_HOST); - AN_offd_data = hypre_CTAlloc(HYPRE_Real, AN_num_nonzeros_offd, HYPRE_MEMORY_HOST); + AN_offd_j = hypre_CTAlloc(HYPRE_Int, AN_num_nonzeros_offd, HYPRE_MEMORY_HOST); + AN_offd_data = hypre_CTAlloc(HYPRE_Real, AN_num_nonzeros_offd, HYPRE_MEMORY_HOST); hypre_CSRMatrixJ(AN_offd) = AN_offd_j; hypre_CSRMatrixData(AN_offd) = AN_offd_data; - + for (i=0; i < num_cols_offd_AN; i++) counter[i] = -1; index = 0; @@ -565,53 +552,53 @@ { for (j=0; j < num_functions; j++) { - for (k=A_offd_i[row]; k < A_offd_i[row+1]; k++) - { - k_map = map_to_map[A_offd_j[k]]; - if (counter[k_map] < start_index) - { - counter[k_map] = index; - AN_offd_j[index] = k_map; - AN_offd_data[index] = A_offd_data[k]*A_offd_data[k]; - index++; - } - else - { - AN_offd_data[counter[k_map]] += - A_offd_data[k]*A_offd_data[k]; - } - } - row++; + for (k=A_offd_i[row]; k < A_offd_i[row+1]; k++) + { + k_map = map_to_map[A_offd_j[k]]; + if (counter[k_map] < start_index) + { + counter[k_map] = index; + AN_offd_j[index] = k_map; + AN_offd_data[index] = A_offd_data[k]*A_offd_data[k]; + index++; + } + else + { + AN_offd_data[counter[k_map]] += + A_offd_data[k]*A_offd_data[k]; + } + } + row++; } start_index = index; } for (i=0; i < AN_num_nonzeros_offd; i++) - AN_offd_data[i] = sqrt(AN_offd_data[i]); + AN_offd_data[i] = sqrt(AN_offd_data[i]); } break; - + case 2: /* sum of abs. value of all elements in block */ { for (i=0; i < num_nodes; i++) { for (j=0; j < num_functions; j++) { - for (k=A_offd_i[row]; k < A_offd_i[row+1]; k++) - { - k_map = map_to_map[A_offd_j[k]]; - if (counter[k_map] < start_index) - { - counter[k_map] = index; - AN_offd_j[index] = k_map; - AN_offd_data[index] = fabs(A_offd_data[k]); - index++; - } - else - { - AN_offd_data[counter[k_map]] += fabs(A_offd_data[k]); - } - } - row++; + for (k=A_offd_i[row]; k < A_offd_i[row+1]; k++) + { + k_map = map_to_map[A_offd_j[k]]; + if (counter[k_map] < start_index) + { + counter[k_map] = index; + AN_offd_j[index] = k_map; + AN_offd_data[index] = fabs(A_offd_data[k]); + index++; + } + else + { + AN_offd_data[counter[k_map]] += fabs(A_offd_data[k]); + } + } + row++; } start_index = index; } @@ -626,35 +613,35 @@ { for (j=0; j < num_functions; j++) { - for (k=A_offd_i[row]; k < A_offd_i[row+1]; k++) - { - k_map = map_to_map[A_offd_j[k]]; - if (counter[k_map] < start_index) - { - counter[k_map] = index; - AN_offd_j[index] = k_map; - AN_offd_data[index] = A_offd_data[k]; - index++; - } - else - { - if (fabs(A_offd_data[k]) > - fabs(AN_offd_data[counter[k_map]])) - AN_offd_data[counter[k_map]] = A_offd_data[k]; - } - } - row++; + for (k=A_offd_i[row]; k < A_offd_i[row+1]; k++) + { + k_map = map_to_map[A_offd_j[k]]; + if (counter[k_map] < start_index) + { + counter[k_map] = index; + AN_offd_j[index] = k_map; + AN_offd_data[index] = A_offd_data[k]; + index++; + } + else + { + if (fabs(A_offd_data[k]) > + fabs(AN_offd_data[counter[k_map]])) + AN_offd_data[counter[k_map]] = A_offd_data[k]; + } + } + row++; } start_index = index; } } break; - + case 4: /* inf. norm (row-sum) */ { - + data = hypre_CTAlloc(HYPRE_Real, AN_num_nonzeros_offd*num_functions, HYPRE_MEMORY_HOST); - + for (i=0; i < num_nodes; i++) { for (j=0; j < num_functions; j++) @@ -681,17 +668,17 @@ for (i=0; i < AN_num_nonzeros_offd; i++) { AN_offd_data[i] = data[i*num_functions]; - + for (j=1; j< num_functions; j++) { AN_offd_data[i] = hypre_max( AN_offd_data[i],data[i*num_functions+j]); } } hypre_TFree(data, HYPRE_MEMORY_HOST); - + } break; - + case 6: /* sum of value of all elements in block */ { for (i=0; i < num_nodes; i++) @@ -717,17 +704,17 @@ } start_index = index; } - + } break; } - + hypre_TFree(map_to_map, HYPRE_MEMORY_HOST); } if (diag_option ==1 ) { - /* make the diag entry the negative of the sum of off-diag entries (here we are adding the + /* make the diag entry the negative of the sum of off-diag entries (here we are adding the off_diag contribution)*/ /* the diagonal is the first element listed in each row of AN_diag_data - */ for (i=0; i < num_nodes; i++) @@ -736,18 +723,18 @@ for (k = AN_offd_i[i]; k < AN_offd_i[i+1]; k++) { sum += AN_offd_data[k]; - + } - index = AN_diag_i[i];/* location of diag entry in data */ + index = AN_diag_i[i];/* location of diag entry in data */ AN_diag_data[index] -= sum; /* subtract from current value */ } - + } - + AN = hypre_ParCSRMatrixCreate(comm, global_num_nodes, global_num_nodes, - row_starts_AN, row_starts_AN, num_cols_offd_AN, - AN_num_nonzeros_diag, AN_num_nonzeros_offd); + row_starts_AN, row_starts_AN, num_cols_offd_AN, + AN_num_nonzeros_diag, AN_num_nonzeros_offd); /* we already created the diag and offd matrices - so we don't need the ones created above */ @@ -756,6 +743,9 @@ hypre_ParCSRMatrixDiag(AN) = AN_diag; hypre_ParCSRMatrixOffd(AN) = AN_offd; + hypre_CSRMatrixMemoryLocation(AN_diag) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixMemoryLocation(AN_offd) = HYPRE_MEMORY_HOST; + hypre_ParCSRMatrixColMapOffd(AN) = col_map_offd_AN; hypre_ParCSRMatrixCommPkg(AN) = comm_pkg_AN; @@ -768,9 +758,9 @@ cnt = 0; for (i=0; i < num_cols_offd_AN; i++) { - for (j=0; j < num_functions; j++) + for (j=0; j < num_functions; j++) { - new_col_map_offd[cnt++] = (HYPRE_BigInt)num_functions*col_map_offd_AN[i]+(HYPRE_BigInt)j; + new_col_map_offd[cnt++] = (HYPRE_BigInt)num_functions*col_map_offd_AN[i]+(HYPRE_BigInt)j; } } cnt = 0; @@ -788,34 +778,34 @@ for (i=0; i < num_nonzeros_offd; i++) { j = A_offd_j[i]; - A_offd_j[i] = (HYPRE_Int)col_map_offd[j]; + A_offd_j[i] = (HYPRE_Int)col_map_offd[j]; } hypre_ParCSRMatrixColMapOffd(A) = new_col_map_offd; hypre_CSRMatrixNumCols(A_offd) = new_num_cols_offd; hypre_TFree(col_map_offd, HYPRE_MEMORY_HOST); } - + hypre_TFree(big_map_to_node, HYPRE_MEMORY_HOST); new_send_elmts_size = send_map_starts_AN[num_sends]*num_functions; if (new_send_elmts_size > send_map_starts[num_sends]) { - new_send_map_elmts = hypre_CTAlloc(HYPRE_Int, new_send_elmts_size, HYPRE_MEMORY_SHARED); + new_send_map_elmts = hypre_CTAlloc(HYPRE_Int, new_send_elmts_size, HYPRE_MEMORY_HOST); cnt = 0; send_map_starts[0] = 0; for (i=0; i < num_sends; i++) { send_map_starts[i+1] = send_map_starts_AN[i+1]*num_functions; for (j=send_map_starts_AN[i]; j < send_map_starts_AN[i+1]; j++) - { + { for (k=0; k < num_functions; k++) - new_send_map_elmts[cnt++] = send_map_elmts_AN[j]*num_functions+k; - } + new_send_map_elmts[cnt++] = send_map_elmts_AN[j]*num_functions+k; + } } - hypre_TFree(send_map_elmts, HYPRE_MEMORY_SHARED); + hypre_TFree(send_map_elmts, HYPRE_MEMORY_HOST); hypre_ParCSRCommPkgSendMapElmts(comm_pkg) = new_send_map_elmts; } - + *AN_ptr = AN; hypre_TFree(counter, HYPRE_MEMORY_HOST); @@ -836,69 +826,69 @@ HYPRE_Int **dof_func_ptr, HYPRE_Int **CF_marker_ptr, HYPRE_Int **col_offd_S_to_A_ptr, - hypre_ParCSRMatrix **S_ptr) + hypre_ParCSRMatrix **S_ptr) { - MPI_Comm comm = hypre_ParCSRMatrixComm(SN); + MPI_Comm comm = hypre_ParCSRMatrixComm(SN); hypre_ParCSRMatrix *S; hypre_CSRMatrix *S_diag; - HYPRE_Int *S_diag_i; - HYPRE_Int *S_diag_j; - HYPRE_Real *S_diag_data; + HYPRE_Int *S_diag_i; + HYPRE_Int *S_diag_j; + HYPRE_Real *S_diag_data; hypre_CSRMatrix *S_offd; - HYPRE_Int *S_offd_i; - HYPRE_Int *S_offd_j; - HYPRE_Real *S_offd_data; - HYPRE_BigInt *row_starts_S; - HYPRE_BigInt *col_starts_S; - HYPRE_BigInt *row_starts_SN = hypre_ParCSRMatrixRowStarts(SN); - HYPRE_BigInt *col_starts_SN = hypre_ParCSRMatrixColStarts(SN); + HYPRE_Int *S_offd_i; + HYPRE_Int *S_offd_j; + HYPRE_Real *S_offd_data; + HYPRE_BigInt *row_starts_S; + HYPRE_BigInt *col_starts_S; + HYPRE_BigInt *row_starts_SN = hypre_ParCSRMatrixRowStarts(SN); + HYPRE_BigInt *col_starts_SN = hypre_ParCSRMatrixColStarts(SN); hypre_CSRMatrix *SN_diag = hypre_ParCSRMatrixDiag(SN); - HYPRE_Int *SN_diag_i = hypre_CSRMatrixI(SN_diag); - HYPRE_Int *SN_diag_j = hypre_CSRMatrixJ(SN_diag); - HYPRE_Real *SN_diag_data; + HYPRE_Int *SN_diag_i = hypre_CSRMatrixI(SN_diag); + HYPRE_Int *SN_diag_j = hypre_CSRMatrixJ(SN_diag); + HYPRE_Real *SN_diag_data; hypre_CSRMatrix *SN_offd = hypre_ParCSRMatrixOffd(SN); - HYPRE_Int *SN_offd_i = hypre_CSRMatrixI(SN_offd); - HYPRE_Int *SN_offd_j = hypre_CSRMatrixJ(SN_offd); - HYPRE_Real *SN_offd_data = NULL; - HYPRE_Int *CF_marker; - HYPRE_BigInt *col_map_offd_SN = hypre_ParCSRMatrixColMapOffd(SN); - HYPRE_BigInt *col_map_offd_S; - HYPRE_Int *dof_func; - HYPRE_Int num_nodes = hypre_CSRMatrixNumRows(SN_diag); - HYPRE_Int num_variables; + HYPRE_Int *SN_offd_i = hypre_CSRMatrixI(SN_offd); + HYPRE_Int *SN_offd_j = hypre_CSRMatrixJ(SN_offd); + HYPRE_Real *SN_offd_data = NULL; + HYPRE_Int *CF_marker; + HYPRE_BigInt *col_map_offd_SN = hypre_ParCSRMatrixColMapOffd(SN); + HYPRE_BigInt *col_map_offd_S; + HYPRE_Int *dof_func; + HYPRE_Int num_nodes = hypre_CSRMatrixNumRows(SN_diag); + HYPRE_Int num_variables; hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(SN); - HYPRE_Int num_sends; - HYPRE_Int num_recvs; - HYPRE_Int *send_procs; - HYPRE_Int *send_map_starts; - HYPRE_Int *send_map_elmts; - HYPRE_Int *recv_procs; - HYPRE_Int *recv_vec_starts; + HYPRE_Int num_sends; + HYPRE_Int num_recvs; + HYPRE_Int *send_procs; + HYPRE_Int *send_map_starts; + HYPRE_Int *send_map_elmts; + HYPRE_Int *recv_procs; + HYPRE_Int *recv_vec_starts; hypre_ParCSRCommPkg *comm_pkg_S; - HYPRE_Int *send_procs_S; - HYPRE_Int *send_map_starts_S; - HYPRE_Int *send_map_elmts_S; - HYPRE_Int *recv_procs_S; - HYPRE_Int *recv_vec_starts_S; - HYPRE_Int *col_offd_S_to_A = NULL; - - HYPRE_Int num_coarse_nodes; - HYPRE_Int i,j,k,k1,jj,cnt; - HYPRE_BigInt big_k1; - HYPRE_Int row, start, end; - HYPRE_Int num_procs; - HYPRE_Int num_cols_offd_SN = hypre_CSRMatrixNumCols(SN_offd); - HYPRE_Int num_cols_offd_S; - HYPRE_Int SN_num_nonzeros_diag; - HYPRE_Int SN_num_nonzeros_offd; - HYPRE_Int S_num_nonzeros_diag; - HYPRE_Int S_num_nonzeros_offd; - HYPRE_BigInt global_num_vars; - HYPRE_BigInt global_num_cols; - HYPRE_BigInt global_num_nodes; - + HYPRE_Int *send_procs_S; + HYPRE_Int *send_map_starts_S; + HYPRE_Int *send_map_elmts_S; + HYPRE_Int *recv_procs_S; + HYPRE_Int *recv_vec_starts_S; + HYPRE_Int *col_offd_S_to_A = NULL; + + HYPRE_Int num_coarse_nodes; + HYPRE_Int i,j,k,k1,jj,cnt; + HYPRE_BigInt big_k1; + HYPRE_Int row, start, end; + HYPRE_Int num_procs; + HYPRE_Int num_cols_offd_SN = hypre_CSRMatrixNumCols(SN_offd); + HYPRE_Int num_cols_offd_S; + HYPRE_Int SN_num_nonzeros_diag; + HYPRE_Int SN_num_nonzeros_offd; + HYPRE_Int S_num_nonzeros_diag; + HYPRE_Int S_num_nonzeros_offd; + HYPRE_BigInt global_num_vars; + HYPRE_BigInt global_num_cols; + HYPRE_BigInt global_num_nodes; + hypre_MPI_Comm_size(comm, &num_procs); - + num_variables = num_functions*num_nodes; CF_marker = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); @@ -908,20 +898,20 @@ num_coarse_nodes = 0; for (i=0; i < num_nodes; i++) { - if (CFN_marker[i] == 1) num_coarse_nodes++; + if (CFN_marker[i] == 1) num_coarse_nodes++; for (j=0; j < num_functions; j++) - CF_marker[cnt++] = CFN_marker[i]; + CF_marker[cnt++] = CFN_marker[i]; } dof_func = hypre_CTAlloc(HYPRE_Int, num_coarse_nodes*num_functions, HYPRE_MEMORY_HOST); cnt = 0; for (i=0; i < num_nodes; i++) { - if (CFN_marker[i] == 1) - { - for (k=0; k < num_functions; k++) - dof_func[cnt++] = k; - } + if (CFN_marker[i] == 1) + { + for (k=0; k < num_functions; k++) + dof_func[cnt++] = k; + } } *dof_func_ptr = dof_func; } @@ -930,7 +920,7 @@ cnt = 0; for (i=0; i < num_nodes; i++) for (j=0; j < num_functions; j++) - CF_marker[cnt++] = CFN_marker[i]; + CF_marker[cnt++] = CFN_marker[i]; } *CF_marker_ptr = CF_marker; @@ -971,26 +961,30 @@ SN_num_nonzeros_diag = SN_diag_i[num_nodes]; SN_num_nonzeros_offd = SN_offd_i[num_nodes]; - + global_num_nodes = hypre_ParCSRMatrixGlobalNumRows(SN); global_num_cols = hypre_ParCSRMatrixGlobalNumCols(SN)*num_functions; - + global_num_vars = global_num_nodes*(HYPRE_BigInt)num_functions; S_num_nonzeros_diag = num_functions*SN_num_nonzeros_diag; S_num_nonzeros_offd = num_functions*SN_num_nonzeros_offd; num_cols_offd_S = num_functions*num_cols_offd_SN; S = hypre_ParCSRMatrixCreate(comm, global_num_vars, global_num_cols, - row_starts_S, col_starts_S, num_cols_offd_S, - S_num_nonzeros_diag, S_num_nonzeros_offd); + row_starts_S, col_starts_S, num_cols_offd_S, + S_num_nonzeros_diag, S_num_nonzeros_offd); S_diag = hypre_ParCSRMatrixDiag(S); S_offd = hypre_ParCSRMatrixOffd(S); + + hypre_CSRMatrixMemoryLocation(S_diag) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixMemoryLocation(S_offd) = HYPRE_MEMORY_HOST; + S_diag_i = hypre_CTAlloc(HYPRE_Int, num_variables+1, HYPRE_MEMORY_HOST); S_offd_i = hypre_CTAlloc(HYPRE_Int, num_variables+1, HYPRE_MEMORY_HOST); S_diag_j = hypre_CTAlloc(HYPRE_Int, S_num_nonzeros_diag, HYPRE_MEMORY_HOST); hypre_CSRMatrixI(S_diag) = S_diag_i; hypre_CSRMatrixJ(S_diag) = S_diag_j; - if (data) + if (data) { SN_diag_data = hypre_CSRMatrixData(SN_diag); S_diag_data = hypre_CTAlloc(HYPRE_Real, S_num_nonzeros_diag, HYPRE_MEMORY_HOST); @@ -1020,11 +1014,11 @@ recv_vec_starts = hypre_ParCSRCommPkgRecvVecStarts(comm_pkg); send_procs_S = NULL; send_map_elmts_S = NULL; - if (num_sends) + if (num_sends) { send_procs_S = hypre_CTAlloc(HYPRE_Int, num_sends, HYPRE_MEMORY_HOST); - send_map_elmts_S = hypre_CTAlloc(HYPRE_Int, - num_functions*send_map_starts[num_sends], HYPRE_MEMORY_SHARED); + send_map_elmts_S = hypre_CTAlloc(HYPRE_Int, + num_functions*send_map_starts[num_sends], HYPRE_MEMORY_HOST); } send_map_starts_S = hypre_CTAlloc(HYPRE_Int, num_sends+1, HYPRE_MEMORY_HOST); recv_vec_starts_S = hypre_CTAlloc(HYPRE_Int, num_recvs+1, HYPRE_MEMORY_HOST); @@ -1046,10 +1040,10 @@ cnt = 0; for (i=0; i < send_map_starts[num_sends]; i++) { - k1 = num_functions*send_map_elmts[i]; + k1 = num_functions*send_map_elmts[i]; for (j=0; j < num_functions; j++) { - send_map_elmts_S[cnt++] = k1+j; + send_map_elmts_S[cnt++] = k1+j; } } hypre_ParCSRCommPkgSendProcs(comm_pkg_S) = send_procs_S; @@ -1076,7 +1070,7 @@ } hypre_ParCSRMatrixColMapOffd(S) = col_map_offd_S; } - + if (col_offd_SN_to_AN) { col_offd_S_to_A = hypre_CTAlloc(HYPRE_Int, num_cols_offd_S, HYPRE_MEMORY_HOST); @@ -1090,7 +1084,7 @@ } *col_offd_S_to_A_ptr = col_offd_S_to_A; } - + cnt = 0; @@ -1102,22 +1096,22 @@ for (j=SN_diag_i[i]; j < SN_diag_i[i+1]; j++) { jj = SN_diag_j[j]; - if (data) S_diag_data[cnt] = SN_diag_data[j]; - S_diag_j[cnt++] = jj*num_functions; + if (data) S_diag_data[cnt] = SN_diag_data[j]; + S_diag_j[cnt++] = jj*num_functions; } end = cnt; S_diag_i[row] = cnt; for (k1=1; k1 < num_functions; k1++) { row++; - for (k=start; k < end; k++) - { - if (data) S_diag_data[cnt] = S_diag_data[k]; - S_diag_j[cnt++] = S_diag_j[k]+k1; - } + for (k=start; k < end; k++) + { + if (data) S_diag_data[cnt] = S_diag_data[k]; + S_diag_j[cnt++] = S_diag_j[k]+k1; + } S_diag_i[row] = cnt; } - } + } cnt = 0; row = 0; @@ -1128,24 +1122,24 @@ for (j=SN_offd_i[i]; j < SN_offd_i[i+1]; j++) { jj = SN_offd_j[j]; - if (data) S_offd_data[cnt] = SN_offd_data[j]; - S_offd_j[cnt++] = jj*num_functions; + if (data) S_offd_data[cnt] = SN_offd_data[j]; + S_offd_j[cnt++] = jj*num_functions; } end = cnt; S_offd_i[row] = cnt; for (k1=1; k1 < num_functions; k1++) { row++; - for (k=start; k < end; k++) - { - if (data) S_offd_data[cnt] = S_offd_data[k]; - S_offd_j[cnt++] = S_offd_j[k]+k1; - } + for (k=start; k < end; k++) + { + if (data) S_offd_data[cnt] = S_offd_data[k]; + S_offd_j[cnt++] = S_offd_j[k]+k1; + } S_offd_i[row] = cnt; } - } + } - *S_ptr = S; + *S_ptr = S; return hypre_error_flag; } @@ -1161,13 +1155,13 @@ HYPRE_Int **CF_marker_ptr) { - HYPRE_Int *CF_marker; - HYPRE_Int *dof_func; - HYPRE_Int num_variables; - HYPRE_Int num_coarse_nodes; - HYPRE_Int i,j,k,cnt; - - + HYPRE_Int *CF_marker; + HYPRE_Int *dof_func; + HYPRE_Int num_variables; + HYPRE_Int num_coarse_nodes; + HYPRE_Int i,j,k,cnt; + + num_variables = num_functions*num_nodes; CF_marker = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); @@ -1180,7 +1174,7 @@ CF_marker[cnt++] = CFN_marker[i]; } - + dof_func = hypre_CTAlloc(HYPRE_Int, num_coarse_nodes*num_functions, HYPRE_MEMORY_HOST); cnt = 0; for (i=0; i < num_nodes; i++) @@ -1191,7 +1185,7 @@ dof_func[cnt++] = k; } } - + *dof_func_ptr = dof_func; *CF_marker_ptr = CF_marker; diff -Nru hypre-2.16.0/src/parcsr_ls/par_nongalerkin.c hypre-2.18.2/src/parcsr_ls/par_nongalerkin.c --- hypre-2.16.0/src/parcsr_ls/par_nongalerkin.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_nongalerkin.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision: 2.14 $ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" #include "../HYPRE.h" @@ -28,37 +23,15 @@ HYPRE_Int start, HYPRE_Int end, HYPRE_BigInt * array, - HYPRE_Int * output) + HYPRE_BigInt * output) { - HYPRE_Int i, length; - length = end - start + 1; - - for(i = 0; i < length; i++) - { output[i] = array[ indices[start + i] ]; } - - return 0; -} - -/* Quick Sort based on magnitude on w (HYPRE_Real), move v */ -void hypre_qsort2_abs( HYPRE_Int *v, - HYPRE_Real *w, - HYPRE_Int left, - HYPRE_Int right ) -{ - HYPRE_Int i, last; - - if (left >= right) - return; - hypre_swap2( v, w, left, (left+right)/2); - last = left; - for (i = left+1; i <= right; i++) - if (fabs(w[i]) < fabs(w[left])) - { - hypre_swap2(v, w, ++last, i); - } - hypre_swap2(v, w, left, last); - hypre_qsort2_abs(v, w, left, last-1); - hypre_qsort2_abs(v, w, last+1, right); + HYPRE_Int i, length; + length = end - start + 1; + + for(i = 0; i < length; i++) + { output[i] = array[ indices[start + i] ]; } + + return 0; } /* Compute the intersection of x and y, placing @@ -71,51 +44,89 @@ * Assumptions: * z is of length min(x_length, y_length) * x and y are sorted - * x_length and y_length are similar in size, otherwise, + * x_length and y_length are similar in size, otherwise, * looping over the smaller array and doing binary search * in the longer array is faster. * */ HYPRE_Int hypre_IntersectTwoArrays(HYPRE_Int *x, HYPRE_Real *x_data, - HYPRE_Int x_length, + HYPRE_Int x_length, HYPRE_Int *y, - HYPRE_Int y_length, + HYPRE_Int y_length, HYPRE_Int *z, HYPRE_Real *output_x_data, HYPRE_Int *intersect_length) { - HYPRE_Int x_index = 0; - HYPRE_Int y_index = 0; - *intersect_length = 0; - - /* Compute Intersection, looping over each array */ - while ( (x_index < x_length) && (y_index < y_length) ) - { - if (x[x_index] > y[y_index]) - { - y_index = y_index + 1; - } - else if (x[x_index] < y[y_index]) - { - x_index = x_index + 1; - } - else - { - z[*intersect_length] = x[x_index]; - output_x_data[*intersect_length] = x_data[x_index]; - x_index = x_index + 1; - y_index = y_index + 1; - *intersect_length = *intersect_length + 1; - } - } - - return 1; + HYPRE_Int x_index = 0; + HYPRE_Int y_index = 0; + *intersect_length = 0; + + /* Compute Intersection, looping over each array */ + while ( (x_index < x_length) && (y_index < y_length) ) + { + if (x[x_index] > y[y_index]) + { + y_index = y_index + 1; + } + else if (x[x_index] < y[y_index]) + { + x_index = x_index + 1; + } + else + { + z[*intersect_length] = x[x_index]; + output_x_data[*intersect_length] = x_data[x_index]; + x_index = x_index + 1; + y_index = y_index + 1; + *intersect_length = *intersect_length + 1; + } + } + + return 1; +} + +HYPRE_Int +hypre_IntersectTwoBigArrays(HYPRE_BigInt *x, + HYPRE_Real *x_data, + HYPRE_Int x_length, + HYPRE_BigInt *y, + HYPRE_Int y_length, + HYPRE_BigInt *z, + HYPRE_Real *output_x_data, + HYPRE_Int *intersect_length) +{ + HYPRE_Int x_index = 0; + HYPRE_Int y_index = 0; + *intersect_length = 0; + + /* Compute Intersection, looping over each array */ + while ( (x_index < x_length) && (y_index < y_length) ) + { + if (x[x_index] > y[y_index]) + { + y_index = y_index + 1; + } + else if (x[x_index] < y[y_index]) + { + x_index = x_index + 1; + } + else + { + z[*intersect_length] = x[x_index]; + output_x_data[*intersect_length] = x_data[x_index]; + x_index = x_index + 1; + y_index = y_index + 1; + *intersect_length = *intersect_length + 1; + } + } + + return 1; } -/* Copy CSR matrix A to CSR matrix B. The column indices are +/* Copy CSR matrix A to CSR matrix B. The column indices are * assumed to be sorted, and the sparsity pattern of B is a subset - * of the sparsity pattern of A. + * of the sparsity pattern of A. * * Assumptions: * Column indices of A and B are sorted @@ -123,87 +134,87 @@ * A and B are the same size and have same data layout **/ HYPRE_Int -hypre_SortedCopyParCSRData(hypre_ParCSRMatrix *A, +hypre_SortedCopyParCSRData(hypre_ParCSRMatrix *A, hypre_ParCSRMatrix *B) { - /* Grab off A and B's data structures */ - hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); - HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); - HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); - HYPRE_Real *A_diag_data = hypre_CSRMatrixData(A_diag); - - hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); - HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); - HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); - HYPRE_Real *A_offd_data = hypre_CSRMatrixData(A_offd); - - hypre_CSRMatrix *B_diag = hypre_ParCSRMatrixDiag(B); - HYPRE_Int *B_diag_i = hypre_CSRMatrixI(B_diag); - HYPRE_Int *B_diag_j = hypre_CSRMatrixJ(B_diag); - HYPRE_Real *B_diag_data = hypre_CSRMatrixData(B_diag); - - hypre_CSRMatrix *B_offd = hypre_ParCSRMatrixOffd(B); - HYPRE_Int *B_offd_i = hypre_CSRMatrixI(B_offd); - HYPRE_Int *B_offd_j = hypre_CSRMatrixJ(B_offd); - HYPRE_Real *B_offd_data = hypre_CSRMatrixData(B_offd); - - HYPRE_Int num_variables = hypre_CSRMatrixNumRows(A_diag); - HYPRE_Int *temp_int_array = NULL; - HYPRE_Int temp_int_array_length=0; - HYPRE_Int i, length, offset_A, offset_B; - - for(i = 0; i < num_variables; i++) - { - - /* Deal with the first row entries, which may be diagonal elements */ - if( A_diag_j[A_diag_i[i]] == i) - { offset_A = 1; } - else - { offset_A = 0; } - if( B_diag_j[B_diag_i[i]] == i) - { offset_B = 1; } - else - { offset_B = 0; } - if( (offset_B == 1) && (offset_A == 1) ) - { B_diag_data[B_diag_i[i]] = A_diag_data[A_diag_i[i]]; } - - /* This finds the intersection of the column indices, and - * also copies the matching data in A to the data array in B - **/ - if( (A_diag_i[i+1] - A_diag_i[i] - offset_A) > temp_int_array_length ) - { - hypre_TFree(temp_int_array, HYPRE_MEMORY_HOST); - temp_int_array_length = (A_diag_i[i+1] - A_diag_i[i] - offset_A); - temp_int_array = hypre_CTAlloc(HYPRE_Int, temp_int_array_length, HYPRE_MEMORY_HOST); - } - hypre_IntersectTwoArrays(&(A_diag_j[A_diag_i[i] + offset_A]), - &(A_diag_data[A_diag_i[i] + offset_A]), - A_diag_i[i+1] - A_diag_i[i] - offset_A, - &(B_diag_j[B_diag_i[i] + offset_B]), - B_diag_i[i+1] - B_diag_i[i] - offset_B, - temp_int_array, - &(B_diag_data[B_diag_i[i] + offset_B]), - &length); - - if( (A_offd_i[i+1] - A_offd_i[i]) > temp_int_array_length ) - { - hypre_TFree(temp_int_array, HYPRE_MEMORY_HOST); - temp_int_array_length = (A_offd_i[i+1] - A_offd_i[i]); - temp_int_array = hypre_CTAlloc(HYPRE_Int, temp_int_array_length, HYPRE_MEMORY_HOST); - } - hypre_IntersectTwoArrays(&(A_offd_j[A_offd_i[i]]), - &(A_offd_data[A_offd_i[i]]), - A_offd_i[i+1] - A_offd_i[i], - &(B_offd_j[B_offd_i[i]]), - B_offd_i[i+1] - B_offd_i[i], - temp_int_array, - &(B_offd_data[B_offd_i[i]]), - &length); - } - - if(temp_int_array) - { hypre_TFree(temp_int_array, HYPRE_MEMORY_HOST); } - return 1; + /* Grab off A and B's data structures */ + hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); + HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); + HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); + HYPRE_Real *A_diag_data = hypre_CSRMatrixData(A_diag); + + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); + HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); + HYPRE_Real *A_offd_data = hypre_CSRMatrixData(A_offd); + + hypre_CSRMatrix *B_diag = hypre_ParCSRMatrixDiag(B); + HYPRE_Int *B_diag_i = hypre_CSRMatrixI(B_diag); + HYPRE_Int *B_diag_j = hypre_CSRMatrixJ(B_diag); + HYPRE_Real *B_diag_data = hypre_CSRMatrixData(B_diag); + + hypre_CSRMatrix *B_offd = hypre_ParCSRMatrixOffd(B); + HYPRE_Int *B_offd_i = hypre_CSRMatrixI(B_offd); + HYPRE_Int *B_offd_j = hypre_CSRMatrixJ(B_offd); + HYPRE_Real *B_offd_data = hypre_CSRMatrixData(B_offd); + + HYPRE_Int num_variables = hypre_CSRMatrixNumRows(A_diag); + HYPRE_Int *temp_int_array = NULL; + HYPRE_Int temp_int_array_length=0; + HYPRE_Int i, length, offset_A, offset_B; + + for(i = 0; i < num_variables; i++) + { + + /* Deal with the first row entries, which may be diagonal elements */ + if( A_diag_j[A_diag_i[i]] == i) + { offset_A = 1; } + else + { offset_A = 0; } + if( B_diag_j[B_diag_i[i]] == i) + { offset_B = 1; } + else + { offset_B = 0; } + if( (offset_B == 1) && (offset_A == 1) ) + { B_diag_data[B_diag_i[i]] = A_diag_data[A_diag_i[i]]; } + + /* This finds the intersection of the column indices, and + * also copies the matching data in A to the data array in B + **/ + if( (A_diag_i[i+1] - A_diag_i[i] - offset_A) > temp_int_array_length ) + { + hypre_TFree(temp_int_array, HYPRE_MEMORY_HOST); + temp_int_array_length = (A_diag_i[i+1] - A_diag_i[i] - offset_A); + temp_int_array = hypre_CTAlloc(HYPRE_Int, temp_int_array_length, HYPRE_MEMORY_HOST); + } + hypre_IntersectTwoArrays(&(A_diag_j[A_diag_i[i] + offset_A]), + &(A_diag_data[A_diag_i[i] + offset_A]), + A_diag_i[i+1] - A_diag_i[i] - offset_A, + &(B_diag_j[B_diag_i[i] + offset_B]), + B_diag_i[i+1] - B_diag_i[i] - offset_B, + temp_int_array, + &(B_diag_data[B_diag_i[i] + offset_B]), + &length); + + if( (A_offd_i[i+1] - A_offd_i[i]) > temp_int_array_length ) + { + hypre_TFree(temp_int_array, HYPRE_MEMORY_HOST); + temp_int_array_length = (A_offd_i[i+1] - A_offd_i[i]); + temp_int_array = hypre_CTAlloc(HYPRE_Int, temp_int_array_length, HYPRE_MEMORY_HOST); + } + hypre_IntersectTwoArrays(&(A_offd_j[A_offd_i[i]]), + &(A_offd_data[A_offd_i[i]]), + A_offd_i[i+1] - A_offd_i[i], + &(B_offd_j[B_offd_i[i]]), + B_offd_i[i+1] - B_offd_i[i], + temp_int_array, + &(B_offd_data[B_offd_i[i]]), + &length); + } + + if(temp_int_array) + { hypre_TFree(temp_int_array, HYPRE_MEMORY_HOST); } + return 1; } /* @@ -218,379 +229,382 @@ HYPRE_Int *dof_func, hypre_ParCSRMatrix **S_ptr) { - MPI_Comm comm = hypre_ParCSRMatrixComm(A); - hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); - hypre_ParCSRCommHandle *comm_handle; - hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); - HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); - HYPRE_Real *A_diag_data = hypre_CSRMatrixData(A_diag); - - - hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); - HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); - HYPRE_Real *A_offd_data = NULL; - HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); - HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); - - HYPRE_BigInt *row_starts = hypre_ParCSRMatrixRowStarts(A); - HYPRE_Int num_variables = hypre_CSRMatrixNumRows(A_diag); - HYPRE_BigInt global_num_vars = hypre_ParCSRMatrixGlobalNumRows(A); - HYPRE_Int num_nonzeros_diag; - HYPRE_Int num_nonzeros_offd = 0; - HYPRE_Int num_cols_offd = 0; - - hypre_ParCSRMatrix *S; - hypre_CSRMatrix *S_diag; - HYPRE_Int *S_diag_i; - HYPRE_Int *S_diag_j; - HYPRE_Real *S_diag_data; - hypre_CSRMatrix *S_offd; - HYPRE_Int *S_offd_i = NULL; - HYPRE_Int *S_offd_j = NULL; - HYPRE_Real *S_offd_data; - - HYPRE_Real diag, row_scale, row_sum; - HYPRE_Int i, jA, jS; - - HYPRE_Int ierr = 0; - - HYPRE_Int *dof_func_offd; - HYPRE_Int num_sends; - HYPRE_Int *int_buf_data; - HYPRE_Int index, start, j; - - /*-------------------------------------------------------------- - * Compute a ParCSR strength matrix, S. - * - * For now, the "strength" of dependence/influence is defined in - * the following way: i depends on j if - * aij > hypre_max (k != i) aik, aii < 0 - * or - * aij < hypre_min (k != i) aik, aii >= 0 - * Then S_ij = aij, else S_ij = 0. - * - * NOTE: the entries are negative initially, corresponding - * to "unaccounted-for" dependence. - *----------------------------------------------------------------*/ - - num_nonzeros_diag = A_diag_i[num_variables]; - num_cols_offd = hypre_CSRMatrixNumCols(A_offd); - - A_offd_i = hypre_CSRMatrixI(A_offd); - num_nonzeros_offd = A_offd_i[num_variables]; - - /* Initialize S */ - S = hypre_ParCSRMatrixCreate(comm, global_num_vars, global_num_vars, - row_starts, row_starts, - num_cols_offd, num_nonzeros_diag, num_nonzeros_offd); - /* row_starts is owned by A, col_starts = row_starts */ - hypre_ParCSRMatrixSetRowStartsOwner(S,0); - S_diag = hypre_ParCSRMatrixDiag(S); - hypre_CSRMatrixI(S_diag) = hypre_CTAlloc(HYPRE_Int, num_variables+1, HYPRE_MEMORY_HOST); - hypre_CSRMatrixJ(S_diag) = hypre_CTAlloc(HYPRE_Int, num_nonzeros_diag, HYPRE_MEMORY_HOST); - hypre_CSRMatrixData(S_diag) = hypre_CTAlloc(HYPRE_Real, num_nonzeros_diag, HYPRE_MEMORY_HOST); - S_offd = hypre_ParCSRMatrixOffd(S); - hypre_CSRMatrixI(S_offd) = hypre_CTAlloc(HYPRE_Int, num_variables+1, HYPRE_MEMORY_HOST); - - S_diag_i = hypre_CSRMatrixI(S_diag); - S_diag_j = hypre_CSRMatrixJ(S_diag); - S_diag_data = hypre_CSRMatrixData(S_diag); - S_offd_i = hypre_CSRMatrixI(S_offd); - - dof_func_offd = NULL; - - if (num_cols_offd) - { - A_offd_data = hypre_CSRMatrixData(A_offd); - hypre_CSRMatrixJ(S_offd) = hypre_CTAlloc(HYPRE_Int, num_nonzeros_offd, HYPRE_MEMORY_HOST); - hypre_CSRMatrixData(S_offd) = hypre_CTAlloc(HYPRE_Real, num_nonzeros_offd, HYPRE_MEMORY_HOST); - S_offd_j = hypre_CSRMatrixJ(S_offd); - S_offd_data = hypre_CSRMatrixData(S_offd); - hypre_ParCSRMatrixColMapOffd(S) = hypre_CTAlloc(HYPRE_BigInt, num_cols_offd, HYPRE_MEMORY_HOST); - if (num_functions > 1) - dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); - } - - - /*------------------------------------------------------------------- - * Get the dof_func data for the off-processor columns - *-------------------------------------------------------------------*/ - - if (!comm_pkg) - { - hypre_MatvecCommPkgCreate(A); - comm_pkg = hypre_ParCSRMatrixCommPkg(A); - } - - num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - if (num_functions > 1) - { - int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, - num_sends), HYPRE_MEMORY_HOST); - index = 0; - for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] = dof_func[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, - dof_func_offd); - - hypre_ParCSRCommHandleDestroy(comm_handle); - hypre_TFree(int_buf_data, HYPRE_MEMORY_HOST); - } - - /* give S same nonzero structure as A */ - hypre_ParCSRMatrixCopy(A,S,1); - + MPI_Comm comm = hypre_ParCSRMatrixComm(A); + hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); + hypre_ParCSRCommHandle *comm_handle; + hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); + HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); + HYPRE_Real *A_diag_data = hypre_CSRMatrixData(A_diag); + + + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); + HYPRE_Real *A_offd_data = NULL; + HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); + HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); + + HYPRE_BigInt *row_starts = hypre_ParCSRMatrixRowStarts(A); + HYPRE_Int num_variables = hypre_CSRMatrixNumRows(A_diag); + HYPRE_BigInt global_num_vars = hypre_ParCSRMatrixGlobalNumRows(A); + HYPRE_Int num_nonzeros_diag; + HYPRE_Int num_nonzeros_offd = 0; + HYPRE_Int num_cols_offd = 0; + + hypre_ParCSRMatrix *S; + hypre_CSRMatrix *S_diag; + HYPRE_Int *S_diag_i; + HYPRE_Int *S_diag_j; + HYPRE_Real *S_diag_data; + hypre_CSRMatrix *S_offd; + HYPRE_Int *S_offd_i = NULL; + HYPRE_Int *S_offd_j = NULL; + HYPRE_Real *S_offd_data; + + HYPRE_Real diag, row_scale, row_sum; + HYPRE_Int i, jA, jS; + + HYPRE_Int ierr = 0; + + HYPRE_Int *dof_func_offd; + HYPRE_Int num_sends; + HYPRE_Int *int_buf_data; + HYPRE_Int index, start, j; + + /*-------------------------------------------------------------- + * Compute a ParCSR strength matrix, S. + * + * For now, the "strength" of dependence/influence is defined in + * the following way: i depends on j if + * aij > hypre_max (k != i) aik, aii < 0 + * or + * aij < hypre_min (k != i) aik, aii >= 0 + * Then S_ij = aij, else S_ij = 0. + * + * NOTE: the entries are negative initially, corresponding + * to "unaccounted-for" dependence. + *----------------------------------------------------------------*/ + + num_nonzeros_diag = A_diag_i[num_variables]; + num_cols_offd = hypre_CSRMatrixNumCols(A_offd); + + A_offd_i = hypre_CSRMatrixI(A_offd); + num_nonzeros_offd = A_offd_i[num_variables]; + + /* Initialize S */ + S = hypre_ParCSRMatrixCreate(comm, global_num_vars, global_num_vars, + row_starts, row_starts, + num_cols_offd, num_nonzeros_diag, num_nonzeros_offd); + /* row_starts is owned by A, col_starts = row_starts */ + hypre_ParCSRMatrixSetRowStartsOwner(S,0); + S_diag = hypre_ParCSRMatrixDiag(S); + hypre_CSRMatrixI(S_diag) = hypre_CTAlloc(HYPRE_Int, num_variables+1, HYPRE_MEMORY_HOST); + hypre_CSRMatrixJ(S_diag) = hypre_CTAlloc(HYPRE_Int, num_nonzeros_diag, HYPRE_MEMORY_HOST); + hypre_CSRMatrixData(S_diag) = hypre_CTAlloc(HYPRE_Real, num_nonzeros_diag, HYPRE_MEMORY_HOST); + S_offd = hypre_ParCSRMatrixOffd(S); + hypre_CSRMatrixI(S_offd) = hypre_CTAlloc(HYPRE_Int, num_variables+1, HYPRE_MEMORY_HOST); + + S_diag_i = hypre_CSRMatrixI(S_diag); + S_diag_j = hypre_CSRMatrixJ(S_diag); + S_diag_data = hypre_CSRMatrixData(S_diag); + S_offd_i = hypre_CSRMatrixI(S_offd); + + hypre_CSRMatrixMemoryLocation(S_diag) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixMemoryLocation(S_offd) = HYPRE_MEMORY_HOST; + + dof_func_offd = NULL; + + if (num_cols_offd) + { + A_offd_data = hypre_CSRMatrixData(A_offd); + hypre_CSRMatrixJ(S_offd) = hypre_CTAlloc(HYPRE_Int, num_nonzeros_offd, HYPRE_MEMORY_HOST); + hypre_CSRMatrixData(S_offd) = hypre_CTAlloc(HYPRE_Real, num_nonzeros_offd, HYPRE_MEMORY_HOST); + S_offd_j = hypre_CSRMatrixJ(S_offd); + S_offd_data = hypre_CSRMatrixData(S_offd); + hypre_ParCSRMatrixColMapOffd(S) = hypre_CTAlloc(HYPRE_BigInt, num_cols_offd, HYPRE_MEMORY_HOST); + if (num_functions > 1) + dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); + } + + + /*------------------------------------------------------------------- + * Get the dof_func data for the off-processor columns + *-------------------------------------------------------------------*/ + + if (!comm_pkg) + { + hypre_MatvecCommPkgCreate(A); + comm_pkg = hypre_ParCSRMatrixCommPkg(A); + } + + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + if (num_functions > 1) + { + int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, + num_sends), HYPRE_MEMORY_HOST); + index = 0; + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + int_buf_data[index++] = dof_func[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } + + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, + dof_func_offd); + + hypre_ParCSRCommHandleDestroy(comm_handle); + hypre_TFree(int_buf_data, HYPRE_MEMORY_HOST); + } + + /* give S same nonzero structure as A */ + hypre_ParCSRMatrixCopy(A,S,1); + #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,diag,row_scale,row_sum,jA) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < num_variables; i++) - { - diag = A_diag_data[A_diag_i[i]]; - - /* compute scaling factor and row sum */ - row_scale = 0.0; - row_sum = diag; - if (num_functions > 1) - { - if (diag < 0) + for (i = 0; i < num_variables; i++) + { + diag = A_diag_data[A_diag_i[i]]; + + /* compute scaling factor and row sum */ + row_scale = 0.0; + row_sum = diag; + if (num_functions > 1) + { + if (diag < 0) + { + for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) { - for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) - { - if (dof_func[i] == dof_func[A_diag_j[jA]]) - { - row_scale = hypre_max(row_scale, A_diag_data[jA]); - row_sum += A_diag_data[jA]; - } - } - for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) - { - if (dof_func[i] == dof_func_offd[A_offd_j[jA]]) - { - row_scale = hypre_max(row_scale, A_offd_data[jA]); - row_sum += A_offd_data[jA]; - } - } + if (dof_func[i] == dof_func[A_diag_j[jA]]) + { + row_scale = hypre_max(row_scale, A_diag_data[jA]); + row_sum += A_diag_data[jA]; + } } - else + for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) { - for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) - { - if (dof_func[i] == dof_func[A_diag_j[jA]]) - { - row_scale = hypre_min(row_scale, A_diag_data[jA]); - row_sum += A_diag_data[jA]; - } - } - for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) - { - if (dof_func[i] == dof_func_offd[A_offd_j[jA]]) - { - row_scale = hypre_min(row_scale, A_offd_data[jA]); - row_sum += A_offd_data[jA]; - } - } + if (dof_func[i] == dof_func_offd[A_offd_j[jA]]) + { + row_scale = hypre_max(row_scale, A_offd_data[jA]); + row_sum += A_offd_data[jA]; + } } - } - else - { - if (diag < 0) + } + else + { + for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) { - for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) - { - row_scale = hypre_max(row_scale, A_diag_data[jA]); - row_sum += A_diag_data[jA]; - } - for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) - { - row_scale = hypre_max(row_scale, A_offd_data[jA]); - row_sum += A_offd_data[jA]; - } + if (dof_func[i] == dof_func[A_diag_j[jA]]) + { + row_scale = hypre_min(row_scale, A_diag_data[jA]); + row_sum += A_diag_data[jA]; + } } - else + for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) { - for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) - { - row_scale = hypre_min(row_scale, A_diag_data[jA]); - row_sum += A_diag_data[jA]; - } - for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) - { - row_scale = hypre_min(row_scale, A_offd_data[jA]); - row_sum += A_offd_data[jA]; - } + if (dof_func[i] == dof_func_offd[A_offd_j[jA]]) + { + row_scale = hypre_min(row_scale, A_offd_data[jA]); + row_sum += A_offd_data[jA]; + } } - } - - /* compute row entries of S */ - S_diag_j[A_diag_i[i]] = -1; - if ((fabs(row_sum) > fabs(diag)*max_row_sum) && (max_row_sum < 1.0)) - { - /* make all dependencies weak */ + } + } + else + { + if (diag < 0) + { for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) { - S_diag_j[jA] = -1; + row_scale = hypre_max(row_scale, A_diag_data[jA]); + row_sum += A_diag_data[jA]; } for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) { - S_offd_j[jA] = -1; + row_scale = hypre_max(row_scale, A_offd_data[jA]); + row_sum += A_offd_data[jA]; + } + } + else + { + for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) + { + row_scale = hypre_min(row_scale, A_diag_data[jA]); + row_sum += A_diag_data[jA]; } - } - else - { - if (num_functions > 1) + for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) { - if (diag < 0) - { - for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) - { - if (A_diag_data[jA] <= strength_threshold * row_scale - || dof_func[i] != dof_func[A_diag_j[jA]]) - { - S_diag_j[jA] = -1; - } - } - for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) - { - if (A_offd_data[jA] <= strength_threshold * row_scale - || dof_func[i] != dof_func_offd[A_offd_j[jA]]) - { - S_offd_j[jA] = -1; - } - } - } - else - { - for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) - { - if (A_diag_data[jA] >= strength_threshold * row_scale - || dof_func[i] != dof_func[A_diag_j[jA]]) - { - S_diag_j[jA] = -1; - } - } - for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) - { - if (A_offd_data[jA] >= strength_threshold * row_scale - || dof_func[i] != dof_func_offd[A_offd_j[jA]]) - { - S_offd_j[jA] = -1; - } - } - } + row_scale = hypre_min(row_scale, A_offd_data[jA]); + row_sum += A_offd_data[jA]; + } + } + } + + /* compute row entries of S */ + S_diag_j[A_diag_i[i]] = -1; + if ((fabs(row_sum) > fabs(diag)*max_row_sum) && (max_row_sum < 1.0)) + { + /* make all dependencies weak */ + for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) + { + S_diag_j[jA] = -1; + } + for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) + { + S_offd_j[jA] = -1; + } + } + else + { + if (num_functions > 1) + { + if (diag < 0) + { + for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) + { + if (A_diag_data[jA] <= strength_threshold * row_scale + || dof_func[i] != dof_func[A_diag_j[jA]]) + { + S_diag_j[jA] = -1; + } + } + for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) + { + if (A_offd_data[jA] <= strength_threshold * row_scale + || dof_func[i] != dof_func_offd[A_offd_j[jA]]) + { + S_offd_j[jA] = -1; + } + } } else { - if (diag < 0) - { - for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) - { - if (A_diag_data[jA] <= strength_threshold * row_scale) - { - S_diag_j[jA] = -1; - } - } - for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) - { - if (A_offd_data[jA] <= strength_threshold * row_scale) - { - S_offd_j[jA] = -1; - } - } - } - else - { - for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) - { - if (A_diag_data[jA] >= strength_threshold * row_scale) - { - S_diag_j[jA] = -1; - } - } - for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) - { - if (A_offd_data[jA] >= strength_threshold * row_scale) - { - S_offd_j[jA] = -1; - } - } - } + for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) + { + if (A_diag_data[jA] >= strength_threshold * row_scale + || dof_func[i] != dof_func[A_diag_j[jA]]) + { + S_diag_j[jA] = -1; + } + } + for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) + { + if (A_offd_data[jA] >= strength_threshold * row_scale + || dof_func[i] != dof_func_offd[A_offd_j[jA]]) + { + S_offd_j[jA] = -1; + } + } } - } - } - - /*-------------------------------------------------------------- - * "Compress" the strength matrix. - * - * NOTE: S has *NO DIAGONAL ELEMENT* on any row. Caveat Emptor! - * - * NOTE: This "compression" section of code may not be removed, the - * non-Galerkin routine depends on it. - *----------------------------------------------------------------*/ - - /* RDF: not sure if able to thread this loop */ - jS = 0; - for (i = 0; i < num_variables; i++) - { - S_diag_i[i] = jS; - for (jA = A_diag_i[i]; jA < A_diag_i[i+1]; jA++) - { - if (S_diag_j[jA] > -1) + } + else + { + if (diag < 0) { - S_diag_j[jS] = S_diag_j[jA]; - S_diag_data[jS] = S_diag_data[jA]; - jS++; + for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) + { + if (A_diag_data[jA] <= strength_threshold * row_scale) + { + S_diag_j[jA] = -1; + } + } + for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) + { + if (A_offd_data[jA] <= strength_threshold * row_scale) + { + S_offd_j[jA] = -1; + } + } } - } - } - S_diag_i[num_variables] = jS; - hypre_CSRMatrixNumNonzeros(S_diag) = jS; - - /* RDF: not sure if able to thread this loop */ - jS = 0; - for (i = 0; i < num_variables; i++) - { - S_offd_i[i] = jS; - for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) - { - if (S_offd_j[jA] > -1) + else { - S_offd_j[jS] = S_offd_j[jA]; - S_offd_data[jS] = S_offd_data[jA]; - jS++; + for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) + { + if (A_diag_data[jA] >= strength_threshold * row_scale) + { + S_diag_j[jA] = -1; + } + } + for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) + { + if (A_offd_data[jA] >= strength_threshold * row_scale) + { + S_offd_j[jA] = -1; + } + } } - } - } - S_offd_i[num_variables] = jS; - hypre_CSRMatrixNumNonzeros(S_offd) = jS; - hypre_ParCSRMatrixCommPkg(S) = NULL; - - *S_ptr = S; - - hypre_TFree(dof_func_offd, HYPRE_MEMORY_HOST); - - return (ierr); + } + } + } + + /*-------------------------------------------------------------- + * "Compress" the strength matrix. + * + * NOTE: S has *NO DIAGONAL ELEMENT* on any row. Caveat Emptor! + * + * NOTE: This "compression" section of code may not be removed, the + * non-Galerkin routine depends on it. + *----------------------------------------------------------------*/ + + /* RDF: not sure if able to thread this loop */ + jS = 0; + for (i = 0; i < num_variables; i++) + { + S_diag_i[i] = jS; + for (jA = A_diag_i[i]; jA < A_diag_i[i+1]; jA++) + { + if (S_diag_j[jA] > -1) + { + S_diag_j[jS] = S_diag_j[jA]; + S_diag_data[jS] = S_diag_data[jA]; + jS++; + } + } + } + S_diag_i[num_variables] = jS; + hypre_CSRMatrixNumNonzeros(S_diag) = jS; + + /* RDF: not sure if able to thread this loop */ + jS = 0; + for (i = 0; i < num_variables; i++) + { + S_offd_i[i] = jS; + for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) + { + if (S_offd_j[jA] > -1) + { + S_offd_j[jS] = S_offd_j[jA]; + S_offd_data[jS] = S_offd_data[jA]; + jS++; + } + } + } + S_offd_i[num_variables] = jS; + hypre_CSRMatrixNumNonzeros(S_offd) = jS; + hypre_ParCSRMatrixCommPkg(S) = NULL; + + *S_ptr = S; + + hypre_TFree(dof_func_offd, HYPRE_MEMORY_HOST); + + return (ierr); } /** * Initialize the IJBuffer counters **/ HYPRE_Int -hypre_NonGalerkinIJBufferInit( HYPRE_Int *ijbuf_cnt, /* See NonGalerkinIJBufferWrite for parameter descriptions */ +hypre_NonGalerkinIJBufferInit( HYPRE_Int *ijbuf_cnt, /* See NonGalerkinIJBufferWrite for parameter descriptions */ HYPRE_Int *ijbuf_rowcounter, HYPRE_Int *ijbuf_numcols ) { - HYPRE_Int ierr = 0; + HYPRE_Int ierr = 0; + + (*ijbuf_cnt) = 0; + (*ijbuf_rowcounter) = 1; /*Always points to the next row*/ + ijbuf_numcols[0] = 0; - (*ijbuf_cnt) = 0; - (*ijbuf_rowcounter) = 1; /*Always points to the next row*/ - ijbuf_numcols[0] = 0; - - return ierr; + return ierr; } @@ -598,86 +612,86 @@ * Initialize the IJBuffer counters **/ HYPRE_Int -hypre_NonGalerkinIJBigBufferInit( HYPRE_Int *ijbuf_cnt, /* See NonGalerkinIJBufferWrite for parameter descriptions */ +hypre_NonGalerkinIJBigBufferInit( HYPRE_Int *ijbuf_cnt, /* See NonGalerkinIJBufferWrite for parameter descriptions */ HYPRE_Int *ijbuf_rowcounter, HYPRE_BigInt *ijbuf_numcols ) { - HYPRE_Int ierr = 0; + HYPRE_Int ierr = 0; - (*ijbuf_cnt) = 0; - (*ijbuf_rowcounter) = 1; /*Always points to the next row*/ - ijbuf_numcols[0] = 0; - - return ierr; + (*ijbuf_cnt) = 0; + (*ijbuf_rowcounter) = 1; /*Always points to the next row*/ + ijbuf_numcols[0] = 0; + + return ierr; } /** - * Update the buffer counters + * Update the buffer counters **/ HYPRE_Int hypre_NonGalerkinIJBufferNewRow(HYPRE_BigInt *ijbuf_rownums, /* See NonGalerkinIJBufferWrite for parameter descriptions */ - HYPRE_Int *ijbuf_numcols, - HYPRE_Int *ijbuf_rowcounter, + HYPRE_Int *ijbuf_numcols, + HYPRE_Int *ijbuf_rowcounter, HYPRE_BigInt new_row) { - HYPRE_Int ierr = 0; - - /* First check to see if the previous row was empty, and if so, overwrite that row */ - if( ijbuf_numcols[(*ijbuf_rowcounter)-1] == 0 ) - { - ijbuf_rownums[(*ijbuf_rowcounter)-1] = new_row; - } - else - { - /* Move to the next row */ - ijbuf_rownums[(*ijbuf_rowcounter)] = new_row; - ijbuf_numcols[(*ijbuf_rowcounter)] = 0; - (*ijbuf_rowcounter)++; - } + HYPRE_Int ierr = 0; + + /* First check to see if the previous row was empty, and if so, overwrite that row */ + if( ijbuf_numcols[(*ijbuf_rowcounter)-1] == 0 ) + { + ijbuf_rownums[(*ijbuf_rowcounter)-1] = new_row; + } + else + { + /* Move to the next row */ + ijbuf_rownums[(*ijbuf_rowcounter)] = new_row; + ijbuf_numcols[(*ijbuf_rowcounter)] = 0; + (*ijbuf_rowcounter)++; + } - return ierr; + return ierr; } /** - * Compress the current row in an IJ Buffer by removing duplicate entries + * Compress the current row in an IJ Buffer by removing duplicate entries **/ HYPRE_Int -hypre_NonGalerkinIJBufferCompressRow( HYPRE_Int *ijbuf_cnt, /* See NonGalerkinIJBufferWrite for parameter descriptions */ - HYPRE_Int ijbuf_rowcounter, - HYPRE_Real *ijbuf_data, - HYPRE_BigInt *ijbuf_cols, - HYPRE_BigInt *ijbuf_rownums, +hypre_NonGalerkinIJBufferCompressRow( HYPRE_Int *ijbuf_cnt, /* See NonGalerkinIJBufferWrite for parameter descriptions */ + HYPRE_Int ijbuf_rowcounter, + HYPRE_Real *ijbuf_data, + HYPRE_BigInt *ijbuf_cols, + HYPRE_BigInt *ijbuf_rownums, HYPRE_Int *ijbuf_numcols) { - HYPRE_Int ierr = 0; - HYPRE_Int nentries, i, nduplicate; - - /* Compress the current row by removing any repeat entries, - * making sure to decrement ijbuf_cnt by nduplicate */ - nentries = ijbuf_numcols[ ijbuf_rowcounter-1 ]; - nduplicate = 0; - hypre_BigQsort1(ijbuf_cols, ijbuf_data, (*ijbuf_cnt)-nentries, (*ijbuf_cnt)-1 ); - - for(i =(*ijbuf_cnt)-nentries+1; i <= (*ijbuf_cnt)-1; i++) - { - if( ijbuf_cols[i] == ijbuf_cols[i-1] ) - { - /* Shift duplicate entry down */ - nduplicate++; - ijbuf_data[i - nduplicate] += ijbuf_data[i]; - } - else if(nduplicate > 0) - { - ijbuf_data[i - nduplicate] = ijbuf_data[i]; - ijbuf_cols[i - nduplicate] = ijbuf_cols[i]; - } - } - (*ijbuf_cnt) -= nduplicate; - ijbuf_numcols[ ijbuf_rowcounter-1 ] -= nduplicate; + HYPRE_Int ierr = 0; + HYPRE_Int nentries, i, nduplicate; - return ierr; + /* Compress the current row by removing any repeat entries, + * making sure to decrement ijbuf_cnt by nduplicate */ + nentries = ijbuf_numcols[ ijbuf_rowcounter-1 ]; + nduplicate = 0; + hypre_BigQsort1(ijbuf_cols, ijbuf_data, (*ijbuf_cnt)-nentries, (*ijbuf_cnt)-1 ); + + for(i =(*ijbuf_cnt)-nentries+1; i <= (*ijbuf_cnt)-1; i++) + { + if( ijbuf_cols[i] == ijbuf_cols[i-1] ) + { + /* Shift duplicate entry down */ + nduplicate++; + ijbuf_data[i - nduplicate] += ijbuf_data[i]; + } + else if(nduplicate > 0) + { + ijbuf_data[i - nduplicate] = ijbuf_data[i]; + ijbuf_cols[i - nduplicate] = ijbuf_cols[i]; + } + } + (*ijbuf_cnt) -= nduplicate; + ijbuf_numcols[ ijbuf_rowcounter-1 ] -= nduplicate; + + return ierr; } @@ -687,141 +701,141 @@ **/ HYPRE_Int hypre_NonGalerkinIJBufferCompress( HYPRE_Int ijbuf_size, - HYPRE_Int *ijbuf_cnt, /* See NonGalerkinIJBufferWrite for parameter descriptions */ - HYPRE_Int *ijbuf_rowcounter, - HYPRE_Real **ijbuf_data, - HYPRE_BigInt **ijbuf_cols, - HYPRE_BigInt **ijbuf_rownums, + HYPRE_Int *ijbuf_cnt, /* See NonGalerkinIJBufferWrite for parameter descriptions */ + HYPRE_Int *ijbuf_rowcounter, + HYPRE_Real **ijbuf_data, + HYPRE_BigInt **ijbuf_cols, + HYPRE_BigInt **ijbuf_rownums, HYPRE_Int **ijbuf_numcols) { - HYPRE_Int ierr = 0; - HYPRE_Int *indys = hypre_CTAlloc(HYPRE_Int, (*ijbuf_rowcounter) , HYPRE_MEMORY_HOST); - - HYPRE_Int i, j, duplicate, cnt_new, rowcounter_new, prev_row; - HYPRE_Int row_loc; - HYPRE_BigInt row_start, row_stop, row; - - HYPRE_Real *data_new; - HYPRE_BigInt *cols_new; - HYPRE_BigInt *rownums_new; - HYPRE_Int *numcols_new; - - - /* Do a sort on rownums, but store the original order in indys. - * Then see if there are any duplicate rows */ - for(i = 0; i < (*ijbuf_rowcounter); i++) - { indys[i] = i; } - hypre_BigQsortbi((*ijbuf_rownums), indys, 0, (*ijbuf_rowcounter)-1); - duplicate = 0; - for(i = 1; i < (*ijbuf_rowcounter); i++) - { - if(indys[i] != (indys[i-1]+1)) - { - duplicate = 1; - break; - } - } - - /* Compress duplicate rows */ - if(duplicate) - { - - /* Accumulate numcols, so that it functions like a CSR row-pointer */ - for(i = 1; i < (*ijbuf_rowcounter); i++) - { (*ijbuf_numcols)[i] += (*ijbuf_numcols)[i-1]; } - - /* Initialize new buffer */ - prev_row = -1; - rowcounter_new = 0; - cnt_new = 0; - data_new = hypre_CTAlloc(HYPRE_Real, ijbuf_size, HYPRE_MEMORY_HOST); - cols_new = hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); - rownums_new = hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); - numcols_new = hypre_CTAlloc(HYPRE_Int, ijbuf_size, HYPRE_MEMORY_HOST); - numcols_new[0] = 0; - - /* Cycle through each row */ - for(i = 0; i < (*ijbuf_rowcounter); i++) - { - - /* Find which row this is in local and global numberings, and where - * this row's data starts and stops in the buffer*/ - row_loc = indys[i]; - row = (*ijbuf_rownums)[i]; - if(row_loc > 0) - { - row_start = (*ijbuf_numcols)[row_loc-1]; - row_stop = (*ijbuf_numcols)[row_loc]; - } - else - { - row_start = 0; - row_stop = (*ijbuf_numcols)[row_loc]; - } - - /* Is this a new row? If so, compress previous row, and add a new - * one. Noting that prev_row = -1 is a special value */ - if(row != prev_row) - { - if(prev_row != -1) - { - /* Compress previous row */ - hypre_NonGalerkinIJBufferCompressRow(&cnt_new, rowcounter_new, data_new, - cols_new, rownums_new, numcols_new); - } - prev_row = row; - numcols_new[rowcounter_new] = 0; - rownums_new[rowcounter_new] = row; - rowcounter_new++; - } - - /* Copy row into new buffer */ - for(j = row_start; j < row_stop; j++) - { - data_new[cnt_new] = (*ijbuf_data)[j]; - cols_new[cnt_new] = (*ijbuf_cols)[j]; - numcols_new[rowcounter_new-1]++; - cnt_new++; - } - } - - /* Compress the final row */ - if(i > 1) - { - hypre_NonGalerkinIJBufferCompressRow(&cnt_new, rowcounter_new, data_new, - cols_new, rownums_new, numcols_new); - } - - *ijbuf_cnt = cnt_new; - *ijbuf_rowcounter = rowcounter_new; - - /* Point to the new buffer */ - hypre_TFree(*ijbuf_data, HYPRE_MEMORY_HOST); - hypre_TFree(*ijbuf_cols, HYPRE_MEMORY_HOST); - hypre_TFree(*ijbuf_rownums, HYPRE_MEMORY_HOST); - hypre_TFree(*ijbuf_numcols, HYPRE_MEMORY_HOST); - (*ijbuf_data) = data_new; - (*ijbuf_cols) = cols_new; - (*ijbuf_rownums) = rownums_new; - (*ijbuf_numcols) = numcols_new; - } - - hypre_TFree(indys, HYPRE_MEMORY_HOST); - - return ierr; + HYPRE_Int ierr = 0; + HYPRE_Int *indys = hypre_CTAlloc(HYPRE_Int, (*ijbuf_rowcounter) , HYPRE_MEMORY_HOST); + + HYPRE_Int i, j, duplicate, cnt_new, rowcounter_new, prev_row; + HYPRE_Int row_loc; + HYPRE_BigInt row_start, row_stop, row; + + HYPRE_Real *data_new; + HYPRE_BigInt *cols_new; + HYPRE_BigInt *rownums_new; + HYPRE_Int *numcols_new; + + + /* Do a sort on rownums, but store the original order in indys. + * Then see if there are any duplicate rows */ + for(i = 0; i < (*ijbuf_rowcounter); i++) + { indys[i] = i; } + hypre_BigQsortbi((*ijbuf_rownums), indys, 0, (*ijbuf_rowcounter)-1); + duplicate = 0; + for(i = 1; i < (*ijbuf_rowcounter); i++) + { + if(indys[i] != (indys[i-1]+1)) + { + duplicate = 1; + break; + } + } + + /* Compress duplicate rows */ + if(duplicate) + { + + /* Accumulate numcols, so that it functions like a CSR row-pointer */ + for(i = 1; i < (*ijbuf_rowcounter); i++) + { (*ijbuf_numcols)[i] += (*ijbuf_numcols)[i-1]; } + + /* Initialize new buffer */ + prev_row = -1; + rowcounter_new = 0; + cnt_new = 0; + data_new = hypre_CTAlloc(HYPRE_Real, ijbuf_size, HYPRE_MEMORY_HOST); + cols_new = hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); + rownums_new = hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); + numcols_new = hypre_CTAlloc(HYPRE_Int, ijbuf_size, HYPRE_MEMORY_HOST); + numcols_new[0] = 0; + + /* Cycle through each row */ + for(i = 0; i < (*ijbuf_rowcounter); i++) + { + + /* Find which row this is in local and global numberings, and where + * this row's data starts and stops in the buffer*/ + row_loc = indys[i]; + row = (*ijbuf_rownums)[i]; + if(row_loc > 0) + { + row_start = (*ijbuf_numcols)[row_loc-1]; + row_stop = (*ijbuf_numcols)[row_loc]; + } + else + { + row_start = 0; + row_stop = (*ijbuf_numcols)[row_loc]; + } + + /* Is this a new row? If so, compress previous row, and add a new + * one. Noting that prev_row = -1 is a special value */ + if(row != prev_row) + { + if(prev_row != -1) + { + /* Compress previous row */ + hypre_NonGalerkinIJBufferCompressRow(&cnt_new, rowcounter_new, data_new, + cols_new, rownums_new, numcols_new); + } + prev_row = row; + numcols_new[rowcounter_new] = 0; + rownums_new[rowcounter_new] = row; + rowcounter_new++; + } + + /* Copy row into new buffer */ + for(j = row_start; j < row_stop; j++) + { + data_new[cnt_new] = (*ijbuf_data)[j]; + cols_new[cnt_new] = (*ijbuf_cols)[j]; + numcols_new[rowcounter_new-1]++; + cnt_new++; + } + } + + /* Compress the final row */ + if(i > 1) + { + hypre_NonGalerkinIJBufferCompressRow(&cnt_new, rowcounter_new, data_new, + cols_new, rownums_new, numcols_new); + } + + *ijbuf_cnt = cnt_new; + *ijbuf_rowcounter = rowcounter_new; + + /* Point to the new buffer */ + hypre_TFree(*ijbuf_data, HYPRE_MEMORY_HOST); + hypre_TFree(*ijbuf_cols, HYPRE_MEMORY_HOST); + hypre_TFree(*ijbuf_rownums, HYPRE_MEMORY_HOST); + hypre_TFree(*ijbuf_numcols, HYPRE_MEMORY_HOST); + (*ijbuf_data) = data_new; + (*ijbuf_cols) = cols_new; + (*ijbuf_rownums) = rownums_new; + (*ijbuf_numcols) = numcols_new; + } + + hypre_TFree(indys, HYPRE_MEMORY_HOST); + + return ierr; } /** - * Do a buffered write to an IJ matrix. - * That is, write to the buffer, until the buffer is full. Then when the + * Do a buffered write to an IJ matrix. + * That is, write to the buffer, until the buffer is full. Then when the * buffer is full, write to the IJ matrix and reset the buffer counters * In effect, this buffers this operation - * A[row_to_write, col_to_write] += val_to_write + * A[row_to_write, col_to_write] += val_to_write **/ HYPRE_Int hypre_NonGalerkinIJBufferWrite( HYPRE_IJMatrix B, /* Unassembled matrix to add an entry to */ - HYPRE_Int *ijbuf_cnt, /* current buffer size */ + HYPRE_Int *ijbuf_cnt, /* current buffer size */ HYPRE_Int ijbuf_size, /* max buffer size */ HYPRE_Int *ijbuf_rowcounter, /* num of rows in rownums, (i.e., size of rownums) */ /* This counter will increase as you call this function for multiple rows */ @@ -834,50 +848,50 @@ HYPRE_BigInt col_to_write, /* Ditto */ HYPRE_Real val_to_write ) /* Ditto */ { - HYPRE_Int ierr = 0; - + HYPRE_Int ierr = 0; + - if( (*ijbuf_cnt) == 0 ) - { - /* brand new buffer: increment buffer structures for the new row */ - hypre_NonGalerkinIJBufferNewRow((*ijbuf_rownums), (*ijbuf_numcols), ijbuf_rowcounter, row_to_write); - - } - else if((*ijbuf_rownums)[ (*ijbuf_rowcounter)-1 ] != row_to_write) - { - /* If this is a new row, compress the previous row */ - hypre_NonGalerkinIJBufferCompressRow(ijbuf_cnt, (*ijbuf_rowcounter), (*ijbuf_data), - (*ijbuf_cols), (*ijbuf_rownums), (*ijbuf_numcols)); - /* increment buffer structures for the new row */ - hypre_NonGalerkinIJBufferNewRow( (*ijbuf_rownums), (*ijbuf_numcols), ijbuf_rowcounter, row_to_write); - } - - /* Add new entry to buffer */ - (*ijbuf_cols)[(*ijbuf_cnt)] = col_to_write; - (*ijbuf_data)[(*ijbuf_cnt)] = val_to_write; - (*ijbuf_numcols)[ (*ijbuf_rowcounter)-1 ]++; - (*ijbuf_cnt)++; - - /* Buffer is full, write to the matrix object */ - if ( (*ijbuf_cnt) == (ijbuf_size-1) ) - { - /* If the last row is empty, decrement rowcounter */ - if( (*ijbuf_numcols)[ (*ijbuf_rowcounter)-1 ] == 0) - { (*ijbuf_rowcounter)--; } - - /* Compress and Add Entries */ - hypre_NonGalerkinIJBufferCompressRow(ijbuf_cnt, (*ijbuf_rowcounter), (*ijbuf_data), - (*ijbuf_cols), (*ijbuf_rownums), (*ijbuf_numcols)); - hypre_NonGalerkinIJBufferCompress(ijbuf_size, ijbuf_cnt, ijbuf_rowcounter, ijbuf_data, - ijbuf_cols, ijbuf_rownums, ijbuf_numcols); - ierr += HYPRE_IJMatrixAddToValues(B, *ijbuf_rowcounter, (*ijbuf_numcols), (*ijbuf_rownums), (*ijbuf_cols), (*ijbuf_data)); - - /* Reinitialize the buffer */ - hypre_NonGalerkinIJBufferInit( ijbuf_cnt, ijbuf_rowcounter, (*ijbuf_numcols)); - hypre_NonGalerkinIJBufferNewRow((*ijbuf_rownums), (*ijbuf_numcols), ijbuf_rowcounter, row_to_write); - } + if( (*ijbuf_cnt) == 0 ) + { + /* brand new buffer: increment buffer structures for the new row */ + hypre_NonGalerkinIJBufferNewRow((*ijbuf_rownums), (*ijbuf_numcols), ijbuf_rowcounter, row_to_write); + + } + else if((*ijbuf_rownums)[ (*ijbuf_rowcounter)-1 ] != row_to_write) + { + /* If this is a new row, compress the previous row */ + hypre_NonGalerkinIJBufferCompressRow(ijbuf_cnt, (*ijbuf_rowcounter), (*ijbuf_data), + (*ijbuf_cols), (*ijbuf_rownums), (*ijbuf_numcols)); + /* increment buffer structures for the new row */ + hypre_NonGalerkinIJBufferNewRow( (*ijbuf_rownums), (*ijbuf_numcols), ijbuf_rowcounter, row_to_write); + } + + /* Add new entry to buffer */ + (*ijbuf_cols)[(*ijbuf_cnt)] = col_to_write; + (*ijbuf_data)[(*ijbuf_cnt)] = val_to_write; + (*ijbuf_numcols)[ (*ijbuf_rowcounter)-1 ]++; + (*ijbuf_cnt)++; + + /* Buffer is full, write to the matrix object */ + if ( (*ijbuf_cnt) == (ijbuf_size-1) ) + { + /* If the last row is empty, decrement rowcounter */ + if( (*ijbuf_numcols)[ (*ijbuf_rowcounter)-1 ] == 0) + { (*ijbuf_rowcounter)--; } + + /* Compress and Add Entries */ + hypre_NonGalerkinIJBufferCompressRow(ijbuf_cnt, (*ijbuf_rowcounter), (*ijbuf_data), + (*ijbuf_cols), (*ijbuf_rownums), (*ijbuf_numcols)); + hypre_NonGalerkinIJBufferCompress(ijbuf_size, ijbuf_cnt, ijbuf_rowcounter, ijbuf_data, + ijbuf_cols, ijbuf_rownums, ijbuf_numcols); + ierr += HYPRE_IJMatrixAddToValues(B, *ijbuf_rowcounter, (*ijbuf_numcols), (*ijbuf_rownums), (*ijbuf_cols), (*ijbuf_data)); + + /* Reinitialize the buffer */ + hypre_NonGalerkinIJBufferInit( ijbuf_cnt, ijbuf_rowcounter, (*ijbuf_numcols)); + hypre_NonGalerkinIJBufferNewRow((*ijbuf_rownums), (*ijbuf_numcols), ijbuf_rowcounter, row_to_write); + } - return ierr; + return ierr; } @@ -885,29 +899,29 @@ * Empty the IJ Buffer with a final AddToValues. **/ HYPRE_Int -hypre_NonGalerkinIJBufferEmpty(HYPRE_IJMatrix B, /* See NonGalerkinIJBufferWrite for parameter descriptions */ +hypre_NonGalerkinIJBufferEmpty(HYPRE_IJMatrix B, /* See NonGalerkinIJBufferWrite for parameter descriptions */ HYPRE_Int ijbuf_size, - HYPRE_Int *ijbuf_cnt, - HYPRE_Int ijbuf_rowcounter, - HYPRE_Real **ijbuf_data, - HYPRE_BigInt **ijbuf_cols, - HYPRE_BigInt **ijbuf_rownums, + HYPRE_Int *ijbuf_cnt, + HYPRE_Int ijbuf_rowcounter, + HYPRE_Real **ijbuf_data, + HYPRE_BigInt **ijbuf_cols, + HYPRE_BigInt **ijbuf_rownums, HYPRE_Int **ijbuf_numcols) { - HYPRE_Int ierr = 0; + HYPRE_Int ierr = 0; - if( (*ijbuf_cnt) > 0) - { - /* Compress the last row and then write */ - hypre_NonGalerkinIJBufferCompressRow(ijbuf_cnt, ijbuf_rowcounter, (*ijbuf_data), - (*ijbuf_cols), (*ijbuf_rownums), (*ijbuf_numcols)); - hypre_NonGalerkinIJBufferCompress(ijbuf_size, ijbuf_cnt, &ijbuf_rowcounter, ijbuf_data, - ijbuf_cols, ijbuf_rownums, ijbuf_numcols); - ierr += HYPRE_IJMatrixAddToValues(B, ijbuf_rowcounter, (*ijbuf_numcols), (*ijbuf_rownums), (*ijbuf_cols), (*ijbuf_data)); - } - (*ijbuf_cnt = 0); + if( (*ijbuf_cnt) > 0) + { + /* Compress the last row and then write */ + hypre_NonGalerkinIJBufferCompressRow(ijbuf_cnt, ijbuf_rowcounter, (*ijbuf_data), + (*ijbuf_cols), (*ijbuf_rownums), (*ijbuf_numcols)); + hypre_NonGalerkinIJBufferCompress(ijbuf_size, ijbuf_cnt, &ijbuf_rowcounter, ijbuf_data, + ijbuf_cols, ijbuf_rownums, ijbuf_numcols); + ierr += HYPRE_IJMatrixAddToValues(B, ijbuf_rowcounter, (*ijbuf_numcols), (*ijbuf_rownums), (*ijbuf_cols), (*ijbuf_data)); + } + (*ijbuf_cnt = 0); - return ierr; + return ierr; } @@ -922,1389 +936,1389 @@ HYPRE_Int sym_collapse, HYPRE_Int collapse_beta ) { - /* MPI Communicator */ - MPI_Comm comm = hypre_ParCSRMatrixComm(RAP); - - /* Declare R_IAP */ - hypre_CSRMatrix *R_IAP_diag = hypre_ParCSRMatrixDiag(R_IAP); - HYPRE_Int *R_IAP_diag_i = hypre_CSRMatrixI(R_IAP_diag); - HYPRE_Int *R_IAP_diag_j = hypre_CSRMatrixJ(R_IAP_diag); - - hypre_CSRMatrix *R_IAP_offd = hypre_ParCSRMatrixOffd(R_IAP); - HYPRE_Int *R_IAP_offd_i = hypre_CSRMatrixI(R_IAP_offd); - HYPRE_Int *R_IAP_offd_j = hypre_CSRMatrixJ(R_IAP_offd); - HYPRE_BigInt *col_map_offd_R_IAP = hypre_ParCSRMatrixColMapOffd(R_IAP); - - /* Declare RAP */ - hypre_CSRMatrix *RAP_diag = hypre_ParCSRMatrixDiag(RAP); - HYPRE_Int *RAP_diag_i = hypre_CSRMatrixI(RAP_diag); - HYPRE_Real *RAP_diag_data = hypre_CSRMatrixData(RAP_diag); - HYPRE_Int *RAP_diag_j = hypre_CSRMatrixJ(RAP_diag); - HYPRE_BigInt first_col_diag_RAP = hypre_ParCSRMatrixFirstColDiag(RAP); - HYPRE_Int num_cols_diag_RAP = hypre_CSRMatrixNumCols(RAP_diag); - HYPRE_BigInt last_col_diag_RAP = first_col_diag_RAP + (HYPRE_BigInt)num_cols_diag_RAP - 1; - - hypre_CSRMatrix *RAP_offd = hypre_ParCSRMatrixOffd(RAP); - HYPRE_Int *RAP_offd_i = hypre_CSRMatrixI(RAP_offd); - HYPRE_Real *RAP_offd_data = NULL; - HYPRE_Int *RAP_offd_j = hypre_CSRMatrixJ(RAP_offd); - HYPRE_BigInt *col_map_offd_RAP = hypre_ParCSRMatrixColMapOffd(RAP); - HYPRE_Int num_cols_RAP_offd = hypre_CSRMatrixNumCols(RAP_offd); - - HYPRE_Int num_variables = hypre_CSRMatrixNumRows(RAP_diag); - - /* Declare A */ - HYPRE_Int num_fine_variables = hypre_CSRMatrixNumRows(R_IAP_diag); - - /* Declare IJ matrices */ - HYPRE_IJMatrix Pattern; - hypre_ParCSRMatrix *Pattern_CSR = NULL; - - /* Buffered IJAddToValues */ - HYPRE_Int ijbuf_cnt, ijbuf_size, ijbuf_rowcounter; - HYPRE_Real *ijbuf_data; - HYPRE_BigInt *ijbuf_cols, *ijbuf_rownums; - HYPRE_Int *ijbuf_numcols; - - /* Buffered IJAddToValues for Symmetric Entries */ - HYPRE_Int ijbuf_sym_cnt, ijbuf_sym_rowcounter; - HYPRE_Real *ijbuf_sym_data; - HYPRE_BigInt *ijbuf_sym_cols, *ijbuf_sym_rownums; - HYPRE_Int *ijbuf_sym_numcols; - - /* Other Declarations */ - HYPRE_Int ierr = 0; - HYPRE_Real max_entry = 0.0; - HYPRE_Real max_entry_offd = 0.0; - HYPRE_Int * rownz = NULL; - HYPRE_Int i, j, Cpt; - HYPRE_BigInt row_start, row_end, global_row, global_col; - - /* Other Setup */ - if (num_cols_RAP_offd) - { RAP_offd_data = hypre_CSRMatrixData(RAP_offd); } - - - /* - * Initialize the IJ matrix, leveraging our rough knowledge of the - * nonzero structure of Pattern based on RAP - * - * ilower, iupper, jlower, jupper */ - ierr += HYPRE_IJMatrixCreate(comm, first_col_diag_RAP, last_col_diag_RAP, first_col_diag_RAP, last_col_diag_RAP, &Pattern); - ierr += HYPRE_IJMatrixSetObjectType(Pattern, HYPRE_PARCSR); - rownz = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); - for(i = 0; i < num_variables; i++) - { rownz[i] = 1.2*(RAP_diag_i[i+1] - RAP_diag_i[i]) + 1.2*(RAP_offd_i[i+1] - RAP_offd_i[i]); } - HYPRE_IJMatrixSetRowSizes(Pattern, rownz); - ierr += HYPRE_IJMatrixInitialize(Pattern); - hypre_TFree(rownz, HYPRE_MEMORY_HOST); - - /* - *For efficiency, we do a buffered IJAddToValues. - * Here, we initialize the buffer and then initialize the buffer counters - */ - ijbuf_size = 1000; - ijbuf_data = hypre_CTAlloc(HYPRE_Real, ijbuf_size, HYPRE_MEMORY_HOST); - ijbuf_cols = hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); - ijbuf_rownums = hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); - ijbuf_numcols = hypre_CTAlloc(HYPRE_Int, ijbuf_size, HYPRE_MEMORY_HOST); - hypre_NonGalerkinIJBigBufferInit( &ijbuf_cnt, &ijbuf_rowcounter, ijbuf_cols ); - if(sym_collapse) - { - ijbuf_sym_data = hypre_CTAlloc(HYPRE_Real, ijbuf_size, HYPRE_MEMORY_HOST); - ijbuf_sym_cols = hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); - ijbuf_sym_rownums= hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); - ijbuf_sym_numcols= hypre_CTAlloc(HYPRE_Int, ijbuf_size, HYPRE_MEMORY_HOST); - hypre_NonGalerkinIJBigBufferInit( &ijbuf_sym_cnt, &ijbuf_sym_rowcounter, ijbuf_sym_cols ); - } - - - /* - * Place entries in R_IAP into Pattern - */ - Cpt = -1; /* Cpt contains the fine grid index of the i-th Cpt */ - for(i = 0; i < num_variables; i++) - { - global_row = i+first_col_diag_RAP; - - /* Find the next Coarse Point in CF_marker */ - for(j = Cpt+1; j < num_fine_variables; j++) - { - if(CF_marker[j] == 1) /* Found Next C-point */ - { - Cpt = j; - break; - } - } - - /* Diag Portion */ - row_start = R_IAP_diag_i[Cpt]; - row_end = R_IAP_diag_i[Cpt+1]; - for(j = row_start; j < row_end; j++) - { - global_col = R_IAP_diag_j[j] + first_col_diag_RAP; - /* This call adds a 1 x 1 to i j data */ - hypre_NonGalerkinIJBufferWrite( Pattern, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, - global_col, 1.0); - if (sym_collapse) - { - hypre_NonGalerkinIJBufferWrite( Pattern, &ijbuf_sym_cnt, + /* MPI Communicator */ + MPI_Comm comm = hypre_ParCSRMatrixComm(RAP); + + /* Declare R_IAP */ + hypre_CSRMatrix *R_IAP_diag = hypre_ParCSRMatrixDiag(R_IAP); + HYPRE_Int *R_IAP_diag_i = hypre_CSRMatrixI(R_IAP_diag); + HYPRE_Int *R_IAP_diag_j = hypre_CSRMatrixJ(R_IAP_diag); + + hypre_CSRMatrix *R_IAP_offd = hypre_ParCSRMatrixOffd(R_IAP); + HYPRE_Int *R_IAP_offd_i = hypre_CSRMatrixI(R_IAP_offd); + HYPRE_Int *R_IAP_offd_j = hypre_CSRMatrixJ(R_IAP_offd); + HYPRE_BigInt *col_map_offd_R_IAP = hypre_ParCSRMatrixColMapOffd(R_IAP); + + /* Declare RAP */ + hypre_CSRMatrix *RAP_diag = hypre_ParCSRMatrixDiag(RAP); + HYPRE_Int *RAP_diag_i = hypre_CSRMatrixI(RAP_diag); + HYPRE_Real *RAP_diag_data = hypre_CSRMatrixData(RAP_diag); + HYPRE_Int *RAP_diag_j = hypre_CSRMatrixJ(RAP_diag); + HYPRE_BigInt first_col_diag_RAP = hypre_ParCSRMatrixFirstColDiag(RAP); + HYPRE_Int num_cols_diag_RAP = hypre_CSRMatrixNumCols(RAP_diag); + HYPRE_BigInt last_col_diag_RAP = first_col_diag_RAP + (HYPRE_BigInt)num_cols_diag_RAP - 1; + + hypre_CSRMatrix *RAP_offd = hypre_ParCSRMatrixOffd(RAP); + HYPRE_Int *RAP_offd_i = hypre_CSRMatrixI(RAP_offd); + HYPRE_Real *RAP_offd_data = NULL; + HYPRE_Int *RAP_offd_j = hypre_CSRMatrixJ(RAP_offd); + HYPRE_BigInt *col_map_offd_RAP = hypre_ParCSRMatrixColMapOffd(RAP); + HYPRE_Int num_cols_RAP_offd = hypre_CSRMatrixNumCols(RAP_offd); + + HYPRE_Int num_variables = hypre_CSRMatrixNumRows(RAP_diag); + + /* Declare A */ + HYPRE_Int num_fine_variables = hypre_CSRMatrixNumRows(R_IAP_diag); + + /* Declare IJ matrices */ + HYPRE_IJMatrix Pattern; + hypre_ParCSRMatrix *Pattern_CSR = NULL; + + /* Buffered IJAddToValues */ + HYPRE_Int ijbuf_cnt, ijbuf_size, ijbuf_rowcounter; + HYPRE_Real *ijbuf_data; + HYPRE_BigInt *ijbuf_cols, *ijbuf_rownums; + HYPRE_Int *ijbuf_numcols; + + /* Buffered IJAddToValues for Symmetric Entries */ + HYPRE_Int ijbuf_sym_cnt, ijbuf_sym_rowcounter; + HYPRE_Real *ijbuf_sym_data; + HYPRE_BigInt *ijbuf_sym_cols, *ijbuf_sym_rownums; + HYPRE_Int *ijbuf_sym_numcols; + + /* Other Declarations */ + HYPRE_Int ierr = 0; + HYPRE_Real max_entry = 0.0; + HYPRE_Real max_entry_offd = 0.0; + HYPRE_Int * rownz = NULL; + HYPRE_Int i, j, Cpt; + HYPRE_BigInt row_start, row_end, global_row, global_col; + + /* Other Setup */ + if (num_cols_RAP_offd) + { RAP_offd_data = hypre_CSRMatrixData(RAP_offd); } + + + /* + * Initialize the IJ matrix, leveraging our rough knowledge of the + * nonzero structure of Pattern based on RAP + * + * ilower, iupper, jlower, jupper */ + ierr += HYPRE_IJMatrixCreate(comm, first_col_diag_RAP, last_col_diag_RAP, first_col_diag_RAP, last_col_diag_RAP, &Pattern); + ierr += HYPRE_IJMatrixSetObjectType(Pattern, HYPRE_PARCSR); + rownz = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); + for(i = 0; i < num_variables; i++) + { rownz[i] = 1.2*(RAP_diag_i[i+1] - RAP_diag_i[i]) + 1.2*(RAP_offd_i[i+1] - RAP_offd_i[i]); } + HYPRE_IJMatrixSetRowSizes(Pattern, rownz); + ierr += HYPRE_IJMatrixInitialize(Pattern); + hypre_TFree(rownz, HYPRE_MEMORY_HOST); + + /* + *For efficiency, we do a buffered IJAddToValues. + * Here, we initialize the buffer and then initialize the buffer counters + */ + ijbuf_size = 1000; + ijbuf_data = hypre_CTAlloc(HYPRE_Real, ijbuf_size, HYPRE_MEMORY_HOST); + ijbuf_cols = hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); + ijbuf_rownums = hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); + ijbuf_numcols = hypre_CTAlloc(HYPRE_Int, ijbuf_size, HYPRE_MEMORY_HOST); + hypre_NonGalerkinIJBigBufferInit( &ijbuf_cnt, &ijbuf_rowcounter, ijbuf_cols ); + if(sym_collapse) + { + ijbuf_sym_data = hypre_CTAlloc(HYPRE_Real, ijbuf_size, HYPRE_MEMORY_HOST); + ijbuf_sym_cols = hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); + ijbuf_sym_rownums= hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); + ijbuf_sym_numcols= hypre_CTAlloc(HYPRE_Int, ijbuf_size, HYPRE_MEMORY_HOST); + hypre_NonGalerkinIJBigBufferInit( &ijbuf_sym_cnt, &ijbuf_sym_rowcounter, ijbuf_sym_cols ); + } + + + /* + * Place entries in R_IAP into Pattern + */ + Cpt = -1; /* Cpt contains the fine grid index of the i-th Cpt */ + for(i = 0; i < num_variables; i++) + { + global_row = i+first_col_diag_RAP; + + /* Find the next Coarse Point in CF_marker */ + for(j = Cpt+1; j < num_fine_variables; j++) + { + if(CF_marker[j] == 1) /* Found Next C-point */ + { + Cpt = j; + break; + } + } + + /* Diag Portion */ + row_start = R_IAP_diag_i[Cpt]; + row_end = R_IAP_diag_i[Cpt+1]; + for(j = row_start; j < row_end; j++) + { + global_col = R_IAP_diag_j[j] + first_col_diag_RAP; + /* This call adds a 1 x 1 to i j data */ + hypre_NonGalerkinIJBufferWrite( Pattern, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, + global_col, 1.0); + if (sym_collapse) + { + hypre_NonGalerkinIJBufferWrite( Pattern, &ijbuf_sym_cnt, ijbuf_size, &ijbuf_sym_rowcounter, &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, &ijbuf_sym_numcols, - global_col, global_row, 1.0); - } - } - - /* Offdiag Portion */ - row_start = R_IAP_offd_i[Cpt]; - row_end = R_IAP_offd_i[Cpt+1]; - for(j = row_start; j < row_end; j++) - { - global_col = col_map_offd_R_IAP[ R_IAP_offd_j[j] ]; - /* This call adds a 1 x 1 to i j data */ - hypre_NonGalerkinIJBufferWrite( Pattern, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, - global_col, 1.0); - - if (sym_collapse) - { - hypre_NonGalerkinIJBufferWrite( Pattern, &ijbuf_sym_cnt, + global_col, global_row, 1.0); + } + } + + /* Offdiag Portion */ + row_start = R_IAP_offd_i[Cpt]; + row_end = R_IAP_offd_i[Cpt+1]; + for(j = row_start; j < row_end; j++) + { + global_col = col_map_offd_R_IAP[ R_IAP_offd_j[j] ]; + /* This call adds a 1 x 1 to i j data */ + hypre_NonGalerkinIJBufferWrite( Pattern, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, + global_col, 1.0); + + if (sym_collapse) + { + hypre_NonGalerkinIJBufferWrite( Pattern, &ijbuf_sym_cnt, ijbuf_size, &ijbuf_sym_rowcounter, &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, &ijbuf_sym_numcols, - global_col, global_row, 1.0); - } - } - - } - - /* - * Use drop-tolerance to compute new entries for sparsity pattern - */ -/*#ifdef HYPRE_USING_OPENMP + global_col, global_row, 1.0); + } + } + + } + + /* + * Use drop-tolerance to compute new entries for sparsity pattern + */ + /*#ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,j,max_entry,max_entry_offd,global_col,global_row) HYPRE_SMP_SCHEDULE -#endif*/ - for(i = 0; i < num_variables; i++) - { - global_row = i+first_col_diag_RAP; - - /* Compute the drop tolerance for this row, which is just - * abs(max of row i)*droptol */ - max_entry = -1.0; - for(j = RAP_diag_i[i]; j < RAP_diag_i[i+1]; j++) - { - if( (RAP_diag_j[j] != i) && (max_entry < fabs(RAP_diag_data[j]) ) ) - { max_entry = fabs(RAP_diag_data[j]); } - } - for(j = RAP_offd_i[i]; j < RAP_offd_i[i+1]; j++) - { - { - if( max_entry < fabs(RAP_offd_data[j]) ) - { max_entry = fabs(RAP_offd_data[j]); } - } - } - max_entry *= droptol; - max_entry_offd = max_entry*collapse_beta; - - - /* Loop over diag portion, adding all entries that are "strong" */ - for(j = RAP_diag_i[i]; j < RAP_diag_i[i+1]; j++) - { - if( fabs(RAP_diag_data[j]) > max_entry ) - { - global_col = RAP_diag_j[j] + first_col_diag_RAP; -/*#ifdef HYPRE_USING_OPENMP +#endif*/ + for(i = 0; i < num_variables; i++) + { + global_row = i+first_col_diag_RAP; + + /* Compute the drop tolerance for this row, which is just + * abs(max of row i)*droptol */ + max_entry = -1.0; + for(j = RAP_diag_i[i]; j < RAP_diag_i[i+1]; j++) + { + if( (RAP_diag_j[j] != i) && (max_entry < fabs(RAP_diag_data[j]) ) ) + { max_entry = fabs(RAP_diag_data[j]); } + } + for(j = RAP_offd_i[i]; j < RAP_offd_i[i+1]; j++) + { + { + if( max_entry < fabs(RAP_offd_data[j]) ) + { max_entry = fabs(RAP_offd_data[j]); } + } + } + max_entry *= droptol; + max_entry_offd = max_entry*collapse_beta; + + + /* Loop over diag portion, adding all entries that are "strong" */ + for(j = RAP_diag_i[i]; j < RAP_diag_i[i+1]; j++) + { + if( fabs(RAP_diag_data[j]) > max_entry ) + { + global_col = RAP_diag_j[j] + first_col_diag_RAP; + /*#ifdef HYPRE_USING_OPENMP #pragma omp critical (IJAdd) #endif -{*/ - /* For efficiency, we do a buffered IJAddToValues - * A[global_row, global_col] += 1.0 */ - hypre_NonGalerkinIJBufferWrite( Pattern, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, - global_col, 1.0 ); - if(sym_collapse) - { - hypre_NonGalerkinIJBufferWrite( Pattern, &ijbuf_sym_cnt, - ijbuf_size, &ijbuf_sym_rowcounter, &ijbuf_sym_data, - &ijbuf_sym_cols, &ijbuf_sym_rownums, &ijbuf_sym_numcols, - global_col, global_row, 1.0 ); - } -/*}*/ +{*/ + /* For efficiency, we do a buffered IJAddToValues + * A[global_row, global_col] += 1.0 */ + hypre_NonGalerkinIJBufferWrite( Pattern, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, + global_col, 1.0 ); + if(sym_collapse) + { + hypre_NonGalerkinIJBufferWrite( Pattern, &ijbuf_sym_cnt, + ijbuf_size, &ijbuf_sym_rowcounter, &ijbuf_sym_data, + &ijbuf_sym_cols, &ijbuf_sym_rownums, &ijbuf_sym_numcols, + global_col, global_row, 1.0 ); } - } + /*}*/ +} +} - /* Loop over offd portion, adding all entries that are "strong" */ - for(j = RAP_offd_i[i]; j < RAP_offd_i[i+1]; j++) - { - if( fabs(RAP_offd_data[j]) > max_entry_offd ) - { - global_col = col_map_offd_RAP[ RAP_offd_j[j] ]; -/*#ifdef HYPRE_USING_OPENMP +/* Loop over offd portion, adding all entries that are "strong" */ +for(j = RAP_offd_i[i]; j < RAP_offd_i[i+1]; j++) +{ + if( fabs(RAP_offd_data[j]) > max_entry_offd ) + { + global_col = col_map_offd_RAP[ RAP_offd_j[j] ]; + /*#ifdef HYPRE_USING_OPENMP #pragma omp critical (IJAdd) #endif {*/ - /* For efficiency, we do a buffered IJAddToValues - * A[global_row, global_col] += 1.0 */ - hypre_NonGalerkinIJBufferWrite( Pattern, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, - global_col, 1.0 ); - if(sym_collapse) - { - hypre_NonGalerkinIJBufferWrite( Pattern, &ijbuf_sym_cnt, - ijbuf_size, &ijbuf_sym_rowcounter, &ijbuf_sym_data, - &ijbuf_sym_cols, &ijbuf_sym_rownums, &ijbuf_sym_numcols, - global_col, global_row, 1.0 ); - } -/*}*/ - } - } + /* For efficiency, we do a buffered IJAddToValues + * A[global_row, global_col] += 1.0 */ + hypre_NonGalerkinIJBufferWrite( Pattern, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, + global_col, 1.0 ); + if(sym_collapse) + { + hypre_NonGalerkinIJBufferWrite( Pattern, &ijbuf_sym_cnt, + ijbuf_size, &ijbuf_sym_rowcounter, &ijbuf_sym_data, + &ijbuf_sym_cols, &ijbuf_sym_rownums, &ijbuf_sym_numcols, + global_col, global_row, 1.0 ); + } + /*}*/ +} +} - } - - /* For efficiency, we do a buffered IJAddToValues. - * This empties the buffer of any remaining values */ - hypre_NonGalerkinIJBufferEmpty(Pattern, ijbuf_size, &ijbuf_cnt, ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols); - if(sym_collapse) - hypre_NonGalerkinIJBufferEmpty(Pattern, ijbuf_size, &ijbuf_sym_cnt, ijbuf_sym_rowcounter, - &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, - &ijbuf_sym_numcols); - - /* Finalize Construction of Pattern */ - ierr += HYPRE_IJMatrixAssemble(Pattern); - ierr += HYPRE_IJMatrixGetObject( Pattern, (void**) &Pattern_CSR ); - - /* Deallocate */ - ierr += HYPRE_IJMatrixSetObjectType(Pattern, -1); - ierr += HYPRE_IJMatrixDestroy(Pattern); - hypre_TFree(ijbuf_data, HYPRE_MEMORY_HOST); - hypre_TFree(ijbuf_cols, HYPRE_MEMORY_HOST); - hypre_TFree(ijbuf_rownums, HYPRE_MEMORY_HOST); - hypre_TFree(ijbuf_numcols, HYPRE_MEMORY_HOST); - if(sym_collapse) - { - hypre_TFree(ijbuf_sym_data, HYPRE_MEMORY_HOST); - hypre_TFree(ijbuf_sym_cols, HYPRE_MEMORY_HOST); - hypre_TFree(ijbuf_sym_rownums, HYPRE_MEMORY_HOST); - hypre_TFree(ijbuf_sym_numcols, HYPRE_MEMORY_HOST); - } +} - return Pattern_CSR; +/* For efficiency, we do a buffered IJAddToValues. + * This empties the buffer of any remaining values */ +hypre_NonGalerkinIJBufferEmpty(Pattern, ijbuf_size, &ijbuf_cnt, ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols); +if(sym_collapse) + hypre_NonGalerkinIJBufferEmpty(Pattern, ijbuf_size, &ijbuf_sym_cnt, ijbuf_sym_rowcounter, + &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, + &ijbuf_sym_numcols); + +/* Finalize Construction of Pattern */ +ierr += HYPRE_IJMatrixAssemble(Pattern); +ierr += HYPRE_IJMatrixGetObject( Pattern, (void**) &Pattern_CSR ); + +/* Deallocate */ +ierr += HYPRE_IJMatrixSetObjectType(Pattern, -1); +ierr += HYPRE_IJMatrixDestroy(Pattern); +hypre_TFree(ijbuf_data, HYPRE_MEMORY_HOST); +hypre_TFree(ijbuf_cols, HYPRE_MEMORY_HOST); +hypre_TFree(ijbuf_rownums, HYPRE_MEMORY_HOST); +hypre_TFree(ijbuf_numcols, HYPRE_MEMORY_HOST); +if(sym_collapse) +{ + hypre_TFree(ijbuf_sym_data, HYPRE_MEMORY_HOST); + hypre_TFree(ijbuf_sym_cols, HYPRE_MEMORY_HOST); + hypre_TFree(ijbuf_sym_rownums, HYPRE_MEMORY_HOST); + hypre_TFree(ijbuf_sym_numcols, HYPRE_MEMORY_HOST); +} + +return Pattern_CSR; } HYPRE_Int -hypre_BoomerAMGBuildNonGalerkinCoarseOperator( hypre_ParCSRMatrix **RAP_ptr, +hypre_BoomerAMGBuildNonGalerkinCoarseOperator( hypre_ParCSRMatrix **RAP_ptr, hypre_ParCSRMatrix *AP, - HYPRE_Real strong_threshold, + HYPRE_Real strong_threshold, HYPRE_Real max_row_sum, - HYPRE_Int num_functions, - HYPRE_Int * dof_func_value, + HYPRE_Int num_functions, + HYPRE_Int * dof_func_value, HYPRE_Real S_commpkg_switch, - HYPRE_Int * CF_marker, - HYPRE_Real droptol, HYPRE_Int sym_collapse, + HYPRE_Int * CF_marker, + HYPRE_Real droptol, HYPRE_Int sym_collapse, HYPRE_Real lump_percent, HYPRE_Int collapse_beta ) { - /* Initializations */ - MPI_Comm comm = hypre_ParCSRMatrixComm(*RAP_ptr); - hypre_ParCSRMatrix *S = NULL; - hypre_ParCSRMatrix *RAP = *RAP_ptr; - HYPRE_Int *col_offd_S_to_A = NULL; - HYPRE_Int i, j, k, row_start, row_end, value, num_cols_offd_Sext, num_procs; - HYPRE_Int S_ext_diag_size, S_ext_offd_size, last_col_diag_RAP, cnt_offd, cnt_diag, cnt; - HYPRE_Int col_indx_Pattern, current_Pattern_j, col_indx_RAP; - /* HYPRE_Real start_time = hypre_MPI_Wtime(); */ - /* HYPRE_Real end_time; */ - HYPRE_BigInt *temp = NULL; - HYPRE_Int ierr = 0; - char filename[256]; - - /* Lumping related variables */ - HYPRE_IJMatrix ijmatrix; - HYPRE_Int * Pattern_offd_indices = NULL; - HYPRE_Int * S_offd_indices = NULL; - HYPRE_Int * offd_intersection = NULL; - HYPRE_Real * offd_intersection_data = NULL; - HYPRE_Int * diag_intersection = NULL; - HYPRE_Real * diag_intersection_data = NULL; - HYPRE_Int Pattern_offd_indices_len = 0; - HYPRE_Int Pattern_offd_indices_allocated_len= 0; - HYPRE_Int S_offd_indices_len = 0; - HYPRE_Int S_offd_indices_allocated_len = 0; - HYPRE_Int offd_intersection_len = 0; - HYPRE_Int offd_intersection_allocated_len = 0; - HYPRE_Int diag_intersection_len = 0; - HYPRE_Int diag_intersection_allocated_len = 0; - HYPRE_Real intersection_len = 0; - HYPRE_Int * Pattern_indices_ptr = NULL; - HYPRE_Int Pattern_diag_indices_len = 0; - HYPRE_Int global_row = 0; - HYPRE_Int has_row_ended = 0; - HYPRE_Real lump_value = 0.; - HYPRE_Real diagonal_lump_value = 0.; - HYPRE_Real neg_lump_value = 0.; - HYPRE_Real sum_strong_neigh = 0.; - HYPRE_Int * rownz = NULL; - - /* offd and diag portions of RAP */ - hypre_CSRMatrix *RAP_diag = hypre_ParCSRMatrixDiag(RAP); - HYPRE_Int *RAP_diag_i = hypre_CSRMatrixI(RAP_diag); - HYPRE_Real *RAP_diag_data = hypre_CSRMatrixData(RAP_diag); - HYPRE_Int *RAP_diag_j = hypre_CSRMatrixJ(RAP_diag); - HYPRE_BigInt first_col_diag_RAP = hypre_ParCSRMatrixFirstColDiag(RAP); - HYPRE_Int num_cols_diag_RAP = hypre_CSRMatrixNumCols(RAP_diag); - - hypre_CSRMatrix *RAP_offd = hypre_ParCSRMatrixOffd(RAP); - HYPRE_Int *RAP_offd_i = hypre_CSRMatrixI(RAP_offd); - HYPRE_Real *RAP_offd_data = NULL; - HYPRE_Int *RAP_offd_j = hypre_CSRMatrixJ(RAP_offd); - HYPRE_BigInt *col_map_offd_RAP = hypre_ParCSRMatrixColMapOffd(RAP); - HYPRE_Int num_cols_RAP_offd = hypre_CSRMatrixNumCols(RAP_offd); - - HYPRE_Int num_variables = hypre_CSRMatrixNumRows(RAP_diag); - HYPRE_BigInt global_num_vars = hypre_ParCSRMatrixGlobalNumRows(RAP); - - /* offd and diag portions of S */ - hypre_CSRMatrix *S_diag = NULL; - HYPRE_Int *S_diag_i = NULL; - HYPRE_Real *S_diag_data = NULL; - HYPRE_Int *S_diag_j = NULL; - - hypre_CSRMatrix *S_offd = NULL; - HYPRE_Int *S_offd_i = NULL; - HYPRE_Real *S_offd_data = NULL; - HYPRE_Int *S_offd_j = NULL; - HYPRE_BigInt *col_map_offd_S = NULL; - - HYPRE_Int num_cols_offd_S; - /* HYPRE_Int num_nonzeros_S_diag; */ - - /* off processor portions of S */ - hypre_CSRMatrix *S_ext = NULL; - HYPRE_Int *S_ext_i = NULL; - HYPRE_Real *S_ext_data = NULL; - HYPRE_BigInt *S_ext_j = NULL; - - HYPRE_Int *S_ext_diag_i = NULL; - HYPRE_Real *S_ext_diag_data = NULL; - HYPRE_Int *S_ext_diag_j = NULL; - - HYPRE_Int *S_ext_offd_i = NULL; - HYPRE_Real *S_ext_offd_data = NULL; - HYPRE_Int *S_ext_offd_j = NULL; - HYPRE_BigInt *col_map_offd_Sext = NULL; - /* HYPRE_Int num_nonzeros_S_ext_diag; - HYPRE_Int num_nonzeros_S_ext_offd; - HYPRE_Int num_rows_Sext = 0; */ - HYPRE_Int row_indx_Sext = 0; - - - /* offd and diag portions of Pattern */ - hypre_ParCSRMatrix *Pattern = NULL; - hypre_CSRMatrix *Pattern_diag = NULL; - HYPRE_Int *Pattern_diag_i = NULL; - HYPRE_Real *Pattern_diag_data = NULL; - HYPRE_Int *Pattern_diag_j = NULL; - - hypre_CSRMatrix *Pattern_offd = NULL; - HYPRE_Int *Pattern_offd_i = NULL; - HYPRE_Real *Pattern_offd_data = NULL; - HYPRE_Int *Pattern_offd_j = NULL; - HYPRE_BigInt *col_map_offd_Pattern = NULL; - - HYPRE_Int num_cols_Pattern_offd; - HYPRE_Int my_id; - - /* Buffered IJAddToValues */ - HYPRE_Int ijbuf_cnt, ijbuf_size, ijbuf_rowcounter; - HYPRE_Real *ijbuf_data; - HYPRE_BigInt *ijbuf_cols, *ijbuf_rownums; - HYPRE_Int *ijbuf_numcols; - - /* Buffered IJAddToValues for Symmetric Entries */ - HYPRE_Int ijbuf_sym_cnt, ijbuf_sym_rowcounter; - HYPRE_Real *ijbuf_sym_data; - HYPRE_BigInt *ijbuf_sym_cols, *ijbuf_sym_rownums; - HYPRE_Int *ijbuf_sym_numcols; - - /* Further Initializations */ - if (num_cols_RAP_offd) - { RAP_offd_data = hypre_CSRMatrixData(RAP_offd); } - hypre_MPI_Comm_size(comm, &num_procs); - hypre_MPI_Comm_rank(comm, &my_id); - - /* Compute Sparsity Pattern */ - Pattern = hypre_NonGalerkinSparsityPattern(AP, RAP, CF_marker, droptol, sym_collapse, collapse_beta); - Pattern_diag = hypre_ParCSRMatrixDiag(Pattern); - Pattern_diag_i = hypre_CSRMatrixI(Pattern_diag); - Pattern_diag_data = hypre_CSRMatrixData(Pattern_diag); - Pattern_diag_j = hypre_CSRMatrixJ(Pattern_diag); - - Pattern_offd = hypre_ParCSRMatrixOffd(Pattern); - Pattern_offd_i = hypre_CSRMatrixI(Pattern_offd); - Pattern_offd_j = hypre_CSRMatrixJ(Pattern_offd); - col_map_offd_Pattern = hypre_ParCSRMatrixColMapOffd(Pattern); - - num_cols_Pattern_offd = hypre_CSRMatrixNumCols(Pattern_offd); - if (num_cols_Pattern_offd) - { Pattern_offd_data = hypre_CSRMatrixData(Pattern_offd); } - - /** - * Fill in the entries of Pattern with entries from RAP - **/ - - /* First, sort column indices in RAP and Pattern */ - for(i = 0; i < num_variables; i++) - { - /* The diag matrices store the diagonal as first element in each row. - * We maintain that for the case of Pattern and RAP, because the - * strength of connection routine relies on it and we need to ignore - * diagonal entries in Pattern later during set intersections. - * */ - - /* Sort diag portion of RAP */ - row_start = RAP_diag_i[i]; - if( RAP_diag_j[row_start] == i) - { row_start = row_start + 1; } - row_end = RAP_diag_i[i+1]; - hypre_qsort1(RAP_diag_j, RAP_diag_data, row_start, row_end-1 ); - - /* Sort diag portion of Pattern */ - row_start = Pattern_diag_i[i]; - - if( Pattern_diag_j[row_start] == i) - { row_start = row_start + 1; } - row_end = Pattern_diag_i[i+1]; - hypre_qsort1(Pattern_diag_j, Pattern_diag_data, row_start, row_end-1 ); - - /* Sort offd portion of RAP */ - row_start = RAP_offd_i[i]; - row_end = RAP_offd_i[i+1]; - hypre_qsort1(RAP_offd_j, RAP_offd_data, row_start, row_end-1 ); - - /* Sort offd portion of Pattern */ - /* Be careful to map coarse dof i with CF_marker into Pattern */ - row_start = Pattern_offd_i[i]; - row_end = Pattern_offd_i[i+1]; - hypre_qsort1(Pattern_offd_j, Pattern_offd_data, row_start, row_end-1 ); - - } - - - /* Create Strength matrix based on RAP or Pattern. If Pattern is used, - * then the SortedCopyParCSRData(...) function call must also be commented - * back in */ - /* hypre_SortedCopyParCSRData(RAP, Pattern); */ - if(0) - { - /* hypre_BoomerAMG_MyCreateS(Pattern, strong_threshold, max_row_sum, */ - hypre_BoomerAMG_MyCreateS(RAP, strong_threshold, max_row_sum, - num_functions, dof_func_value, &S); - } - else - { - /* Passing in "1, NULL" because dof_array is not needed - * because we assume that the number of functions is 1 */ - /* hypre_BoomerAMG_MyCreateS(Pattern, strong_threshold, max_row_sum,*/ - hypre_BoomerAMG_MyCreateS(RAP, strong_threshold, max_row_sum, - 1, NULL, &S); - } - /*if (0)*/ /*(strong_threshold > S_commpkg_switch)*/ - /*{ hypre_BoomerAMG_MyCreateSCommPkg(RAP, S, &col_offd_S_to_A); }*/ - - /* Grab diag and offd parts of S */ - S_diag = hypre_ParCSRMatrixDiag(S); - S_diag_i = hypre_CSRMatrixI(S_diag); - S_diag_j = hypre_CSRMatrixJ(S_diag); - S_diag_data = hypre_CSRMatrixData(S_diag); - - S_offd = hypre_ParCSRMatrixOffd(S); - S_offd_i = hypre_CSRMatrixI(S_offd); - S_offd_j = hypre_CSRMatrixJ(S_offd); - S_offd_data = hypre_CSRMatrixData(S_offd); - col_map_offd_S = hypre_ParCSRMatrixColMapOffd(S); - - num_cols_offd_S = hypre_CSRMatrixNumCols(S_offd); - /* num_nonzeros_S_diag = S_diag_i[num_variables]; */ - - - - - /* Grab part of S that is distance one away from the local rows - * This is needed later for the stencil collapsing. This section - * of the code mimics par_rap.c when it extracts Ps_ext. - * When moving from par_rap.c, the variable name changes were: - * A --> RAP - * P --> S - * Ps_ext --> S_ext - * P_ext_diag --> S_ext_diag - * P_ext_offd --> S_ext_offd - * - * The data layout of S_ext as returned by ExtractBExt gives you only global - * column indices, and must be converted to the local numbering. This code - * section constructs S_ext_diag and S_ext_offd, which are the distance 1 - * couplings in S based on the sparsity structure in RAP. - * --> S_ext_diag corresponds to the same column slice that RAP_diag - * corresponds to. Thus, the column indexing is the same as in - * RAP_diag such that S_ext_diag_j[k] just needs to be offset by - * the RAP_diag first global dof offset. - * --> S_ext_offd column indexing is a little more complicated, and - * requires the computation below of col_map_S_ext_offd, which - * maps the local 0,1,2,... column indexing in S_ext_offd to global - * dof numbers. Note, that the num_cols_RAP_offd is NOT equal to - * num_cols_offd_S_ext - * --> The row indexing of S_ext_diag|offd is as follows. Use - * col_map_offd_RAP, where the first index corresponds to the - * first global row index in S_ext_diag|offd. Remember that ExtractBExt - * grabs the information from S required for locally computing - * (RAP*S)[proc_k row slice, :] */ - - if (num_procs > 1) - { - S_ext = hypre_ParCSRMatrixExtractBExt(S,RAP,1); - S_ext_data = hypre_CSRMatrixData(S_ext); - S_ext_i = hypre_CSRMatrixI(S_ext); - S_ext_j = hypre_CSRMatrixBigJ(S_ext); - } - - /* This uses the num_cols_RAP_offd to set S_ext_diag|offd_i, because S_ext - * is the off-processor information needed to compute RAP*S. That is, - * num_cols_RAP_offd represents the number of rows needed from S_ext for - * the multiplication */ - S_ext_diag_i = hypre_CTAlloc(HYPRE_Int, num_cols_RAP_offd+1, HYPRE_MEMORY_HOST); - S_ext_offd_i = hypre_CTAlloc(HYPRE_Int, num_cols_RAP_offd+1, HYPRE_MEMORY_HOST); - S_ext_diag_size = 0; - S_ext_offd_size = 0; - /* num_rows_Sext = num_cols_RAP_offd; */ - last_col_diag_RAP = first_col_diag_RAP + num_cols_diag_RAP - 1; - - /* construct the S_ext_diag and _offd row-pointer arrays by counting elements - * This looks to create offd and diag blocks related to the local rows belonging - * to this processor...we may not need to split up S_ext this way...or we could. - * It would make for faster binary searching and set intersecting later...this will - * be the bottle neck so LETS SPLIT THIS UP Between offd and diag*/ - for (i=0; i < num_cols_RAP_offd; i++) - { - for (j=S_ext_i[i]; j < S_ext_i[i+1]; j++) - if (S_ext_j[j] < first_col_diag_RAP || S_ext_j[j] > last_col_diag_RAP) - S_ext_offd_size++; - else - S_ext_diag_size++; - S_ext_diag_i[i+1] = S_ext_diag_size; - S_ext_offd_i[i+1] = S_ext_offd_size; - } - - if (S_ext_diag_size) - { - S_ext_diag_j = hypre_CTAlloc(HYPRE_Int, S_ext_diag_size, HYPRE_MEMORY_HOST); - S_ext_diag_data = hypre_CTAlloc(HYPRE_Real, S_ext_diag_size, HYPRE_MEMORY_HOST); - } - if (S_ext_offd_size) - { - S_ext_offd_j = hypre_CTAlloc(HYPRE_Int, S_ext_offd_size, HYPRE_MEMORY_HOST); - S_ext_offd_data = hypre_CTAlloc(HYPRE_Real, S_ext_offd_size, HYPRE_MEMORY_HOST); - } - - /* This copies over the column indices into the offd and diag parts. - * The diag portion has it's local column indices shifted to start at 0. - * The offd portion requires more work to construct the col_map_offd array - * and a local column ordering. */ - cnt_offd = 0; - cnt_diag = 0; - cnt = 0; - for (i=0; i < num_cols_RAP_offd; i++) - { - for (j=S_ext_i[i]; j < S_ext_i[i+1]; j++) - if (S_ext_j[j] < first_col_diag_RAP || S_ext_j[j] > last_col_diag_RAP) - { - S_ext_offd_data[cnt_offd] = S_ext_data[j]; - //S_ext_offd_j[cnt_offd++] = S_ext_j[j]; - S_ext_j[cnt_offd++] = S_ext_j[j]; - } - else - { - S_ext_diag_data[cnt_diag] = S_ext_data[j]; - S_ext_diag_j[cnt_diag++] = (HYPRE_Int)(S_ext_j[j] - first_col_diag_RAP); - } - } - - /* This creates col_map_offd_Sext */ - if (S_ext_offd_size || num_cols_offd_S) - { - temp = hypre_CTAlloc(HYPRE_BigInt, S_ext_offd_size+num_cols_offd_S, HYPRE_MEMORY_HOST); - for (i=0; i < S_ext_offd_size; i++) - temp[i] = S_ext_j[i]; - cnt = S_ext_offd_size; - for (i=0; i < num_cols_offd_S; i++) - temp[cnt++] = col_map_offd_S[i]; - } - if (cnt) - { - /* after this, the first so many entries of temp will hold the - * unique column indices in S_ext_offd_j unioned with the indices - * in col_map_offd_S */ - hypre_BigQsort0(temp, 0, cnt-1); - - num_cols_offd_Sext = 1; - value = temp[0]; - for (i=1; i < cnt; i++) - { - if (temp[i] > value) - { - value = temp[i]; - temp[num_cols_offd_Sext++] = value; - } - } - } - else - { - num_cols_offd_Sext = 0; - } - - /* num_nonzeros_S_ext_diag = cnt_diag; - num_nonzeros_S_ext_offd = S_ext_offd_size; */ - - if (num_cols_offd_Sext) - col_map_offd_Sext = hypre_CTAlloc(HYPRE_BigInt, num_cols_offd_Sext, HYPRE_MEMORY_HOST); - - for (i=0; i < num_cols_offd_Sext; i++) - col_map_offd_Sext[i] = temp[i]; - - if (S_ext_offd_size || num_cols_offd_S) - hypre_TFree(temp, HYPRE_MEMORY_HOST); - - /* look for S_ext_offd_j[i] in col_map_offd_Sext, and set S_ext_offd_j[i] - * to the index of that column value in col_map_offd_Sext */ - for (i=0 ; i < S_ext_offd_size; i++) - S_ext_offd_j[i] = hypre_BigBinarySearch(col_map_offd_Sext, - S_ext_j[i], - num_cols_offd_Sext); - - - if (num_procs > 1) - { - hypre_CSRMatrixDestroy(S_ext); - S_ext = NULL; - } - - /* Need to sort column indices in S and S_ext */ - for(i = 0; i < num_variables; i++) - { - - /* Re-Sort diag portion of Pattern, placing the diagonal entry in a - * sorted position */ - row_start = Pattern_diag_i[i]; - row_end = Pattern_diag_i[i+1]; - hypre_qsort1(Pattern_diag_j, Pattern_diag_data, row_start, row_end-1 ); - - /* Sort diag portion of S, noting that no diagonal entry */ - /* S has not "data" array...it's just NULL */ - row_start = S_diag_i[i]; - row_end = S_diag_i[i+1]; - hypre_qsort1(S_diag_j, S_diag_data, row_start, row_end-1 ); - - /* Sort offd portion of S */ - /* S has no "data" array...it's just NULL */ - row_start = S_offd_i[i]; - row_end = S_offd_i[i+1]; - hypre_qsort1(S_offd_j, S_offd_data, row_start, row_end-1 ); - - } - - /* Sort S_ext - * num_cols_RAP_offd equals num_rows for S_ext*/ - for(i = 0; i < num_cols_RAP_offd; i++) - { - /* Sort diag portion of S_ext */ - row_start = S_ext_diag_i[i]; - row_end = S_ext_diag_i[i+1]; - hypre_qsort1(S_ext_diag_j, S_ext_diag_data, row_start, row_end-1 ); - - /* Sort offd portion of S_ext */ - row_start = S_ext_offd_i[i]; - row_end = S_ext_offd_i[i+1]; - hypre_qsort1(S_ext_offd_j, S_ext_offd_data, row_start, row_end-1 ); - - } - - /* - * Now, for the fun stuff -- Computing the Non-Galerkin Operator - */ - - /* Initialize the ijmatrix, leveraging our knowledge of the nonzero - * structure in Pattern */ - ierr += HYPRE_IJMatrixCreate(comm, first_col_diag_RAP, last_col_diag_RAP, - first_col_diag_RAP, last_col_diag_RAP, &ijmatrix); - ierr += HYPRE_IJMatrixSetObjectType(ijmatrix, HYPRE_PARCSR); - rownz = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); - for(i = 0; i < num_variables; i++) - { rownz[i] = 1.2*(Pattern_diag_i[i+1] - Pattern_diag_i[i]) + 1.2*(Pattern_offd_i[i+1] - Pattern_offd_i[i]); } - HYPRE_IJMatrixSetRowSizes(ijmatrix, rownz); - ierr += HYPRE_IJMatrixInitialize(ijmatrix); - hypre_TFree(rownz, HYPRE_MEMORY_HOST); - - /* - *For efficiency, we do a buffered IJAddToValues. - * Here, we initialize the buffer and then initialize the buffer counters - */ - ijbuf_size = 1000; - ijbuf_data = hypre_CTAlloc(HYPRE_Real, ijbuf_size, HYPRE_MEMORY_HOST); - ijbuf_cols = hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); - ijbuf_rownums = hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); - ijbuf_numcols = hypre_CTAlloc(HYPRE_Int, ijbuf_size, HYPRE_MEMORY_HOST); - hypre_NonGalerkinIJBigBufferInit( &ijbuf_cnt, &ijbuf_rowcounter, ijbuf_cols ); - if(sym_collapse) - { - ijbuf_sym_data = hypre_CTAlloc(HYPRE_Real, ijbuf_size, HYPRE_MEMORY_HOST); - ijbuf_sym_cols = hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); - ijbuf_sym_rownums= hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); - ijbuf_sym_numcols= hypre_CTAlloc(HYPRE_Int, ijbuf_size, HYPRE_MEMORY_HOST); - hypre_NonGalerkinIJBigBufferInit( &ijbuf_sym_cnt, &ijbuf_sym_rowcounter, ijbuf_sym_cols ); - } - - /* - * Eliminate Entries In RAP_diag - * */ - for(i = 0; i < num_variables; i++) - { - global_row = i+first_col_diag_RAP; - row_start = RAP_diag_i[i]; - row_end = RAP_diag_i[i+1]; - has_row_ended = 0; - - /* Only do work if row has nonzeros */ - if( row_start < row_end) - { - /* Grab pointer to current entry in Pattern_diag */ - current_Pattern_j = Pattern_diag_i[i]; - col_indx_Pattern = Pattern_diag_j[current_Pattern_j]; - - /* Grab this row's indices out of Pattern offd and diag. This will - * be for computing index set intersections for lumping */ - /* Ensure adequate length */ - Pattern_offd_indices_len = Pattern_offd_i[i+1] - Pattern_offd_i[i]; - if(Pattern_offd_indices_allocated_len < Pattern_offd_indices_len) + /* Initializations */ + MPI_Comm comm = hypre_ParCSRMatrixComm(*RAP_ptr); + hypre_ParCSRMatrix *S = NULL; + hypre_ParCSRMatrix *RAP = *RAP_ptr; + HYPRE_Int *col_offd_S_to_A = NULL; + HYPRE_Int i, j, k, row_start, row_end, value, num_cols_offd_Sext, num_procs; + HYPRE_Int S_ext_diag_size, S_ext_offd_size, last_col_diag_RAP, cnt_offd, cnt_diag, cnt; + HYPRE_Int col_indx_Pattern, current_Pattern_j, col_indx_RAP; + /* HYPRE_Real start_time = hypre_MPI_Wtime(); */ + /* HYPRE_Real end_time; */ + HYPRE_BigInt *temp = NULL; + HYPRE_Int ierr = 0; + char filename[256]; + + /* Lumping related variables */ + HYPRE_IJMatrix ijmatrix; + HYPRE_BigInt * Pattern_offd_indices = NULL; + HYPRE_BigInt * S_offd_indices = NULL; + HYPRE_BigInt * offd_intersection = NULL; + HYPRE_Real * offd_intersection_data = NULL; + HYPRE_Int * diag_intersection = NULL; + HYPRE_Real * diag_intersection_data = NULL; + HYPRE_Int Pattern_offd_indices_len = 0; + HYPRE_Int Pattern_offd_indices_allocated_len= 0; + HYPRE_Int S_offd_indices_len = 0; + HYPRE_Int S_offd_indices_allocated_len = 0; + HYPRE_Int offd_intersection_len = 0; + HYPRE_Int offd_intersection_allocated_len = 0; + HYPRE_Int diag_intersection_len = 0; + HYPRE_Int diag_intersection_allocated_len = 0; + HYPRE_Real intersection_len = 0; + HYPRE_Int * Pattern_indices_ptr = NULL; + HYPRE_Int Pattern_diag_indices_len = 0; + HYPRE_Int global_row = 0; + HYPRE_Int has_row_ended = 0; + HYPRE_Real lump_value = 0.; + HYPRE_Real diagonal_lump_value = 0.; + HYPRE_Real neg_lump_value = 0.; + HYPRE_Real sum_strong_neigh = 0.; + HYPRE_Int * rownz = NULL; + + /* offd and diag portions of RAP */ + hypre_CSRMatrix *RAP_diag = hypre_ParCSRMatrixDiag(RAP); + HYPRE_Int *RAP_diag_i = hypre_CSRMatrixI(RAP_diag); + HYPRE_Real *RAP_diag_data = hypre_CSRMatrixData(RAP_diag); + HYPRE_Int *RAP_diag_j = hypre_CSRMatrixJ(RAP_diag); + HYPRE_BigInt first_col_diag_RAP = hypre_ParCSRMatrixFirstColDiag(RAP); + HYPRE_Int num_cols_diag_RAP = hypre_CSRMatrixNumCols(RAP_diag); + + hypre_CSRMatrix *RAP_offd = hypre_ParCSRMatrixOffd(RAP); + HYPRE_Int *RAP_offd_i = hypre_CSRMatrixI(RAP_offd); + HYPRE_Real *RAP_offd_data = NULL; + HYPRE_Int *RAP_offd_j = hypre_CSRMatrixJ(RAP_offd); + HYPRE_BigInt *col_map_offd_RAP = hypre_ParCSRMatrixColMapOffd(RAP); + HYPRE_Int num_cols_RAP_offd = hypre_CSRMatrixNumCols(RAP_offd); + + HYPRE_Int num_variables = hypre_CSRMatrixNumRows(RAP_diag); + HYPRE_BigInt global_num_vars = hypre_ParCSRMatrixGlobalNumRows(RAP); + + /* offd and diag portions of S */ + hypre_CSRMatrix *S_diag = NULL; + HYPRE_Int *S_diag_i = NULL; + HYPRE_Real *S_diag_data = NULL; + HYPRE_Int *S_diag_j = NULL; + + hypre_CSRMatrix *S_offd = NULL; + HYPRE_Int *S_offd_i = NULL; + HYPRE_Real *S_offd_data = NULL; + HYPRE_Int *S_offd_j = NULL; + HYPRE_BigInt *col_map_offd_S = NULL; + + HYPRE_Int num_cols_offd_S; + /* HYPRE_Int num_nonzeros_S_diag; */ + + /* off processor portions of S */ + hypre_CSRMatrix *S_ext = NULL; + HYPRE_Int *S_ext_i = NULL; + HYPRE_Real *S_ext_data = NULL; + HYPRE_BigInt *S_ext_j = NULL; + + HYPRE_Int *S_ext_diag_i = NULL; + HYPRE_Real *S_ext_diag_data = NULL; + HYPRE_Int *S_ext_diag_j = NULL; + + HYPRE_Int *S_ext_offd_i = NULL; + HYPRE_Real *S_ext_offd_data = NULL; + HYPRE_Int *S_ext_offd_j = NULL; + HYPRE_BigInt *col_map_offd_Sext = NULL; + /* HYPRE_Int num_nonzeros_S_ext_diag; + HYPRE_Int num_nonzeros_S_ext_offd; + HYPRE_Int num_rows_Sext = 0; */ + HYPRE_Int row_indx_Sext = 0; + + + /* offd and diag portions of Pattern */ + hypre_ParCSRMatrix *Pattern = NULL; + hypre_CSRMatrix *Pattern_diag = NULL; + HYPRE_Int *Pattern_diag_i = NULL; + HYPRE_Real *Pattern_diag_data = NULL; + HYPRE_Int *Pattern_diag_j = NULL; + + hypre_CSRMatrix *Pattern_offd = NULL; + HYPRE_Int *Pattern_offd_i = NULL; + HYPRE_Real *Pattern_offd_data = NULL; + HYPRE_Int *Pattern_offd_j = NULL; + HYPRE_BigInt *col_map_offd_Pattern = NULL; + + HYPRE_Int num_cols_Pattern_offd; + HYPRE_Int my_id; + + /* Buffered IJAddToValues */ + HYPRE_Int ijbuf_cnt, ijbuf_size, ijbuf_rowcounter; + HYPRE_Real *ijbuf_data; + HYPRE_BigInt *ijbuf_cols, *ijbuf_rownums; + HYPRE_Int *ijbuf_numcols; + + /* Buffered IJAddToValues for Symmetric Entries */ + HYPRE_Int ijbuf_sym_cnt, ijbuf_sym_rowcounter; + HYPRE_Real *ijbuf_sym_data; + HYPRE_BigInt *ijbuf_sym_cols, *ijbuf_sym_rownums; + HYPRE_Int *ijbuf_sym_numcols; + + /* Further Initializations */ + if (num_cols_RAP_offd) + { RAP_offd_data = hypre_CSRMatrixData(RAP_offd); } + hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_rank(comm, &my_id); + + /* Compute Sparsity Pattern */ + Pattern = hypre_NonGalerkinSparsityPattern(AP, RAP, CF_marker, droptol, sym_collapse, collapse_beta); + Pattern_diag = hypre_ParCSRMatrixDiag(Pattern); + Pattern_diag_i = hypre_CSRMatrixI(Pattern_diag); + Pattern_diag_data = hypre_CSRMatrixData(Pattern_diag); + Pattern_diag_j = hypre_CSRMatrixJ(Pattern_diag); + + Pattern_offd = hypre_ParCSRMatrixOffd(Pattern); + Pattern_offd_i = hypre_CSRMatrixI(Pattern_offd); + Pattern_offd_j = hypre_CSRMatrixJ(Pattern_offd); + col_map_offd_Pattern = hypre_ParCSRMatrixColMapOffd(Pattern); + + num_cols_Pattern_offd = hypre_CSRMatrixNumCols(Pattern_offd); + if (num_cols_Pattern_offd) + { Pattern_offd_data = hypre_CSRMatrixData(Pattern_offd); } + + /** + * Fill in the entries of Pattern with entries from RAP + **/ + + /* First, sort column indices in RAP and Pattern */ + for(i = 0; i < num_variables; i++) + { + /* The diag matrices store the diagonal as first element in each row. + * We maintain that for the case of Pattern and RAP, because the + * strength of connection routine relies on it and we need to ignore + * diagonal entries in Pattern later during set intersections. + * */ + + /* Sort diag portion of RAP */ + row_start = RAP_diag_i[i]; + if( RAP_diag_j[row_start] == i) + { row_start = row_start + 1; } + row_end = RAP_diag_i[i+1]; + hypre_qsort1(RAP_diag_j, RAP_diag_data, row_start, row_end-1 ); + + /* Sort diag portion of Pattern */ + row_start = Pattern_diag_i[i]; + + if( Pattern_diag_j[row_start] == i) + { row_start = row_start + 1; } + row_end = Pattern_diag_i[i+1]; + hypre_qsort1(Pattern_diag_j, Pattern_diag_data, row_start, row_end-1 ); + + /* Sort offd portion of RAP */ + row_start = RAP_offd_i[i]; + row_end = RAP_offd_i[i+1]; + hypre_qsort1(RAP_offd_j, RAP_offd_data, row_start, row_end-1 ); + + /* Sort offd portion of Pattern */ + /* Be careful to map coarse dof i with CF_marker into Pattern */ + row_start = Pattern_offd_i[i]; + row_end = Pattern_offd_i[i+1]; + hypre_qsort1(Pattern_offd_j, Pattern_offd_data, row_start, row_end-1 ); + + } + + + /* Create Strength matrix based on RAP or Pattern. If Pattern is used, + * then the SortedCopyParCSRData(...) function call must also be commented + * back in */ + /* hypre_SortedCopyParCSRData(RAP, Pattern); */ + if(0) + { + /* hypre_BoomerAMG_MyCreateS(Pattern, strong_threshold, max_row_sum, */ + hypre_BoomerAMG_MyCreateS(RAP, strong_threshold, max_row_sum, + num_functions, dof_func_value, &S); + } + else + { + /* Passing in "1, NULL" because dof_array is not needed + * because we assume that the number of functions is 1 */ + /* hypre_BoomerAMG_MyCreateS(Pattern, strong_threshold, max_row_sum,*/ + hypre_BoomerAMG_MyCreateS(RAP, strong_threshold, max_row_sum, + 1, NULL, &S); + } + /*if (0)*/ /*(strong_threshold > S_commpkg_switch)*/ + /*{ hypre_BoomerAMG_MyCreateSCommPkg(RAP, S, &col_offd_S_to_A); }*/ + + /* Grab diag and offd parts of S */ + S_diag = hypre_ParCSRMatrixDiag(S); + S_diag_i = hypre_CSRMatrixI(S_diag); + S_diag_j = hypre_CSRMatrixJ(S_diag); + S_diag_data = hypre_CSRMatrixData(S_diag); + + S_offd = hypre_ParCSRMatrixOffd(S); + S_offd_i = hypre_CSRMatrixI(S_offd); + S_offd_j = hypre_CSRMatrixJ(S_offd); + S_offd_data = hypre_CSRMatrixData(S_offd); + col_map_offd_S = hypre_ParCSRMatrixColMapOffd(S); + + num_cols_offd_S = hypre_CSRMatrixNumCols(S_offd); + /* num_nonzeros_S_diag = S_diag_i[num_variables]; */ + + + + + /* Grab part of S that is distance one away from the local rows + * This is needed later for the stencil collapsing. This section + * of the code mimics par_rap.c when it extracts Ps_ext. + * When moving from par_rap.c, the variable name changes were: + * A --> RAP + * P --> S + * Ps_ext --> S_ext + * P_ext_diag --> S_ext_diag + * P_ext_offd --> S_ext_offd + * + * The data layout of S_ext as returned by ExtractBExt gives you only global + * column indices, and must be converted to the local numbering. This code + * section constructs S_ext_diag and S_ext_offd, which are the distance 1 + * couplings in S based on the sparsity structure in RAP. + * --> S_ext_diag corresponds to the same column slice that RAP_diag + * corresponds to. Thus, the column indexing is the same as in + * RAP_diag such that S_ext_diag_j[k] just needs to be offset by + * the RAP_diag first global dof offset. + * --> S_ext_offd column indexing is a little more complicated, and + * requires the computation below of col_map_S_ext_offd, which + * maps the local 0,1,2,... column indexing in S_ext_offd to global + * dof numbers. Note, that the num_cols_RAP_offd is NOT equal to + * num_cols_offd_S_ext + * --> The row indexing of S_ext_diag|offd is as follows. Use + * col_map_offd_RAP, where the first index corresponds to the + * first global row index in S_ext_diag|offd. Remember that ExtractBExt + * grabs the information from S required for locally computing + * (RAP*S)[proc_k row slice, :] */ + + if (num_procs > 1) + { + S_ext = hypre_ParCSRMatrixExtractBExt(S,RAP,1); + S_ext_data = hypre_CSRMatrixData(S_ext); + S_ext_i = hypre_CSRMatrixI(S_ext); + S_ext_j = hypre_CSRMatrixBigJ(S_ext); + } + + /* This uses the num_cols_RAP_offd to set S_ext_diag|offd_i, because S_ext + * is the off-processor information needed to compute RAP*S. That is, + * num_cols_RAP_offd represents the number of rows needed from S_ext for + * the multiplication */ + S_ext_diag_i = hypre_CTAlloc(HYPRE_Int, num_cols_RAP_offd+1, HYPRE_MEMORY_HOST); + S_ext_offd_i = hypre_CTAlloc(HYPRE_Int, num_cols_RAP_offd+1, HYPRE_MEMORY_HOST); + S_ext_diag_size = 0; + S_ext_offd_size = 0; + /* num_rows_Sext = num_cols_RAP_offd; */ + last_col_diag_RAP = first_col_diag_RAP + num_cols_diag_RAP - 1; + + /* construct the S_ext_diag and _offd row-pointer arrays by counting elements + * This looks to create offd and diag blocks related to the local rows belonging + * to this processor...we may not need to split up S_ext this way...or we could. + * It would make for faster binary searching and set intersecting later...this will + * be the bottle neck so LETS SPLIT THIS UP Between offd and diag*/ + for (i=0; i < num_cols_RAP_offd; i++) + { + for (j=S_ext_i[i]; j < S_ext_i[i+1]; j++) + if (S_ext_j[j] < first_col_diag_RAP || S_ext_j[j] > last_col_diag_RAP) + S_ext_offd_size++; + else + S_ext_diag_size++; + S_ext_diag_i[i+1] = S_ext_diag_size; + S_ext_offd_i[i+1] = S_ext_offd_size; + } + + if (S_ext_diag_size) + { + S_ext_diag_j = hypre_CTAlloc(HYPRE_Int, S_ext_diag_size, HYPRE_MEMORY_HOST); + S_ext_diag_data = hypre_CTAlloc(HYPRE_Real, S_ext_diag_size, HYPRE_MEMORY_HOST); + } + if (S_ext_offd_size) + { + S_ext_offd_j = hypre_CTAlloc(HYPRE_Int, S_ext_offd_size, HYPRE_MEMORY_HOST); + S_ext_offd_data = hypre_CTAlloc(HYPRE_Real, S_ext_offd_size, HYPRE_MEMORY_HOST); + } + + /* This copies over the column indices into the offd and diag parts. + * The diag portion has it's local column indices shifted to start at 0. + * The offd portion requires more work to construct the col_map_offd array + * and a local column ordering. */ + cnt_offd = 0; + cnt_diag = 0; + cnt = 0; + for (i=0; i < num_cols_RAP_offd; i++) + { + for (j=S_ext_i[i]; j < S_ext_i[i+1]; j++) + if (S_ext_j[j] < first_col_diag_RAP || S_ext_j[j] > last_col_diag_RAP) + { + S_ext_offd_data[cnt_offd] = S_ext_data[j]; + //S_ext_offd_j[cnt_offd++] = S_ext_j[j]; + S_ext_j[cnt_offd++] = S_ext_j[j]; + } + else + { + S_ext_diag_data[cnt_diag] = S_ext_data[j]; + S_ext_diag_j[cnt_diag++] = (HYPRE_Int)(S_ext_j[j] - first_col_diag_RAP); + } + } + + /* This creates col_map_offd_Sext */ + if (S_ext_offd_size || num_cols_offd_S) + { + temp = hypre_CTAlloc(HYPRE_BigInt, S_ext_offd_size+num_cols_offd_S, HYPRE_MEMORY_HOST); + for (i=0; i < S_ext_offd_size; i++) + temp[i] = S_ext_j[i]; + cnt = S_ext_offd_size; + for (i=0; i < num_cols_offd_S; i++) + temp[cnt++] = col_map_offd_S[i]; + } + if (cnt) + { + /* after this, the first so many entries of temp will hold the + * unique column indices in S_ext_offd_j unioned with the indices + * in col_map_offd_S */ + hypre_BigQsort0(temp, 0, cnt-1); + + num_cols_offd_Sext = 1; + value = temp[0]; + for (i=1; i < cnt; i++) + { + if (temp[i] > value) + { + value = temp[i]; + temp[num_cols_offd_Sext++] = value; + } + } + } + else + { + num_cols_offd_Sext = 0; + } + + /* num_nonzeros_S_ext_diag = cnt_diag; + num_nonzeros_S_ext_offd = S_ext_offd_size; */ + + if (num_cols_offd_Sext) + col_map_offd_Sext = hypre_CTAlloc(HYPRE_BigInt, num_cols_offd_Sext, HYPRE_MEMORY_HOST); + + for (i=0; i < num_cols_offd_Sext; i++) + col_map_offd_Sext[i] = temp[i]; + + if (S_ext_offd_size || num_cols_offd_S) + hypre_TFree(temp, HYPRE_MEMORY_HOST); + + /* look for S_ext_offd_j[i] in col_map_offd_Sext, and set S_ext_offd_j[i] + * to the index of that column value in col_map_offd_Sext */ + for (i=0 ; i < S_ext_offd_size; i++) + S_ext_offd_j[i] = hypre_BigBinarySearch(col_map_offd_Sext, + S_ext_j[i], + num_cols_offd_Sext); + + + if (num_procs > 1) + { + hypre_CSRMatrixDestroy(S_ext); + S_ext = NULL; + } + + /* Need to sort column indices in S and S_ext */ + for(i = 0; i < num_variables; i++) + { + + /* Re-Sort diag portion of Pattern, placing the diagonal entry in a + * sorted position */ + row_start = Pattern_diag_i[i]; + row_end = Pattern_diag_i[i+1]; + hypre_qsort1(Pattern_diag_j, Pattern_diag_data, row_start, row_end-1 ); + + /* Sort diag portion of S, noting that no diagonal entry */ + /* S has not "data" array...it's just NULL */ + row_start = S_diag_i[i]; + row_end = S_diag_i[i+1]; + hypre_qsort1(S_diag_j, S_diag_data, row_start, row_end-1 ); + + /* Sort offd portion of S */ + /* S has no "data" array...it's just NULL */ + row_start = S_offd_i[i]; + row_end = S_offd_i[i+1]; + hypre_qsort1(S_offd_j, S_offd_data, row_start, row_end-1 ); + + } + + /* Sort S_ext + * num_cols_RAP_offd equals num_rows for S_ext*/ + for(i = 0; i < num_cols_RAP_offd; i++) + { + /* Sort diag portion of S_ext */ + row_start = S_ext_diag_i[i]; + row_end = S_ext_diag_i[i+1]; + hypre_qsort1(S_ext_diag_j, S_ext_diag_data, row_start, row_end-1 ); + + /* Sort offd portion of S_ext */ + row_start = S_ext_offd_i[i]; + row_end = S_ext_offd_i[i+1]; + hypre_qsort1(S_ext_offd_j, S_ext_offd_data, row_start, row_end-1 ); + + } + + /* + * Now, for the fun stuff -- Computing the Non-Galerkin Operator + */ + + /* Initialize the ijmatrix, leveraging our knowledge of the nonzero + * structure in Pattern */ + ierr += HYPRE_IJMatrixCreate(comm, first_col_diag_RAP, last_col_diag_RAP, + first_col_diag_RAP, last_col_diag_RAP, &ijmatrix); + ierr += HYPRE_IJMatrixSetObjectType(ijmatrix, HYPRE_PARCSR); + rownz = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_HOST); + for(i = 0; i < num_variables; i++) + { rownz[i] = 1.2*(Pattern_diag_i[i+1] - Pattern_diag_i[i]) + 1.2*(Pattern_offd_i[i+1] - Pattern_offd_i[i]); } + HYPRE_IJMatrixSetRowSizes(ijmatrix, rownz); + ierr += HYPRE_IJMatrixInitialize(ijmatrix); + hypre_TFree(rownz, HYPRE_MEMORY_HOST); + + /* + *For efficiency, we do a buffered IJAddToValues. + * Here, we initialize the buffer and then initialize the buffer counters + */ + ijbuf_size = 1000; + ijbuf_data = hypre_CTAlloc(HYPRE_Real, ijbuf_size, HYPRE_MEMORY_HOST); + ijbuf_cols = hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); + ijbuf_rownums = hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); + ijbuf_numcols = hypre_CTAlloc(HYPRE_Int, ijbuf_size, HYPRE_MEMORY_HOST); + hypre_NonGalerkinIJBigBufferInit( &ijbuf_cnt, &ijbuf_rowcounter, ijbuf_cols ); + if(sym_collapse) + { + ijbuf_sym_data = hypre_CTAlloc(HYPRE_Real, ijbuf_size, HYPRE_MEMORY_HOST); + ijbuf_sym_cols = hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); + ijbuf_sym_rownums= hypre_CTAlloc(HYPRE_BigInt, ijbuf_size, HYPRE_MEMORY_HOST); + ijbuf_sym_numcols= hypre_CTAlloc(HYPRE_Int, ijbuf_size, HYPRE_MEMORY_HOST); + hypre_NonGalerkinIJBigBufferInit( &ijbuf_sym_cnt, &ijbuf_sym_rowcounter, ijbuf_sym_cols ); + } + + /* + * Eliminate Entries In RAP_diag + * */ + for(i = 0; i < num_variables; i++) + { + global_row = i+first_col_diag_RAP; + row_start = RAP_diag_i[i]; + row_end = RAP_diag_i[i+1]; + has_row_ended = 0; + + /* Only do work if row has nonzeros */ + if( row_start < row_end) + { + /* Grab pointer to current entry in Pattern_diag */ + current_Pattern_j = Pattern_diag_i[i]; + col_indx_Pattern = Pattern_diag_j[current_Pattern_j]; + + /* Grab this row's indices out of Pattern offd and diag. This will + * be for computing index set intersections for lumping */ + /* Ensure adequate length */ + Pattern_offd_indices_len = Pattern_offd_i[i+1] - Pattern_offd_i[i]; + if(Pattern_offd_indices_allocated_len < Pattern_offd_indices_len) + { + hypre_TFree(Pattern_offd_indices, HYPRE_MEMORY_HOST); + Pattern_offd_indices = hypre_CTAlloc(HYPRE_BigInt, Pattern_offd_indices_len, HYPRE_MEMORY_HOST); + Pattern_offd_indices_allocated_len = Pattern_offd_indices_len; + } + /* Grab sub array from col_map, corresponding to the slice of Pattern_offd_j */ + hypre_GrabSubArray(Pattern_offd_j, + Pattern_offd_i[i], Pattern_offd_i[i+1]-1, + col_map_offd_Pattern, Pattern_offd_indices); + /* No need to grab info out of Pattern_diag_j[...], here we just start from + * Pattern_diag_i[i] and end at index Pattern_diag_i[i+1] - 1. We do need to + * ignore the diagonal entry in Pattern, because we don't lump entries there */ + if( Pattern_diag_j[Pattern_diag_i[i]] == i ) + { + Pattern_indices_ptr = &( Pattern_diag_j[Pattern_diag_i[i]+1]); + Pattern_diag_indices_len = Pattern_diag_i[i+1] - Pattern_diag_i[i] - 1; + } + else + { + Pattern_indices_ptr = &( Pattern_diag_j[Pattern_diag_i[i]]); + Pattern_diag_indices_len = Pattern_diag_i[i+1] - Pattern_diag_i[i]; + } + } + + for(j = row_start; j < row_end; j++) + { + col_indx_RAP = RAP_diag_j[j]; + + /* Ignore zero entries in RAP */ + if( RAP_diag_data[j] != 0.0) + { + /* Don't change the diagonal, just write it */ + if(col_indx_RAP == i) { - hypre_TFree(Pattern_offd_indices, HYPRE_MEMORY_HOST); - Pattern_offd_indices = hypre_CTAlloc(HYPRE_Int, Pattern_offd_indices_len, HYPRE_MEMORY_HOST); - Pattern_offd_indices_allocated_len = Pattern_offd_indices_len; - } - /* Grab sub array from col_map, corresponding to the slice of Pattern_offd_j */ - hypre_GrabSubArray(Pattern_offd_j, - Pattern_offd_i[i], Pattern_offd_i[i+1]-1, - col_map_offd_Pattern, Pattern_offd_indices); - /* No need to grab info out of Pattern_diag_j[...], here we just start from - * Pattern_diag_i[i] and end at index Pattern_diag_i[i+1] - 1. We do need to - * ignore the diagonal entry in Pattern, because we don't lump entries there */ - if( Pattern_diag_j[Pattern_diag_i[i]] == i ) - { - Pattern_indices_ptr = &( Pattern_diag_j[Pattern_diag_i[i]+1]); - Pattern_diag_indices_len = Pattern_diag_i[i+1] - Pattern_diag_i[i] - 1; - } - else - { - Pattern_indices_ptr = &( Pattern_diag_j[Pattern_diag_i[i]]); - Pattern_diag_indices_len = Pattern_diag_i[i+1] - Pattern_diag_i[i]; - } - } - - for(j = row_start; j < row_end; j++) - { - col_indx_RAP = RAP_diag_j[j]; + /*#ifdef HY PRE_USING_OPENMP +#pragma omp critical (IJAdd) +#endif +{*/ + /* For efficiency, we do a buffered IJAddToValues. + * A[global_row, global_row] += RAP_diag_data[j] */ + hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, + global_row, RAP_diag_data[j] ); + /*}*/ - /* Ignore zero entries in RAP */ - if( RAP_diag_data[j] != 0.0) - { - /* Don't change the diagonal, just write it */ - if(col_indx_RAP == i) - { -/*#ifdef HY PRE_USING_OPENMP +} +/* The entry in RAP does not appear in Pattern, so LUMP it */ +else if( (col_indx_RAP < col_indx_Pattern) || has_row_ended) +{ + /* Lump entry (i, col_indx_RAP) in RAP */ + + /* Grab the indices for row col_indx_RAP of S_offd and diag. This will + * be for computing lumping locations */ + S_offd_indices_len = S_offd_i[col_indx_RAP+1] - S_offd_i[col_indx_RAP]; + if(S_offd_indices_allocated_len < S_offd_indices_len) + { + hypre_TFree(S_offd_indices, HYPRE_MEMORY_HOST); + S_offd_indices = hypre_CTAlloc(HYPRE_BigInt, S_offd_indices_len, HYPRE_MEMORY_HOST); + S_offd_indices_allocated_len = S_offd_indices_len; + } + /* Grab sub array from col_map, corresponding to the slice of S_offd_j */ + hypre_GrabSubArray(S_offd_j, S_offd_i[col_indx_RAP], S_offd_i[col_indx_RAP+1]-1, + col_map_offd_S, S_offd_indices); + /* No need to grab info out of S_diag_j[...], here we just start from + * S_diag_i[col_indx_RAP] and end at index S_diag_i[col_indx_RAP+1] - 1 */ + + /* Intersect the diag and offd pieces, remembering that the + * diag array will need to have the offset +first_col_diag_RAP */ + cnt = hypre_max(S_offd_indices_len, Pattern_offd_indices_len); + if(offd_intersection_allocated_len < cnt) + { + hypre_TFree(offd_intersection, HYPRE_MEMORY_HOST); + hypre_TFree(offd_intersection_data, HYPRE_MEMORY_HOST); + offd_intersection = hypre_CTAlloc(HYPRE_BigInt, cnt, HYPRE_MEMORY_HOST); + offd_intersection_data = hypre_CTAlloc(HYPRE_Real, cnt, HYPRE_MEMORY_HOST); + offd_intersection_allocated_len = cnt; + } + /* This intersection also tracks S_offd_data and assumes that + * S_offd_indices is the first argument here */ + hypre_IntersectTwoBigArrays(S_offd_indices, + &(S_offd_data[ S_offd_i[col_indx_RAP] ]), + S_offd_indices_len, + Pattern_offd_indices, + Pattern_offd_indices_len, + offd_intersection, + offd_intersection_data, + &offd_intersection_len); + + + /* Now, intersect the indices for the diag block. Note that S_diag_j does + * not have a diagonal entry, so no lumping occurs to the diagonal. */ + cnt = hypre_max(Pattern_diag_indices_len, + S_diag_i[col_indx_RAP+1] - S_diag_i[col_indx_RAP] ); + if(diag_intersection_allocated_len < cnt) + { + hypre_TFree(diag_intersection, HYPRE_MEMORY_HOST); + hypre_TFree(diag_intersection_data, HYPRE_MEMORY_HOST); + diag_intersection = hypre_CTAlloc(HYPRE_Int, cnt, HYPRE_MEMORY_HOST); + diag_intersection_data = hypre_CTAlloc(HYPRE_Real, cnt, HYPRE_MEMORY_HOST); + diag_intersection_allocated_len = cnt; + } + /* There is no diagonal entry in first position of S */ + hypre_IntersectTwoArrays( &(S_diag_j[S_diag_i[col_indx_RAP]]), + &(S_diag_data[ S_diag_i[col_indx_RAP] ]), + S_diag_i[col_indx_RAP+1] - S_diag_i[col_indx_RAP], + Pattern_indices_ptr, + Pattern_diag_indices_len, + diag_intersection, + diag_intersection_data, + &diag_intersection_len); + + /* Loop over these intersections, and lump a constant fraction of + * RAP_diag_data[j] to each entry */ + intersection_len = diag_intersection_len + offd_intersection_len; + if(intersection_len > 0) + { + /* Sum the strength-of-connection values from row + * col_indx_RAP in S, corresponding to the indices we are + * collapsing to in row i This will give us our collapsing + * weights. */ + sum_strong_neigh = 0.0; + for(k = 0; k < diag_intersection_len; k++) + { sum_strong_neigh += fabs(diag_intersection_data[k]); } + for(k = 0; k < offd_intersection_len; k++) + { sum_strong_neigh += fabs(offd_intersection_data[k]); } + sum_strong_neigh = RAP_diag_data[j]/sum_strong_neigh; + + /* When lumping with the diag_intersection, must offset column index */ + for(k = 0; k < diag_intersection_len; k++) + { + lump_value = lump_percent * fabs(diag_intersection_data[k])*sum_strong_neigh; + diagonal_lump_value = (1.0 - lump_percent) * fabs(diag_intersection_data[k])*sum_strong_neigh; + neg_lump_value = -1.0 * lump_value; + cnt = diag_intersection[k]+first_col_diag_RAP; + + /*#ifdef HY PRE_USING_OPENMP #pragma omp critical (IJAdd) #endif -{*/ - /* For efficiency, we do a buffered IJAddToValues. - * A[global_row, global_row] += RAP_diag_data[j] */ - hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, - global_row, RAP_diag_data[j] ); -/*}*/ +{*/ + /* For efficiency, we do a buffered IJAddToValues. + * A[global_row, cnt] += RAP_diag_data[j] */ + hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, + cnt, lump_value ); + if (lump_percent < 1.0) + { + /* Preserve row sum by updating diagonal */ + hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, + global_row, diagonal_lump_value ); + } + + /* Update mirror entries, if symmetric collapsing */ + if(sym_collapse) + { + /* Update mirror entry */ + hypre_NonGalerkinIJBufferWrite( ijmatrix, + &ijbuf_sym_cnt, ijbuf_size, &ijbuf_sym_rowcounter, + &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, + &ijbuf_sym_numcols, cnt, global_row, lump_value ); + /* Update mirror entry diagonal */ + hypre_NonGalerkinIJBufferWrite( ijmatrix, + &ijbuf_sym_cnt, ijbuf_size, &ijbuf_sym_rowcounter, + &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, + &ijbuf_sym_numcols, cnt, cnt, neg_lump_value ); + } + /*}*/ +} +/* The offd_intersection has global column indices, i.e., the + * col_map arrays contain global indices */ +for(k = 0; k < offd_intersection_len; k++) +{ + lump_value = lump_percent * fabs(offd_intersection_data[k])*sum_strong_neigh; + diagonal_lump_value = (1.0 - lump_percent) * fabs(offd_intersection_data[k])*sum_strong_neigh; + neg_lump_value = -1.0 * lump_value; + + hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, + offd_intersection[k], lump_value ); + + if (lump_percent < 1.0) + { + hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, + global_row, diagonal_lump_value ); + } + + /* Update mirror entries, if symmetric collapsing */ + if (sym_collapse) + { + hypre_NonGalerkinIJBufferWrite( ijmatrix, + &ijbuf_sym_cnt, ijbuf_size, &ijbuf_sym_rowcounter, + &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, + &ijbuf_sym_numcols, offd_intersection[k], + global_row, lump_value ); + hypre_NonGalerkinIJBufferWrite( ijmatrix, + &ijbuf_sym_cnt, ijbuf_size, &ijbuf_sym_rowcounter, + &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, + &ijbuf_sym_numcols, offd_intersection[k], + offd_intersection[k], neg_lump_value ); + } +} +} +/* If intersection is empty, do not eliminate entry */ +else +{ + /* Don't forget to update mirror entry if collapsing symmetrically */ + if (sym_collapse) + { lump_value = 0.5*RAP_diag_data[j]; } + else + { lump_value = RAP_diag_data[j]; } + + cnt = col_indx_RAP+first_col_diag_RAP; + hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, + cnt, lump_value ); + if (sym_collapse) + { + hypre_NonGalerkinIJBufferWrite( ijmatrix, + &ijbuf_sym_cnt, ijbuf_size, &ijbuf_sym_rowcounter, + &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, + &ijbuf_sym_numcols, cnt, global_row, lump_value ); + } +} +} +/* The entry in RAP appears in Pattern, so keep it */ +else if(col_indx_RAP == col_indx_Pattern) +{ + cnt = col_indx_RAP+first_col_diag_RAP; + hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, + cnt, RAP_diag_data[j] ); + + /* Only go to the next entry in Pattern, if this is not the end of a row */ + if( current_Pattern_j < Pattern_diag_i[i+1]-1 ) + { + current_Pattern_j += 1; + col_indx_Pattern = Pattern_diag_j[current_Pattern_j]; + } + else + { has_row_ended = 1;} +} +/* Increment col_indx_Pattern, and repeat this loop iter for current + * col_ind_RAP value */ +else if(col_indx_RAP > col_indx_Pattern) +{ + for(; current_Pattern_j < Pattern_diag_i[i+1]; current_Pattern_j++) + { + col_indx_Pattern = Pattern_diag_j[current_Pattern_j]; + if(col_indx_RAP <= col_indx_Pattern) + { break;} + } + + /* If col_indx_RAP is still greater (i.e., we've reached a row end), then + * we need to lump everything else in this row */ + if(col_indx_RAP > col_indx_Pattern) + { has_row_ended = 1; } + + /* Decrement j, in order to repeat this loop iteration for the current + * col_indx_RAP value */ + j--; +} +} +} + +} + +/* + * Eliminate Entries In RAP_offd + * Structure of this for-loop is very similar to the RAP_diag for-loop + * But, not so similar that these loops should be combined into a single fuction. + * */ +if(num_cols_RAP_offd) +{ + for(i = 0; i < num_variables; i++) + { + global_row = i+first_col_diag_RAP; + row_start = RAP_offd_i[i]; + row_end = RAP_offd_i[i+1]; + has_row_ended = 0; + + /* Only do work if row has nonzeros */ + if( row_start < row_end) + { + current_Pattern_j = Pattern_offd_i[i]; + Pattern_offd_indices_len = Pattern_offd_i[i+1] - Pattern_offd_i[i]; + if( (Pattern_offd_j != NULL) && (Pattern_offd_indices_len > 0) ) + { col_indx_Pattern = col_map_offd_Pattern[ Pattern_offd_j[current_Pattern_j] ]; } + else + { /* if Pattern_offd_j is not allocated or this is a zero length row, + then all entries need to be lumped. + This is an analagous situation to has_row_ended=1. */ + col_indx_Pattern = -1; + has_row_ended = 1; + } + + /* Grab this row's indices out of Pattern offd and diag. This will + * be for computing index set intersections for lumping. The above + * loop over RAP_diag ensures adequate length of Pattern_offd_indices */ + /* Ensure adequate length */ + hypre_GrabSubArray(Pattern_offd_j, + Pattern_offd_i[i], Pattern_offd_i[i+1]-1, + col_map_offd_Pattern, Pattern_offd_indices); + /* No need to grab info out of Pattern_diag_j[...], here we just start from + * Pattern_diag_i[i] and end at index Pattern_diag_i[i+1] - 1. We do need to + * ignore the diagonal entry in Pattern, because we don't lump entries there */ + if( Pattern_diag_j[Pattern_diag_i[i]] == i ) + { + Pattern_indices_ptr = &( Pattern_diag_j[Pattern_diag_i[i]+1]); + Pattern_diag_indices_len = Pattern_diag_i[i+1] - Pattern_diag_i[i] - 1; + } + else + { + Pattern_indices_ptr = &( Pattern_diag_j[Pattern_diag_i[i]]); + Pattern_diag_indices_len = Pattern_diag_i[i+1] - Pattern_diag_i[i]; + } + + } + + for(j = row_start; j < row_end; j++) + { + + /* Ignore zero entries in RAP */ + if( RAP_offd_data[j] != 0.0) + { + + /* In general for all the offd_j arrays, we have to indirectly + * index with the col_map_offd array to get a global index */ + col_indx_RAP = col_map_offd_RAP[ RAP_offd_j[j] ]; + + /* The entry in RAP does not appear in Pattern, so LUMP it */ + if( (col_indx_RAP < col_indx_Pattern) || has_row_ended) + { + /* The row_indx_Sext would be found with: + row_indx_Sext = hypre_BinarySearch(col_map_offd_RAP, col_indx_RAP, num_cols_RAP_offd); + But, we already know the answer to this with, */ + row_indx_Sext = RAP_offd_j[j]; + + /* Grab the indices for row row_indx_Sext from the offd and diag parts. This will + * be for computing lumping locations */ + S_offd_indices_len = S_ext_offd_i[row_indx_Sext+1] - S_ext_offd_i[row_indx_Sext]; + if(S_offd_indices_allocated_len < S_offd_indices_len) + { + hypre_TFree(S_offd_indices, HYPRE_MEMORY_HOST); + S_offd_indices = hypre_CTAlloc(HYPRE_BigInt, S_offd_indices_len, HYPRE_MEMORY_HOST); + S_offd_indices_allocated_len = S_offd_indices_len; } - /* The entry in RAP does not appear in Pattern, so LUMP it */ - else if( (col_indx_RAP < col_indx_Pattern) || has_row_ended) + /* Grab sub array from col_map, corresponding to the slice of S_ext_offd_j */ + hypre_GrabSubArray(S_ext_offd_j, S_ext_offd_i[row_indx_Sext], S_ext_offd_i[row_indx_Sext+1]-1, + col_map_offd_Sext, S_offd_indices); + /* No need to grab info out of S_ext_diag_j[...], here we just start from + * S_ext_diag_i[row_indx_Sext] and end at index S_ext_diag_i[row_indx_Sext+1] - 1 */ + + /* Intersect the diag and offd pieces, remembering that the + * diag array will need to have the offset +first_col_diag_RAP */ + cnt = hypre_max(S_offd_indices_len, Pattern_offd_indices_len); + if(offd_intersection_allocated_len < cnt) { - /* Lump entry (i, col_indx_RAP) in RAP */ - - /* Grab the indices for row col_indx_RAP of S_offd and diag. This will - * be for computing lumping locations */ - S_offd_indices_len = S_offd_i[col_indx_RAP+1] - S_offd_i[col_indx_RAP]; - if(S_offd_indices_allocated_len < S_offd_indices_len) - { - hypre_TFree(S_offd_indices, HYPRE_MEMORY_HOST); - S_offd_indices = hypre_CTAlloc(HYPRE_Int, S_offd_indices_len, HYPRE_MEMORY_HOST); - S_offd_indices_allocated_len = S_offd_indices_len; - } - /* Grab sub array from col_map, corresponding to the slice of S_offd_j */ - hypre_GrabSubArray(S_offd_j, S_offd_i[col_indx_RAP], S_offd_i[col_indx_RAP+1]-1, - col_map_offd_S, S_offd_indices); - /* No need to grab info out of S_diag_j[...], here we just start from - * S_diag_i[col_indx_RAP] and end at index S_diag_i[col_indx_RAP+1] - 1 */ - - /* Intersect the diag and offd pieces, remembering that the - * diag array will need to have the offset +first_col_diag_RAP */ - cnt = hypre_max(S_offd_indices_len, Pattern_offd_indices_len); - if(offd_intersection_allocated_len < cnt) - { - hypre_TFree(offd_intersection, HYPRE_MEMORY_HOST); - hypre_TFree(offd_intersection_data, HYPRE_MEMORY_HOST); - offd_intersection = hypre_CTAlloc(HYPRE_Int, cnt, HYPRE_MEMORY_HOST); - offd_intersection_data = hypre_CTAlloc(HYPRE_Real, cnt, HYPRE_MEMORY_HOST); - offd_intersection_allocated_len = cnt; - } - /* This intersection also tracks S_offd_data and assumes that - * S_offd_indices is the first argument here */ - hypre_IntersectTwoArrays(S_offd_indices, - &(S_offd_data[ S_offd_i[col_indx_RAP] ]), - S_offd_indices_len, - Pattern_offd_indices, - Pattern_offd_indices_len, - offd_intersection, - offd_intersection_data, - &offd_intersection_len); - - - /* Now, intersect the indices for the diag block. Note that S_diag_j does - * not have a diagonal entry, so no lumping occurs to the diagonal. */ - cnt = hypre_max(Pattern_diag_indices_len, - S_diag_i[col_indx_RAP+1] - S_diag_i[col_indx_RAP] ); - if(diag_intersection_allocated_len < cnt) - { - hypre_TFree(diag_intersection, HYPRE_MEMORY_HOST); - hypre_TFree(diag_intersection_data, HYPRE_MEMORY_HOST); - diag_intersection = hypre_CTAlloc(HYPRE_Int, cnt, HYPRE_MEMORY_HOST); - diag_intersection_data = hypre_CTAlloc(HYPRE_Real, cnt, HYPRE_MEMORY_HOST); - diag_intersection_allocated_len = cnt; - } - /* There is no diagonal entry in first position of S */ - hypre_IntersectTwoArrays( &(S_diag_j[S_diag_i[col_indx_RAP]]), - &(S_diag_data[ S_diag_i[col_indx_RAP] ]), - S_diag_i[col_indx_RAP+1] - S_diag_i[col_indx_RAP], - Pattern_indices_ptr, - Pattern_diag_indices_len, - diag_intersection, - diag_intersection_data, - &diag_intersection_len); - - /* Loop over these intersections, and lump a constant fraction of - * RAP_diag_data[j] to each entry */ - intersection_len = diag_intersection_len + offd_intersection_len; - if(intersection_len > 0) - { - /* Sum the strength-of-connection values from row - * col_indx_RAP in S, corresponding to the indices we are - * collapsing to in row i This will give us our collapsing - * weights. */ - sum_strong_neigh = 0.0; - for(k = 0; k < diag_intersection_len; k++) - { sum_strong_neigh += fabs(diag_intersection_data[k]); } - for(k = 0; k < offd_intersection_len; k++) - { sum_strong_neigh += fabs(offd_intersection_data[k]); } - sum_strong_neigh = RAP_diag_data[j]/sum_strong_neigh; - - /* When lumping with the diag_intersection, must offset column index */ - for(k = 0; k < diag_intersection_len; k++) - { - lump_value = lump_percent * fabs(diag_intersection_data[k])*sum_strong_neigh; - diagonal_lump_value = (1.0 - lump_percent) * fabs(diag_intersection_data[k])*sum_strong_neigh; - neg_lump_value = -1.0 * lump_value; - cnt = diag_intersection[k]+first_col_diag_RAP; - -/*#ifdef HY PRE_USING_OPENMP -#pragma omp critical (IJAdd) -#endif -{*/ - /* For efficiency, we do a buffered IJAddToValues. - * A[global_row, cnt] += RAP_diag_data[j] */ - hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, - cnt, lump_value ); - if (lump_percent < 1.0) - { - /* Preserve row sum by updating diagonal */ - hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, - global_row, diagonal_lump_value ); - } - - /* Update mirror entries, if symmetric collapsing */ - if(sym_collapse) - { - /* Update mirror entry */ - hypre_NonGalerkinIJBufferWrite( ijmatrix, - &ijbuf_sym_cnt, ijbuf_size, &ijbuf_sym_rowcounter, - &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, - &ijbuf_sym_numcols, cnt, global_row, lump_value ); - /* Update mirror entry diagonal */ - hypre_NonGalerkinIJBufferWrite( ijmatrix, - &ijbuf_sym_cnt, ijbuf_size, &ijbuf_sym_rowcounter, - &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, - &ijbuf_sym_numcols, cnt, cnt, neg_lump_value ); - } -/*}*/ - } - - /* The offd_intersection has global column indices, i.e., the - * col_map arrays contain global indices */ - for(k = 0; k < offd_intersection_len; k++) - { - lump_value = lump_percent * fabs(offd_intersection_data[k])*sum_strong_neigh; - diagonal_lump_value = (1.0 - lump_percent) * fabs(offd_intersection_data[k])*sum_strong_neigh; - neg_lump_value = -1.0 * lump_value; - - hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, - offd_intersection[k], lump_value ); - - if (lump_percent < 1.0) - { - hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, - global_row, diagonal_lump_value ); - } - - /* Update mirror entries, if symmetric collapsing */ - if (sym_collapse) - { - hypre_NonGalerkinIJBufferWrite( ijmatrix, - &ijbuf_sym_cnt, ijbuf_size, &ijbuf_sym_rowcounter, - &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, - &ijbuf_sym_numcols, offd_intersection[k], - global_row, lump_value ); - hypre_NonGalerkinIJBufferWrite( ijmatrix, - &ijbuf_sym_cnt, ijbuf_size, &ijbuf_sym_rowcounter, - &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, - &ijbuf_sym_numcols, offd_intersection[k], - offd_intersection[k], neg_lump_value ); - } - } - } - /* If intersection is empty, do not eliminate entry */ - else - { - /* Don't forget to update mirror entry if collapsing symmetrically */ - if (sym_collapse) - { lump_value = 0.5*RAP_diag_data[j]; } - else - { lump_value = RAP_diag_data[j]; } - - cnt = col_indx_RAP+first_col_diag_RAP; - hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, - cnt, lump_value ); - if (sym_collapse) - { - hypre_NonGalerkinIJBufferWrite( ijmatrix, - &ijbuf_sym_cnt, ijbuf_size, &ijbuf_sym_rowcounter, - &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, - &ijbuf_sym_numcols, cnt, global_row, lump_value ); - } - } + hypre_TFree(offd_intersection, HYPRE_MEMORY_HOST); + hypre_TFree(offd_intersection_data, HYPRE_MEMORY_HOST); + offd_intersection = hypre_CTAlloc(HYPRE_BigInt, cnt, HYPRE_MEMORY_HOST); + offd_intersection_data = hypre_CTAlloc(HYPRE_Real, cnt, HYPRE_MEMORY_HOST); + offd_intersection_allocated_len = cnt; + } + hypre_IntersectTwoBigArrays(S_offd_indices, + &(S_ext_offd_data[ S_ext_offd_i[row_indx_Sext] ]), + S_offd_indices_len, + Pattern_offd_indices, + Pattern_offd_indices_len, + offd_intersection, + offd_intersection_data, + &offd_intersection_len); + + /* Now, intersect the indices for the diag block. */ + cnt = hypre_max(Pattern_diag_indices_len, + S_ext_diag_i[row_indx_Sext+1] - S_ext_diag_i[row_indx_Sext] ); + if(diag_intersection_allocated_len < cnt) + { + hypre_TFree(diag_intersection, HYPRE_MEMORY_HOST); + hypre_TFree(diag_intersection_data, HYPRE_MEMORY_HOST); + diag_intersection = hypre_CTAlloc(HYPRE_Int, cnt, HYPRE_MEMORY_HOST); + diag_intersection_data = hypre_CTAlloc(HYPRE_Real, cnt, HYPRE_MEMORY_HOST); + diag_intersection_allocated_len = cnt; } - /* The entry in RAP appears in Pattern, so keep it */ - else if(col_indx_RAP == col_indx_Pattern) + hypre_IntersectTwoArrays( &(S_ext_diag_j[S_ext_diag_i[row_indx_Sext]]), + &(S_ext_diag_data[ S_ext_diag_i[row_indx_Sext] ]), + S_ext_diag_i[row_indx_Sext+1] - S_ext_diag_i[row_indx_Sext], + Pattern_indices_ptr, + Pattern_diag_indices_len, + diag_intersection, + diag_intersection_data, + &diag_intersection_len); + + /* Loop over these intersections, and lump a constant fraction of + * RAP_offd_data[j] to each entry */ + intersection_len = diag_intersection_len + offd_intersection_len; + if(intersection_len > 0) { - cnt = col_indx_RAP+first_col_diag_RAP; - hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, - cnt, RAP_diag_data[j] ); - - /* Only go to the next entry in Pattern, if this is not the end of a row */ - if( current_Pattern_j < Pattern_diag_i[i+1]-1 ) - { - current_Pattern_j += 1; - col_indx_Pattern = Pattern_diag_j[current_Pattern_j]; - } - else - { has_row_ended = 1;} + /* Sum the strength-of-connection values from row + * row_indx_Sext in S, corresponding to the indices we are + * collapsing to in row i. This will give us our collapsing + * weights. */ + sum_strong_neigh = 0.0; + for(k = 0; k < diag_intersection_len; k++) + { sum_strong_neigh += fabs(diag_intersection_data[k]); } + for(k = 0; k < offd_intersection_len; k++) + { sum_strong_neigh += fabs(offd_intersection_data[k]); } + sum_strong_neigh = RAP_offd_data[j]/sum_strong_neigh; + + /* When lumping with the diag_intersection, must offset column index */ + for(k = 0; k < diag_intersection_len; k++) + { + lump_value = lump_percent * fabs(diag_intersection_data[k])*sum_strong_neigh; + diagonal_lump_value = (1.0 - lump_percent) * fabs(diag_intersection_data[k])*sum_strong_neigh; + neg_lump_value = -1.0 * lump_value; + cnt = diag_intersection[k]+first_col_diag_RAP; + + hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, cnt, lump_value ); + if (lump_percent < 1.0) + { + hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, global_row, + diagonal_lump_value ); + } + + /* Update mirror entries, if symmetric collapsing */ + if (sym_collapse) + { + hypre_NonGalerkinIJBufferWrite( ijmatrix, + &ijbuf_sym_cnt, ijbuf_size, + &ijbuf_sym_rowcounter, &ijbuf_sym_data, + &ijbuf_sym_cols, &ijbuf_sym_rownums, + &ijbuf_sym_numcols, cnt, global_row, lump_value); + hypre_NonGalerkinIJBufferWrite( ijmatrix, + &ijbuf_sym_cnt, ijbuf_size, + &ijbuf_sym_rowcounter, &ijbuf_sym_data, + &ijbuf_sym_cols, &ijbuf_sym_rownums, + &ijbuf_sym_numcols, cnt, cnt, neg_lump_value ); + } + } + + /* The offd_intersection has global column indices, i.e., the + * col_map arrays contain global indices */ + for(k = 0; k < offd_intersection_len; k++) + { + lump_value = lump_percent * fabs(offd_intersection_data[k])*sum_strong_neigh; + diagonal_lump_value = (1.0 - lump_percent) * fabs(offd_intersection_data[k])*sum_strong_neigh; + neg_lump_value = -1.0 * lump_value; + + hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, + offd_intersection[k], lump_value ); + if (lump_percent < 1.0) + { + hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, global_row, + diagonal_lump_value ); + } + + + /* Update mirror entries, if symmetric collapsing */ + if (sym_collapse) + { + hypre_NonGalerkinIJBufferWrite( ijmatrix, + &ijbuf_sym_cnt, ijbuf_size, + &ijbuf_sym_rowcounter, &ijbuf_sym_data, + &ijbuf_sym_cols, &ijbuf_sym_rownums, + &ijbuf_sym_numcols, offd_intersection[k], + global_row, lump_value ); + hypre_NonGalerkinIJBufferWrite( ijmatrix, + &ijbuf_sym_cnt, ijbuf_size, + &ijbuf_sym_rowcounter, &ijbuf_sym_data, + &ijbuf_sym_cols, &ijbuf_sym_rownums, + &ijbuf_sym_numcols, offd_intersection[k], + offd_intersection[k], neg_lump_value ); + } + } } - /* Increment col_indx_Pattern, and repeat this loop iter for current - * col_ind_RAP value */ - else if(col_indx_RAP > col_indx_Pattern) + /* If intersection is empty, do not eliminate entry */ + else { - for(; current_Pattern_j < Pattern_diag_i[i+1]; current_Pattern_j++) - { - col_indx_Pattern = Pattern_diag_j[current_Pattern_j]; - if(col_indx_RAP <= col_indx_Pattern) - { break;} - } - - /* If col_indx_RAP is still greater (i.e., we've reached a row end), then - * we need to lump everything else in this row */ - if(col_indx_RAP > col_indx_Pattern) - { has_row_ended = 1; } - - /* Decrement j, in order to repeat this loop iteration for the current - * col_indx_RAP value */ - j--; + /* Don't forget to update mirror entry if collapsing symmetrically */ + if (sym_collapse) + { lump_value = 0.5*RAP_offd_data[j]; } + else + { lump_value = RAP_offd_data[j]; } + + hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, col_indx_RAP, + lump_value ); + if (sym_collapse) + { + hypre_NonGalerkinIJBufferWrite( ijmatrix, + &ijbuf_sym_cnt, ijbuf_size, &ijbuf_sym_rowcounter, + &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, + &ijbuf_sym_numcols, col_indx_RAP, global_row, + lump_value ); + } } } - } - - } - - /* - * Eliminate Entries In RAP_offd - * Structure of this for-loop is very similar to the RAP_diag for-loop - * But, not so similar that these loops should be combined into a single fuction. - * */ - if(num_cols_RAP_offd) - { - for(i = 0; i < num_variables; i++) - { - global_row = i+first_col_diag_RAP; - row_start = RAP_offd_i[i]; - row_end = RAP_offd_i[i+1]; - has_row_ended = 0; - - /* Only do work if row has nonzeros */ - if( row_start < row_end) + /* The entry in RAP appears in Pattern, so keep it */ + else if (col_indx_RAP == col_indx_Pattern) { - current_Pattern_j = Pattern_offd_i[i]; - Pattern_offd_indices_len = Pattern_offd_i[i+1] - Pattern_offd_i[i]; - if( (Pattern_offd_j != NULL) && (Pattern_offd_indices_len > 0) ) - { col_indx_Pattern = col_map_offd_Pattern[ Pattern_offd_j[current_Pattern_j] ]; } - else - { /* if Pattern_offd_j is not allocated or this is a zero length row, - then all entries need to be lumped. - This is an analagous situation to has_row_ended=1. */ - col_indx_Pattern = -1; - has_row_ended = 1; - } - - /* Grab this row's indices out of Pattern offd and diag. This will - * be for computing index set intersections for lumping. The above - * loop over RAP_diag ensures adequate length of Pattern_offd_indices */ - /* Ensure adequate length */ - hypre_GrabSubArray(Pattern_offd_j, - Pattern_offd_i[i], Pattern_offd_i[i+1]-1, - col_map_offd_Pattern, Pattern_offd_indices); - /* No need to grab info out of Pattern_diag_j[...], here we just start from - * Pattern_diag_i[i] and end at index Pattern_diag_i[i+1] - 1. We do need to - * ignore the diagonal entry in Pattern, because we don't lump entries there */ - if( Pattern_diag_j[Pattern_diag_i[i]] == i ) - { - Pattern_indices_ptr = &( Pattern_diag_j[Pattern_diag_i[i]+1]); - Pattern_diag_indices_len = Pattern_diag_i[i+1] - Pattern_diag_i[i] - 1; - } - else - { - Pattern_indices_ptr = &( Pattern_diag_j[Pattern_diag_i[i]]); - Pattern_diag_indices_len = Pattern_diag_i[i+1] - Pattern_diag_i[i]; - } + /* For the offd structure, col_indx_RAP is a global dof number */ + hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, col_indx_RAP, + RAP_offd_data[j]); + /* Only go to the next entry in Pattern, if this is not the end of a row */ + if( current_Pattern_j < Pattern_offd_i[i+1]-1 ) + { + current_Pattern_j += 1; + col_indx_Pattern = col_map_offd_Pattern[ Pattern_offd_j[current_Pattern_j] ]; + } + else + { has_row_ended = 1;} } - - for(j = row_start; j < row_end; j++) + /* Increment col_indx_Pattern, and repeat this loop iter for current + * col_ind_RAP value */ + else if(col_indx_RAP > col_indx_Pattern) { - - /* Ignore zero entries in RAP */ - if( RAP_offd_data[j] != 0.0) - { - - /* In general for all the offd_j arrays, we have to indirectly - * index with the col_map_offd array to get a global index */ - col_indx_RAP = col_map_offd_RAP[ RAP_offd_j[j] ]; - - /* The entry in RAP does not appear in Pattern, so LUMP it */ - if( (col_indx_RAP < col_indx_Pattern) || has_row_ended) - { - /* The row_indx_Sext would be found with: - row_indx_Sext = hypre_BinarySearch(col_map_offd_RAP, col_indx_RAP, num_cols_RAP_offd); - But, we already know the answer to this with, */ - row_indx_Sext = RAP_offd_j[j]; - - /* Grab the indices for row row_indx_Sext from the offd and diag parts. This will - * be for computing lumping locations */ - S_offd_indices_len = S_ext_offd_i[row_indx_Sext+1] - S_ext_offd_i[row_indx_Sext]; - if(S_offd_indices_allocated_len < S_offd_indices_len) - { - hypre_TFree(S_offd_indices, HYPRE_MEMORY_HOST); - S_offd_indices = hypre_CTAlloc(HYPRE_Int, S_offd_indices_len, HYPRE_MEMORY_HOST); - S_offd_indices_allocated_len = S_offd_indices_len; - } - /* Grab sub array from col_map, corresponding to the slice of S_ext_offd_j */ - hypre_GrabSubArray(S_ext_offd_j, S_ext_offd_i[row_indx_Sext], S_ext_offd_i[row_indx_Sext+1]-1, - col_map_offd_Sext, S_offd_indices); - /* No need to grab info out of S_ext_diag_j[...], here we just start from - * S_ext_diag_i[row_indx_Sext] and end at index S_ext_diag_i[row_indx_Sext+1] - 1 */ - - /* Intersect the diag and offd pieces, remembering that the - * diag array will need to have the offset +first_col_diag_RAP */ - cnt = hypre_max(S_offd_indices_len, Pattern_offd_indices_len); - if(offd_intersection_allocated_len < cnt) - { - hypre_TFree(offd_intersection, HYPRE_MEMORY_HOST); - hypre_TFree(offd_intersection_data, HYPRE_MEMORY_HOST); - offd_intersection = hypre_CTAlloc(HYPRE_Int, cnt, HYPRE_MEMORY_HOST); - offd_intersection_data = hypre_CTAlloc(HYPRE_Real, cnt, HYPRE_MEMORY_HOST); - offd_intersection_allocated_len = cnt; - } - hypre_IntersectTwoArrays(S_offd_indices, - &(S_ext_offd_data[ S_ext_offd_i[row_indx_Sext] ]), - S_offd_indices_len, - Pattern_offd_indices, - Pattern_offd_indices_len, - offd_intersection, - offd_intersection_data, - &offd_intersection_len); - - /* Now, intersect the indices for the diag block. */ - cnt = hypre_max(Pattern_diag_indices_len, - S_ext_diag_i[row_indx_Sext+1] - S_ext_diag_i[row_indx_Sext] ); - if(diag_intersection_allocated_len < cnt) - { - hypre_TFree(diag_intersection, HYPRE_MEMORY_HOST); - hypre_TFree(diag_intersection_data, HYPRE_MEMORY_HOST); - diag_intersection = hypre_CTAlloc(HYPRE_Int, cnt, HYPRE_MEMORY_HOST); - diag_intersection_data = hypre_CTAlloc(HYPRE_Real, cnt, HYPRE_MEMORY_HOST); - diag_intersection_allocated_len = cnt; - } - hypre_IntersectTwoArrays( &(S_ext_diag_j[S_ext_diag_i[row_indx_Sext]]), - &(S_ext_diag_data[ S_ext_diag_i[row_indx_Sext] ]), - S_ext_diag_i[row_indx_Sext+1] - S_ext_diag_i[row_indx_Sext], - Pattern_indices_ptr, - Pattern_diag_indices_len, - diag_intersection, - diag_intersection_data, - &diag_intersection_len); - - /* Loop over these intersections, and lump a constant fraction of - * RAP_offd_data[j] to each entry */ - intersection_len = diag_intersection_len + offd_intersection_len; - if(intersection_len > 0) - { - /* Sum the strength-of-connection values from row - * row_indx_Sext in S, corresponding to the indices we are - * collapsing to in row i. This will give us our collapsing - * weights. */ - sum_strong_neigh = 0.0; - for(k = 0; k < diag_intersection_len; k++) - { sum_strong_neigh += fabs(diag_intersection_data[k]); } - for(k = 0; k < offd_intersection_len; k++) - { sum_strong_neigh += fabs(offd_intersection_data[k]); } - sum_strong_neigh = RAP_offd_data[j]/sum_strong_neigh; - - /* When lumping with the diag_intersection, must offset column index */ - for(k = 0; k < diag_intersection_len; k++) - { - lump_value = lump_percent * fabs(diag_intersection_data[k])*sum_strong_neigh; - diagonal_lump_value = (1.0 - lump_percent) * fabs(diag_intersection_data[k])*sum_strong_neigh; - neg_lump_value = -1.0 * lump_value; - cnt = diag_intersection[k]+first_col_diag_RAP; - - hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, cnt, lump_value ); - if (lump_percent < 1.0) - { - hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, global_row, - diagonal_lump_value ); - } - - /* Update mirror entries, if symmetric collapsing */ - if (sym_collapse) - { - hypre_NonGalerkinIJBufferWrite( ijmatrix, - &ijbuf_sym_cnt, ijbuf_size, - &ijbuf_sym_rowcounter, &ijbuf_sym_data, - &ijbuf_sym_cols, &ijbuf_sym_rownums, - &ijbuf_sym_numcols, cnt, global_row, lump_value); - hypre_NonGalerkinIJBufferWrite( ijmatrix, - &ijbuf_sym_cnt, ijbuf_size, - &ijbuf_sym_rowcounter, &ijbuf_sym_data, - &ijbuf_sym_cols, &ijbuf_sym_rownums, - &ijbuf_sym_numcols, cnt, cnt, neg_lump_value ); - } - } - - /* The offd_intersection has global column indices, i.e., the - * col_map arrays contain global indices */ - for(k = 0; k < offd_intersection_len; k++) - { - lump_value = lump_percent * fabs(offd_intersection_data[k])*sum_strong_neigh; - diagonal_lump_value = (1.0 - lump_percent) * fabs(offd_intersection_data[k])*sum_strong_neigh; - neg_lump_value = -1.0 * lump_value; - - hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, - offd_intersection[k], lump_value ); - if (lump_percent < 1.0) - { - hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, global_row, - diagonal_lump_value ); - } - - - /* Update mirror entries, if symmetric collapsing */ - if (sym_collapse) - { - hypre_NonGalerkinIJBufferWrite( ijmatrix, - &ijbuf_sym_cnt, ijbuf_size, - &ijbuf_sym_rowcounter, &ijbuf_sym_data, - &ijbuf_sym_cols, &ijbuf_sym_rownums, - &ijbuf_sym_numcols, offd_intersection[k], - global_row, lump_value ); - hypre_NonGalerkinIJBufferWrite( ijmatrix, - &ijbuf_sym_cnt, ijbuf_size, - &ijbuf_sym_rowcounter, &ijbuf_sym_data, - &ijbuf_sym_cols, &ijbuf_sym_rownums, - &ijbuf_sym_numcols, offd_intersection[k], - offd_intersection[k], neg_lump_value ); - } - } - } - /* If intersection is empty, do not eliminate entry */ - else - { - /* Don't forget to update mirror entry if collapsing symmetrically */ - if (sym_collapse) - { lump_value = 0.5*RAP_offd_data[j]; } - else - { lump_value = RAP_offd_data[j]; } - - hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, col_indx_RAP, - lump_value ); - if (sym_collapse) - { - hypre_NonGalerkinIJBufferWrite( ijmatrix, - &ijbuf_sym_cnt, ijbuf_size, &ijbuf_sym_rowcounter, - &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, - &ijbuf_sym_numcols, col_indx_RAP, global_row, - lump_value ); - } - } - } - /* The entry in RAP appears in Pattern, so keep it */ - else if (col_indx_RAP == col_indx_Pattern) - { - /* For the offd structure, col_indx_RAP is a global dof number */ - hypre_NonGalerkinIJBufferWrite( ijmatrix, &ijbuf_cnt, ijbuf_size, &ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols, global_row, col_indx_RAP, - RAP_offd_data[j]); - - /* Only go to the next entry in Pattern, if this is not the end of a row */ - if( current_Pattern_j < Pattern_offd_i[i+1]-1 ) - { - current_Pattern_j += 1; - col_indx_Pattern = col_map_offd_Pattern[ Pattern_offd_j[current_Pattern_j] ]; - } - else - { has_row_ended = 1;} - } - /* Increment col_indx_Pattern, and repeat this loop iter for current - * col_ind_RAP value */ - else if(col_indx_RAP > col_indx_Pattern) - { - for(; current_Pattern_j < Pattern_offd_i[i+1]; current_Pattern_j++) - { - col_indx_Pattern = col_map_offd_Pattern[ Pattern_offd_j[current_Pattern_j] ]; - if(col_indx_RAP <= col_indx_Pattern) - { break;} - } - - /* If col_indx_RAP is still greater (i.e., we've reached a row end), then - * we need to lump everything else in this row */ - if(col_indx_RAP > col_indx_Pattern) - { has_row_ended = 1; } - - /* Decrement j, in order to repeat this loop iteration for the current - * col_indx_RAP value */ - j--; - } - } + for(; current_Pattern_j < Pattern_offd_i[i+1]; current_Pattern_j++) + { + col_indx_Pattern = col_map_offd_Pattern[ Pattern_offd_j[current_Pattern_j] ]; + if(col_indx_RAP <= col_indx_Pattern) + { break;} + } + + /* If col_indx_RAP is still greater (i.e., we've reached a row end), then + * we need to lump everything else in this row */ + if(col_indx_RAP > col_indx_Pattern) + { has_row_ended = 1; } + + /* Decrement j, in order to repeat this loop iteration for the current + * col_indx_RAP value */ + j--; } - - } - - } - - /* For efficiency, we do a buffered IJAddToValues. - * This empties the buffer of any remaining values */ - hypre_NonGalerkinIJBufferEmpty(ijmatrix, ijbuf_size, &ijbuf_cnt, ijbuf_rowcounter, - &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols); - if(sym_collapse) - hypre_NonGalerkinIJBufferEmpty(ijmatrix, ijbuf_size, &ijbuf_sym_cnt, ijbuf_sym_rowcounter, - &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, - &ijbuf_sym_numcols); - - /* Assemble non-Galerkin Matrix, and overwrite current RAP*/ - ierr += HYPRE_IJMatrixAssemble (ijmatrix); - ierr += HYPRE_IJMatrixGetObject( ijmatrix, (void**) RAP_ptr); - - /* Optional diagnostic matrix printing */ - if (0) - { - hypre_sprintf(filename, "Pattern_%d.ij", global_num_vars); - hypre_ParCSRMatrixPrintIJ(Pattern, 0, 0, filename); - hypre_sprintf(filename, "Strength_%d.ij", global_num_vars); - hypre_ParCSRMatrixPrintIJ(S, 0, 0, filename); - hypre_sprintf(filename, "RAP_%d.ij", global_num_vars); - hypre_ParCSRMatrixPrintIJ(RAP, 0, 0, filename); - hypre_sprintf(filename, "RAPc_%d.ij", global_num_vars); - hypre_ParCSRMatrixPrintIJ(*RAP_ptr, 0, 0, filename); - hypre_sprintf(filename, "AP_%d.ij", global_num_vars); - hypre_ParCSRMatrixPrintIJ(AP, 0, 0, filename); - } - - /* Free matrices and variables and arrays */ - hypre_TFree(ijbuf_data, HYPRE_MEMORY_HOST); - hypre_TFree(ijbuf_cols, HYPRE_MEMORY_HOST); - hypre_TFree(ijbuf_rownums, HYPRE_MEMORY_HOST); - hypre_TFree(ijbuf_numcols, HYPRE_MEMORY_HOST); - if(sym_collapse) - { - hypre_TFree(ijbuf_sym_data, HYPRE_MEMORY_HOST); - hypre_TFree(ijbuf_sym_cols, HYPRE_MEMORY_HOST); - hypre_TFree(ijbuf_sym_rownums, HYPRE_MEMORY_HOST); - hypre_TFree(ijbuf_sym_numcols, HYPRE_MEMORY_HOST); - } - - hypre_TFree(Pattern_offd_indices, HYPRE_MEMORY_HOST); - hypre_TFree(S_ext_diag_i, HYPRE_MEMORY_HOST); - hypre_TFree(S_ext_offd_i, HYPRE_MEMORY_HOST); - hypre_TFree(S_offd_indices, HYPRE_MEMORY_HOST); - hypre_TFree(offd_intersection, HYPRE_MEMORY_HOST); - hypre_TFree(offd_intersection_data, HYPRE_MEMORY_HOST); - hypre_TFree(diag_intersection, HYPRE_MEMORY_HOST); - hypre_TFree(diag_intersection_data, HYPRE_MEMORY_HOST); - if (S_ext_diag_size) - { - hypre_TFree(S_ext_diag_j, HYPRE_MEMORY_HOST); - hypre_TFree(S_ext_diag_data, HYPRE_MEMORY_HOST); - } - if (S_ext_offd_size) - { - hypre_TFree(S_ext_offd_j, HYPRE_MEMORY_HOST); - hypre_TFree(S_ext_offd_data, HYPRE_MEMORY_HOST); - } - if (num_cols_offd_Sext) - { hypre_TFree(col_map_offd_Sext, HYPRE_MEMORY_HOST); } - if (0) /*(strong_threshold > S_commpkg_switch)*/ - { hypre_TFree(col_offd_S_to_A, HYPRE_MEMORY_HOST); } - - ierr += hypre_ParCSRMatrixDestroy(Pattern); - ierr += hypre_ParCSRMatrixDestroy(RAP); - ierr += hypre_ParCSRMatrixDestroy(S); - ierr += HYPRE_IJMatrixSetObjectType(ijmatrix, -1); - ierr += HYPRE_IJMatrixDestroy(ijmatrix); - - /*end_time = hypre_MPI_Wtime(); - if(my_id == 0) - { fprintf(stdout, "NonGalerkin Time: %1.2e\n", end_time-start_time); } */ - - return ierr; + } + } + + } + +} + +/* For efficiency, we do a buffered IJAddToValues. + * This empties the buffer of any remaining values */ +hypre_NonGalerkinIJBufferEmpty(ijmatrix, ijbuf_size, &ijbuf_cnt, ijbuf_rowcounter, + &ijbuf_data, &ijbuf_cols, &ijbuf_rownums, &ijbuf_numcols); +if(sym_collapse) + hypre_NonGalerkinIJBufferEmpty(ijmatrix, ijbuf_size, &ijbuf_sym_cnt, ijbuf_sym_rowcounter, + &ijbuf_sym_data, &ijbuf_sym_cols, &ijbuf_sym_rownums, + &ijbuf_sym_numcols); + +/* Assemble non-Galerkin Matrix, and overwrite current RAP*/ +ierr += HYPRE_IJMatrixAssemble (ijmatrix); +ierr += HYPRE_IJMatrixGetObject( ijmatrix, (void**) RAP_ptr); + +/* Optional diagnostic matrix printing */ +if (0) +{ + hypre_sprintf(filename, "Pattern_%d.ij", global_num_vars); + hypre_ParCSRMatrixPrintIJ(Pattern, 0, 0, filename); + hypre_sprintf(filename, "Strength_%d.ij", global_num_vars); + hypre_ParCSRMatrixPrintIJ(S, 0, 0, filename); + hypre_sprintf(filename, "RAP_%d.ij", global_num_vars); + hypre_ParCSRMatrixPrintIJ(RAP, 0, 0, filename); + hypre_sprintf(filename, "RAPc_%d.ij", global_num_vars); + hypre_ParCSRMatrixPrintIJ(*RAP_ptr, 0, 0, filename); + hypre_sprintf(filename, "AP_%d.ij", global_num_vars); + hypre_ParCSRMatrixPrintIJ(AP, 0, 0, filename); +} + +/* Free matrices and variables and arrays */ +hypre_TFree(ijbuf_data, HYPRE_MEMORY_HOST); +hypre_TFree(ijbuf_cols, HYPRE_MEMORY_HOST); +hypre_TFree(ijbuf_rownums, HYPRE_MEMORY_HOST); +hypre_TFree(ijbuf_numcols, HYPRE_MEMORY_HOST); +if(sym_collapse) +{ + hypre_TFree(ijbuf_sym_data, HYPRE_MEMORY_HOST); + hypre_TFree(ijbuf_sym_cols, HYPRE_MEMORY_HOST); + hypre_TFree(ijbuf_sym_rownums, HYPRE_MEMORY_HOST); + hypre_TFree(ijbuf_sym_numcols, HYPRE_MEMORY_HOST); +} + +hypre_TFree(Pattern_offd_indices, HYPRE_MEMORY_HOST); +hypre_TFree(S_ext_diag_i, HYPRE_MEMORY_HOST); +hypre_TFree(S_ext_offd_i, HYPRE_MEMORY_HOST); +hypre_TFree(S_offd_indices, HYPRE_MEMORY_HOST); +hypre_TFree(offd_intersection, HYPRE_MEMORY_HOST); +hypre_TFree(offd_intersection_data, HYPRE_MEMORY_HOST); +hypre_TFree(diag_intersection, HYPRE_MEMORY_HOST); +hypre_TFree(diag_intersection_data, HYPRE_MEMORY_HOST); +if (S_ext_diag_size) +{ + hypre_TFree(S_ext_diag_j, HYPRE_MEMORY_HOST); + hypre_TFree(S_ext_diag_data, HYPRE_MEMORY_HOST); +} +if (S_ext_offd_size) +{ + hypre_TFree(S_ext_offd_j, HYPRE_MEMORY_HOST); + hypre_TFree(S_ext_offd_data, HYPRE_MEMORY_HOST); +} +if (num_cols_offd_Sext) +{ hypre_TFree(col_map_offd_Sext, HYPRE_MEMORY_HOST); } +if (0) /*(strong_threshold > S_commpkg_switch)*/ +{ hypre_TFree(col_offd_S_to_A, HYPRE_MEMORY_HOST); } + +ierr += hypre_ParCSRMatrixDestroy(Pattern); +ierr += hypre_ParCSRMatrixDestroy(RAP); +ierr += hypre_ParCSRMatrixDestroy(S); +ierr += HYPRE_IJMatrixSetObjectType(ijmatrix, -1); +ierr += HYPRE_IJMatrixDestroy(ijmatrix); + +/*end_time = hypre_MPI_Wtime(); + if(my_id == 0) + { fprintf(stdout, "NonGalerkin Time: %1.2e\n", end_time-start_time); } */ + +return ierr; } diff -Nru hypre-2.16.0/src/parcsr_ls/par_rap.c hypre-2.18.2/src/parcsr_ls/par_rap.c --- hypre-2.16.0/src/parcsr_ls/par_rap.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_rap.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,200 +1,15 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" #include "_hypre_utilities.h" #include "hypre_hopscotch_hash.h" /*-------------------------------------------------------------------------- - * OLD NOTES: - * Sketch of John's code to build RAP - * - * Uses two integer arrays icg and ifg as marker arrays - * - * icg needs to be of size n_fine; size of ia. - * A negative value of icg(i) indicates i is a f-point, otherwise - * icg(i) is the converts from fine to coarse grid orderings. - * Note that I belive the code assumes that if i irap(ic) < irap(jc)) but I don't - * think there is a guarantee that the entries within a row will - * be ordered in any way except that the diagonal entry comes first. - * - * As structured now, the code requires that the size of rap be - * predicted up front. To avoid this, one could execute the code - * twice, the first time would only keep track of icg ,ifg and ka. - * Then you would know how much memory to allocate for rap and jrap. - * The second time would fill in these arrays. Actually you might - * be able to include the filling in of jrap into the first pass; - * just overestimate its size (its an integer array) and cut it - * back before the second time through. This would avoid some if tests - * in the second pass. - * - * Questions - * 1) parallel (PetSc) version? - * 2) what if we don't store R row-wise and don't - * even want to store a copy of it in this form - * temporarily? - *--------------------------------------------------------------------------*/ - -hypre_CSRMatrix * -hypre_ExchangeRAPData( hypre_CSRMatrix *RAP_int, - hypre_ParCSRCommPkg *comm_pkg_RT) -{ - HYPRE_Int *RAP_int_i; - HYPRE_BigInt *RAP_int_j = NULL; - HYPRE_Real *RAP_int_data = NULL; - HYPRE_Int num_cols = 0; - - MPI_Comm comm = hypre_ParCSRCommPkgComm(comm_pkg_RT); - HYPRE_Int num_recvs = hypre_ParCSRCommPkgNumRecvs(comm_pkg_RT); - HYPRE_Int *recv_procs = hypre_ParCSRCommPkgRecvProcs(comm_pkg_RT); - HYPRE_Int *recv_vec_starts = hypre_ParCSRCommPkgRecvVecStarts(comm_pkg_RT); - HYPRE_Int num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg_RT); - HYPRE_Int *send_procs = hypre_ParCSRCommPkgSendProcs(comm_pkg_RT); - HYPRE_Int *send_map_starts = hypre_ParCSRCommPkgSendMapStarts(comm_pkg_RT); - - hypre_CSRMatrix *RAP_ext; - - HYPRE_Int *RAP_ext_i; - HYPRE_BigInt *RAP_ext_j = NULL; - HYPRE_Real *RAP_ext_data = NULL; - - hypre_ParCSRCommHandle *comm_handle = NULL; - hypre_ParCSRCommPkg *tmp_comm_pkg; - - HYPRE_Int *jdata_recv_vec_starts; - HYPRE_Int *jdata_send_map_starts; - - HYPRE_Int num_rows; - HYPRE_Int num_nonzeros; - HYPRE_Int i, j; - HYPRE_Int num_procs; - - hypre_MPI_Comm_size(comm,&num_procs); - - RAP_ext_i = hypre_CTAlloc(HYPRE_Int, send_map_starts[num_sends]+1, HYPRE_MEMORY_HOST); - jdata_recv_vec_starts = hypre_TAlloc(HYPRE_Int, num_recvs+1, HYPRE_MEMORY_HOST); - jdata_send_map_starts = hypre_TAlloc(HYPRE_Int, num_sends+1, HYPRE_MEMORY_HOST); - -/*-------------------------------------------------------------------------- - * recompute RAP_int_i so that RAP_int_i[j+1] contains the number of - * elements of row j (to be determined through send_map_elmnts on the - * receiving end) - *--------------------------------------------------------------------------*/ - - if (num_recvs) - { - RAP_int_i = hypre_CSRMatrixI(RAP_int); - RAP_int_j = hypre_CSRMatrixBigJ(RAP_int); - RAP_int_data = hypre_CSRMatrixData(RAP_int); - num_cols = hypre_CSRMatrixNumCols(RAP_int); - } - - jdata_recv_vec_starts[0] = 0; - for (i=0; i < num_recvs; i++) - { - jdata_recv_vec_starts[i+1] = RAP_int_i[recv_vec_starts[i+1]]; - } - - for (i=num_recvs; i > 0; i--) - for (j = recv_vec_starts[i]; j > recv_vec_starts[i-1]; j--) - RAP_int_i[j] -= RAP_int_i[j-1]; - -/*-------------------------------------------------------------------------- - * initialize communication - *--------------------------------------------------------------------------*/ - - if (num_recvs && num_sends) - comm_handle = hypre_ParCSRCommHandleCreate(12,comm_pkg_RT, - &RAP_int_i[1], &RAP_ext_i[1]); - else if (num_recvs) - comm_handle = hypre_ParCSRCommHandleCreate(12,comm_pkg_RT, - &RAP_int_i[1], NULL); - else if (num_sends) - comm_handle = hypre_ParCSRCommHandleCreate(12,comm_pkg_RT, - NULL, &RAP_ext_i[1]); - - tmp_comm_pkg = hypre_CTAlloc(hypre_ParCSRCommPkg, 1, HYPRE_MEMORY_HOST); - hypre_ParCSRCommPkgComm(tmp_comm_pkg) = comm; - hypre_ParCSRCommPkgNumSends(tmp_comm_pkg) = num_recvs; - hypre_ParCSRCommPkgNumRecvs(tmp_comm_pkg) = num_sends; - hypre_ParCSRCommPkgSendProcs(tmp_comm_pkg) = recv_procs; - hypre_ParCSRCommPkgRecvProcs(tmp_comm_pkg) = send_procs; - - hypre_ParCSRCommHandleDestroy(comm_handle); - comm_handle = NULL; - -/*-------------------------------------------------------------------------- - * compute num_nonzeros for RAP_ext - *--------------------------------------------------------------------------*/ - - for (i=0; i < num_sends; i++) - for (j = send_map_starts[i]; j < send_map_starts[i+1]; j++) - RAP_ext_i[j+1] += RAP_ext_i[j]; - - num_rows = send_map_starts[num_sends]; - num_nonzeros = RAP_ext_i[num_rows]; - if (num_nonzeros) - { - RAP_ext_j = hypre_TAlloc(HYPRE_BigInt, num_nonzeros, HYPRE_MEMORY_HOST); - RAP_ext_data = hypre_TAlloc(HYPRE_Real, num_nonzeros, HYPRE_MEMORY_HOST); - } - - for (i=0; i < num_sends+1; i++) - { - jdata_send_map_starts[i] = RAP_ext_i[send_map_starts[i]]; - } - - hypre_ParCSRCommPkgRecvVecStarts(tmp_comm_pkg) = jdata_send_map_starts; - hypre_ParCSRCommPkgSendMapStarts(tmp_comm_pkg) = jdata_recv_vec_starts; - - comm_handle = hypre_ParCSRCommHandleCreate(1,tmp_comm_pkg,RAP_int_data, - RAP_ext_data); - hypre_ParCSRCommHandleDestroy(comm_handle); - comm_handle = NULL; - - comm_handle = hypre_ParCSRCommHandleCreate(21,tmp_comm_pkg,RAP_int_j, - RAP_ext_j); - RAP_ext = hypre_CSRMatrixCreate(num_rows,num_cols,num_nonzeros); - - hypre_CSRMatrixI(RAP_ext) = RAP_ext_i; - if (num_nonzeros) - { - hypre_CSRMatrixBigJ(RAP_ext) = RAP_ext_j; - hypre_CSRMatrixData(RAP_ext) = RAP_ext_data; - } - - hypre_ParCSRCommHandleDestroy(comm_handle); - comm_handle = NULL; - - hypre_TFree(jdata_recv_vec_starts, HYPRE_MEMORY_HOST); - hypre_TFree(jdata_send_map_starts, HYPRE_MEMORY_HOST); - hypre_TFree(tmp_comm_pkg, HYPRE_MEMORY_HOST); - - return RAP_ext; -} - -/*-------------------------------------------------------------------------- * hypre_BoomerAMGBuildCoarseOperator *--------------------------------------------------------------------------*/ @@ -210,10 +25,10 @@ HYPRE_Int hypre_BoomerAMGBuildCoarseOperatorKT( hypre_ParCSRMatrix *RT, - hypre_ParCSRMatrix *A, - hypre_ParCSRMatrix *P, - HYPRE_Int keepTranspose, - hypre_ParCSRMatrix **RAP_ptr ) + hypre_ParCSRMatrix *A, + hypre_ParCSRMatrix *P, + HYPRE_Int keepTranspose, + hypre_ParCSRMatrix **RAP_ptr ) { #ifdef HYPRE_PROFILE @@ -224,42 +39,42 @@ hypre_CSRMatrix *RT_diag = hypre_ParCSRMatrixDiag(RT); hypre_CSRMatrix *RT_offd = hypre_ParCSRMatrixOffd(RT); - HYPRE_Int num_cols_diag_RT = hypre_CSRMatrixNumCols(RT_diag); - HYPRE_Int num_cols_offd_RT = hypre_CSRMatrixNumCols(RT_offd); - HYPRE_Int num_rows_offd_RT = hypre_CSRMatrixNumRows(RT_offd); + HYPRE_Int num_cols_diag_RT = hypre_CSRMatrixNumCols(RT_diag); + HYPRE_Int num_cols_offd_RT = hypre_CSRMatrixNumCols(RT_offd); + HYPRE_Int num_rows_offd_RT = hypre_CSRMatrixNumRows(RT_offd); hypre_ParCSRCommPkg *comm_pkg_RT = hypre_ParCSRMatrixCommPkg(RT); - HYPRE_Int num_recvs_RT = 0; - HYPRE_Int num_sends_RT = 0; - HYPRE_Int *send_map_starts_RT; - HYPRE_Int *send_map_elmts_RT; + HYPRE_Int num_recvs_RT = 0; + HYPRE_Int num_sends_RT = 0; + HYPRE_Int *send_map_starts_RT; + HYPRE_Int *send_map_elmts_RT; hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); - + HYPRE_Real *A_diag_data = hypre_CSRMatrixData(A_diag); - HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); - HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); + HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); + HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); - + HYPRE_Real *A_offd_data = hypre_CSRMatrixData(A_offd); - HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); - HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); + HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); + HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); HYPRE_Int num_cols_diag_A = hypre_CSRMatrixNumCols(A_diag); HYPRE_Int num_cols_offd_A = hypre_CSRMatrixNumCols(A_offd); hypre_CSRMatrix *P_diag = hypre_ParCSRMatrixDiag(P); - + HYPRE_Real *P_diag_data = hypre_CSRMatrixData(P_diag); - HYPRE_Int *P_diag_i = hypre_CSRMatrixI(P_diag); - HYPRE_Int *P_diag_j = hypre_CSRMatrixJ(P_diag); + HYPRE_Int *P_diag_i = hypre_CSRMatrixI(P_diag); + HYPRE_Int *P_diag_j = hypre_CSRMatrixJ(P_diag); hypre_CSRMatrix *P_offd = hypre_ParCSRMatrixOffd(P); HYPRE_BigInt *col_map_offd_P = hypre_ParCSRMatrixColMapOffd(P); - + HYPRE_Real *P_offd_data = hypre_CSRMatrixData(P_offd); - HYPRE_Int *P_offd_i = hypre_CSRMatrixI(P_offd); - HYPRE_Int *P_offd_j = hypre_CSRMatrixJ(P_offd); + HYPRE_Int *P_offd_i = hypre_CSRMatrixI(P_offd); + HYPRE_Int *P_offd_j = hypre_CSRMatrixJ(P_offd); HYPRE_BigInt first_col_diag_P = hypre_ParCSRMatrixFirstColDiag(P); HYPRE_BigInt last_col_diag_P; @@ -275,48 +90,48 @@ hypre_CSRMatrix *RAP_int = NULL; HYPRE_Real *RAP_int_data; - HYPRE_Int *RAP_int_i; + HYPRE_Int *RAP_int_i; HYPRE_BigInt *RAP_int_j; hypre_CSRMatrix *RAP_ext; HYPRE_Real *RAP_ext_data = NULL; - HYPRE_Int *RAP_ext_i = NULL; + HYPRE_Int *RAP_ext_i = NULL; HYPRE_BigInt *RAP_ext_j = NULL; hypre_CSRMatrix *RAP_diag; HYPRE_Real *RAP_diag_data; - HYPRE_Int *RAP_diag_i; - HYPRE_Int *RAP_diag_j; + HYPRE_Int *RAP_diag_i; + HYPRE_Int *RAP_diag_j; hypre_CSRMatrix *RAP_offd; HYPRE_Real *RAP_offd_data = NULL; - HYPRE_Int *RAP_offd_i = NULL; - HYPRE_Int *RAP_offd_j = NULL; + HYPRE_Int *RAP_offd_i = NULL; + HYPRE_Int *RAP_offd_j = NULL; - HYPRE_Int RAP_size; - HYPRE_Int RAP_ext_size; - HYPRE_Int RAP_diag_size; - HYPRE_Int RAP_offd_size; - HYPRE_Int P_ext_diag_size; - HYPRE_Int P_ext_offd_size; + HYPRE_Int RAP_size; + HYPRE_Int RAP_ext_size; + HYPRE_Int RAP_diag_size; + HYPRE_Int RAP_offd_size; + HYPRE_Int P_ext_diag_size; + HYPRE_Int P_ext_offd_size; HYPRE_BigInt first_col_diag_RAP; HYPRE_BigInt last_col_diag_RAP; - HYPRE_Int num_cols_offd_RAP = 0; - + HYPRE_Int num_cols_offd_RAP = 0; + hypre_CSRMatrix *R_diag; - + HYPRE_Real *R_diag_data; - HYPRE_Int *R_diag_i; - HYPRE_Int *R_diag_j; + HYPRE_Int *R_diag_i; + HYPRE_Int *R_diag_j; hypre_CSRMatrix *R_offd; - + HYPRE_Real *R_offd_data; - HYPRE_Int *R_offd_i; - HYPRE_Int *R_offd_j; + HYPRE_Int *R_offd_i; + HYPRE_Int *R_offd_j; HYPRE_Real *RA_diag_data_array = NULL; HYPRE_Int *RA_diag_j_array = NULL; @@ -324,57 +139,57 @@ HYPRE_Int *RA_offd_j_array = NULL; hypre_CSRMatrix *Ps_ext; - + HYPRE_Real *Ps_ext_data; - HYPRE_Int *Ps_ext_i; + HYPRE_Int *Ps_ext_i; HYPRE_BigInt *Ps_ext_j; HYPRE_Real *P_ext_diag_data = NULL; - HYPRE_Int *P_ext_diag_i = NULL; - HYPRE_Int *P_ext_diag_j = NULL; + HYPRE_Int *P_ext_diag_i = NULL; + HYPRE_Int *P_ext_diag_j = NULL; HYPRE_Real *P_ext_offd_data = NULL; - HYPRE_Int *P_ext_offd_i = NULL; - HYPRE_Int *P_ext_offd_j = NULL; + HYPRE_Int *P_ext_offd_i = NULL; + HYPRE_Int *P_ext_offd_j = NULL; HYPRE_BigInt *P_big_offd_j = NULL; HYPRE_BigInt *col_map_offd_Pext; - HYPRE_Int *map_P_to_Pext = NULL; - HYPRE_Int *map_P_to_RAP = NULL; - HYPRE_Int *map_Pext_to_RAP = NULL; - - HYPRE_Int *P_marker; - HYPRE_Int **P_mark_array; - HYPRE_Int **A_mark_array; - HYPRE_Int *A_marker; + HYPRE_Int *map_P_to_Pext = NULL; + HYPRE_Int *map_P_to_RAP = NULL; + HYPRE_Int *map_Pext_to_RAP = NULL; + + HYPRE_Int *P_marker; + HYPRE_Int **P_mark_array; + HYPRE_Int **A_mark_array; + HYPRE_Int *A_marker; HYPRE_BigInt *temp; HYPRE_BigInt n_coarse, n_coarse_RT; - HYPRE_Int square = 1; - HYPRE_Int num_cols_offd_Pext = 0; - - HYPRE_Int ic, i, j, k; - HYPRE_Int i1, i2, i3, ii, ns, ne, size, rest; - HYPRE_Int cnt = 0; /*value; */ - HYPRE_Int jj1, jj2, jj3, jcol; - - HYPRE_Int *jj_count, *jj_cnt_diag, *jj_cnt_offd; - HYPRE_Int jj_counter, jj_count_diag, jj_count_offd; - HYPRE_Int jj_row_begining, jj_row_begin_diag, jj_row_begin_offd; - HYPRE_Int start_indexing = 0; /* start indexing for RAP_data at 0 */ - HYPRE_Int num_nz_cols_A; - HYPRE_Int num_procs; - HYPRE_Int num_threads; + HYPRE_Int square = 1; + HYPRE_Int num_cols_offd_Pext = 0; + + HYPRE_Int ic, i, j, k; + HYPRE_Int i1, i2, i3, ii, ns, ne, size, rest; + HYPRE_Int cnt = 0; /*value; */ + HYPRE_Int jj1, jj2, jj3, jcol; + + HYPRE_Int *jj_count, *jj_cnt_diag, *jj_cnt_offd; + HYPRE_Int jj_counter, jj_count_diag, jj_count_offd; + HYPRE_Int jj_row_begining, jj_row_begin_diag, jj_row_begin_offd; + HYPRE_Int start_indexing = 0; /* start indexing for RAP_data at 0 */ + HYPRE_Int num_nz_cols_A; + HYPRE_Int num_procs; + HYPRE_Int num_threads; HYPRE_Real r_entry; HYPRE_Real r_a_product; HYPRE_Real r_a_p_product; - + HYPRE_Real zero = 0.0; HYPRE_Int *prefix_sum_workspace; /*----------------------------------------------------------------------- - * Copy ParCSRMatrix RT into CSRMatrix R so that we have row-wise access + * Copy ParCSRMatrix RT into CSRMatrix R so that we have row-wise access * to restriction . *-----------------------------------------------------------------------*/ @@ -383,28 +198,28 @@ if (comm_pkg_RT) { - num_recvs_RT = hypre_ParCSRCommPkgNumRecvs(comm_pkg_RT); - num_sends_RT = hypre_ParCSRCommPkgNumSends(comm_pkg_RT); - send_map_starts_RT =hypre_ParCSRCommPkgSendMapStarts(comm_pkg_RT); - send_map_elmts_RT = hypre_ParCSRCommPkgSendMapElmts(comm_pkg_RT); + num_recvs_RT = hypre_ParCSRCommPkgNumRecvs(comm_pkg_RT); + num_sends_RT = hypre_ParCSRCommPkgNumSends(comm_pkg_RT); + send_map_starts_RT =hypre_ParCSRCommPkgSendMapStarts(comm_pkg_RT); + send_map_elmts_RT = hypre_ParCSRCommPkgSendMapElmts(comm_pkg_RT); } else if (num_procs > 1) { - hypre_MatvecCommPkgCreate(RT); - comm_pkg_RT = hypre_ParCSRMatrixCommPkg(RT); - num_recvs_RT = hypre_ParCSRCommPkgNumRecvs(comm_pkg_RT); - num_sends_RT = hypre_ParCSRCommPkgNumSends(comm_pkg_RT); - send_map_starts_RT =hypre_ParCSRCommPkgSendMapStarts(comm_pkg_RT); - send_map_elmts_RT = hypre_ParCSRCommPkgSendMapElmts(comm_pkg_RT); + hypre_MatvecCommPkgCreate(RT); + comm_pkg_RT = hypre_ParCSRMatrixCommPkg(RT); + num_recvs_RT = hypre_ParCSRCommPkgNumRecvs(comm_pkg_RT); + num_sends_RT = hypre_ParCSRCommPkgNumSends(comm_pkg_RT); + send_map_starts_RT =hypre_ParCSRCommPkgSendMapStarts(comm_pkg_RT); + send_map_elmts_RT = hypre_ParCSRCommPkgSendMapElmts(comm_pkg_RT); } - hypre_CSRMatrixTranspose(RT_diag,&R_diag,1); - if (num_cols_offd_RT) - { - hypre_CSRMatrixTranspose(RT_offd,&R_offd,1); - R_offd_data = hypre_CSRMatrixData(R_offd); - R_offd_i = hypre_CSRMatrixI(R_offd); - R_offd_j = hypre_CSRMatrixJ(R_offd); + hypre_CSRMatrixTranspose(RT_diag,&R_diag,1); + if (num_cols_offd_RT) + { + hypre_CSRMatrixTranspose(RT_offd,&R_offd,1); + R_offd_data = hypre_CSRMatrixData(R_offd); + R_offd_i = hypre_CSRMatrixI(R_offd); + R_offd_j = hypre_CSRMatrixJ(R_offd); } /*----------------------------------------------------------------------- @@ -425,7 +240,7 @@ /*----------------------------------------------------------------------- * Generate Ps_ext, i.e. portion of P that is stored on neighbor procs - * and needed locally for triple matrix product + * and needed locally for triple matrix product *-----------------------------------------------------------------------*/ #ifdef HYPRE_CONCURRENT_HOPSCOTCH @@ -490,19 +305,19 @@ send_map_elmts_RT_aggregated[offset] = i; } } -#endif /* HYPRE_CONCURRENT_HOPSCOTCH */ +#endif /* HYPRE_CONCURRENT_HOPSCOTCH */ #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_RENUMBER_COLIDX] -= hypre_MPI_Wtime(); hypre_profile_times[HYPRE_TIMER_ID_RENUMBER_COLIDX_RAP] -= hypre_MPI_Wtime(); #endif - if (num_procs > 1) + if (num_procs > 1) { - Ps_ext = hypre_ParCSRMatrixExtractBExt(P,A,1); - Ps_ext_data = hypre_CSRMatrixData(Ps_ext); - Ps_ext_i = hypre_CSRMatrixI(Ps_ext); - Ps_ext_j = hypre_CSRMatrixBigJ(Ps_ext); + Ps_ext = hypre_ParCSRMatrixExtractBExt(P,A,1); + Ps_ext_data = hypre_CSRMatrixData(Ps_ext); + Ps_ext_i = hypre_CSRMatrixI(Ps_ext); + Ps_ext_j = hypre_CSRMatrixBigJ(Ps_ext); } P_ext_diag_i = hypre_TAlloc(HYPRE_Int, num_cols_offd_A+1, HYPRE_MEMORY_HOST); @@ -516,7 +331,7 @@ /*HYPRE_Int prefix_sum_workspace[2*(num_threads + 1)];*/ prefix_sum_workspace = hypre_TAlloc(HYPRE_Int, 2*(num_threads + 1), HYPRE_MEMORY_HOST); -#ifdef HYPRE_USING_OPENMP +#ifdef HYPRE_USING_OPENMP #pragma omp parallel private(i,j) #endif /* This threading causes problem, maybe the prefix_sum in combination with BigInt? */ { @@ -582,11 +397,12 @@ } /* omp parallel */ hypre_TFree(prefix_sum_workspace, HYPRE_MEMORY_HOST); - if (num_procs > 1) + if (num_procs > 1) { hypre_CSRMatrixDestroy(Ps_ext); Ps_ext = NULL; } + #ifdef HYPRE_CONCURRENT_HOPSCOTCH if (P_ext_offd_size || num_cols_offd_P) { @@ -607,9 +423,9 @@ { hypre_UnorderedBigIntSetPut(&found_set, col_map_offd_P[i]); } - } /* omp parallel */ + } /* omp parallel */ - /* Warning on getting temp right !!!!! */ + /* Warning on getting temp right !!!!! */ temp = hypre_UnorderedBigIntSetCopyToArray(&found_set, &num_cols_offd_Pext); hypre_UnorderedBigIntSetDestroy(&found_set); @@ -628,9 +444,9 @@ { temp = hypre_CTAlloc(HYPRE_BigInt, P_ext_offd_size+num_cols_offd_P, HYPRE_MEMORY_HOST); for (i=0; i < P_ext_offd_size; i++) - //Ps_ext_j[i] = temp[i]; - //temp[i] = Ps_ext_j[i]; - temp[i] = P_big_offd_j[i]; + //Ps_ext_j[i] = temp[i]; + //temp[i] = Ps_ext_j[i]; + temp[i] = P_big_offd_j[i]; cnt = P_ext_offd_size; for (i=0; i < num_cols_offd_P; i++) temp[cnt++] = col_map_offd_P[i]; @@ -650,9 +466,9 @@ } } } - + if (num_cols_offd_Pext) - col_map_offd_Pext = hypre_CTAlloc(HYPRE_BigInt, num_cols_offd_Pext, HYPRE_MEMORY_HOST); + col_map_offd_Pext = hypre_CTAlloc(HYPRE_BigInt, num_cols_offd_Pext, HYPRE_MEMORY_HOST); for (i=0; i < num_cols_offd_Pext; i++) col_map_offd_Pext[i] = temp[i]; @@ -661,21 +477,21 @@ hypre_TFree(temp, HYPRE_MEMORY_HOST); /*if (P_ext_offd_size) - P_ext_offd_j = hypre_CTAlloc(HYPRE_Int, P_ext_offd_size, HYPRE_MEMORY_HOST);*/ + P_ext_offd_j = hypre_CTAlloc(HYPRE_Int, P_ext_offd_size, HYPRE_MEMORY_HOST);*/ for (i=0 ; i < P_ext_offd_size; i++) P_ext_offd_j[i] = hypre_BigBinarySearch(col_map_offd_Pext, - //Ps_ext_j[i], - P_big_offd_j[i], - num_cols_offd_Pext); + //Ps_ext_j[i], + P_big_offd_j[i], + num_cols_offd_Pext); #endif /* !HYPRE_CONCURRENT_HOPSCOTCH */ if (P_ext_offd_size) hypre_TFree(P_big_offd_j, HYPRE_MEMORY_HOST); - /*if (num_procs > 1) - { - hypre_CSRMatrixDestroy(Ps_ext); - Ps_ext = NULL; - }*/ + /*if (num_procs > 1) + { + hypre_CSRMatrixDestroy(Ps_ext); + Ps_ext = NULL; + }*/ if (num_cols_offd_P) { @@ -690,495 +506,498 @@ } } #ifdef HYPRE_PROFILE - hypre_profile_times[HYPRE_TIMER_ID_RENUMBER_COLIDX] += hypre_MPI_Wtime(); - hypre_profile_times[HYPRE_TIMER_ID_RENUMBER_COLIDX_RAP] += hypre_MPI_Wtime(); + hypre_profile_times[HYPRE_TIMER_ID_RENUMBER_COLIDX] += hypre_MPI_Wtime(); + hypre_profile_times[HYPRE_TIMER_ID_RENUMBER_COLIDX_RAP] += hypre_MPI_Wtime(); #endif /*----------------------------------------------------------------------- - * First Pass: Determine size of RAP_int and set up RAP_int_i if there + * First Pass: Determine size of RAP_int and set up RAP_int_i if there * are more than one processor and nonzero elements in R_offd *-----------------------------------------------------------------------*/ - P_mark_array = hypre_CTAlloc(HYPRE_Int *, num_threads, HYPRE_MEMORY_HOST); - A_mark_array = hypre_CTAlloc(HYPRE_Int *, num_threads, HYPRE_MEMORY_HOST); + P_mark_array = hypre_CTAlloc(HYPRE_Int *, num_threads, HYPRE_MEMORY_HOST); + A_mark_array = hypre_CTAlloc(HYPRE_Int *, num_threads, HYPRE_MEMORY_HOST); - if (num_cols_offd_RT) - { - jj_count = hypre_CTAlloc(HYPRE_Int, num_threads, HYPRE_MEMORY_HOST); + if (num_cols_offd_RT) + { + jj_count = hypre_CTAlloc(HYPRE_Int, num_threads, HYPRE_MEMORY_HOST); #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,ic,i1,i2,i3,jj1,jj2,jj3,ns,ne,size,rest,jj_counter,jj_row_begining,A_marker,P_marker) HYPRE_SMP_SCHEDULE #endif - for (ii = 0; ii < num_threads; ii++) - { - size = num_cols_offd_RT/num_threads; - rest = num_cols_offd_RT - size*num_threads; - if (ii < rest) - { - ns = ii*size+ii; - ne = (ii+1)*size+ii+1; - } - else - { - ns = ii*size+rest; - ne = (ii+1)*size+rest; - } - - /*----------------------------------------------------------------------- - * Allocate marker arrays. - *-----------------------------------------------------------------------*/ + for (ii = 0; ii < num_threads; ii++) + { + size = num_cols_offd_RT/num_threads; + rest = num_cols_offd_RT - size*num_threads; + if (ii < rest) + { + ns = ii*size+ii; + ne = (ii+1)*size+ii+1; + } + else + { + ns = ii*size+rest; + ne = (ii+1)*size+rest; + } - if (num_cols_offd_Pext || num_cols_diag_P) - { - P_mark_array[ii] = hypre_CTAlloc(HYPRE_Int, num_cols_diag_P+num_cols_offd_Pext, HYPRE_MEMORY_HOST); - P_marker = P_mark_array[ii]; - } - A_mark_array[ii] = hypre_CTAlloc(HYPRE_Int, num_nz_cols_A, HYPRE_MEMORY_HOST); - A_marker = A_mark_array[ii]; - /*----------------------------------------------------------------------- - * Initialize some stuff. - *-----------------------------------------------------------------------*/ + /*----------------------------------------------------------------------- + * Allocate marker arrays. + *-----------------------------------------------------------------------*/ - jj_counter = start_indexing; - for (ic = 0; ic < num_cols_diag_P+num_cols_offd_Pext; ic++) - { - P_marker[ic] = -1; - } - for (i = 0; i < num_nz_cols_A; i++) - { - A_marker[i] = -1; - } + if (num_cols_offd_Pext || num_cols_diag_P) + { + P_mark_array[ii] = hypre_CTAlloc(HYPRE_Int, num_cols_diag_P+num_cols_offd_Pext, HYPRE_MEMORY_HOST); + P_marker = P_mark_array[ii]; + } + A_mark_array[ii] = hypre_CTAlloc(HYPRE_Int, num_nz_cols_A, HYPRE_MEMORY_HOST); + A_marker = A_mark_array[ii]; + /*----------------------------------------------------------------------- + * Initialize some stuff. + *-----------------------------------------------------------------------*/ - /*----------------------------------------------------------------------- - * Loop over exterior c-points - *-----------------------------------------------------------------------*/ - - for (ic = ns; ic < ne; ic++) - { - - jj_row_begining = jj_counter; + jj_counter = start_indexing; + for (ic = 0; ic < num_cols_diag_P+num_cols_offd_Pext; ic++) + { + P_marker[ic] = -1; + } + for (i = 0; i < num_nz_cols_A; i++) + { + A_marker[i] = -1; + } + + /*----------------------------------------------------------------------- + * Loop over exterior c-points + *-----------------------------------------------------------------------*/ + + for (ic = ns; ic < ne; ic++) + { + + jj_row_begining = jj_counter; - /*-------------------------------------------------------------------- - * Loop over entries in row ic of R_offd. - *--------------------------------------------------------------------*/ - - for (jj1 = R_offd_i[ic]; jj1 < R_offd_i[ic+1]; jj1++) - { - i1 = R_offd_j[jj1]; - - /*----------------------------------------------------------------- - * Loop over entries in row i1 of A_offd. - *-----------------------------------------------------------------*/ - - for (jj2 = A_offd_i[i1]; jj2 < A_offd_i[i1+1]; jj2++) - { - i2 = A_offd_j[jj2]; - - /*-------------------------------------------------------------- - * Check A_marker to see if point i2 has been previously - * visited. New entries in RAP only occur from unmarked points. - *--------------------------------------------------------------*/ + /*-------------------------------------------------------------------- + * Loop over entries in row ic of R_offd. + *--------------------------------------------------------------------*/ - if (A_marker[i2] != ic) + for (jj1 = R_offd_i[ic]; jj1 < R_offd_i[ic+1]; jj1++) { + i1 = R_offd_j[jj1]; - /*----------------------------------------------------------- - * Mark i2 as visited. - *-----------------------------------------------------------*/ - - A_marker[i2] = ic; - - /*----------------------------------------------------------- - * Loop over entries in row i2 of P_ext. - *-----------------------------------------------------------*/ + /*----------------------------------------------------------------- + * Loop over entries in row i1 of A_offd. + *-----------------------------------------------------------------*/ - for (jj3 = P_ext_diag_i[i2]; jj3 < P_ext_diag_i[i2+1]; jj3++) + for (jj2 = A_offd_i[i1]; jj2 < A_offd_i[i1+1]; jj2++) { - i3 = P_ext_diag_j[jj3]; - - /*-------------------------------------------------------- - * Check P_marker to see that RAP_{ic,i3} has not already - * been accounted for. If it has not, mark it and increment - * counter. - *--------------------------------------------------------*/ + i2 = A_offd_j[jj2]; - if (P_marker[i3] < jj_row_begining) - { - P_marker[i3] = jj_counter; - jj_counter++; - } - } - for (jj3 = P_ext_offd_i[i2]; jj3 < P_ext_offd_i[i2+1]; jj3++) - { - i3 = P_ext_offd_j[jj3] + num_cols_diag_P; - - /*-------------------------------------------------------- - * Check P_marker to see that RAP_{ic,i3} has not already - * been accounted for. If it has not, mark it and increment - * counter. - *--------------------------------------------------------*/ + /*-------------------------------------------------------------- + * Check A_marker to see if point i2 has been previously + * visited. New entries in RAP only occur from unmarked points. + *--------------------------------------------------------------*/ - if (P_marker[i3] < jj_row_begining) + if (A_marker[i2] != ic) { - P_marker[i3] = jj_counter; - jj_counter++; - } - } - } - } - /*----------------------------------------------------------------- - * Loop over entries in row i1 of A_diag. - *-----------------------------------------------------------------*/ - - for (jj2 = A_diag_i[i1]; jj2 < A_diag_i[i1+1]; jj2++) - { - i2 = A_diag_j[jj2]; - - /*-------------------------------------------------------------- - * Check A_marker to see if point i2 has been previously - * visited. New entries in RAP only occur from unmarked points. - *--------------------------------------------------------------*/ - if (A_marker[i2+num_cols_offd_A] != ic) - { - - /*----------------------------------------------------------- - * Mark i2 as visited. - *-----------------------------------------------------------*/ - - A_marker[i2+num_cols_offd_A] = ic; - - /*----------------------------------------------------------- - * Loop over entries in row i2 of P_diag. - *-----------------------------------------------------------*/ + /*----------------------------------------------------------- + * Mark i2 as visited. + *-----------------------------------------------------------*/ + + A_marker[i2] = ic; + + /*----------------------------------------------------------- + * Loop over entries in row i2 of P_ext. + *-----------------------------------------------------------*/ + + for (jj3 = P_ext_diag_i[i2]; jj3 < P_ext_diag_i[i2+1]; jj3++) + { + i3 = P_ext_diag_j[jj3]; + + /*-------------------------------------------------------- + * Check P_marker to see that RAP_{ic,i3} has not already + * been accounted for. If it has not, mark it and increment + * counter. + *--------------------------------------------------------*/ - for (jj3 = P_diag_i[i2]; jj3 < P_diag_i[i2+1]; jj3++) - { - i3 = P_diag_j[jj3]; - - /*-------------------------------------------------------- - * Check P_marker to see that RAP_{ic,i3} has not already - * been accounted for. If it has not, mark it and increment - * counter. - *--------------------------------------------------------*/ + if (P_marker[i3] < jj_row_begining) + { + P_marker[i3] = jj_counter; + jj_counter++; + } + } + for (jj3 = P_ext_offd_i[i2]; jj3 < P_ext_offd_i[i2+1]; jj3++) + { + i3 = P_ext_offd_j[jj3] + num_cols_diag_P; + + /*-------------------------------------------------------- + * Check P_marker to see that RAP_{ic,i3} has not already + * been accounted for. If it has not, mark it and increment + * counter. + *--------------------------------------------------------*/ - if (P_marker[i3] < jj_row_begining) - { - P_marker[i3] = jj_counter; - jj_counter++; + if (P_marker[i3] < jj_row_begining) + { + P_marker[i3] = jj_counter; + jj_counter++; + } + } } } - /*----------------------------------------------------------- - * Loop over entries in row i2 of P_offd. - *-----------------------------------------------------------*/ + /*----------------------------------------------------------------- + * Loop over entries in row i1 of A_diag. + *-----------------------------------------------------------------*/ - for (jj3 = P_offd_i[i2]; jj3 < P_offd_i[i2+1]; jj3++) + for (jj2 = A_diag_i[i1]; jj2 < A_diag_i[i1+1]; jj2++) { - i3 = map_P_to_Pext[P_offd_j[jj3]] + num_cols_diag_P; - - /*-------------------------------------------------------- - * Check P_marker to see that RAP_{ic,i3} has not already - * been accounted for. If it has not, mark it and increment - * counter. - *--------------------------------------------------------*/ + i2 = A_diag_j[jj2]; + + /*-------------------------------------------------------------- + * Check A_marker to see if point i2 has been previously + * visited. New entries in RAP only occur from unmarked points. + *--------------------------------------------------------------*/ - if (P_marker[i3] < jj_row_begining) + if (A_marker[i2+num_cols_offd_A] != ic) { - P_marker[i3] = jj_counter; - jj_counter++; + + /*----------------------------------------------------------- + * Mark i2 as visited. + *-----------------------------------------------------------*/ + + A_marker[i2+num_cols_offd_A] = ic; + + /*----------------------------------------------------------- + * Loop over entries in row i2 of P_diag. + *-----------------------------------------------------------*/ + + for (jj3 = P_diag_i[i2]; jj3 < P_diag_i[i2+1]; jj3++) + { + i3 = P_diag_j[jj3]; + + /*-------------------------------------------------------- + * Check P_marker to see that RAP_{ic,i3} has not already + * been accounted for. If it has not, mark it and increment + * counter. + *--------------------------------------------------------*/ + + if (P_marker[i3] < jj_row_begining) + { + P_marker[i3] = jj_counter; + jj_counter++; + } + } + /*----------------------------------------------------------- + * Loop over entries in row i2 of P_offd. + *-----------------------------------------------------------*/ + + for (jj3 = P_offd_i[i2]; jj3 < P_offd_i[i2+1]; jj3++) + { + i3 = map_P_to_Pext[P_offd_j[jj3]] + num_cols_diag_P; + + /*-------------------------------------------------------- + * Check P_marker to see that RAP_{ic,i3} has not already + * been accounted for. If it has not, mark it and increment + * counter. + *--------------------------------------------------------*/ + + if (P_marker[i3] < jj_row_begining) + { + P_marker[i3] = jj_counter; + jj_counter++; + } + } } } } } + + jj_count[ii] = jj_counter; + } - } - jj_count[ii] = jj_counter; + /*----------------------------------------------------------------------- + * Allocate RAP_int_data and RAP_int_j arrays. + *-----------------------------------------------------------------------*/ + for (i = 0; i < num_threads-1; i++) + jj_count[i+1] += jj_count[i]; - } - - /*----------------------------------------------------------------------- - * Allocate RAP_int_data and RAP_int_j arrays. - *-----------------------------------------------------------------------*/ - for (i = 0; i < num_threads-1; i++) - jj_count[i+1] += jj_count[i]; - - RAP_size = jj_count[num_threads-1]; - RAP_int_i = hypre_CTAlloc(HYPRE_Int, num_cols_offd_RT+1, HYPRE_MEMORY_HOST); - RAP_int_data = hypre_CTAlloc(HYPRE_Real, RAP_size, HYPRE_MEMORY_HOST); - RAP_int_j = hypre_CTAlloc(HYPRE_BigInt, RAP_size, HYPRE_MEMORY_HOST); + RAP_size = jj_count[num_threads-1]; + RAP_int_i = hypre_CTAlloc(HYPRE_Int, num_cols_offd_RT+1, HYPRE_MEMORY_HOST); + RAP_int_data = hypre_CTAlloc(HYPRE_Real, RAP_size, HYPRE_MEMORY_HOST); + RAP_int_j = hypre_CTAlloc(HYPRE_BigInt, RAP_size, HYPRE_MEMORY_HOST); - RAP_int_i[num_cols_offd_RT] = RAP_size; + RAP_int_i[num_cols_offd_RT] = RAP_size; - /*----------------------------------------------------------------------- - * Second Pass: Fill in RAP_int_data and RAP_int_j. - *-----------------------------------------------------------------------*/ + /*----------------------------------------------------------------------- + * Second Pass: Fill in RAP_int_data and RAP_int_j. + *-----------------------------------------------------------------------*/ #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,ic,i1,i2,i3,jj1,jj2,jj3,ns,ne,size,rest,jj_counter,jj_row_begining,A_marker,P_marker,r_entry,r_a_product,r_a_p_product) HYPRE_SMP_SCHEDULE #endif - for (ii = 0; ii < num_threads; ii++) - { - size = num_cols_offd_RT/num_threads; - rest = num_cols_offd_RT - size*num_threads; - if (ii < rest) - { - ns = ii*size+ii; - ne = (ii+1)*size+ii+1; - } - else - { - ns = ii*size+rest; - ne = (ii+1)*size+rest; - } + for (ii = 0; ii < num_threads; ii++) + { + size = num_cols_offd_RT/num_threads; + rest = num_cols_offd_RT - size*num_threads; + if (ii < rest) + { + ns = ii*size+ii; + ne = (ii+1)*size+ii+1; + } + else + { + ns = ii*size+rest; + ne = (ii+1)*size+rest; + } - /*----------------------------------------------------------------------- - * Initialize some stuff. - *-----------------------------------------------------------------------*/ - if (num_cols_offd_Pext || num_cols_diag_P) - P_marker = P_mark_array[ii]; - A_marker = A_mark_array[ii]; + /*----------------------------------------------------------------------- + * Initialize some stuff. + *-----------------------------------------------------------------------*/ + if (num_cols_offd_Pext || num_cols_diag_P) + P_marker = P_mark_array[ii]; + A_marker = A_mark_array[ii]; - jj_counter = start_indexing; - if (ii > 0) jj_counter = jj_count[ii-1]; + jj_counter = start_indexing; + if (ii > 0) jj_counter = jj_count[ii-1]; - for (ic = 0; ic < num_cols_diag_P+num_cols_offd_Pext; ic++) - { - P_marker[ic] = -1; - } - for (i = 0; i < num_nz_cols_A; i++) - { - A_marker[i] = -1; - } - - /*----------------------------------------------------------------------- - * Loop over exterior c-points. - *-----------------------------------------------------------------------*/ - - for (ic = ns; ic < ne; ic++) - { - - jj_row_begining = jj_counter; - RAP_int_i[ic] = jj_counter; - - /*-------------------------------------------------------------------- - * Loop over entries in row ic of R_offd. - *--------------------------------------------------------------------*/ - - for (jj1 = R_offd_i[ic]; jj1 < R_offd_i[ic+1]; jj1++) - { - i1 = R_offd_j[jj1]; - r_entry = R_offd_data[jj1]; - - /*----------------------------------------------------------------- - * Loop over entries in row i1 of A_offd. - *-----------------------------------------------------------------*/ - - for (jj2 = A_offd_i[i1]; jj2 < A_offd_i[i1+1]; jj2++) - { - i2 = A_offd_j[jj2]; - r_a_product = r_entry * A_offd_data[jj2]; - - /*-------------------------------------------------------------- - * Check A_marker to see if point i2 has been previously - * visited. New entries in RAP only occur from unmarked points. - *--------------------------------------------------------------*/ + for (ic = 0; ic < num_cols_diag_P+num_cols_offd_Pext; ic++) + { + P_marker[ic] = -1; + } + for (i = 0; i < num_nz_cols_A; i++) + { + A_marker[i] = -1; + } + + /*----------------------------------------------------------------------- + * Loop over exterior c-points. + *-----------------------------------------------------------------------*/ + + for (ic = ns; ic < ne; ic++) + { - if (A_marker[i2] != ic) + jj_row_begining = jj_counter; + RAP_int_i[ic] = jj_counter; + + /*-------------------------------------------------------------------- + * Loop over entries in row ic of R_offd. + *--------------------------------------------------------------------*/ + + for (jj1 = R_offd_i[ic]; jj1 < R_offd_i[ic+1]; jj1++) { + i1 = R_offd_j[jj1]; + r_entry = R_offd_data[jj1]; - /*----------------------------------------------------------- - * Mark i2 as visited. - *-----------------------------------------------------------*/ - - A_marker[i2] = ic; - - /*----------------------------------------------------------- - * Loop over entries in row i2 of P_ext. - *-----------------------------------------------------------*/ + /*----------------------------------------------------------------- + * Loop over entries in row i1 of A_offd. + *-----------------------------------------------------------------*/ - for (jj3 = P_ext_diag_i[i2]; jj3 < P_ext_diag_i[i2+1]; jj3++) + for (jj2 = A_offd_i[i1]; jj2 < A_offd_i[i1+1]; jj2++) { - i3 = P_ext_diag_j[jj3]; - r_a_p_product = r_a_product * P_ext_diag_data[jj3]; - - /*-------------------------------------------------------- - * Check P_marker to see that RAP_{ic,i3} has not already - * been accounted for. If it has not, create a new entry. - * If it has, add new contribution. - *--------------------------------------------------------*/ + i2 = A_offd_j[jj2]; + r_a_product = r_entry * A_offd_data[jj2]; - if (P_marker[i3] < jj_row_begining) - { - P_marker[i3] = jj_counter; - RAP_int_data[jj_counter] = r_a_p_product; - RAP_int_j[jj_counter] = (HYPRE_BigInt)i3 + first_col_diag_P; - jj_counter++; - } - else + /*-------------------------------------------------------------- + * Check A_marker to see if point i2 has been previously + * visited. New entries in RAP only occur from unmarked points. + *--------------------------------------------------------------*/ + + if (A_marker[i2] != ic) { - RAP_int_data[P_marker[i3]] += r_a_p_product; - } - } - for (jj3 = P_ext_offd_i[i2]; jj3 < P_ext_offd_i[i2+1]; jj3++) - { - i3 = P_ext_offd_j[jj3] + num_cols_diag_P; - r_a_p_product = r_a_product * P_ext_offd_data[jj3]; - - /*-------------------------------------------------------- - * Check P_marker to see that RAP_{ic,i3} has not already - * been accounted for. If it has not, create a new entry. - * If it has, add new contribution. - *--------------------------------------------------------*/ + /*----------------------------------------------------------- + * Mark i2 as visited. + *-----------------------------------------------------------*/ + + A_marker[i2] = ic; + + /*----------------------------------------------------------- + * Loop over entries in row i2 of P_ext. + *-----------------------------------------------------------*/ + + for (jj3 = P_ext_diag_i[i2]; jj3 < P_ext_diag_i[i2+1]; jj3++) + { + i3 = P_ext_diag_j[jj3]; + r_a_p_product = r_a_product * P_ext_diag_data[jj3]; + + /*-------------------------------------------------------- + * Check P_marker to see that RAP_{ic,i3} has not already + * been accounted for. If it has not, create a new entry. + * If it has, add new contribution. + *--------------------------------------------------------*/ - if (P_marker[i3] < jj_row_begining) - { - P_marker[i3] = jj_counter; - RAP_int_data[jj_counter] = r_a_p_product; - RAP_int_j[jj_counter] - = col_map_offd_Pext[i3-num_cols_diag_P]; - jj_counter++; + if (P_marker[i3] < jj_row_begining) + { + P_marker[i3] = jj_counter; + RAP_int_data[jj_counter] = r_a_p_product; + RAP_int_j[jj_counter] = (HYPRE_BigInt)i3 + first_col_diag_P; + jj_counter++; + } + else + { + RAP_int_data[P_marker[i3]] += r_a_p_product; + } + } + + for (jj3 = P_ext_offd_i[i2]; jj3 < P_ext_offd_i[i2+1]; jj3++) + { + i3 = P_ext_offd_j[jj3] + num_cols_diag_P; + r_a_p_product = r_a_product * P_ext_offd_data[jj3]; + + /*-------------------------------------------------------- + * Check P_marker to see that RAP_{ic,i3} has not already + * been accounted for. If it has not, create a new entry. + * If it has, add new contribution. + *--------------------------------------------------------*/ + + if (P_marker[i3] < jj_row_begining) + { + P_marker[i3] = jj_counter; + RAP_int_data[jj_counter] = r_a_p_product; + RAP_int_j[jj_counter] + = col_map_offd_Pext[i3-num_cols_diag_P]; + jj_counter++; + } + else + { + RAP_int_data[P_marker[i3]] += r_a_p_product; + } + } } + + /*-------------------------------------------------------------- + * If i2 is previously visited ( A_marker[12]=ic ) it yields + * no new entries in RAP and can just add new contributions. + *--------------------------------------------------------------*/ + else { - RAP_int_data[P_marker[i3]] += r_a_p_product; + for (jj3 = P_ext_diag_i[i2]; jj3 < P_ext_diag_i[i2+1]; jj3++) + { + i3 = P_ext_diag_j[jj3]; + r_a_p_product = r_a_product * P_ext_diag_data[jj3]; + RAP_int_data[P_marker[i3]] += r_a_p_product; + } + for (jj3 = P_ext_offd_i[i2]; jj3 < P_ext_offd_i[i2+1]; jj3++) + { + i3 = P_ext_offd_j[jj3] + num_cols_diag_P; + r_a_p_product = r_a_product * P_ext_offd_data[jj3]; + RAP_int_data[P_marker[i3]] += r_a_p_product; + } } } - } - /*-------------------------------------------------------------- - * If i2 is previously visited ( A_marker[12]=ic ) it yields - * no new entries in RAP and can just add new contributions. - *--------------------------------------------------------------*/ + /*----------------------------------------------------------------- + * Loop over entries in row i1 of A_diag. + *-----------------------------------------------------------------*/ - else - { - for (jj3 = P_ext_diag_i[i2]; jj3 < P_ext_diag_i[i2+1]; jj3++) + for (jj2 = A_diag_i[i1]; jj2 < A_diag_i[i1+1]; jj2++) { - i3 = P_ext_diag_j[jj3]; - r_a_p_product = r_a_product * P_ext_diag_data[jj3]; - RAP_int_data[P_marker[i3]] += r_a_p_product; - } - for (jj3 = P_ext_offd_i[i2]; jj3 < P_ext_offd_i[i2+1]; jj3++) - { - i3 = P_ext_offd_j[jj3] + num_cols_diag_P; - r_a_p_product = r_a_product * P_ext_offd_data[jj3]; - RAP_int_data[P_marker[i3]] += r_a_p_product; - } - } - } + i2 = A_diag_j[jj2]; + r_a_product = r_entry * A_diag_data[jj2]; - /*----------------------------------------------------------------- - * Loop over entries in row i1 of A_diag. - *-----------------------------------------------------------------*/ - - for (jj2 = A_diag_i[i1]; jj2 < A_diag_i[i1+1]; jj2++) - { - i2 = A_diag_j[jj2]; - r_a_product = r_entry * A_diag_data[jj2]; - - /*-------------------------------------------------------------- - * Check A_marker to see if point i2 has been previously - * visited. New entries in RAP only occur from unmarked points. - *--------------------------------------------------------------*/ + /*-------------------------------------------------------------- + * Check A_marker to see if point i2 has been previously + * visited. New entries in RAP only occur from unmarked points. + *--------------------------------------------------------------*/ - if (A_marker[i2+num_cols_offd_A] != ic) - { + if (A_marker[i2+num_cols_offd_A] != ic) + { - /*----------------------------------------------------------- - * Mark i2 as visited. - *-----------------------------------------------------------*/ - - A_marker[i2+num_cols_offd_A] = ic; - - /*----------------------------------------------------------- - * Loop over entries in row i2 of P_diag. - *-----------------------------------------------------------*/ + /*----------------------------------------------------------- + * Mark i2 as visited. + *-----------------------------------------------------------*/ + + A_marker[i2+num_cols_offd_A] = ic; + + /*----------------------------------------------------------- + * Loop over entries in row i2 of P_diag. + *-----------------------------------------------------------*/ + + for (jj3 = P_diag_i[i2]; jj3 < P_diag_i[i2+1]; jj3++) + { + i3 = P_diag_j[jj3]; + r_a_p_product = r_a_product * P_diag_data[jj3]; + + /*-------------------------------------------------------- + * Check P_marker to see that RAP_{ic,i3} has not already + * been accounted for. If it has not, create a new entry. + * If it has, add new contribution. + *--------------------------------------------------------*/ - for (jj3 = P_diag_i[i2]; jj3 < P_diag_i[i2+1]; jj3++) - { - i3 = P_diag_j[jj3]; - r_a_p_product = r_a_product * P_diag_data[jj3]; - - /*-------------------------------------------------------- - * Check P_marker to see that RAP_{ic,i3} has not already - * been accounted for. If it has not, create a new entry. - * If it has, add new contribution. - *--------------------------------------------------------*/ + if (P_marker[i3] < jj_row_begining) + { + P_marker[i3] = jj_counter; + RAP_int_data[jj_counter] = r_a_p_product; + RAP_int_j[jj_counter] = (HYPRE_BigInt)i3 + first_col_diag_P; + jj_counter++; + } + else + { + RAP_int_data[P_marker[i3]] += r_a_p_product; + } + } + for (jj3 = P_offd_i[i2]; jj3 < P_offd_i[i2+1]; jj3++) + { + i3 = map_P_to_Pext[P_offd_j[jj3]] + num_cols_diag_P; + r_a_p_product = r_a_product * P_offd_data[jj3]; + + /*-------------------------------------------------------- + * Check P_marker to see that RAP_{ic,i3} has not already + * been accounted for. If it has not, create a new entry. + * If it has, add new contribution. + *--------------------------------------------------------*/ - if (P_marker[i3] < jj_row_begining) - { - P_marker[i3] = jj_counter; - RAP_int_data[jj_counter] = r_a_p_product; - RAP_int_j[jj_counter] = (HYPRE_BigInt)i3 + first_col_diag_P; - jj_counter++; - } - else - { - RAP_int_data[P_marker[i3]] += r_a_p_product; + if (P_marker[i3] < jj_row_begining) + { + P_marker[i3] = jj_counter; + RAP_int_data[jj_counter] = r_a_p_product; + RAP_int_j[jj_counter] = + col_map_offd_Pext[i3-num_cols_diag_P]; + jj_counter++; + } + else + { + RAP_int_data[P_marker[i3]] += r_a_p_product; + } + } } - } - for (jj3 = P_offd_i[i2]; jj3 < P_offd_i[i2+1]; jj3++) - { - i3 = map_P_to_Pext[P_offd_j[jj3]] + num_cols_diag_P; - r_a_p_product = r_a_product * P_offd_data[jj3]; - - /*-------------------------------------------------------- - * Check P_marker to see that RAP_{ic,i3} has not already - * been accounted for. If it has not, create a new entry. - * If it has, add new contribution. - *--------------------------------------------------------*/ - if (P_marker[i3] < jj_row_begining) - { - P_marker[i3] = jj_counter; - RAP_int_data[jj_counter] = r_a_p_product; - RAP_int_j[jj_counter] = - col_map_offd_Pext[i3-num_cols_diag_P]; - jj_counter++; - } + /*-------------------------------------------------------------- + * If i2 is previously visited ( A_marker[12]=ic ) it yields + * no new entries in RAP and can just add new contributions. + *--------------------------------------------------------------*/ + else { - RAP_int_data[P_marker[i3]] += r_a_p_product; + for (jj3 = P_diag_i[i2]; jj3 < P_diag_i[i2+1]; jj3++) + { + i3 = P_diag_j[jj3]; + r_a_p_product = r_a_product * P_diag_data[jj3]; + RAP_int_data[P_marker[i3]] += r_a_p_product; + } + for (jj3 = P_offd_i[i2]; jj3 < P_offd_i[i2+1]; jj3++) + { + i3 = map_P_to_Pext[P_offd_j[jj3]] + num_cols_diag_P; + r_a_p_product = r_a_product * P_offd_data[jj3]; + RAP_int_data[P_marker[i3]] += r_a_p_product; + } } } } - - /*-------------------------------------------------------------- - * If i2 is previously visited ( A_marker[12]=ic ) it yields - * no new entries in RAP and can just add new contributions. - *--------------------------------------------------------------*/ - - else - { - for (jj3 = P_diag_i[i2]; jj3 < P_diag_i[i2+1]; jj3++) - { - i3 = P_diag_j[jj3]; - r_a_p_product = r_a_product * P_diag_data[jj3]; - RAP_int_data[P_marker[i3]] += r_a_p_product; - } - for (jj3 = P_offd_i[i2]; jj3 < P_offd_i[i2+1]; jj3++) - { - i3 = map_P_to_Pext[P_offd_j[jj3]] + num_cols_diag_P; - r_a_p_product = r_a_product * P_offd_data[jj3]; - RAP_int_data[P_marker[i3]] += r_a_p_product; - } - } } + if (num_cols_offd_Pext || num_cols_diag_P) + hypre_TFree(P_mark_array[ii], HYPRE_MEMORY_HOST); + hypre_TFree(A_mark_array[ii], HYPRE_MEMORY_HOST); } - } - if (num_cols_offd_Pext || num_cols_diag_P) - hypre_TFree(P_mark_array[ii], HYPRE_MEMORY_HOST); - hypre_TFree(A_mark_array[ii], HYPRE_MEMORY_HOST); - } - RAP_int = hypre_CSRMatrixCreate(num_cols_offd_RT,num_rows_offd_RT,RAP_size); - hypre_CSRMatrixI(RAP_int) = RAP_int_i; - hypre_CSRMatrixBigJ(RAP_int) = RAP_int_j; - hypre_CSRMatrixData(RAP_int) = RAP_int_data; - hypre_TFree(jj_count, HYPRE_MEMORY_HOST); - } + RAP_int = hypre_CSRMatrixCreate(num_cols_offd_RT,num_rows_offd_RT,RAP_size); + + hypre_CSRMatrixMemoryLocation(RAP_int) = HYPRE_MEMORY_HOST; + + hypre_CSRMatrixI(RAP_int) = RAP_int_i; + hypre_CSRMatrixBigJ(RAP_int) = RAP_int_j; + hypre_CSRMatrixData(RAP_int) = RAP_int_data; + hypre_TFree(jj_count, HYPRE_MEMORY_HOST); + } #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_RENUMBER_COLIDX] -= hypre_MPI_Wtime(); @@ -1188,18 +1007,20 @@ RAP_ext_size = 0; if (num_sends_RT || num_recvs_RT) { - RAP_ext = hypre_ExchangeRAPData(RAP_int,comm_pkg_RT); - RAP_ext_i = hypre_CSRMatrixI(RAP_ext); - RAP_ext_j = hypre_CSRMatrixBigJ(RAP_ext); - RAP_ext_data = hypre_CSRMatrixData(RAP_ext); - RAP_ext_size = RAP_ext_i[hypre_CSRMatrixNumRows(RAP_ext)]; + void *request; + hypre_ExchangeExternalRowsInit(RAP_int, comm_pkg_RT, &request); + RAP_ext = hypre_ExchangeExternalRowsWait(request); + RAP_ext_i = hypre_CSRMatrixI(RAP_ext); + RAP_ext_j = hypre_CSRMatrixBigJ(RAP_ext); + RAP_ext_data = hypre_CSRMatrixData(RAP_ext); + RAP_ext_size = RAP_ext_i[hypre_CSRMatrixNumRows(RAP_ext)]; } if (num_cols_offd_RT) { hypre_CSRMatrixDestroy(RAP_int); RAP_int = NULL; } - + RAP_diag_i = hypre_TAlloc(HYPRE_Int, num_cols_diag_RT+1, HYPRE_MEMORY_SHARED); RAP_offd_i = hypre_TAlloc(HYPRE_Int, num_cols_diag_RT+1, HYPRE_MEMORY_SHARED); @@ -1223,8 +1044,8 @@ #pragma omp for HYPRE_SMP_SCHEDULE for (i = 0; i < RAP_ext_size; i++) { - if (RAP_ext_j[i] < first_col_diag_RAP - || RAP_ext_j[i] > last_col_diag_RAP) + if (RAP_ext_j[i] < first_col_diag_RAP + || RAP_ext_j[i] > last_col_diag_RAP) hypre_UnorderedBigIntSetPut(&found_set, RAP_ext_j[i]); } @@ -1245,8 +1066,8 @@ temp = hypre_CTAlloc(HYPRE_BigInt, RAP_ext_size+num_cols_offd_Pext, HYPRE_MEMORY_HOST); cnt = 0; for (i=0; i < RAP_ext_size; i++) - if (RAP_ext_j[i] < first_col_diag_RAP - || RAP_ext_j[i] > last_col_diag_RAP) + if (RAP_ext_j[i] < first_col_diag_RAP + || RAP_ext_j[i] > last_col_diag_RAP) temp[cnt++] = RAP_ext_j[i]; for (i=0; i < num_cols_offd_Pext; i++) temp[cnt++] = col_map_offd_Pext[i]; @@ -1267,13 +1088,13 @@ } } - /* now evaluate col_map_offd_RAP */ + /* now evaluate col_map_offd_RAP */ if (num_cols_offd_RAP) col_map_offd_RAP = hypre_CTAlloc(HYPRE_BigInt, num_cols_offd_RAP, HYPRE_MEMORY_HOST); for (i=0 ; i < num_cols_offd_RAP; i++) col_map_offd_RAP[i] = temp[i]; - + hypre_TFree(temp, HYPRE_MEMORY_HOST); } #endif /* !HYPRE_CONCURRENT_HOPSCOTCH */ @@ -1312,16 +1133,16 @@ #pragma omp parallel for HYPRE_SMP_SCHEDULE #endif for (i=0; i < RAP_ext_size; i++) - if (RAP_ext_j[i] < first_col_diag_RAP - || RAP_ext_j[i] > last_col_diag_RAP) - RAP_ext_j[i] = (HYPRE_BigInt)num_cols_diag_P + if (RAP_ext_j[i] < first_col_diag_RAP + || RAP_ext_j[i] > last_col_diag_RAP) + RAP_ext_j[i] = (HYPRE_BigInt)num_cols_diag_P #ifdef HYPRE_CONCURRENT_HOPSCOTCH - +(HYPRE_BigInt)hypre_UnorderedBigIntMapGet(&col_map_offd_RAP_inverse, RAP_ext_j[i]); + +(HYPRE_BigInt)hypre_UnorderedBigIntMapGet(&col_map_offd_RAP_inverse, RAP_ext_j[i]); #else - +(HYPRE_BigInt)hypre_BigBinarySearch(col_map_offd_RAP, RAP_ext_j[i],num_cols_offd_RAP); + +(HYPRE_BigInt)hypre_BigBinarySearch(col_map_offd_RAP, RAP_ext_j[i],num_cols_offd_RAP); #endif else - RAP_ext_j[i] -= first_col_diag_RAP; + RAP_ext_j[i] -= first_col_diag_RAP; #ifdef HYPRE_CONCURRENT_HOPSCOTCH if (num_cols_offd_RAP) @@ -1333,7 +1154,7 @@ hypre_profile_times[HYPRE_TIMER_ID_RENUMBER_COLIDX_RAP] += hypre_MPI_Wtime(); #endif -/* need to allocate new P_marker etc. and make further changes */ + /* need to allocate new P_marker etc. and make further changes */ /*----------------------------------------------------------------------- * Initialize some stuff. *-----------------------------------------------------------------------*/ @@ -1345,264 +1166,264 @@ #endif for (ii = 0; ii < num_threads; ii++) { - size = num_cols_diag_RT/num_threads; - rest = num_cols_diag_RT - size*num_threads; - if (ii < rest) - { - ns = ii*size+ii; - ne = (ii+1)*size+ii+1; - } - else - { - ns = ii*size+rest; - ne = (ii+1)*size+rest; - } - - P_mark_array[ii] = hypre_CTAlloc(HYPRE_Int, num_cols_diag_P+num_cols_offd_RAP, HYPRE_MEMORY_HOST); - A_mark_array[ii] = hypre_CTAlloc(HYPRE_Int, num_nz_cols_A, HYPRE_MEMORY_HOST); - P_marker = P_mark_array[ii]; - A_marker = A_mark_array[ii]; - jj_count_diag = start_indexing; - jj_count_offd = start_indexing; - - for (ic = 0; ic < num_cols_diag_P+num_cols_offd_RAP; ic++) - { - P_marker[ic] = -1; - } - for (i = 0; i < num_nz_cols_A; i++) - { - A_marker[i] = -1; - } + size = num_cols_diag_RT/num_threads; + rest = num_cols_diag_RT - size*num_threads; + if (ii < rest) + { + ns = ii*size+ii; + ne = (ii+1)*size+ii+1; + } + else + { + ns = ii*size+rest; + ne = (ii+1)*size+rest; + } - /*----------------------------------------------------------------------- - * Loop over interior c-points. - *-----------------------------------------------------------------------*/ - - for (ic = ns; ic < ne; ic++) - { - - /*-------------------------------------------------------------------- - * Set marker for diagonal entry, RAP_{ic,ic}. and for all points - * being added to row ic of RAP_diag and RAP_offd through RAP_ext - *--------------------------------------------------------------------*/ + P_mark_array[ii] = hypre_CTAlloc(HYPRE_Int, num_cols_diag_P+num_cols_offd_RAP, HYPRE_MEMORY_HOST); + A_mark_array[ii] = hypre_CTAlloc(HYPRE_Int, num_nz_cols_A, HYPRE_MEMORY_HOST); + P_marker = P_mark_array[ii]; + A_marker = A_mark_array[ii]; + jj_count_diag = start_indexing; + jj_count_offd = start_indexing; - jj_row_begin_diag = jj_count_diag; - jj_row_begin_offd = jj_count_offd; + for (ic = 0; ic < num_cols_diag_P+num_cols_offd_RAP; ic++) + { + P_marker[ic] = -1; + } + for (i = 0; i < num_nz_cols_A; i++) + { + A_marker[i] = -1; + } - if (square) - P_marker[ic] = jj_count_diag++; + /*----------------------------------------------------------------------- + * Loop over interior c-points. + *-----------------------------------------------------------------------*/ -#ifdef HYPRE_CONCURRENT_HOPSCOTCH - if (send_map_elmts_RT_inverse_map_initialized) + for (ic = ns; ic < ne; ic++) { - HYPRE_Int i = hypre_UnorderedIntMapGet(&send_map_elmts_RT_inverse_map, ic); - if (i != -1) - { - for (j = send_map_elmts_starts_RT_aggregated[i]; j < send_map_elmts_starts_RT_aggregated[i + 1]; j++) - { - HYPRE_Int jj = send_map_elmts_RT_aggregated[j]; - for (k=RAP_ext_i[jj]; k < RAP_ext_i[jj+1]; k++) - { - jcol = (HYPRE_Int)RAP_ext_j[k]; - if (jcol < num_cols_diag_P) - { - if (P_marker[jcol] < jj_row_begin_diag) - { - P_marker[jcol] = jj_count_diag; - jj_count_diag++; - } - } - else - { - if (P_marker[jcol] < jj_row_begin_offd) - { - P_marker[jcol] = jj_count_offd; - jj_count_offd++; - } - } - } - } - } // if (set) - } -#else /* !HYPRE_CONCURRENT_HOPSCOTCH */ - for (i=0; i < num_sends_RT; i++) - for (j = send_map_starts_RT[i]; j < send_map_starts_RT[i+1]; j++) - if (send_map_elmts_RT[j] == ic) + + /*-------------------------------------------------------------------- + * Set marker for diagonal entry, RAP_{ic,ic}. and for all points + * being added to row ic of RAP_diag and RAP_offd through RAP_ext + *--------------------------------------------------------------------*/ + + jj_row_begin_diag = jj_count_diag; + jj_row_begin_offd = jj_count_offd; + + if (square) + P_marker[ic] = jj_count_diag++; + +#ifdef HYPRE_CONCURRENT_HOPSCOTCH + if (send_map_elmts_RT_inverse_map_initialized) + { + HYPRE_Int i = hypre_UnorderedIntMapGet(&send_map_elmts_RT_inverse_map, ic); + if (i != -1) { - for (k=RAP_ext_i[j]; k < RAP_ext_i[j+1]; k++) - { - jcol = (HYPRE_Int) RAP_ext_j[k]; - if (jcol < num_cols_diag_P) - { + for (j = send_map_elmts_starts_RT_aggregated[i]; j < send_map_elmts_starts_RT_aggregated[i + 1]; j++) + { + HYPRE_Int jj = send_map_elmts_RT_aggregated[j]; + for (k=RAP_ext_i[jj]; k < RAP_ext_i[jj+1]; k++) + { + jcol = (HYPRE_Int)RAP_ext_j[k]; + if (jcol < num_cols_diag_P) + { if (P_marker[jcol] < jj_row_begin_diag) { - P_marker[jcol] = jj_count_diag; - jj_count_diag++; + P_marker[jcol] = jj_count_diag; + jj_count_diag++; } - } - else - { + } + else + { if (P_marker[jcol] < jj_row_begin_offd) { - P_marker[jcol] = jj_count_offd; - jj_count_offd++; + P_marker[jcol] = jj_count_offd; + jj_count_offd++; } - } - } - break; - } -#endif /* !HYPRE_CONCURRENT_HOPSCOTCH */ - - /*-------------------------------------------------------------------- - * Loop over entries in row ic of R_diag. - *--------------------------------------------------------------------*/ - - for (jj1 = R_diag_i[ic]; jj1 < R_diag_i[ic+1]; jj1++) - { - i1 = R_diag_j[jj1]; - - /*----------------------------------------------------------------- - * Loop over entries in row i1 of A_offd. - *-----------------------------------------------------------------*/ - - if (num_cols_offd_A) - { - for (jj2 = A_offd_i[i1]; jj2 < A_offd_i[i1+1]; jj2++) - { - i2 = A_offd_j[jj2]; - - /*-------------------------------------------------------------- - * Check A_marker to see if point i2 has been previously - * visited. New entries in RAP only occur from unmarked points. - *--------------------------------------------------------------*/ - - if (A_marker[i2] != ic) - { - - /*----------------------------------------------------------- - * Mark i2 as visited. - *-----------------------------------------------------------*/ - - A_marker[i2] = ic; - - /*----------------------------------------------------------- - * Loop over entries in row i2 of P_ext. - *-----------------------------------------------------------*/ - - for (jj3 = P_ext_diag_i[i2]; jj3 < P_ext_diag_i[i2+1]; jj3++) + } + } + } + } // if (set) + } +#else /* !HYPRE_CONCURRENT_HOPSCOTCH */ + for (i=0; i < num_sends_RT; i++) + for (j = send_map_starts_RT[i]; j < send_map_starts_RT[i+1]; j++) + if (send_map_elmts_RT[j] == ic) { - i3 = P_ext_diag_j[jj3]; - - /*-------------------------------------------------------- - * Check P_marker to see that RAP_{ic,i3} has not already - * been accounted for. If it has not, mark it and increment - * counter. - *--------------------------------------------------------*/ - - if (P_marker[i3] < jj_row_begin_diag) + for (k=RAP_ext_i[j]; k < RAP_ext_i[j+1]; k++) { - P_marker[i3] = jj_count_diag; - jj_count_diag++; + jcol = (HYPRE_Int) RAP_ext_j[k]; + if (jcol < num_cols_diag_P) + { + if (P_marker[jcol] < jj_row_begin_diag) + { + P_marker[jcol] = jj_count_diag; + jj_count_diag++; + } + } + else + { + if (P_marker[jcol] < jj_row_begin_offd) + { + P_marker[jcol] = jj_count_offd; + jj_count_offd++; + } + } } + break; } - for (jj3 = P_ext_offd_i[i2]; jj3 < P_ext_offd_i[i2+1]; jj3++) +#endif /* !HYPRE_CONCURRENT_HOPSCOTCH */ + + /*-------------------------------------------------------------------- + * Loop over entries in row ic of R_diag. + *--------------------------------------------------------------------*/ + + for (jj1 = R_diag_i[ic]; jj1 < R_diag_i[ic+1]; jj1++) + { + i1 = R_diag_j[jj1]; + + /*----------------------------------------------------------------- + * Loop over entries in row i1 of A_offd. + *-----------------------------------------------------------------*/ + + if (num_cols_offd_A) + { + for (jj2 = A_offd_i[i1]; jj2 < A_offd_i[i1+1]; jj2++) { - i3 = map_Pext_to_RAP[P_ext_offd_j[jj3]]+num_cols_diag_P; - - /*-------------------------------------------------------- - * Check P_marker to see that RAP_{ic,i3} has not already - * been accounted for. If it has not, mark it and increment - * counter. - *--------------------------------------------------------*/ + i2 = A_offd_j[jj2]; - if (P_marker[i3] < jj_row_begin_offd) + /*-------------------------------------------------------------- + * Check A_marker to see if point i2 has been previously + * visited. New entries in RAP only occur from unmarked points. + *--------------------------------------------------------------*/ + + if (A_marker[i2] != ic) { - P_marker[i3] = jj_count_offd; - jj_count_offd++; + + /*----------------------------------------------------------- + * Mark i2 as visited. + *-----------------------------------------------------------*/ + + A_marker[i2] = ic; + + /*----------------------------------------------------------- + * Loop over entries in row i2 of P_ext. + *-----------------------------------------------------------*/ + + for (jj3 = P_ext_diag_i[i2]; jj3 < P_ext_diag_i[i2+1]; jj3++) + { + i3 = P_ext_diag_j[jj3]; + + /*-------------------------------------------------------- + * Check P_marker to see that RAP_{ic,i3} has not already + * been accounted for. If it has not, mark it and increment + * counter. + *--------------------------------------------------------*/ + + if (P_marker[i3] < jj_row_begin_diag) + { + P_marker[i3] = jj_count_diag; + jj_count_diag++; + } + } + for (jj3 = P_ext_offd_i[i2]; jj3 < P_ext_offd_i[i2+1]; jj3++) + { + i3 = map_Pext_to_RAP[P_ext_offd_j[jj3]]+num_cols_diag_P; + + /*-------------------------------------------------------- + * Check P_marker to see that RAP_{ic,i3} has not already + * been accounted for. If it has not, mark it and increment + * counter. + *--------------------------------------------------------*/ + + if (P_marker[i3] < jj_row_begin_offd) + { + P_marker[i3] = jj_count_offd; + jj_count_offd++; + } + } } } } - } - } - /*----------------------------------------------------------------- - * Loop over entries in row i1 of A_diag. - *-----------------------------------------------------------------*/ - - for (jj2 = A_diag_i[i1]; jj2 < A_diag_i[i1+1]; jj2++) - { - i2 = A_diag_j[jj2]; - - /*-------------------------------------------------------------- - * Check A_marker to see if point i2 has been previously - * visited. New entries in RAP only occur from unmarked points. - *--------------------------------------------------------------*/ - - if (A_marker[i2+num_cols_offd_A] != ic) + /*----------------------------------------------------------------- + * Loop over entries in row i1 of A_diag. + *-----------------------------------------------------------------*/ + + for (jj2 = A_diag_i[i1]; jj2 < A_diag_i[i1+1]; jj2++) { - - /*----------------------------------------------------------- - * Mark i2 as visited. - *-----------------------------------------------------------*/ - - A_marker[i2+num_cols_offd_A] = ic; - - /*----------------------------------------------------------- - * Loop over entries in row i2 of P_diag. - *-----------------------------------------------------------*/ - - for (jj3 = P_diag_i[i2]; jj3 < P_diag_i[i2+1]; jj3++) + i2 = A_diag_j[jj2]; + + /*-------------------------------------------------------------- + * Check A_marker to see if point i2 has been previously + * visited. New entries in RAP only occur from unmarked points. + *--------------------------------------------------------------*/ + + if (A_marker[i2+num_cols_offd_A] != ic) { - i3 = P_diag_j[jj3]; - - /*-------------------------------------------------------- - * Check P_marker to see that RAP_{ic,i3} has not already - * been accounted for. If it has not, mark it and increment - * counter. - *--------------------------------------------------------*/ - - if (P_marker[i3] < jj_row_begin_diag) + + /*----------------------------------------------------------- + * Mark i2 as visited. + *-----------------------------------------------------------*/ + + A_marker[i2+num_cols_offd_A] = ic; + + /*----------------------------------------------------------- + * Loop over entries in row i2 of P_diag. + *-----------------------------------------------------------*/ + + for (jj3 = P_diag_i[i2]; jj3 < P_diag_i[i2+1]; jj3++) { - P_marker[i3] = jj_count_diag; - jj_count_diag++; + i3 = P_diag_j[jj3]; + + /*-------------------------------------------------------- + * Check P_marker to see that RAP_{ic,i3} has not already + * been accounted for. If it has not, mark it and increment + * counter. + *--------------------------------------------------------*/ + + if (P_marker[i3] < jj_row_begin_diag) + { + P_marker[i3] = jj_count_diag; + jj_count_diag++; + } } - } - /*----------------------------------------------------------- - * Loop over entries in row i2 of P_offd. - *-----------------------------------------------------------*/ - - if (num_cols_offd_P) - { - for (jj3 = P_offd_i[i2]; jj3 < P_offd_i[i2+1]; jj3++) - { - i3 = map_P_to_RAP[P_offd_j[jj3]] + num_cols_diag_P; - - /*-------------------------------------------------------- - * Check P_marker to see that RAP_{ic,i3} has not already - * been accounted for. If it has not, mark it and increment - * counter. - *--------------------------------------------------------*/ - - if (P_marker[i3] < jj_row_begin_offd) + /*----------------------------------------------------------- + * Loop over entries in row i2 of P_offd. + *-----------------------------------------------------------*/ + + if (num_cols_offd_P) { - P_marker[i3] = jj_count_offd; - jj_count_offd++; + for (jj3 = P_offd_i[i2]; jj3 < P_offd_i[i2+1]; jj3++) + { + i3 = map_P_to_RAP[P_offd_j[jj3]] + num_cols_diag_P; + + /*-------------------------------------------------------- + * Check P_marker to see that RAP_{ic,i3} has not already + * been accounted for. If it has not, mark it and increment + * counter. + *--------------------------------------------------------*/ + + if (P_marker[i3] < jj_row_begin_offd) + { + P_marker[i3] = jj_count_offd; + jj_count_offd++; + } + } } - } - } + } } } + + /*-------------------------------------------------------------------- + * Set RAP_diag_i and RAP_offd_i for this row. + *--------------------------------------------------------------------*/ + /* + RAP_diag_i[ic] = jj_row_begin_diag; + RAP_offd_i[ic] = jj_row_begin_offd; + */ } - - /*-------------------------------------------------------------------- - * Set RAP_diag_i and RAP_offd_i for this row. - *--------------------------------------------------------------------*/ -/* - RAP_diag_i[ic] = jj_row_begin_diag; - RAP_offd_i[ic] = jj_row_begin_offd; -*/ - } - jj_cnt_diag[ii] = jj_count_diag; - jj_cnt_offd[ii] = jj_count_offd; + jj_cnt_diag[ii] = jj_count_diag; + jj_cnt_offd[ii] = jj_count_offd; } for (i=0; i < num_threads-1; i++) @@ -1616,25 +1437,25 @@ RAP_diag_i[num_cols_diag_RT] = jj_count_diag; RAP_offd_i[num_cols_diag_RT] = jj_count_offd; - + /*----------------------------------------------------------------------- * Allocate RAP_diag_data and RAP_diag_j arrays. * Allocate RAP_offd_data and RAP_offd_j arrays. *-----------------------------------------------------------------------*/ - + RAP_diag_size = jj_count_diag; if (RAP_diag_size) - { + { RAP_diag_data = hypre_CTAlloc(HYPRE_Real, RAP_diag_size, HYPRE_MEMORY_SHARED); RAP_diag_j = hypre_CTAlloc(HYPRE_Int, RAP_diag_size, HYPRE_MEMORY_SHARED); - } - + } + RAP_offd_size = jj_count_offd; if (RAP_offd_size) - { - RAP_offd_data = hypre_CTAlloc(HYPRE_Real, RAP_offd_size, HYPRE_MEMORY_SHARED); - RAP_offd_j = hypre_CTAlloc(HYPRE_Int, RAP_offd_size, HYPRE_MEMORY_SHARED); - } + { + RAP_offd_data = hypre_CTAlloc(HYPRE_Real, RAP_offd_size, HYPRE_MEMORY_SHARED); + RAP_offd_j = hypre_CTAlloc(HYPRE_Int, RAP_offd_size, HYPRE_MEMORY_SHARED); + } if (RAP_offd_size == 0 && num_cols_offd_RAP != 0) { @@ -1660,356 +1481,295 @@ #endif for (ii = 0; ii < num_threads; ii++) { - size = num_cols_diag_RT/num_threads; - rest = num_cols_diag_RT - size*num_threads; - if (ii < rest) - { - ns = ii*size+ii; - ne = (ii+1)*size+ii+1; - } - else - { - ns = ii*size+rest; - ne = (ii+1)*size+rest; - } - - /*----------------------------------------------------------------------- - * Initialize some stuff. - *-----------------------------------------------------------------------*/ + size = num_cols_diag_RT/num_threads; + rest = num_cols_diag_RT - size*num_threads; + if (ii < rest) + { + ns = ii*size+ii; + ne = (ii+1)*size+ii+1; + } + else + { + ns = ii*size+rest; + ne = (ii+1)*size+rest; + } - P_marker = P_mark_array[ii]; - A_marker = A_mark_array[ii]; - for (ic = 0; ic < num_cols_diag_P+num_cols_offd_RAP; ic++) - { - P_marker[ic] = -1; - } - for (i = 0; i < num_nz_cols_A ; i++) - { - A_marker[i] = -1; - } - - jj_count_diag = start_indexing; - jj_count_offd = start_indexing; - if (ii > 0) - { - jj_count_diag = jj_cnt_diag[ii-1]; - jj_count_offd = jj_cnt_offd[ii-1]; - } - - // temporal matrix RA = R*A - // only need to store one row per thread because R*A and (R*A)*P are fused - // into one loop. - hypre_CSRMatrix RA_diag, RA_offd; - RA_diag.data = RA_diag_data_array + num_cols_diag_A*ii; - RA_diag.j = RA_diag_j_array + num_cols_diag_A*ii; - RA_diag.num_nonzeros = 0; - RA_offd.num_nonzeros = 0; + /*----------------------------------------------------------------------- + * Initialize some stuff. + *-----------------------------------------------------------------------*/ - if (num_cols_offd_A) - { - RA_offd.data = RA_offd_data_array + num_cols_offd_A*ii; - RA_offd.j = RA_offd_j_array + num_cols_offd_A*ii; - } + P_marker = P_mark_array[ii]; + A_marker = A_mark_array[ii]; + for (ic = 0; ic < num_cols_diag_P+num_cols_offd_RAP; ic++) + { + P_marker[ic] = -1; + } + for (i = 0; i < num_nz_cols_A ; i++) + { + A_marker[i] = -1; + } - /*----------------------------------------------------------------------- - * Loop over interior c-points. - *-----------------------------------------------------------------------*/ - - for (ic = ns; ic < ne; ic++) - { - - /*-------------------------------------------------------------------- - * Create diagonal entry, RAP_{ic,ic} and add entries of RAP_ext - *--------------------------------------------------------------------*/ - - jj_row_begin_diag = jj_count_diag; - jj_row_begin_offd = jj_count_offd; - RAP_diag_i[ic] = jj_row_begin_diag; - RAP_offd_i[ic] = jj_row_begin_offd; - - HYPRE_Int ra_row_begin_diag = RA_diag.num_nonzeros; - HYPRE_Int ra_row_begin_offd = RA_offd.num_nonzeros; - - if (square) - { - P_marker[ic] = jj_count_diag; - RAP_diag_data[jj_count_diag] = zero; - RAP_diag_j[jj_count_diag] = ic; - jj_count_diag++; + jj_count_diag = start_indexing; + jj_count_offd = start_indexing; + if (ii > 0) + { + jj_count_diag = jj_cnt_diag[ii-1]; + jj_count_offd = jj_cnt_offd[ii-1]; } -#ifdef HYPRE_CONCURRENT_HOPSCOTCH - if (send_map_elmts_RT_inverse_map_initialized) + // temporal matrix RA = R*A + // only need to store one row per thread because R*A and (R*A)*P are fused + // into one loop. + hypre_CSRMatrix RA_diag, RA_offd; + RA_diag.data = RA_diag_data_array + num_cols_diag_A*ii; + RA_diag.j = RA_diag_j_array + num_cols_diag_A*ii; + RA_diag.num_nonzeros = 0; + RA_offd.num_nonzeros = 0; + + if (num_cols_offd_A) { - HYPRE_Int i = hypre_UnorderedIntMapGet(&send_map_elmts_RT_inverse_map, ic); - if (i != -1) - { - for (j = send_map_elmts_starts_RT_aggregated[i]; j < send_map_elmts_starts_RT_aggregated[i + 1]; j++) - { - HYPRE_Int jj = send_map_elmts_RT_aggregated[j]; - for (k=RAP_ext_i[jj]; k < RAP_ext_i[jj+1]; k++) - { - jcol = (HYPRE_Int)RAP_ext_j[k]; - if (jcol < num_cols_diag_P) - { - if (P_marker[jcol] < jj_row_begin_diag) - { - P_marker[jcol] = jj_count_diag; - RAP_diag_data[jj_count_diag] - = RAP_ext_data[k]; - RAP_diag_j[jj_count_diag] = jcol; - jj_count_diag++; - } - else - RAP_diag_data[P_marker[jcol]] - += RAP_ext_data[k]; - } - else - { - if (P_marker[jcol] < jj_row_begin_offd) - { - P_marker[jcol] = jj_count_offd; - RAP_offd_data[jj_count_offd] - = RAP_ext_data[k]; - RAP_offd_j[jj_count_offd] - = jcol-num_cols_diag_P; - jj_count_offd++; - } - else - RAP_offd_data[P_marker[jcol]] - += RAP_ext_data[k]; - } - } - } - } // if (set) + RA_offd.data = RA_offd_data_array + num_cols_offd_A*ii; + RA_offd.j = RA_offd_j_array + num_cols_offd_A*ii; } -#else /* !HYPRE_CONCURRENT_HOPSCOTCH */ - for (i=0; i < num_sends_RT; i++) - for (j = send_map_starts_RT[i]; j < send_map_starts_RT[i+1]; j++) - if (send_map_elmts_RT[j] == ic) + + /*----------------------------------------------------------------------- + * Loop over interior c-points. + *-----------------------------------------------------------------------*/ + + for (ic = ns; ic < ne; ic++) + { + + /*-------------------------------------------------------------------- + * Create diagonal entry, RAP_{ic,ic} and add entries of RAP_ext + *--------------------------------------------------------------------*/ + + jj_row_begin_diag = jj_count_diag; + jj_row_begin_offd = jj_count_offd; + RAP_diag_i[ic] = jj_row_begin_diag; + RAP_offd_i[ic] = jj_row_begin_offd; + + HYPRE_Int ra_row_begin_diag = RA_diag.num_nonzeros; + HYPRE_Int ra_row_begin_offd = RA_offd.num_nonzeros; + + if (square) + { + P_marker[ic] = jj_count_diag; + RAP_diag_data[jj_count_diag] = zero; + RAP_diag_j[jj_count_diag] = ic; + jj_count_diag++; + } + +#ifdef HYPRE_CONCURRENT_HOPSCOTCH + if (send_map_elmts_RT_inverse_map_initialized) + { + HYPRE_Int i = hypre_UnorderedIntMapGet(&send_map_elmts_RT_inverse_map, ic); + if (i != -1) { - for (k=RAP_ext_i[j]; k < RAP_ext_i[j+1]; k++) - { - jcol = (HYPRE_Int)RAP_ext_j[k]; - if (jcol < num_cols_diag_P) - { + for (j = send_map_elmts_starts_RT_aggregated[i]; j < send_map_elmts_starts_RT_aggregated[i + 1]; j++) + { + HYPRE_Int jj = send_map_elmts_RT_aggregated[j]; + for (k=RAP_ext_i[jj]; k < RAP_ext_i[jj+1]; k++) + { + jcol = (HYPRE_Int)RAP_ext_j[k]; + if (jcol < num_cols_diag_P) + { if (P_marker[jcol] < jj_row_begin_diag) { - P_marker[jcol] = jj_count_diag; - RAP_diag_data[jj_count_diag] - = RAP_ext_data[k]; - RAP_diag_j[jj_count_diag] = jcol; - jj_count_diag++; + P_marker[jcol] = jj_count_diag; + RAP_diag_data[jj_count_diag] + = RAP_ext_data[k]; + RAP_diag_j[jj_count_diag] = jcol; + jj_count_diag++; } else - RAP_diag_data[P_marker[jcol]] - += RAP_ext_data[k]; - } - else - { + RAP_diag_data[P_marker[jcol]] + += RAP_ext_data[k]; + } + else + { if (P_marker[jcol] < jj_row_begin_offd) { - P_marker[jcol] = jj_count_offd; - RAP_offd_data[jj_count_offd] - = RAP_ext_data[k]; - RAP_offd_j[jj_count_offd] - = jcol-num_cols_diag_P; - jj_count_offd++; + P_marker[jcol] = jj_count_offd; + RAP_offd_data[jj_count_offd] + = RAP_ext_data[k]; + RAP_offd_j[jj_count_offd] + = jcol-num_cols_diag_P; + jj_count_offd++; } else - RAP_offd_data[P_marker[jcol]] - += RAP_ext_data[k]; - } - } - break; - } + RAP_offd_data[P_marker[jcol]] + += RAP_ext_data[k]; + } + } + } + } // if (set) + } +#else /* !HYPRE_CONCURRENT_HOPSCOTCH */ + for (i=0; i < num_sends_RT; i++) + for (j = send_map_starts_RT[i]; j < send_map_starts_RT[i+1]; j++) + if (send_map_elmts_RT[j] == ic) + { + for (k=RAP_ext_i[j]; k < RAP_ext_i[j+1]; k++) + { + jcol = (HYPRE_Int)RAP_ext_j[k]; + if (jcol < num_cols_diag_P) + { + if (P_marker[jcol] < jj_row_begin_diag) + { + P_marker[jcol] = jj_count_diag; + RAP_diag_data[jj_count_diag] + = RAP_ext_data[k]; + RAP_diag_j[jj_count_diag] = jcol; + jj_count_diag++; + } + else + RAP_diag_data[P_marker[jcol]] + += RAP_ext_data[k]; + } + else + { + if (P_marker[jcol] < jj_row_begin_offd) + { + P_marker[jcol] = jj_count_offd; + RAP_offd_data[jj_count_offd] + = RAP_ext_data[k]; + RAP_offd_j[jj_count_offd] + = jcol-num_cols_diag_P; + jj_count_offd++; + } + else + RAP_offd_data[P_marker[jcol]] + += RAP_ext_data[k]; + } + } + break; + } #endif /* !HYPRE_CONCURRENT_HOPSCOTCH */ - /*-------------------------------------------------------------------- - * Loop over entries in row ic of R_diag and compute row ic of RA. - *--------------------------------------------------------------------*/ - - for (jj1 = R_diag_i[ic]; jj1 < R_diag_i[ic+1]; jj1++) - { - i1 = R_diag_j[jj1]; - r_entry = R_diag_data[jj1]; - - /*----------------------------------------------------------------- - * Loop over entries in row i1 of A_offd. - *-----------------------------------------------------------------*/ - - if (num_cols_offd_A) - { - for (jj2 = A_offd_i[i1]; jj2 < A_offd_i[i1+1]; jj2++) - { - i2 = A_offd_j[jj2]; - HYPRE_Real a_entry = A_offd_data[jj2]; - HYPRE_Int marker = A_marker[i2]; - - /*-------------------------------------------------------------- - * Check A_marker to see if point i2 has been previously - * visited. New entries in RAP only occur from unmarked points. - *--------------------------------------------------------------*/ + /*-------------------------------------------------------------------- + * Loop over entries in row ic of R_diag and compute row ic of RA. + *--------------------------------------------------------------------*/ - if (marker < ra_row_begin_offd) - { - /*----------------------------------------------------------- - * Mark i2 as visited. - *-----------------------------------------------------------*/ - - A_marker[i2] = RA_offd.num_nonzeros; - RA_offd.data[RA_offd.num_nonzeros - ra_row_begin_offd] = r_entry * a_entry; - RA_offd.j[RA_offd.num_nonzeros - ra_row_begin_offd] = i2; - RA_offd.num_nonzeros++; - } - /*-------------------------------------------------------------- - * If i2 is previously visited ( A_marker[12]=ic ) it yields - * no new entries in RA and can just add new contributions. - *--------------------------------------------------------------*/ - else - { - RA_offd.data[marker - ra_row_begin_offd] += r_entry * a_entry; - // JSP: compiler will more likely to generate FMA instructions - // when we don't eliminate common subexpressions of - // r_entry * A_offd_data[jj2] manually. - } - } // loop over entries in row i1 of A_offd - } // num_cols_offd_A - - /*----------------------------------------------------------------- - * Loop over entries in row i1 of A_diag. - *-----------------------------------------------------------------*/ - - for (jj2 = A_diag_i[i1]; jj2 < A_diag_i[i1+1]; jj2++) - { - i2 = A_diag_j[jj2]; - HYPRE_Real a_entry = A_diag_data[jj2]; - HYPRE_Int marker = A_marker[i2+num_cols_offd_A]; - - /*-------------------------------------------------------------- - * Check A_marker to see if point i2 has been previously - * visited. New entries in RAP only occur from unmarked points. - *--------------------------------------------------------------*/ + for (jj1 = R_diag_i[ic]; jj1 < R_diag_i[ic+1]; jj1++) + { + i1 = R_diag_j[jj1]; + r_entry = R_diag_data[jj1]; - if (marker < ra_row_begin_diag) - { - /*----------------------------------------------------------- - * Mark i2 as visited. - *-----------------------------------------------------------*/ - A_marker[i2+num_cols_offd_A] = RA_diag.num_nonzeros; - RA_diag.data[RA_diag.num_nonzeros - ra_row_begin_diag] = r_entry * a_entry; - RA_diag.j[RA_diag.num_nonzeros - ra_row_begin_diag] = i2; - RA_diag.num_nonzeros++; - } - /*-------------------------------------------------------------- - * If i2 is previously visited ( A_marker[12]=ic ) it yields - * no new entries in RA and can just add new contributions. - *--------------------------------------------------------------*/ - else - { - RA_diag.data[marker - ra_row_begin_diag] += r_entry * a_entry; - } - } // loop over entries in row i1 of A_diag - } // loop over entries in row ic of R_diag + /*----------------------------------------------------------------- + * Loop over entries in row i1 of A_offd. + *-----------------------------------------------------------------*/ - /*-------------------------------------------------------------------- - * Loop over entries in row ic of RA_offd. - *--------------------------------------------------------------------*/ - - for (jj1 = ra_row_begin_offd; jj1 < RA_offd.num_nonzeros; jj1++) - { - i1 = RA_offd.j[jj1 - ra_row_begin_offd]; - r_a_product = RA_offd.data[jj1 - ra_row_begin_offd]; - - /*----------------------------------------------------------- - * Loop over entries in row i1 of P_ext. - *-----------------------------------------------------------*/ - for (jj2 = P_ext_diag_i[i1]; jj2 < P_ext_diag_i[i1+1]; jj2++) - { - i2 = P_ext_diag_j[jj2]; - HYPRE_Real p_entry = P_ext_diag_data[jj2]; - HYPRE_Int marker = P_marker[i2]; - - /*-------------------------------------------------------- - * Check P_marker to see that RAP_{ic,i2} has not already - * been accounted for. If it has not, create a new entry. - * If it has, add new contribution. - *--------------------------------------------------------*/ - if (marker < jj_row_begin_diag) + if (num_cols_offd_A) { - P_marker[i2] = jj_count_diag; - RAP_diag_data[jj_count_diag] = r_a_product * p_entry; - RAP_diag_j[jj_count_diag] = i2; - jj_count_diag++; - } - else - RAP_diag_data[marker] += r_a_product * p_entry; - } - for (jj2 = P_ext_offd_i[i1]; jj2 < P_ext_offd_i[i1+1]; jj2++) - { - i2 = map_Pext_to_RAP[P_ext_offd_j[jj2]] + num_cols_diag_P; - HYPRE_Real p_entry = P_ext_offd_data[jj2]; - HYPRE_Int marker = P_marker[i2]; - - /*-------------------------------------------------------- - * Check P_marker to see that RAP_{ic,i2} has not already - * been accounted for. If it has not, create a new entry. - * If it has, add new contribution. - *--------------------------------------------------------*/ - if (marker < jj_row_begin_offd) + for (jj2 = A_offd_i[i1]; jj2 < A_offd_i[i1+1]; jj2++) + { + i2 = A_offd_j[jj2]; + HYPRE_Real a_entry = A_offd_data[jj2]; + HYPRE_Int marker = A_marker[i2]; + + /*-------------------------------------------------------------- + * Check A_marker to see if point i2 has been previously + * visited. New entries in RAP only occur from unmarked points. + *--------------------------------------------------------------*/ + + if (marker < ra_row_begin_offd) + { + /*----------------------------------------------------------- + * Mark i2 as visited. + *-----------------------------------------------------------*/ + + A_marker[i2] = RA_offd.num_nonzeros; + RA_offd.data[RA_offd.num_nonzeros - ra_row_begin_offd] = r_entry * a_entry; + RA_offd.j[RA_offd.num_nonzeros - ra_row_begin_offd] = i2; + RA_offd.num_nonzeros++; + } + /*-------------------------------------------------------------- + * If i2 is previously visited ( A_marker[12]=ic ) it yields + * no new entries in RA and can just add new contributions. + *--------------------------------------------------------------*/ + else + { + RA_offd.data[marker - ra_row_begin_offd] += r_entry * a_entry; + // JSP: compiler will more likely to generate FMA instructions + // when we don't eliminate common subexpressions of + // r_entry * A_offd_data[jj2] manually. + } + } // loop over entries in row i1 of A_offd + } // num_cols_offd_A + + /*----------------------------------------------------------------- + * Loop over entries in row i1 of A_diag. + *-----------------------------------------------------------------*/ + + for (jj2 = A_diag_i[i1]; jj2 < A_diag_i[i1+1]; jj2++) { - P_marker[i2] = jj_count_offd; - RAP_offd_data[jj_count_offd] = r_a_product * p_entry; - RAP_offd_j[jj_count_offd] = i2 - num_cols_diag_P; - jj_count_offd++; - } - else - RAP_offd_data[marker] += r_a_product * p_entry; - } - } // loop over entries in row ic of RA_offd + i2 = A_diag_j[jj2]; + HYPRE_Real a_entry = A_diag_data[jj2]; + HYPRE_Int marker = A_marker[i2+num_cols_offd_A]; - /*-------------------------------------------------------------------- - * Loop over entries in row ic of RA_diag. - *--------------------------------------------------------------------*/ + /*-------------------------------------------------------------- + * Check A_marker to see if point i2 has been previously + * visited. New entries in RAP only occur from unmarked points. + *--------------------------------------------------------------*/ - for (jj1 = ra_row_begin_diag; jj1 < RA_diag.num_nonzeros; jj1++) - { - HYPRE_Int i1 = RA_diag.j[jj1 - ra_row_begin_diag]; - HYPRE_Real r_a_product = RA_diag.data[jj1 - ra_row_begin_diag]; + if (marker < ra_row_begin_diag) + { + /*----------------------------------------------------------- + * Mark i2 as visited. + *-----------------------------------------------------------*/ + A_marker[i2+num_cols_offd_A] = RA_diag.num_nonzeros; + RA_diag.data[RA_diag.num_nonzeros - ra_row_begin_diag] = r_entry * a_entry; + RA_diag.j[RA_diag.num_nonzeros - ra_row_begin_diag] = i2; + RA_diag.num_nonzeros++; + } + /*-------------------------------------------------------------- + * If i2 is previously visited ( A_marker[12]=ic ) it yields + * no new entries in RA and can just add new contributions. + *--------------------------------------------------------------*/ + else + { + RA_diag.data[marker - ra_row_begin_diag] += r_entry * a_entry; + } + } // loop over entries in row i1 of A_diag + } // loop over entries in row ic of R_diag - /*----------------------------------------------------------------- - * Loop over entries in row i1 of P_diag. - *-----------------------------------------------------------------*/ - for (jj2 = P_diag_i[i1]; jj2 < P_diag_i[i1+1]; jj2++) - { - i2 = P_diag_j[jj2]; - HYPRE_Real p_entry = P_diag_data[jj2]; - HYPRE_Int marker = P_marker[i2]; + /*-------------------------------------------------------------------- + * Loop over entries in row ic of RA_offd. + *--------------------------------------------------------------------*/ - /*-------------------------------------------------------- - * Check P_marker to see that RAP_{ic,i2} has not already - * been accounted for. If it has not, create a new entry. - * If it has, add new contribution. - *--------------------------------------------------------*/ + for (jj1 = ra_row_begin_offd; jj1 < RA_offd.num_nonzeros; jj1++) + { + i1 = RA_offd.j[jj1 - ra_row_begin_offd]; + r_a_product = RA_offd.data[jj1 - ra_row_begin_offd]; - if (marker < jj_row_begin_diag) - { - P_marker[i2] = jj_count_diag; - RAP_diag_data[jj_count_diag] = r_a_product * p_entry; - RAP_diag_j[jj_count_diag] = i2; - jj_count_diag++; - } - else + /*----------------------------------------------------------- + * Loop over entries in row i1 of P_ext. + *-----------------------------------------------------------*/ + for (jj2 = P_ext_diag_i[i1]; jj2 < P_ext_diag_i[i1+1]; jj2++) { - RAP_diag_data[marker] += r_a_product * p_entry; + i2 = P_ext_diag_j[jj2]; + HYPRE_Real p_entry = P_ext_diag_data[jj2]; + HYPRE_Int marker = P_marker[i2]; + + /*-------------------------------------------------------- + * Check P_marker to see that RAP_{ic,i2} has not already + * been accounted for. If it has not, create a new entry. + * If it has, add new contribution. + *--------------------------------------------------------*/ + if (marker < jj_row_begin_diag) + { + P_marker[i2] = jj_count_diag; + RAP_diag_data[jj_count_diag] = r_a_product * p_entry; + RAP_diag_j[jj_count_diag] = i2; + jj_count_diag++; + } + else + RAP_diag_data[marker] += r_a_product * p_entry; } - } - if (num_cols_offd_P) - { - for (jj2 = P_offd_i[i1]; jj2 < P_offd_i[i1+1]; jj2++) + for (jj2 = P_ext_offd_i[i1]; jj2 < P_ext_offd_i[i1+1]; jj2++) { - i2 = map_P_to_RAP[P_offd_j[jj2]] + num_cols_diag_P; - HYPRE_Real p_entry = P_offd_data[jj2]; + i2 = map_Pext_to_RAP[P_ext_offd_j[jj2]] + num_cols_diag_P; + HYPRE_Real p_entry = P_ext_offd_data[jj2]; HYPRE_Int marker = P_marker[i2]; /*-------------------------------------------------------- @@ -2017,7 +1777,6 @@ * been accounted for. If it has not, create a new entry. * If it has, add new contribution. *--------------------------------------------------------*/ - if (marker < jj_row_begin_offd) { P_marker[i2] = jj_count_offd; @@ -2026,19 +1785,81 @@ jj_count_offd++; } else - { RAP_offd_data[marker] += r_a_product * p_entry; + } + } // loop over entries in row ic of RA_offd + + /*-------------------------------------------------------------------- + * Loop over entries in row ic of RA_diag. + *--------------------------------------------------------------------*/ + + for (jj1 = ra_row_begin_diag; jj1 < RA_diag.num_nonzeros; jj1++) + { + HYPRE_Int i1 = RA_diag.j[jj1 - ra_row_begin_diag]; + HYPRE_Real r_a_product = RA_diag.data[jj1 - ra_row_begin_diag]; + + /*----------------------------------------------------------------- + * Loop over entries in row i1 of P_diag. + *-----------------------------------------------------------------*/ + for (jj2 = P_diag_i[i1]; jj2 < P_diag_i[i1+1]; jj2++) + { + i2 = P_diag_j[jj2]; + HYPRE_Real p_entry = P_diag_data[jj2]; + HYPRE_Int marker = P_marker[i2]; + + /*-------------------------------------------------------- + * Check P_marker to see that RAP_{ic,i2} has not already + * been accounted for. If it has not, create a new entry. + * If it has, add new contribution. + *--------------------------------------------------------*/ + + if (marker < jj_row_begin_diag) + { + P_marker[i2] = jj_count_diag; + RAP_diag_data[jj_count_diag] = r_a_product * p_entry; + RAP_diag_j[jj_count_diag] = i2; + jj_count_diag++; + } + else + { + RAP_diag_data[marker] += r_a_product * p_entry; } } - } // num_cols_offd_P - } // loop over entries in row ic of RA_diag. - } // Loop over interior c-points. - hypre_TFree(P_mark_array[ii], HYPRE_MEMORY_HOST); - hypre_TFree(A_mark_array[ii], HYPRE_MEMORY_HOST); + if (num_cols_offd_P) + { + for (jj2 = P_offd_i[i1]; jj2 < P_offd_i[i1+1]; jj2++) + { + i2 = map_P_to_RAP[P_offd_j[jj2]] + num_cols_diag_P; + HYPRE_Real p_entry = P_offd_data[jj2]; + HYPRE_Int marker = P_marker[i2]; + + /*-------------------------------------------------------- + * Check P_marker to see that RAP_{ic,i2} has not already + * been accounted for. If it has not, create a new entry. + * If it has, add new contribution. + *--------------------------------------------------------*/ + + if (marker < jj_row_begin_offd) + { + P_marker[i2] = jj_count_offd; + RAP_offd_data[jj_count_offd] = r_a_product * p_entry; + RAP_offd_j[jj_count_offd] = i2 - num_cols_diag_P; + jj_count_offd++; + } + else + { + RAP_offd_data[marker] += r_a_product * p_entry; + } + } + } // num_cols_offd_P + } // loop over entries in row ic of RA_diag. + } // Loop over interior c-points. + hypre_TFree(P_mark_array[ii], HYPRE_MEMORY_HOST); + hypre_TFree(A_mark_array[ii], HYPRE_MEMORY_HOST); } // omp parallel for /* check if really all off-diagonal entries occurring in col_map_offd_RAP - are represented and eliminate if necessary */ + are represented and eliminate if necessary */ P_marker = hypre_CTAlloc(HYPRE_Int, num_cols_offd_RAP, HYPRE_MEMORY_HOST); #ifdef HYPRE_USING_OPENMP @@ -2073,21 +1894,21 @@ new_col_map_offd_RAP = hypre_CTAlloc(HYPRE_BigInt, jj_count_offd, HYPRE_MEMORY_HOST); jj_counter = 0; for (i=0; i < num_cols_offd_RAP; i++) - if (!P_marker[i]) + if (!P_marker[i]) { - P_marker[i] = jj_counter; - new_col_map_offd_RAP[jj_counter++] = col_map_offd_RAP[i]; + P_marker[i] = jj_counter; + new_col_map_offd_RAP[jj_counter++] = col_map_offd_RAP[i]; } - + #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i3) HYPRE_SMP_SCHEDULE #endif for (i=0; i < RAP_offd_size; i++) { - i3 = RAP_offd_j[i]; - RAP_offd_j[i] = P_marker[i3]; + i3 = RAP_offd_j[i]; + RAP_offd_j[i] = P_marker[i3]; } - + num_cols_offd_RAP = jj_count_offd; hypre_TFree(col_map_offd_RAP, HYPRE_MEMORY_HOST); col_map_offd_RAP = new_col_map_offd_RAP; @@ -2095,34 +1916,34 @@ hypre_TFree(P_marker, HYPRE_MEMORY_HOST); RAP = hypre_ParCSRMatrixCreate(comm, n_coarse_RT, n_coarse, - RT_partitioning, coarse_partitioning, - num_cols_offd_RAP, RAP_diag_size, - RAP_offd_size); + RT_partitioning, coarse_partitioning, + num_cols_offd_RAP, RAP_diag_size, + RAP_offd_size); -/* Have RAP own coarse_partitioning instead of P */ + /* Have RAP own coarse_partitioning instead of P */ hypre_ParCSRMatrixSetColStartsOwner(P,0); hypre_ParCSRMatrixSetColStartsOwner(RT,0); RAP_diag = hypre_ParCSRMatrixDiag(RAP); - hypre_CSRMatrixI(RAP_diag) = RAP_diag_i; + hypre_CSRMatrixI(RAP_diag) = RAP_diag_i; if (RAP_diag_size) { - hypre_CSRMatrixData(RAP_diag) = RAP_diag_data; - hypre_CSRMatrixJ(RAP_diag) = RAP_diag_j; + hypre_CSRMatrixData(RAP_diag) = RAP_diag_data; + hypre_CSRMatrixJ(RAP_diag) = RAP_diag_j; } RAP_offd = hypre_ParCSRMatrixOffd(RAP); - hypre_CSRMatrixI(RAP_offd) = RAP_offd_i; + hypre_CSRMatrixI(RAP_offd) = RAP_offd_i; if (num_cols_offd_RAP) { - hypre_CSRMatrixData(RAP_offd) = RAP_offd_data; - hypre_CSRMatrixJ(RAP_offd) = RAP_offd_j; - hypre_ParCSRMatrixColMapOffd(RAP) = col_map_offd_RAP; + hypre_CSRMatrixData(RAP_offd) = RAP_offd_data; + hypre_CSRMatrixJ(RAP_offd) = RAP_offd_j; + hypre_ParCSRMatrixColMapOffd(RAP) = col_map_offd_RAP; } if (num_procs > 1) { - /* hypre_GenerateRAPCommPkg(RAP, A); */ - hypre_MatvecCommPkgCreate(RAP); + /* hypre_GenerateRAPCommPkg(RAP, A); */ + hypre_MatvecCommPkgCreate(RAP); } *RAP_ptr = RAP; @@ -2142,7 +1963,7 @@ } R_diag = NULL; - if (num_cols_offd_RT) + if (num_cols_offd_RT) { if (keepTranspose) { @@ -2155,17 +1976,17 @@ R_offd = NULL; } - if (num_sends_RT || num_recvs_RT) + if (num_sends_RT || num_recvs_RT) { hypre_CSRMatrixDestroy(RAP_ext); RAP_ext = NULL; } - hypre_TFree(P_mark_array, HYPRE_MEMORY_HOST); + hypre_TFree(P_mark_array, HYPRE_MEMORY_HOST); hypre_TFree(A_mark_array, HYPRE_MEMORY_HOST); hypre_TFree(P_ext_diag_i, HYPRE_MEMORY_HOST); hypre_TFree(P_ext_offd_i, HYPRE_MEMORY_HOST); - hypre_TFree(jj_cnt_diag, HYPRE_MEMORY_HOST); - hypre_TFree(jj_cnt_offd, HYPRE_MEMORY_HOST); + hypre_TFree(jj_cnt_diag, HYPRE_MEMORY_HOST); + hypre_TFree(jj_cnt_offd, HYPRE_MEMORY_HOST); if (num_cols_offd_P) { hypre_TFree(map_P_to_Pext, HYPRE_MEMORY_HOST); @@ -2207,7 +2028,5 @@ #endif return(0); - -} - +} diff -Nru hypre-2.16.0/src/parcsr_ls/par_rap_communication.c hypre-2.18.2/src/parcsr_ls/par_rap_communication.c --- hypre-2.16.0/src/parcsr_ls/par_rap_communication.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_rap_communication.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,26 +1,17 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" HYPRE_Int hypre_GetCommPkgRTFromCommPkgA( hypre_ParCSRMatrix *RT, - hypre_ParCSRMatrix *A, - HYPRE_Int *fine_to_coarse, - HYPRE_Int *tmp_map_offd) + hypre_ParCSRMatrix *A, + HYPRE_Int *fine_to_coarse, + HYPRE_Int *tmp_map_offd) { MPI_Comm comm = hypre_ParCSRMatrixComm(RT); hypre_ParCSRCommPkg *comm_pkg_A = hypre_ParCSRMatrixCommPkg(A); @@ -34,12 +25,12 @@ hypre_ParCSRCommPkg *comm_pkg; HYPRE_Int num_recvs_RT; - HYPRE_Int *recv_procs_RT; - HYPRE_Int *recv_vec_starts_RT; + HYPRE_Int *recv_procs_RT; + HYPRE_Int *recv_vec_starts_RT; HYPRE_Int num_sends_RT; - HYPRE_Int *send_procs_RT; - HYPRE_Int *send_map_starts_RT; - HYPRE_Int *send_map_elmts_RT; + HYPRE_Int *send_procs_RT; + HYPRE_Int *send_map_starts_RT; + HYPRE_Int *send_map_elmts_RT; HYPRE_BigInt *col_map_offd_RT = hypre_ParCSRMatrixColMapOffd(RT); HYPRE_Int num_cols_offd_RT = hypre_CSRMatrixNumCols( hypre_ParCSRMatrixOffd(RT)); @@ -60,7 +51,7 @@ HYPRE_Int num_threads = hypre_NumThreads(); HYPRE_Int size, rest, ns, ne, start; HYPRE_Int index; - + HYPRE_Int *proc_mark; HYPRE_Int *change_array; HYPRE_Int *coarse_counter; @@ -72,14 +63,14 @@ hypre_MPI_Comm_size(comm,&num_procs); hypre_MPI_Comm_rank(comm,&my_id); -/*-------------------------------------------------------------------------- - * determine num_recvs, recv_procs and recv_vec_starts for RT - *--------------------------------------------------------------------------*/ + /*-------------------------------------------------------------------------- + * determine num_recvs, recv_procs and recv_vec_starts for RT + *--------------------------------------------------------------------------*/ proc_mark = hypre_CTAlloc(HYPRE_Int, num_recvs_A, HYPRE_MEMORY_HOST); for (i=0; i < num_recvs_A; i++) - proc_mark[i] = 0; + proc_mark[i] = 0; proc_num = 0; num_recvs_RT = 0; @@ -92,9 +83,9 @@ offd_col = tmp_map_offd[proc_num]; if (offd_col == j) { - proc_mark[i]++; - proc_num++; - if (proc_num == num_cols_offd_RT) break; + proc_mark[i]++; + proc_num++; + if (proc_num == num_cols_offd_RT) break; } } if (proc_mark[i]) num_recvs_RT++; @@ -117,35 +108,35 @@ #endif for (j = 0; j < num_threads; j++) { - coarse_shift = 0; - if (j > 0) coarse_shift = coarse_counter[j-1]; - size = n_fine/num_threads; - rest = n_fine - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) - fine_to_coarse[i] += coarse_shift; + coarse_shift = 0; + if (j > 0) coarse_shift = coarse_counter[j-1]; + size = n_fine/num_threads; + rest = n_fine - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) + fine_to_coarse[i] += coarse_shift; } index = 0; for (i = 0; i < num_sends_A; i++) { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg_A, i); - for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg_A, i+1); j++) - big_buf_data[index++] = my_first_cpt+ - (HYPRE_BigInt)fine_to_coarse[hypre_ParCSRCommPkgSendMapElmt(comm_pkg_A,j)]; + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg_A, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg_A, i+1); j++) + big_buf_data[index++] = my_first_cpt+ + (HYPRE_BigInt)fine_to_coarse[hypre_ParCSRCommPkgSendMapElmt(comm_pkg_A,j)]; } comm_handle = hypre_ParCSRCommHandleCreate( 21, comm_pkg_A, big_buf_data, - fine_to_coarse_offd); + fine_to_coarse_offd); hypre_ParCSRCommHandleDestroy(comm_handle); @@ -159,22 +150,22 @@ recv_procs_RT = hypre_CTAlloc(HYPRE_Int, num_recvs_RT, HYPRE_MEMORY_HOST); recv_vec_starts_RT = hypre_CTAlloc(HYPRE_Int, num_recvs_RT+1, HYPRE_MEMORY_HOST); - + j = 0; recv_vec_starts_RT[0] = 0; for (i=0; i < num_recvs_A; i++) { - if (proc_mark[i]) - { - recv_procs_RT[j] = recv_procs_A[i]; - recv_vec_starts_RT[j+1] = recv_vec_starts_RT[j]+proc_mark[i]; - j++; - } + if (proc_mark[i]) + { + recv_procs_RT[j] = recv_procs_A[i]; + recv_vec_starts_RT[j+1] = recv_vec_starts_RT[j]+proc_mark[i]; + j++; + } } -/*-------------------------------------------------------------------------- - * send num_changes to recv_procs_A and receive change_array from send_procs_A - *--------------------------------------------------------------------------*/ + /*-------------------------------------------------------------------------- + * send num_changes to recv_procs_A and receive change_array from send_procs_A + *--------------------------------------------------------------------------*/ num_requests = num_recvs_A+num_sends_A; requests = hypre_CTAlloc(hypre_MPI_Request, num_requests, HYPRE_MEMORY_HOST); @@ -184,26 +175,26 @@ j = 0; for (i=0; i < num_sends_A; i++) - hypre_MPI_Irecv(&change_array[i],1,HYPRE_MPI_INT,send_procs_A[i],0,comm, - &requests[j++]); + hypre_MPI_Irecv(&change_array[i],1,HYPRE_MPI_INT,send_procs_A[i],0,comm, + &requests[j++]); for (i=0; i < num_recvs_A; i++) - hypre_MPI_Isend(&proc_mark[i],1,HYPRE_MPI_INT,recv_procs_A[i],0,comm, - &requests[j++]); - + hypre_MPI_Isend(&proc_mark[i],1,HYPRE_MPI_INT,recv_procs_A[i],0,comm, + &requests[j++]); + hypre_MPI_Waitall(num_requests,requests,status); hypre_TFree(proc_mark, HYPRE_MEMORY_HOST); - -/*-------------------------------------------------------------------------- - * if change_array[i] is 0 , omit send_procs_A[i] in send_procs_RT - *--------------------------------------------------------------------------*/ + + /*-------------------------------------------------------------------------- + * if change_array[i] is 0 , omit send_procs_A[i] in send_procs_RT + *--------------------------------------------------------------------------*/ num_sends_RT = 0; for (i=0; i < num_sends_A; i++) - if (change_array[i]) + if (change_array[i]) { - num_sends_RT++; + num_sends_RT++; } send_procs_RT = hypre_CTAlloc(HYPRE_Int, num_sends_RT, HYPRE_MEMORY_HOST); @@ -212,42 +203,44 @@ j = 0; send_map_starts_RT[0] = 0; for (i=0; i < num_sends_A; i++) - if (change_array[i]) + { + if (change_array[i]) { - send_procs_RT[j] = send_procs_A[i]; - send_map_starts_RT[j+1] = send_map_starts_RT[j]+change_array[i]; - j++; + send_procs_RT[j] = send_procs_A[i]; + send_map_starts_RT[j+1] = send_map_starts_RT[j]+change_array[i]; + j++; } + } -/*-------------------------------------------------------------------------- - * generate send_map_elmts - *--------------------------------------------------------------------------*/ + /*-------------------------------------------------------------------------- + * generate send_map_elmts + *--------------------------------------------------------------------------*/ - send_map_elmts_RT = hypre_CTAlloc(HYPRE_Int, send_map_starts_RT[num_sends_RT], HYPRE_MEMORY_SHARED); - send_big_elmts = hypre_CTAlloc(HYPRE_BigInt, send_map_starts_RT[num_sends_RT], HYPRE_MEMORY_SHARED); + send_map_elmts_RT = hypre_CTAlloc(HYPRE_Int, send_map_starts_RT[num_sends_RT], HYPRE_MEMORY_HOST); + send_big_elmts = hypre_CTAlloc(HYPRE_BigInt, send_map_starts_RT[num_sends_RT], HYPRE_MEMORY_HOST); j = 0; for (i=0; i < num_sends_RT; i++) { - vec_start = send_map_starts_RT[i]; - vec_len = send_map_starts_RT[i+1]-vec_start; - hypre_MPI_Irecv(&send_big_elmts[vec_start],vec_len,HYPRE_MPI_BIG_INT, - send_procs_RT[i],0,comm,&requests[j++]); + vec_start = send_map_starts_RT[i]; + vec_len = send_map_starts_RT[i+1]-vec_start; + hypre_MPI_Irecv(&send_big_elmts[vec_start],vec_len,HYPRE_MPI_BIG_INT, + send_procs_RT[i],0,comm,&requests[j++]); } for (i=0; i < num_recvs_RT; i++) { - vec_start = recv_vec_starts_RT[i]; - vec_len = recv_vec_starts_RT[i+1] - vec_start; - hypre_MPI_Isend(&col_map_offd_RT[vec_start],vec_len,HYPRE_MPI_BIG_INT, - recv_procs_RT[i],0,comm,&requests[j++]); + vec_start = recv_vec_starts_RT[i]; + vec_len = recv_vec_starts_RT[i+1] - vec_start; + hypre_MPI_Isend(&col_map_offd_RT[vec_start],vec_len,HYPRE_MPI_BIG_INT, + recv_procs_RT[i],0,comm,&requests[j++]); } - + hypre_MPI_Waitall(j,requests,status); for (i=0; i < send_map_starts_RT[num_sends_RT]; i++) - send_map_elmts_RT[i] = (HYPRE_Int)(send_big_elmts[i]-first_col_diag); - + send_map_elmts_RT[i] = (HYPRE_Int)(send_big_elmts[i]-first_col_diag); + comm_pkg = hypre_CTAlloc(hypre_ParCSRCommPkg, 1, HYPRE_MEMORY_HOST); hypre_ParCSRCommPkgComm(comm_pkg) = comm; @@ -261,7 +254,7 @@ hypre_TFree(status, HYPRE_MEMORY_HOST); hypre_TFree(requests, HYPRE_MEMORY_HOST); - hypre_TFree(send_big_elmts, HYPRE_MEMORY_SHARED); + hypre_TFree(send_big_elmts, HYPRE_MEMORY_HOST); hypre_ParCSRMatrixCommPkg(RT) = comm_pkg; hypre_TFree(change_array, HYPRE_MEMORY_HOST); @@ -271,8 +264,8 @@ HYPRE_Int hypre_GenerateSendMapAndCommPkg(MPI_Comm comm, HYPRE_Int num_sends, HYPRE_Int num_recvs, - HYPRE_Int *recv_procs, HYPRE_Int *send_procs, - HYPRE_Int *recv_vec_starts, hypre_ParCSRMatrix *A) + HYPRE_Int *recv_procs, HYPRE_Int *send_procs, + HYPRE_Int *recv_vec_starts, hypre_ParCSRMatrix *A) { HYPRE_Int *send_map_starts; HYPRE_Int *send_map_elmts; @@ -286,54 +279,54 @@ HYPRE_BigInt first_col_diag = hypre_ParCSRMatrixFirstColDiag(A); HYPRE_BigInt *send_big_elmts = NULL; -/*-------------------------------------------------------------------------- - * generate send_map_starts and send_map_elmts - *--------------------------------------------------------------------------*/ + /*-------------------------------------------------------------------------- + * generate send_map_starts and send_map_elmts + *--------------------------------------------------------------------------*/ requests = hypre_CTAlloc(hypre_MPI_Request, num_requests, HYPRE_MEMORY_HOST); status = hypre_CTAlloc(hypre_MPI_Status, num_requests, HYPRE_MEMORY_HOST); send_map_starts = hypre_CTAlloc(HYPRE_Int, num_sends+1, HYPRE_MEMORY_HOST); j = 0; for (i=0; i < num_sends; i++) - hypre_MPI_Irecv(&send_map_starts[i+1],1,HYPRE_MPI_INT,send_procs[i],0,comm, - &requests[j++]); + hypre_MPI_Irecv(&send_map_starts[i+1],1,HYPRE_MPI_INT,send_procs[i],0,comm, + &requests[j++]); for (i=0; i < num_recvs; i++) { - vec_len = recv_vec_starts[i+1] - recv_vec_starts[i]; - hypre_MPI_Isend(&vec_len,1,HYPRE_MPI_INT, recv_procs[i],0,comm,&requests[j++]); + vec_len = recv_vec_starts[i+1] - recv_vec_starts[i]; + hypre_MPI_Isend(&vec_len,1,HYPRE_MPI_INT, recv_procs[i],0,comm,&requests[j++]); } - + hypre_MPI_Waitall(j,requests,status); - - send_map_starts[0] = 0; + + send_map_starts[0] = 0; for (i=0; i < num_sends; i++) - send_map_starts[i+1] += send_map_starts[i]; + send_map_starts[i+1] += send_map_starts[i]; - send_map_elmts = hypre_CTAlloc(HYPRE_Int, send_map_starts[num_sends], HYPRE_MEMORY_SHARED); - send_big_elmts = hypre_CTAlloc(HYPRE_BigInt, send_map_starts[num_sends], HYPRE_MEMORY_SHARED); + send_map_elmts = hypre_CTAlloc(HYPRE_Int, send_map_starts[num_sends], HYPRE_MEMORY_HOST); + send_big_elmts = hypre_CTAlloc(HYPRE_BigInt, send_map_starts[num_sends], HYPRE_MEMORY_HOST); j = 0; for (i=0; i < num_sends; i++) { - vec_start = send_map_starts[i]; - vec_len = send_map_starts[i+1]-vec_start; - hypre_MPI_Irecv(&send_big_elmts[vec_start],vec_len,HYPRE_MPI_BIG_INT, - send_procs[i],0,comm,&requests[j++]); + vec_start = send_map_starts[i]; + vec_len = send_map_starts[i+1]-vec_start; + hypre_MPI_Irecv(&send_big_elmts[vec_start],vec_len,HYPRE_MPI_BIG_INT, + send_procs[i],0,comm,&requests[j++]); } for (i=0; i < num_recvs; i++) { - vec_start = recv_vec_starts[i]; - vec_len = recv_vec_starts[i+1] - vec_start; - hypre_MPI_Isend(&col_map_offd[vec_start],vec_len,HYPRE_MPI_BIG_INT, - recv_procs[i],0,comm,&requests[j++]); + vec_start = recv_vec_starts[i]; + vec_len = recv_vec_starts[i+1] - vec_start; + hypre_MPI_Isend(&col_map_offd[vec_start],vec_len,HYPRE_MPI_BIG_INT, + recv_procs[i],0,comm,&requests[j++]); } - + hypre_MPI_Waitall(j,requests,status); for (i=0; i < send_map_starts[num_sends]; i++) - send_map_elmts[i] = (HYPRE_Int)(send_big_elmts[i]-first_col_diag); - + send_map_elmts[i] = (HYPRE_Int)(send_big_elmts[i]-first_col_diag); + comm_pkg = hypre_CTAlloc(hypre_ParCSRCommPkg, 1, HYPRE_MEMORY_HOST); hypre_ParCSRCommPkgComm(comm_pkg) = comm; @@ -347,7 +340,7 @@ hypre_TFree(status, HYPRE_MEMORY_HOST); hypre_TFree(requests, HYPRE_MEMORY_HOST); - hypre_TFree(send_big_elmts, HYPRE_MEMORY_SHARED); + hypre_TFree(send_big_elmts, HYPRE_MEMORY_HOST); hypre_ParCSRMatrixCommPkg(A) = comm_pkg; return 0; diff -Nru hypre-2.16.0/src/parcsr_ls/par_relax.c hypre-2.18.2/src/parcsr_ls/par_relax.c --- hypre-2.16.0/src/parcsr_ls/par_relax.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_relax.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -37,7 +32,7 @@ hypre_ParVector *Vtemp, hypre_ParVector *Ztemp ) { - MPI_Comm comm = hypre_ParCSRMatrixComm(A); + MPI_Comm comm = hypre_ParCSRMatrixComm(A); hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); HYPRE_Real *A_diag_data = hypre_CSRMatrixData(A_diag); HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); @@ -52,41 +47,46 @@ HYPRE_BigInt global_num_rows = hypre_ParCSRMatrixGlobalNumRows(A); HYPRE_Int n = hypre_CSRMatrixNumRows(A_diag); HYPRE_Int num_cols_offd = hypre_CSRMatrixNumCols(A_offd); - HYPRE_BigInt first_ind = hypre_ParVectorFirstIndex(u); - + HYPRE_BigInt first_ind = hypre_ParVectorFirstIndex(u); + hypre_Vector *u_local = hypre_ParVectorLocalVector(u); HYPRE_Real *u_data = hypre_VectorData(u_local); hypre_Vector *f_local = hypre_ParVectorLocalVector(f); HYPRE_Real *f_data = hypre_VectorData(f_local); - hypre_Vector *Vtemp_local = hypre_ParVectorLocalVector(Vtemp); - HYPRE_Real *Vtemp_data = hypre_VectorData(Vtemp_local); - HYPRE_Real *Vext_data = NULL; - HYPRE_Real *v_buf_data; - HYPRE_Real *tmp_data; + hypre_Vector *Vtemp_local; + HYPRE_Real *Vtemp_data; + if (relax_type != 10) + { + Vtemp_local = hypre_ParVectorLocalVector(Vtemp); + Vtemp_data = hypre_VectorData(Vtemp_local); + } + HYPRE_Real *Vext_data = NULL; + HYPRE_Real *v_buf_data = NULL; + HYPRE_Real *tmp_data; hypre_Vector *Ztemp_local; HYPRE_Real *Ztemp_data; hypre_CSRMatrix *A_CSR; - HYPRE_Int *A_CSR_i; - HYPRE_Int *A_CSR_j; - HYPRE_Real *A_CSR_data; - + HYPRE_Int *A_CSR_i; + HYPRE_Int *A_CSR_j; + HYPRE_Real *A_CSR_data; + hypre_Vector *f_vector; - HYPRE_Real *f_vector_data; + HYPRE_Real *f_vector_data; HYPRE_Int i, j, jr; HYPRE_Int ii, jj; HYPRE_Int ns, ne, size, rest; HYPRE_Int column; HYPRE_Int relax_error = 0; - HYPRE_Int num_sends; - HYPRE_Int num_recvs; - HYPRE_Int index, start; - HYPRE_Int num_procs, num_threads, my_id, ip, p; - HYPRE_Int vec_start, vec_len; + HYPRE_Int num_sends; + HYPRE_Int num_recvs; + HYPRE_Int index, start; + HYPRE_Int num_procs, num_threads, my_id, ip, p; + HYPRE_Int vec_start, vec_len; hypre_MPI_Status *status; hypre_MPI_Request *requests; @@ -94,69 +94,82 @@ HYPRE_Real *b_vec; HYPRE_Real zero = 0.0; - HYPRE_Real res, res0, res2; + HYPRE_Real res, res0, res2; HYPRE_Real one_minus_weight; HYPRE_Real one_minus_omega; HYPRE_Real prod; one_minus_weight = 1.0 - relax_weight; one_minus_omega = 1.0 - omega; - hypre_MPI_Comm_size(comm,&num_procs); - hypre_MPI_Comm_rank(comm,&my_id); + hypre_MPI_Comm_size(comm,&num_procs); + hypre_MPI_Comm_rank(comm,&my_id); num_threads = hypre_NumThreads(); /*----------------------------------------------------------------------- * Switch statement to direct control based on relax_type: * relax_type = 0 -> Jacobi or CF-Jacobi * relax_type = 1 -> Gauss-Seidel <--- very slow, sequential * relax_type = 2 -> Gauss_Seidel: interior points in parallel , - * boundary sequential + * boundary sequential * relax_type = 3 -> hybrid: SOR-J mix off-processor, SOR on-processor - * with outer relaxation parameters (forward solve) + * with outer relaxation parameters (forward solve) * relax_type = 4 -> hybrid: SOR-J mix off-processor, SOR on-processor - * with outer relaxation parameters (backward solve) + * with outer relaxation parameters (backward solve) * relax_type = 5 -> hybrid: GS-J mix off-processor, chaotic GS on-node * relax_type = 6 -> hybrid: SSOR-J mix off-processor, SSOR on-processor - * with outer relaxation parameters + * with outer relaxation parameters * relax_type = 7 -> Jacobi (uses Matvec), only needed in CGNR + * relax_type = 8 -> hybrid L1 Symm. Gauss-Seidel + * relax_type = 10 -> On-processor direct forward solve for matrices with + * triangular structure (indices need not be ordered + * triangular) + * relax_type = 13 -> hybrid L1 Gauss-Seidel forward solve + * relax_type = 14 -> hybrid L1 Gauss-Seidel backward solve + * relax_type = 15 -> CG + * relax_type = 16 -> Scaled Chebyshev + * relax_type = 17 -> FCF-Jacobi + * relax_type = 18 -> L1-Jacobi + * relax_type = 9, 99, 98 -> Direct solve, Gaussian elimination * relax_type = 19-> Direct Solve, (old version) - * relax_type = 29-> Direct solve: use gaussian elimination & BLAS - * (with pivoting) (old version) + * relax_type = 29-> Direct solve: use gaussian elimination & BLAS + * (with pivoting) (old version) *-----------------------------------------------------------------------*/ + switch (relax_type) { case 0: /* Weighted Jacobi */ { - if (num_procs > 1) - { - num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - - v_buf_data = hypre_CTAlloc(HYPRE_Real, - hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); - - Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); - - if (num_cols_offd) - { - A_offd_j = hypre_CSRMatrixJ(A_offd); - A_offd_data = hypre_CSRMatrixData(A_offd); - } - - index = 0; - for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - v_buf_data[index++] - = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg, v_buf_data, - Vext_data); - } + if (num_procs > 1) + { + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + + /* printf("!! Proc %d: n %d, num_sends %d, num_cols_offd %d\n", my_id, n, num_sends, num_cols_offd); */ + + v_buf_data = hypre_CTAlloc(HYPRE_Real, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + + Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); + + if (num_cols_offd) + { + A_offd_j = hypre_CSRMatrixJ(A_offd); + A_offd_data = hypre_CSRMatrixData(A_offd); + } + + index = 0; + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + { + v_buf_data[index++] = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } + } + + comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg, v_buf_data, Vext_data); + } /*----------------------------------------------------------------- * Copy current approximation into temporary vector. *-----------------------------------------------------------------*/ - + #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif @@ -164,11 +177,11 @@ { Vtemp_data[i] = u_data[i]; } - if (num_procs > 1) - { - hypre_ParCSRCommHandleDestroy(comm_handle); + if (num_procs > 1) + { + hypre_ParCSRCommHandleDestroy(comm_handle); comm_handle = NULL; - } + } /*----------------------------------------------------------------- * Relax all points. @@ -185,7 +198,7 @@ /*----------------------------------------------------------- * If diagonal is nonzero, relax point i; otherwise, skip it. *-----------------------------------------------------------*/ - + if (A_diag_data[A_diag_i[i]] != zero) { res = f_data[i]; @@ -199,16 +212,14 @@ ii = A_offd_j[jj]; res -= A_offd_data[jj] * Vext_data[ii]; } - u_data[i] *= one_minus_weight; + u_data[i] *= one_minus_weight; u_data[i] += relax_weight * res / A_diag_data[A_diag_i[i]]; } } } - /*----------------------------------------------------------------- * Relax only C or F points as determined by relax_points. *-----------------------------------------------------------------*/ - else { #ifdef HYPRE_USING_OPENMP @@ -221,9 +232,8 @@ * If i is of the right type ( C or F ) and diagonal is * nonzero, relax point i; otherwise, skip it. *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) + + if (cf_marker[i] == relax_points && A_diag_data[A_diag_i[i]] != zero) { res = f_data[i]; for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) @@ -236,55 +246,54 @@ ii = A_offd_j[jj]; res -= A_offd_data[jj] * Vext_data[ii]; } - u_data[i] *= one_minus_weight; + u_data[i] *= one_minus_weight; u_data[i] += relax_weight * res / A_diag_data[A_diag_i[i]]; } - } + } } - if (num_procs > 1) + if (num_procs > 1) { - hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); - hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); + hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); + hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); } } break; - case 5: /* Hybrid: Jacobi off-processor, + case 5: /* Hybrid: Jacobi off-processor, chaotic Gauss-Seidel on-processor */ { - if (num_procs > 1) - { - num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - - v_buf_data = hypre_CTAlloc(HYPRE_Real, - hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); - - Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); - - if (num_cols_offd) - { - A_offd_j = hypre_CSRMatrixJ(A_offd); - A_offd_data = hypre_CSRMatrixData(A_offd); - } - - index = 0; - for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg,i+1); j++) - v_buf_data[index++] - = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg, v_buf_data, - Vext_data); + if (num_procs > 1) + { + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - /*----------------------------------------------------------------- - * Copy current approximation into temporary vector. - *-----------------------------------------------------------------*/ - hypre_ParCSRCommHandleDestroy(comm_handle); - comm_handle = NULL; - } + v_buf_data = hypre_CTAlloc(HYPRE_Real, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + + Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); + + if (num_cols_offd) + { + A_offd_j = hypre_CSRMatrixJ(A_offd); + A_offd_data = hypre_CSRMatrixData(A_offd); + } + + index = 0; + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg,i+1); j++) + { + v_buf_data[index++] = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } + } + + comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg, v_buf_data, Vext_data); + + /*----------------------------------------------------------------- + * Copy current approximation into temporary vector. + *-----------------------------------------------------------------*/ + hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = NULL; + } /*----------------------------------------------------------------- * Relax all points. @@ -295,13 +304,13 @@ #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,jj,res) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) /* interior points first */ + for (i = 0; i < n; i++) /* interior points first */ { /*----------------------------------------------------------- * If diagonal is nonzero, relax point i; otherwise, skip it. *-----------------------------------------------------------*/ - + if ( A_diag_data[A_diag_i[i]] != zero) { res = f_data[i]; @@ -336,9 +345,8 @@ * If i is of the right type ( C or F ) and diagonal is * nonzero, relax point i; otherwise, skip it. *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) + + if (cf_marker[i] == relax_points && A_diag_data[A_diag_i[i]] != zero) { res = f_data[i]; for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) @@ -353,32 +361,30 @@ } u_data[i] = res / A_diag_data[A_diag_i[i]]; } - } + } } if (num_procs > 1) { - hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); - hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); + hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); + hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); } } break; - case 3: /* Hybrid: Jacobi off-processor, - Gauss-Seidel on-processor - (forward loop) */ + /* Hybrid: Jacobi off-processor, Gauss-Seidel on-processor (forward loop) */ + case 3: { - if (num_threads > 1) { Ztemp_local = hypre_ParVectorLocalVector(Ztemp); Ztemp_data = hypre_VectorData(Ztemp_local); } - -#ifdef HYPRE_USING_PERSISTENT_COMM + +#if defined(HYPRE_USING_PERSISTENT_COMM) // JSP: persistent comm can be similarly used for other smoothers hypre_ParCSRPersistentCommHandle *persistent_comm_handle; #endif - + if (num_procs > 1) { #ifdef HYPRE_PROFILE @@ -386,18 +392,17 @@ #endif num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - -#ifdef HYPRE_USING_PERSISTENT_COMM + +#if defined(HYPRE_USING_PERSISTENT_COMM) persistent_comm_handle = hypre_ParCSRCommPkgGetPersistentCommHandle(1, comm_pkg); - v_buf_data = (HYPRE_Real *)persistent_comm_handle->send_data; - Vext_data = (HYPRE_Real *)persistent_comm_handle->recv_data; + v_buf_data = (HYPRE_Real *) hypre_ParCSRCommHandleSendDataBuffer(persistent_comm_handle); + Vext_data = (HYPRE_Real *) hypre_ParCSRCommHandleRecvDataBuffer(persistent_comm_handle); #else - v_buf_data = hypre_CTAlloc(HYPRE_Real, - hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); - + v_buf_data = hypre_CTAlloc(HYPRE_Real, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); #endif - + if (num_cols_offd) { A_offd_j = hypre_CSRMatrixJ(A_offd); @@ -411,27 +416,25 @@ #endif for (i = begin; i < end; i++) { - v_buf_data[i - begin] - = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,i)]; + v_buf_data[i-begin] = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,i)]; } - + #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_PACK_UNPACK] += hypre_MPI_Wtime(); hypre_profile_times[HYPRE_TIMER_ID_HALO_EXCHANGE] -= hypre_MPI_Wtime(); #endif -#ifdef HYPRE_USING_PERSISTENT_COMM - hypre_ParCSRPersistentCommHandleStart(persistent_comm_handle); +#if defined(HYPRE_USING_PERSISTENT_COMM) + hypre_ParCSRPersistentCommHandleStart(persistent_comm_handle, HYPRE_MEMORY_HOST, v_buf_data); #else - comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg, v_buf_data, - Vext_data); + comm_handle = hypre_ParCSRCommHandleCreate(1, comm_pkg, v_buf_data, Vext_data); #endif - + /*----------------------------------------------------------------- * Copy current approximation into temporary vector. *-----------------------------------------------------------------*/ -#ifdef HYPRE_USING_PERSISTENT_COMM - hypre_ParCSRPersistentCommHandleWait(persistent_comm_handle); +#if defined(HYPRE_USING_PERSISTENT_COMM) + hypre_ParCSRPersistentCommHandleWait(persistent_comm_handle, HYPRE_MEMORY_HOST, Vext_data); #else hypre_ParCSRCommHandleDestroy(comm_handle); #endif @@ -449,411 +452,391 @@ hypre_profile_times[HYPRE_TIMER_ID_RELAX] -= hypre_MPI_Wtime(); #endif - if (relax_weight == 1 && omega == 1) + if (relax_weight == 1 && omega == 1) { - if (relax_points == 0) - { - if (num_threads > 1) - { - tmp_data = Ztemp_data; + if (relax_points == 0) + { + if (num_threads > 1) + { + tmp_data = Ztemp_data; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE #endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( A_diag_data[A_diag_i[i]] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - res -= A_diag_data[jj] * u_data[ii]; - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] = res / A_diag_data[A_diag_i[i]]; - } - } - } - - } - else - { - for (i = 0; i < n; i++) /* interior points first */ - { + for (j = 0; j < num_threads; j++) + { + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* interior points first */ + { + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + if ( A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + res -= A_diag_data[jj] * u_data[ii]; + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } + } + } + } + else + { + for (i = 0; i < n; i++) /* interior points first */ + { - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( A_diag_data[A_diag_i[i]] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] = res / A_diag_data[A_diag_i[i]]; - } - } - } - } + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ - /*----------------------------------------------------------------- - * Relax only C or F points as determined by relax_points. - *-----------------------------------------------------------------*/ + if ( A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } + } + } + } - else - { - if (num_threads > 1) - { - tmp_data = Ztemp_data; + /*----------------------------------------------------------------- + * Relax only C or F points as determined by relax_points. + *-----------------------------------------------------------------*/ + else + { + if (num_threads > 1) + { + tmp_data = Ztemp_data; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE #endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - res -= A_diag_data[jj] * u_data[ii]; - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] = res / A_diag_data[A_diag_i[i]]; - } - } - } - - } - else - { - for (i = 0; i < n; i++) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] = res / A_diag_data[A_diag_i[i]]; - } - } - } - } + for (j = 0; j < num_threads; j++) + { + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* relax interior points */ + { + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + if (cf_marker[i] == relax_points && A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + res -= A_diag_data[jj] * u_data[ii]; + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } + } + } + } + else + { + for (i = 0; i < n; i++) /* relax interior points */ + { + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + if (cf_marker[i] == relax_points && A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } + } + } + } } - else + else { #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - { - Vtemp_data[i] = u_data[i]; - } - prod = (1.0-relax_weight*omega); - if (relax_points == 0) - { - if (num_threads > 1) - { - tmp_data = Ztemp_data; + for (i = 0; i < n; i++) + { + Vtemp_data[i] = u_data[i]; + } + prod = (1.0-relax_weight*omega); + if (relax_points == 0) + { + if (num_threads > 1) + { + tmp_data = Ztemp_data; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE #endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) /* interior points first */ - { + for (j = 0; j < num_threads; j++) + { + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* interior points first */ + { + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + if ( A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + res0 = 0.0; + res2 = 0.0; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ + } + } + } + } + else + { + for (i = 0; i < n; i++) /* interior points first */ + { + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + if ( A_diag_data[A_diag_i[i]] != zero) + { + res0 = 0.0; + res2 = 0.0; + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ + } + } + } + } - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( A_diag_data[A_diag_i[i]] != zero) - { - res = f_data[i]; - res0 = 0.0; - res2 = 0.0; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ - } - } - } - - } - else - { - for (i = 0; i < n; i++) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( A_diag_data[A_diag_i[i]] != zero) - { - res0 = 0.0; - res2 = 0.0; - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ - } - } - } - } - - /*----------------------------------------------------------------- - * Relax only C or F points as determined by relax_points. - *-----------------------------------------------------------------*/ - - else - { - if (num_threads > 1) - { - tmp_data = Ztemp_data; + /*----------------------------------------------------------------- + * Relax only C or F points as determined by relax_points. + *-----------------------------------------------------------------*/ + else + { + if (num_threads > 1) + { + tmp_data = Ztemp_data; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE #endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) /* relax interior points */ - { + for (j = 0; j < num_threads; j++) + { + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* relax interior points */ + { - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) - { - res0 = 0.0; - res2 = 0.0; - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ - } - } - } - - - } - else - { - for (i = 0; i < n; i++) /* relax interior points */ - { + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && A_diag_data[A_diag_i[i]] != zero) + { + res0 = 0.0; + res2 = 0.0; + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ + } + } + } - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) - { - res = f_data[i]; - res0 = 0.0; - res2 = 0.0; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ - } - } - } - } + + } + else + { + for (i = 0; i < n; i++) /* relax interior points */ + { + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + res0 = 0.0; + res2 = 0.0; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ + } + } + } + } } #ifndef HYPRE_USING_PERSISTENT_COMM if (num_procs > 1) { - hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); - hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); + hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); + hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); } #endif #ifdef HYPRE_PROFILE @@ -864,192 +847,192 @@ case 1: /* Gauss-Seidel VERY SLOW */ { - if (num_procs > 1) - { - num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - num_recvs = hypre_ParCSRCommPkgNumRecvs(comm_pkg); + if (num_procs > 1) + { + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + num_recvs = hypre_ParCSRCommPkgNumRecvs(comm_pkg); - v_buf_data = hypre_CTAlloc(HYPRE_Real, - hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + v_buf_data = hypre_CTAlloc(HYPRE_Real, + hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); - Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); - - status = hypre_CTAlloc(hypre_MPI_Status, num_recvs+num_sends, HYPRE_MEMORY_HOST); - requests= hypre_CTAlloc(hypre_MPI_Request, num_recvs+num_sends, HYPRE_MEMORY_HOST); - - if (num_cols_offd) - { - A_offd_j = hypre_CSRMatrixJ(A_offd); - A_offd_data = hypre_CSRMatrixData(A_offd); - } - - /*----------------------------------------------------------------- - * Copy current approximation into temporary vector. - *-----------------------------------------------------------------*/ - /* - for (i = 0; i < n; i++) - { - Vtemp_data[i] = u_data[i]; - } */ - - } + Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); + + status = hypre_CTAlloc(hypre_MPI_Status, num_recvs+num_sends, HYPRE_MEMORY_HOST); + requests= hypre_CTAlloc(hypre_MPI_Request, num_recvs+num_sends, HYPRE_MEMORY_HOST); + + if (num_cols_offd) + { + A_offd_j = hypre_CSRMatrixJ(A_offd); + A_offd_data = hypre_CSRMatrixData(A_offd); + } + + /*----------------------------------------------------------------- + * Copy current approximation into temporary vector. + *-----------------------------------------------------------------*/ + /* + for (i = 0; i < n; i++) + { + Vtemp_data[i] = u_data[i]; + } */ + + } /*----------------------------------------------------------------- * Relax all points. *-----------------------------------------------------------------*/ - for (p = 0; p < num_procs; p++) - { - jr = 0; - if (p != my_id) - { - for (i = 0; i < num_sends; i++) - { - ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); - if (ip == p) - { - vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - vec_len = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1)-vec_start; - for (j=vec_start; j < vec_start+vec_len; j++) - v_buf_data[j] = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - hypre_MPI_Isend(&v_buf_data[vec_start], vec_len, HYPRE_MPI_REAL, - ip, 0, comm, &requests[jr++]); - } - } - hypre_MPI_Waitall(jr,requests,status); - hypre_MPI_Barrier(comm); - } - else - { - if (num_procs > 1) - { - for (i = 0; i < num_recvs; i++) - { - ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); - vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i); - vec_len = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i+1)-vec_start; - hypre_MPI_Irecv(&Vext_data[vec_start], vec_len, HYPRE_MPI_REAL, - ip, 0, comm, &requests[jr++]); - } - hypre_MPI_Waitall(jr,requests,status); - } - if (relax_points == 0) - { - for (i = 0; i < n; i++) + for (p = 0; p < num_procs; p++) + { + jr = 0; + if (p != my_id) { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( A_diag_data[A_diag_i[i]] != zero) + for (i = 0; i < num_sends; i++) { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); + if (ip == p) { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; + vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + vec_len = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1)-vec_start; + for (j=vec_start; j < vec_start+vec_len; j++) + v_buf_data[j] = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + hypre_MPI_Isend(&v_buf_data[vec_start], vec_len, HYPRE_MPI_REAL, + ip, 0, comm, &requests[jr++]); } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + } + hypre_MPI_Waitall(jr,requests,status); + hypre_MPI_Barrier(comm); + } + else + { + if (num_procs > 1) + { + for (i = 0; i < num_recvs; i++) { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); + vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i); + vec_len = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i+1)-vec_start; + hypre_MPI_Irecv(&Vext_data[vec_start], vec_len, HYPRE_MPI_REAL, + ip, 0, comm, &requests[jr++]); } - u_data[i] = res / A_diag_data[A_diag_i[i]]; + hypre_MPI_Waitall(jr,requests,status); } - } - } + if (relax_points == 0) + { + for (i = 0; i < n; i++) + { - /*----------------------------------------------------------------- - * Relax only C or F points as determined by relax_points. - *-----------------------------------------------------------------*/ + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ - else - { - for (i = 0; i < n; i++) - { + if ( A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } + } + } - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) + /*----------------------------------------------------------------- + * Relax only C or F points as determined by relax_points. + *-----------------------------------------------------------------*/ + + else { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (i = 0; i < n; i++) { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } } - u_data[i] = res / A_diag_data[A_diag_i[i]]; } - } - } - if (num_procs > 1) - hypre_MPI_Barrier(comm); - } - } - if (num_procs > 1) - { - hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); - hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); - hypre_TFree(status, HYPRE_MEMORY_HOST); - hypre_TFree(requests, HYPRE_MEMORY_HOST); - } + if (num_procs > 1) + hypre_MPI_Barrier(comm); + } + } + if (num_procs > 1) + { + hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); + hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); + hypre_TFree(status, HYPRE_MEMORY_HOST); + hypre_TFree(requests, HYPRE_MEMORY_HOST); + } } break; case 2: /* Gauss-Seidel: relax interior points in parallel, boundary - sequentially */ + sequentially */ { - if (num_procs > 1) - { - num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - num_recvs = hypre_ParCSRCommPkgNumRecvs(comm_pkg); - - v_buf_data = hypre_CTAlloc(HYPRE_Real, - hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); - - Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); - - status = hypre_CTAlloc(hypre_MPI_Status, num_recvs+num_sends, HYPRE_MEMORY_HOST); - requests= hypre_CTAlloc(hypre_MPI_Request, num_recvs+num_sends, HYPRE_MEMORY_HOST); - - if (num_cols_offd) - { - A_offd_j = hypre_CSRMatrixJ(A_offd); - A_offd_data = hypre_CSRMatrixData(A_offd); - } - } - + if (num_procs > 1) + { + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + num_recvs = hypre_ParCSRCommPkgNumRecvs(comm_pkg); + + v_buf_data = hypre_CTAlloc(HYPRE_Real, + hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + + Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); + + status = hypre_CTAlloc(hypre_MPI_Status, num_recvs+num_sends, HYPRE_MEMORY_HOST); + requests= hypre_CTAlloc(hypre_MPI_Request, num_recvs+num_sends, HYPRE_MEMORY_HOST); + + if (num_cols_offd) + { + A_offd_j = hypre_CSRMatrixJ(A_offd); + A_offd_data = hypre_CSRMatrixData(A_offd); + } + } + /*----------------------------------------------------------------- * Copy current approximation into temporary vector. *-----------------------------------------------------------------*/ - /* - for (i = 0; i < n; i++) - { + /* + for (i = 0; i < n; i++) + { Vtemp_data[i] = u_data[i]; - } */ - + } */ + /*----------------------------------------------------------------- * Relax interior points first *-----------------------------------------------------------------*/ - if (relax_points == 0) - { - for (i = 0; i < n; i++) + if (relax_points == 0) + { + for (i = 0; i < n; i++) { /*----------------------------------------------------------- * If diagonal is nonzero, relax point i; otherwise, skip it. *-----------------------------------------------------------*/ - + if ((A_offd_i[i+1]-A_offd_i[i]) == zero && - A_diag_data[A_diag_i[i]] != zero) + A_diag_data[A_diag_i[i]] != zero) { res = f_data[i]; for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) @@ -1060,9 +1043,9 @@ u_data[i] = res / A_diag_data[A_diag_i[i]]; } } - } - else - { + } + else + { for (i = 0; i < n; i++) { @@ -1070,10 +1053,10 @@ * If i is of the right type ( C or F ) and diagonal is * nonzero, relax point i; otherwise, skip it. *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && (A_offd_i[i+1]-A_offd_i[i]) == zero - && A_diag_data[A_diag_i[i]] != zero) + + if (cf_marker[i] == relax_points + && (A_offd_i[i+1]-A_offd_i[i]) == zero + && A_diag_data[A_diag_i[i]] != zero) { res = f_data[i]; for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) @@ -1083,572 +1066,572 @@ } u_data[i] = res / A_diag_data[A_diag_i[i]]; } - } - } - for (p = 0; p < num_procs; p++) - { - jr = 0; - if (p != my_id) - { - for (i = 0; i < num_sends; i++) - { - ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); - if (ip == p) - { - vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - vec_len = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1)-vec_start; - for (j=vec_start; j < vec_start+vec_len; j++) - v_buf_data[j] = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - hypre_MPI_Isend(&v_buf_data[vec_start], vec_len, HYPRE_MPI_REAL, - ip, 0, comm, &requests[jr++]); - } - } - hypre_MPI_Waitall(jr,requests,status); - hypre_MPI_Barrier(comm); - } - else - { - if (num_procs > 1) - { - for (i = 0; i < num_recvs; i++) - { - ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); - vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i); - vec_len = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i+1)-vec_start; - hypre_MPI_Irecv(&Vext_data[vec_start], vec_len, HYPRE_MPI_REAL, - ip, 0, comm, &requests[jr++]); - } - hypre_MPI_Waitall(jr,requests,status); - } - if (relax_points == 0) - { - for (i = 0; i < n; i++) + } + } + for (p = 0; p < num_procs; p++) + { + jr = 0; + if (p != my_id) { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ((A_offd_i[i+1]-A_offd_i[i]) != zero && - A_diag_data[A_diag_i[i]] != zero) + for (i = 0; i < num_sends; i++) { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); + if (ip == p) { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; + vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + vec_len = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1)-vec_start; + for (j=vec_start; j < vec_start+vec_len; j++) + v_buf_data[j] = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + hypre_MPI_Isend(&v_buf_data[vec_start], vec_len, HYPRE_MPI_REAL, + ip, 0, comm, &requests[jr++]); } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + } + hypre_MPI_Waitall(jr,requests,status); + hypre_MPI_Barrier(comm); + } + else + { + if (num_procs > 1) + { + for (i = 0; i < num_recvs; i++) { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); + vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i); + vec_len = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i+1)-vec_start; + hypre_MPI_Irecv(&Vext_data[vec_start], vec_len, HYPRE_MPI_REAL, + ip, 0, comm, &requests[jr++]); } - u_data[i] = res / A_diag_data[A_diag_i[i]]; + hypre_MPI_Waitall(jr,requests,status); } - } - } + if (relax_points == 0) + { + for (i = 0; i < n; i++) + { - /*----------------------------------------------------------------- - * Relax only C or F points as determined by relax_points. - *-----------------------------------------------------------------*/ + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ - else - { - for (i = 0; i < n; i++) - { + if ((A_offd_i[i+1]-A_offd_i[i]) != zero && + A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } + } + } - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && (A_offd_i[i+1]-A_offd_i[i]) != zero - && A_diag_data[A_diag_i[i]] != zero) + /*----------------------------------------------------------------- + * Relax only C or F points as determined by relax_points. + *-----------------------------------------------------------------*/ + + else { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + for (i = 0; i < n; i++) { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && (A_offd_i[i+1]-A_offd_i[i]) != zero + && A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } } - u_data[i] = res / A_diag_data[A_diag_i[i]]; } - } - } - if (num_procs > 1) - hypre_MPI_Barrier(comm); - } - } - if (num_procs > 1) - { - hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); - hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); - hypre_TFree(status, HYPRE_MEMORY_HOST); - hypre_TFree(requests, HYPRE_MEMORY_HOST); - } + if (num_procs > 1) + hypre_MPI_Barrier(comm); + } + } + if (num_procs > 1) + { + hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); + hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); + hypre_TFree(status, HYPRE_MEMORY_HOST); + hypre_TFree(requests, HYPRE_MEMORY_HOST); + } } break; - case 4: /* Hybrid: Jacobi off-processor, - Gauss-Seidel/SOR on-processor - (backward loop) */ + case 4: /* Hybrid: Jacobi off-processor, + Gauss-Seidel/SOR on-processor + (backward loop) */ { - if (num_procs > 1) - { - num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - - v_buf_data = hypre_CTAlloc(HYPRE_Real, - hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); - - Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); - - if (num_cols_offd) - { - A_offd_j = hypre_CSRMatrixJ(A_offd); - A_offd_data = hypre_CSRMatrixData(A_offd); - } - - index = 0; - for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg,i+1); j++) - v_buf_data[index++] - = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg, v_buf_data, - Vext_data); + if (num_procs > 1) + { + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - /*----------------------------------------------------------------- - * Copy current approximation into temporary vector. - *-----------------------------------------------------------------*/ - hypre_ParCSRCommHandleDestroy(comm_handle); - comm_handle = NULL; - } + v_buf_data = hypre_CTAlloc(HYPRE_Real, + hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + + Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); + + if (num_cols_offd) + { + A_offd_j = hypre_CSRMatrixJ(A_offd); + A_offd_data = hypre_CSRMatrixData(A_offd); + } + + index = 0; + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg,i+1); j++) + v_buf_data[index++] + = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } + + comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg, v_buf_data, + Vext_data); + + /*----------------------------------------------------------------- + * Copy current approximation into temporary vector. + *-----------------------------------------------------------------*/ + hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = NULL; + } /*----------------------------------------------------------------- * Relax all points. *-----------------------------------------------------------------*/ - if (relax_weight == 1 && omega == 1) - { - if (relax_points == 0) + if (relax_weight == 1 && omega == 1) { - if (num_threads > 1) - { - tmp_data = hypre_CTAlloc(HYPRE_Real, n, HYPRE_MEMORY_HOST); + if (relax_points == 0) + { + if (num_threads > 1) + { + tmp_data = hypre_CTAlloc(HYPRE_Real, n, HYPRE_MEMORY_HOST); #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE #endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ne-1; i > ns-1; i--) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( A_diag_data[A_diag_i[i]] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - res -= A_diag_data[jj] * u_data[ii]; - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (j = 0; j < num_threads; j++) { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ne-1; i > ns-1; i--) /* interior points first */ + { + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + res -= A_diag_data[jj] * u_data[ii]; + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } + } } - u_data[i] = res / A_diag_data[A_diag_i[i]]; + hypre_TFree(tmp_data, HYPRE_MEMORY_HOST); } - } - } - hypre_TFree(tmp_data, HYPRE_MEMORY_HOST); - } - else - { - for (i = n-1; i > -1; i--) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( A_diag_data[A_diag_i[i]] != zero) + else { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (i = n-1; i > -1; i--) /* interior points first */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } } - u_data[i] = res / A_diag_data[A_diag_i[i]]; + } } - - } - } - /*----------------------------------------------------------------- - * Relax only C or F points as determined by relax_points. - *-----------------------------------------------------------------*/ + /*----------------------------------------------------------------- + * Relax only C or F points as determined by relax_points. + *-----------------------------------------------------------------*/ - else - { - if (num_threads > 1) - { - tmp_data = hypre_CTAlloc(HYPRE_Real, n, HYPRE_MEMORY_HOST); + else + { + if (num_threads > 1) + { + tmp_data = hypre_CTAlloc(HYPRE_Real, n, HYPRE_MEMORY_HOST); #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE #endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ne-1; i > ns-1; i--) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - res -= A_diag_data[jj] * u_data[ii]; - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (j = 0; j < num_threads; j++) { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ne-1; i > ns-1; i--) /* relax interior points */ + { + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + res -= A_diag_data[jj] * u_data[ii]; + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } + } } - u_data[i] = res / A_diag_data[A_diag_i[i]]; - } - } - } - hypre_TFree(tmp_data, HYPRE_MEMORY_HOST); - - } - else - { - for (i = n-1; i > -1; i--) /* relax interior points */ - { + hypre_TFree(tmp_data, HYPRE_MEMORY_HOST); - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) + } + else { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (i = n-1; i > -1; i--) /* relax interior points */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } } - u_data[i] = res / A_diag_data[A_diag_i[i]]; } - } - } - } + } } - else + else { #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - { - Vtemp_data[i] = u_data[i]; - } - prod = (1.0-relax_weight*omega); - if (relax_points == 0) - { - if (num_threads > 1) - { - tmp_data = hypre_CTAlloc(HYPRE_Real, n, HYPRE_MEMORY_HOST); + for (i = 0; i < n; i++) + { + Vtemp_data[i] = u_data[i]; + } + prod = (1.0-relax_weight*omega); + if (relax_points == 0) + { + if (num_threads > 1) + { + tmp_data = hypre_CTAlloc(HYPRE_Real, n, HYPRE_MEMORY_HOST); #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE #endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ne-1; i > ns-1; i--) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( A_diag_data[A_diag_i[i]] != zero) - { - res = f_data[i]; - res0 = 0.0; - res2 = 0.0; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (j = 0; j < num_threads; j++) { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ne-1; i > ns-1; i--) /* interior points first */ + { + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + res0 = 0.0; + res2 = 0.0; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ + } + } } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ - } - } - } - hypre_TFree(tmp_data, HYPRE_MEMORY_HOST); - - } - else - { - for (i = n-1; i > -1; i--) /* interior points first */ - { + hypre_TFree(tmp_data, HYPRE_MEMORY_HOST); - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( A_diag_data[A_diag_i[i]] != zero) + } + else { - res0 = 0.0; - res2 = 0.0; - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (i = n-1; i > -1; i--) /* interior points first */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( A_diag_data[A_diag_i[i]] != zero) + { + res0 = 0.0; + res2 = 0.0; + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ + } } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ } } - } - } - /*----------------------------------------------------------------- - * Relax only C or F points as determined by relax_points. - *-----------------------------------------------------------------*/ + /*----------------------------------------------------------------- + * Relax only C or F points as determined by relax_points. + *-----------------------------------------------------------------*/ - else - { - if (num_threads > 1) - { - tmp_data = hypre_CTAlloc(HYPRE_Real, n, HYPRE_MEMORY_HOST); + else + { + if (num_threads > 1) + { + tmp_data = hypre_CTAlloc(HYPRE_Real, n, HYPRE_MEMORY_HOST); #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,j,jj,ns,ne,res,res0,res2,rest,size) HYPRE_SMP_SCHEDULE #endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ne-1; i > ns-1; i--) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) - { - res0 = 0.0; - res2 = 0.0; - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (j = 0; j < num_threads; j++) { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ - } - } - } - hypre_TFree(tmp_data, HYPRE_MEMORY_HOST); - } - else - { - for (i = n-1; i > -1; i--) /* relax interior points */ - { + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ne-1; i > ns-1; i--) /* relax interior points */ + { - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && A_diag_data[A_diag_i[i]] != zero) + { + res0 = 0.0; + res2 = 0.0; + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ + } + } + } + hypre_TFree(tmp_data, HYPRE_MEMORY_HOST); + } + else { - res = f_data[i]; - res0 = 0.0; - res2 = 0.0; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + for (i = n-1; i > -1; i--) /* relax interior points */ { - ii = A_diag_j[jj]; - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + res0 = 0.0; + res2 = 0.0; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ + } } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ } - } - } - } + } } if (num_procs > 1) { - hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); - hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); + hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); + hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); } } break; - case 6: /* Hybrid: Jacobi off-processor, - Symm. Gauss-Seidel/ SSOR on-processor - with outer relaxation parameter */ + case 6: /* Hybrid: Jacobi off-processor, + Symm. Gauss-Seidel/ SSOR on-processor + with outer relaxation parameter */ { if (num_threads > 1) @@ -1656,1439 +1639,731 @@ Ztemp_local = hypre_ParVectorLocalVector(Ztemp); Ztemp_data = hypre_VectorData(Ztemp_local); } - + /*----------------------------------------------------------------- * Copy current approximation into temporary vector. *-----------------------------------------------------------------*/ - if (num_procs > 1) - { - num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - - v_buf_data = hypre_CTAlloc(HYPRE_Real, - hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); - - Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); - - if (num_cols_offd) - { - A_offd_j = hypre_CSRMatrixJ(A_offd); - A_offd_data = hypre_CSRMatrixData(A_offd); - } - - index = 0; - for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg,i+1); j++) - v_buf_data[index++] - = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg, v_buf_data, - Vext_data); + if (num_procs > 1) + { + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + + v_buf_data = hypre_CTAlloc(HYPRE_Real, + hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + + Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); + + if (num_cols_offd) + { + A_offd_j = hypre_CSRMatrixJ(A_offd); + A_offd_data = hypre_CSRMatrixData(A_offd); + } + + index = 0; + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg,i+1); j++) + v_buf_data[index++] + = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } + + comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg, v_buf_data, + Vext_data); + + /*----------------------------------------------------------------- + * Copy current approximation into temporary vector. + *-----------------------------------------------------------------*/ + hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = NULL; + } /*----------------------------------------------------------------- - * Copy current approximation into temporary vector. + * Relax all points. *-----------------------------------------------------------------*/ - hypre_ParCSRCommHandleDestroy(comm_handle); - comm_handle = NULL; - } - - /*----------------------------------------------------------------- - * Relax all points. - *-----------------------------------------------------------------*/ - if (relax_weight == 1 && omega == 1) - { - if (relax_points == 0) + if (relax_weight == 1 && omega == 1) { - if (num_threads > 1) - { - tmp_data = Ztemp_data; + if (relax_points == 0) + { + if (num_threads > 1) + { + tmp_data = Ztemp_data; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE #endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( A_diag_data[A_diag_i[i]] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res -= A_diag_data[jj] * u_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (j = 0; j < num_threads; j++) { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* interior points first */ + { + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res -= A_diag_data[jj] * u_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } + } + for (i = ne-1; i > ns-1; i--) /* interior points first */ + { + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res -= A_diag_data[jj] * u_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } + } } - u_data[i] = res / A_diag_data[A_diag_i[i]]; - } - } - for (i = ne-1; i > ns-1; i--) /* interior points first */ - { - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( A_diag_data[A_diag_i[i]] != zero) + } + else { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + for (i = 0; i < n; i++) /* interior points first */ { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res -= A_diag_data[jj] * u_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (i = n-1; i > -1; i--) /* interior points first */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } } - u_data[i] = res / A_diag_data[A_diag_i[i]]; } } - } - } - else - { - for (i = 0; i < n; i++) /* interior points first */ - { + /*----------------------------------------------------------------- + * Relax only C or F points as determined by relax_points. + *-----------------------------------------------------------------*/ - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( A_diag_data[A_diag_i[i]] != zero) + else + { + if (num_threads > 1) { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + tmp_data = Ztemp_data; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE +#endif + for (j = 0; j < num_threads; j++) { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* relax interior points */ + { + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res -= A_diag_data[jj] * u_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } + } + for (i = ne-1; i > ns-1; i--) /* relax interior points */ + { + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res -= A_diag_data[jj] * u_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } + } } - u_data[i] = res / A_diag_data[A_diag_i[i]]; - } - } - for (i = n-1; i > -1; i--) /* interior points first */ - { - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( A_diag_data[A_diag_i[i]] != zero) + } + else { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + for (i = 0; i < n; i++) /* relax interior points */ { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (i = n-1; i > -1; i--) /* relax interior points */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] = res / A_diag_data[A_diag_i[i]]; + } } - u_data[i] = res / A_diag_data[A_diag_i[i]]; } } - } } - - /*----------------------------------------------------------------- - * Relax only C or F points as determined by relax_points. - *-----------------------------------------------------------------*/ - else { - if (num_threads > 1) - { - tmp_data = Ztemp_data; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE -#endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) /* relax interior points */ + for (i = 0; i < n; i++) { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) + Vtemp_data[i] = u_data[i]; + } + prod = (1.0-relax_weight*omega); + if (relax_points == 0) + { + if (num_threads > 1) { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res -= A_diag_data[jj] * u_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + tmp_data = Ztemp_data; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,res0,res2,rest,size) HYPRE_SMP_SCHEDULE +#endif + for (j = 0; j < num_threads; j++) { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* interior points first */ + { + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( A_diag_data[A_diag_i[i]] != zero) + { + res0 = 0.0; + res2 = 0.0; + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ + } + } + for (i = ne-1; i > ns-1; i--) /* interior points first */ + { + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( A_diag_data[A_diag_i[i]] != zero) + { + res0 = 0.0; + res2 = 0.0; + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ + } + } } - u_data[i] = res / A_diag_data[A_diag_i[i]]; - } - } - for (i = ne-1; i > ns-1; i--) /* relax interior points */ - { - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) + } + else { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + for (i = 0; i < n; i++) /* interior points first */ { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res -= A_diag_data[jj] * u_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( A_diag_data[A_diag_i[i]] != zero) + { + res0 = 0.0; + res = f_data[i]; + res2 = 0.0; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ + } } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (i = n-1; i > -1; i--) /* interior points first */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( A_diag_data[A_diag_i[i]] != zero) + { + res0 = 0.0; + res = f_data[i]; + res2 = 0.0; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ + } } - u_data[i] = res / A_diag_data[A_diag_i[i]]; } - } - } + } - } - else - { - for (i = 0; i < n; i++) /* relax interior points */ - { + /*----------------------------------------------------------------- + * Relax only C or F points as determined by relax_points. + *-----------------------------------------------------------------*/ - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) + else + { + if (num_threads > 1) { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + tmp_data = Ztemp_data; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,res0,res2,rest,size) HYPRE_SMP_SCHEDULE +#endif + for (j = 0; j < num_threads; j++) { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] = res / A_diag_data[A_diag_i[i]]; - } - } - for (i = n-1; i > -1; i--) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] = res / A_diag_data[A_diag_i[i]]; - } - } - } - } - } - else - { -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < n; i++) - { - Vtemp_data[i] = u_data[i]; - } - prod = (1.0-relax_weight*omega); - if (relax_points == 0) - { - if (num_threads > 1) - { - tmp_data = Ztemp_data; -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,res0,res2,rest,size) HYPRE_SMP_SCHEDULE -#endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( A_diag_data[A_diag_i[i]] != zero) - { - res0 = 0.0; - res2 = 0.0; - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ - } - } - for (i = ne-1; i > ns-1; i--) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( A_diag_data[A_diag_i[i]] != zero) - { - res0 = 0.0; - res2 = 0.0; - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ - } - } - } - - } - else - { - for (i = 0; i < n; i++) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( A_diag_data[A_diag_i[i]] != zero) - { - res0 = 0.0; - res = f_data[i]; - res2 = 0.0; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ - } - } - for (i = n-1; i > -1; i--) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( A_diag_data[A_diag_i[i]] != zero) - { - res0 = 0.0; - res = f_data[i]; - res2 = 0.0; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ - } - } - } - } - - /*----------------------------------------------------------------- - * Relax only C or F points as determined by relax_points. - *-----------------------------------------------------------------*/ - - else - { - if (num_threads > 1) - { - tmp_data = Ztemp_data; -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,res0,res2,rest,size) HYPRE_SMP_SCHEDULE -#endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) - { - res0 = 0.0; - res2 = 0.0; - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res2 += A_diag_data[jj] * Vtemp_data[ii]; - res0 -= A_diag_data[jj] * u_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ - } - } - for (i = ne-1; i > ns-1; i--) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) - { - res0 = 0.0; - res2 = 0.0; - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res2 += A_diag_data[jj] * Vtemp_data[ii]; - res0 -= A_diag_data[jj] * u_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ - } - } - } - - } - else - { - for (i = 0; i < n; i++) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) - { - res = f_data[i]; - res0 = 0.0; - res2 = 0.0; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ - } - } - for (i = n-1; i > -1; i--) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && A_diag_data[A_diag_i[i]] != zero) - { - res = f_data[i]; - res0 = 0.0; - res2 = 0.0; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ - } - } - } - } - } - if (num_procs > 1) - { - hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); - hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); - } - } - break; - - case 7: /* Jacobi (uses ParMatvec) */ - { - - /*----------------------------------------------------------------- - * Copy f into temporary vector. - *-----------------------------------------------------------------*/ - PUSH_RANGE("RELAX",4); -#if defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) - hypre_SeqVectorPrefetchToDevice(hypre_ParVectorLocalVector(Vtemp)); - hypre_SeqVectorPrefetchToDevice(hypre_ParVectorLocalVector(f)); - VecCopy(Vtemp_data,f_data,hypre_VectorSize(hypre_ParVectorLocalVector(Vtemp)),HYPRE_STREAM(4)); -#else - hypre_ParVectorCopy(f,Vtemp); -#endif - /*----------------------------------------------------------------- - * Perform Matvec Vtemp=f-Au - *-----------------------------------------------------------------*/ - - hypre_ParCSRMatrixMatvec(-relax_weight,A, u, relax_weight, Vtemp); -#if defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) - VecScale(u_data,Vtemp_data,l1_norms,n,HYPRE_STREAM(4)); -#else - for (i = 0; i < n; i++) - { - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - u_data[i] += Vtemp_data[i] / l1_norms[i]; - } -#endif - POP_RANGE; - } - break; - - case 8: /* hybrid L1 Symm. Gauss-Seidel */ - { - - if (num_threads > 1) - { - Ztemp_local = hypre_ParVectorLocalVector(Ztemp); - Ztemp_data = hypre_VectorData(Ztemp_local); - } - - /*----------------------------------------------------------------- - * Copy current approximation into temporary vector. - *-----------------------------------------------------------------*/ - if (num_procs > 1) - { - num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - - v_buf_data = hypre_CTAlloc(HYPRE_Real, - hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); - - Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); - - if (num_cols_offd) - { - A_offd_j = hypre_CSRMatrixJ(A_offd); - A_offd_data = hypre_CSRMatrixData(A_offd); - } - - index = 0; - for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg,i+1); j++) - v_buf_data[index++] - = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } - - comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg, v_buf_data, - Vext_data); - - /*----------------------------------------------------------------- - * Copy current approximation into temporary vector. - *-----------------------------------------------------------------*/ - hypre_ParCSRCommHandleDestroy(comm_handle); - comm_handle = NULL; - } - - /*----------------------------------------------------------------- - * Relax all points. - *-----------------------------------------------------------------*/ - - if (relax_weight == 1 && omega == 1) - { - if (relax_points == 0) - { - if (num_threads > 1) - { - tmp_data = Ztemp_data; -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE -#endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( l1_norms[i] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res -= A_diag_data[jj] * u_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] += res / l1_norms[i]; - } - } - for (i = ne-1; i > ns-1; i--) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( l1_norms[i] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res -= A_diag_data[jj] * u_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] += res / l1_norms[i]; - } - } - } - - } - else - { - for (i = 0; i < n; i++) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( l1_norms[i] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] += res / l1_norms[i]; - } - } - for (i = n-1; i > -1; i--) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( l1_norms[i] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] += res / l1_norms[i]; - } - } - } - } - - /*----------------------------------------------------------------- - * Relax only C or F points as determined by relax_points. - *-----------------------------------------------------------------*/ - - else - { - if (num_threads > 1) - { - tmp_data = Ztemp_data; -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE -#endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && l1_norms[i] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res -= A_diag_data[jj] * u_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] += res / l1_norms[i]; - } - } - for (i = ne-1; i > ns-1; i--) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && l1_norms[i] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res -= A_diag_data[jj] * u_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] += res / l1_norms[i]; - } - } - } - - } - else - { - for (i = 0; i < n; i++) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && l1_norms[i] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] += res / l1_norms[i]; - } - } - for (i = n-1; i > -1; i--) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && l1_norms[i] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] += res / l1_norms[i]; - } - } - } - } - } - else - { -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < n; i++) - { - Vtemp_data[i] = u_data[i]; - } - prod = (1.0-relax_weight*omega); - if (relax_points == 0) - { - if (num_threads > 1) - { - tmp_data = Ztemp_data; -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE -#endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( l1_norms[i] != zero) - { - res0 = 0.0; - res2 = 0.0; - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / l1_norms[i]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / l1_norms[i];*/ - } - } - for (i = ne-1; i > ns-1; i--) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( l1_norms[i] != zero) - { - res0 = 0.0; - res2 = 0.0; - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / l1_norms[i]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / l1_norms[i];*/ - } - } - } - - } - else - { - for (i = 0; i < n; i++) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( l1_norms[i] != zero) - { - res0 = 0.0; - res = f_data[i]; - res2 = 0.0; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / l1_norms[i]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / l1_norms[i];*/ - } - } - for (i = n-1; i > -1; i--) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( l1_norms[i] != zero) - { - res0 = 0.0; - res = f_data[i]; - res2 = 0.0; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / l1_norms[i]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / l1_norms[i];*/ - } - } - } - } - - /*----------------------------------------------------------------- - * Relax only C or F points as determined by relax_points. - *-----------------------------------------------------------------*/ - - else - { - if (num_threads > 1) - { - tmp_data = Ztemp_data; -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE -#endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && l1_norms[i] != zero) - { - res0 = 0.0; - res2 = 0.0; - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res2 += A_diag_data[jj] * Vtemp_data[ii]; - res0 -= A_diag_data[jj] * u_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / l1_norms[i]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / l1_norms[i];*/ - } - } - for (i = ne-1; i > ns-1; i--) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && l1_norms[i] != zero) - { - res0 = 0.0; - res2 = 0.0; - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) { - res2 += A_diag_data[jj] * Vtemp_data[ii]; - res0 -= A_diag_data[jj] * u_data[ii]; + ns = j*size+j; + ne = (j+1)*size+j+1; } else - res -= A_diag_data[jj] * tmp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / l1_norms[i]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / l1_norms[i];*/ - } - } - } - - } - else - { - for (i = 0; i < n; i++) /* relax interior points */ - { + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* relax interior points */ + { - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && A_diag_data[A_diag_i[i]] != zero) + { + res0 = 0.0; + res2 = 0.0; + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res2 += A_diag_data[jj] * Vtemp_data[ii]; + res0 -= A_diag_data[jj] * u_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ + } + } + for (i = ne-1; i > ns-1; i--) /* relax interior points */ + { - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && A_diag_data[A_diag_i[i]] != zero) + { + res0 = 0.0; + res2 = 0.0; + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res2 += A_diag_data[jj] * Vtemp_data[ii]; + res0 -= A_diag_data[jj] * u_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ + } + } + } - if (cf_marker[i] == relax_points - && l1_norms[i] != zero) + } + else { - res = f_data[i]; - res0 = 0.0; - res2 = 0.0; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (i = 0; i < n; i++) /* relax interior points */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / l1_norms[i]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / l1_norms[i];*/ - } - } - for (i = n-1; i > -1; i--) /* relax interior points */ - { - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ - if (cf_marker[i] == relax_points - && l1_norms[i] != zero) - { - res = f_data[i]; - res0 = 0.0; - res2 = 0.0; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; + if (cf_marker[i] == relax_points + && A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + res0 = 0.0; + res2 = 0.0; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ + } } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (i = n-1; i > -1; i--) /* relax interior points */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && A_diag_data[A_diag_i[i]] != zero) + { + res = f_data[i]; + res0 = 0.0; + res2 = 0.0; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / A_diag_data[A_diag_i[i]]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / A_diag_data[A_diag_i[i]];*/ + } } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / l1_norms[i]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / l1_norms[i];*/ } } - } } - } - if (num_procs > 1) - { - hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); - hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); - } + if (num_procs > 1) + { + hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); + hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); + } } break; - case 13: /* hybrid L1 Gauss-Seidel forward solve */ + case 7: /* Jacobi (uses ParMatvec) */ { + /*----------------------------------------------------------------- + * Copy f into temporary vector. + *-----------------------------------------------------------------*/ + hypre_SeqVectorPrefetch(hypre_ParVectorLocalVector(Vtemp), HYPRE_MEMORY_DEVICE); + hypre_SeqVectorPrefetch(hypre_ParVectorLocalVector(f), HYPRE_MEMORY_DEVICE); + hypre_ParVectorCopy(f, Vtemp); + + /*----------------------------------------------------------------- + * Perform Matvec Vtemp=f-Au + *-----------------------------------------------------------------*/ + + hypre_ParCSRMatrixMatvec(-relax_weight,A, u, relax_weight, Vtemp); +#if defined(HYPRE_USING_CUDA) + hypreDevice_IVAXPY(n, l1_norms, Vtemp_data, u_data); +#else + for (i = 0; i < n; i++) + { + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + u_data[i] += Vtemp_data[i] / l1_norms[i]; + } +#endif + } + break; + + case 8: /* hybrid L1 Symm. Gauss-Seidel */ + { if (num_threads > 1) { Ztemp_local = hypre_ParVectorLocalVector(Ztemp); @@ -3098,457 +2373,971 @@ /*----------------------------------------------------------------- * Copy current approximation into temporary vector. *-----------------------------------------------------------------*/ - if (num_procs > 1) - { - num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + if (num_procs > 1) + { + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - v_buf_data = hypre_CTAlloc(HYPRE_Real, - hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + v_buf_data = hypre_CTAlloc(HYPRE_Real, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); - Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); + Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); - if (num_cols_offd) - { - A_offd_j = hypre_CSRMatrixJ(A_offd); - A_offd_data = hypre_CSRMatrixData(A_offd); - } + if (num_cols_offd) + { + A_offd_j = hypre_CSRMatrixJ(A_offd); + A_offd_data = hypre_CSRMatrixData(A_offd); + } - index = 0; - for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg,i+1); j++) - v_buf_data[index++] - = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } + index = 0; + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg,i+1); j++) + { + v_buf_data[index++] = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } + } + + comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg, v_buf_data, Vext_data); - comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg, v_buf_data, - Vext_data); + /*----------------------------------------------------------------- + * Copy current approximation into temporary vector. + *-----------------------------------------------------------------*/ + hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = NULL; + } /*----------------------------------------------------------------- - * Copy current approximation into temporary vector. + * Relax all points. *-----------------------------------------------------------------*/ - hypre_ParCSRCommHandleDestroy(comm_handle); - comm_handle = NULL; - } - - /*----------------------------------------------------------------- - * Relax all points. - *-----------------------------------------------------------------*/ - if (relax_weight == 1 && omega == 1) - { - if (relax_points == 0) + if (relax_weight == 1 && omega == 1) { - if (num_threads > 1) - { - tmp_data = Ztemp_data; + if (relax_points == 0) + { + if (num_threads > 1) + { + tmp_data = Ztemp_data; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE #endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) /* interior points first */ - { + for (j = 0; j < num_threads; j++) + { + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* interior points first */ + { - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( l1_norms[i] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res -= A_diag_data[jj] * u_data[ii]; + } + else + { + res -= A_diag_data[jj] * tmp_data[ii]; + } + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] += res / l1_norms[i]; + } + } + for (i = ne-1; i > ns-1; i--) /* interior points first */ + { - if ( l1_norms[i] != zero) + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( l1_norms[i] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res -= A_diag_data[jj] * u_data[ii]; + } + else + { + res -= A_diag_data[jj] * tmp_data[ii]; + } + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] += res / l1_norms[i]; + } + } + } + + } + else { - res = f_data[i]; - for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + for (i = 0; i < n; i++) /* interior points first */ { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( l1_norms[i] != zero) { - res -= A_diag_data[jj] * u_data[ii]; + res = f_data[i]; + for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] += res / l1_norms[i]; } - else - res -= A_diag_data[jj] * tmp_data[ii]; } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (i = n-1; i > -1; i--) /* interior points first */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( l1_norms[i] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] += res / l1_norms[i]; + } } - u_data[i] += res / l1_norms[i]; } } - } - - } - else - { - for (i = 0; i < n; i++) /* interior points first */ + /*----------------------------------------------------------------- + * Relax only C or F points as determined by relax_points. + *-----------------------------------------------------------------*/ + else { + if (num_threads > 1) + { + tmp_data = Ztemp_data; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE +#endif + for (j = 0; j < num_threads; j++) + { + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* relax interior points */ + { - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && l1_norms[i] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res -= A_diag_data[jj] * u_data[ii]; + } + else + { + res -= A_diag_data[jj] * tmp_data[ii]; + } + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] += res / l1_norms[i]; + } + } + for (i = ne-1; i > ns-1; i--) /* relax interior points */ + { - if ( l1_norms[i] != zero) + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && l1_norms[i] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res -= A_diag_data[jj] * u_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] += res / l1_norms[i]; + } + } + } + } + else { - res = f_data[i]; - for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + for (i = 0; i < n; i++) /* relax interior points */ { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && l1_norms[i] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] += res / l1_norms[i]; + } } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (i = n-1; i > -1; i--) /* relax interior points */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && l1_norms[i] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] += res / l1_norms[i]; + } } - u_data[i] += res / l1_norms[i]; } } - } } - - /*----------------------------------------------------------------- - * Relax only C or F points as determined by relax_points. - *-----------------------------------------------------------------*/ - else { - if (num_threads > 1) - { - tmp_data = Ztemp_data; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; + for (i = 0; i < n; i++) + { + Vtemp_data[i] = u_data[i]; + } + prod = (1.0-relax_weight*omega); + if (relax_points == 0) + { + if (num_threads > 1) + { + tmp_data = Ztemp_data; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE +#endif + for (j = 0; j < num_threads; j++) + { + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* interior points first */ + { + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( l1_norms[i] != zero) + { + res0 = 0.0; + res2 = 0.0; + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + one_minus_omega*res2) / l1_norms[i]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / l1_norms[i];*/ + } + } + for (i = ne-1; i > ns-1; i--) /* interior points first */ + { + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( l1_norms[i] != zero) + { + res0 = 0.0; + res2 = 0.0; + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / l1_norms[i]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / l1_norms[i];*/ + } + } + } + } + else + { + for (i = 0; i < n; i++) /* interior points first */ + { + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( l1_norms[i] != zero) + { + res0 = 0.0; + res = f_data[i]; + res2 = 0.0; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / l1_norms[i]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / l1_norms[i];*/ + } + } + for (i = n-1; i > -1; i--) /* interior points first */ + { + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( l1_norms[i] != zero) + { + res0 = 0.0; + res = f_data[i]; + res2 = 0.0; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / l1_norms[i]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / l1_norms[i];*/ + } + } + } + } + /*----------------------------------------------------------------- + * Relax only C or F points as determined by relax_points. + *-----------------------------------------------------------------*/ + else + { + if (num_threads > 1) + { + tmp_data = Ztemp_data; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE #endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) /* relax interior points */ - { + for (j = 0; j < num_threads; j++) + { + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* relax interior points */ + { - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points && l1_norms[i] != zero) + { + res0 = 0.0; + res2 = 0.0; + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res2 += A_diag_data[jj] * Vtemp_data[ii]; + res0 -= A_diag_data[jj] * u_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / l1_norms[i]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / l1_norms[i];*/ + } + } + for (i = ne-1; i > ns-1; i--) /* relax interior points */ + { - if (cf_marker[i] == relax_points - && l1_norms[i] != zero) + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && l1_norms[i] != zero) + { + res0 = 0.0; + res2 = 0.0; + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res2 += A_diag_data[jj] * Vtemp_data[ii]; + res0 -= A_diag_data[jj] * u_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / l1_norms[i]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / l1_norms[i];*/ + } + } + } + + } + else { - res = f_data[i]; - for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + for (i = 0; i < n; i++) /* relax interior points */ { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && l1_norms[i] != zero) { - res -= A_diag_data[jj] * u_data[ii]; + res = f_data[i]; + res0 = 0.0; + res2 = 0.0; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / l1_norms[i]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / l1_norms[i];*/ } - else - res -= A_diag_data[jj] * tmp_data[ii]; } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + for (i = n-1; i > -1; i--) /* relax interior points */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && l1_norms[i] != zero) + { + res = f_data[i]; + res0 = 0.0; + res2 = 0.0; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / l1_norms[i]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / l1_norms[i];*/ + } } - u_data[i] += res / l1_norms[i]; } } - } + } + if (num_procs > 1) + { + hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); + hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); + } + } + break; - } - else - { - for (i = 0; i < n; i++) /* relax interior points */ - { + /* Hybrid: Jacobi off-processor, ordered Gauss-Seidel on-processor */ + case 10: + { + if (num_threads > 1) + { + Ztemp_local = hypre_ParVectorLocalVector(Ztemp); + Ztemp_data = hypre_VectorData(Ztemp_local); + } - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is +#ifdef HYPRE_USING_PERSISTENT_COMM + // JSP: persistent comm can be similarly used for other smoothers + hypre_ParCSRPersistentCommHandle *persistent_comm_handle; +#endif - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ + if (num_procs > 1) + { +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_PACK_UNPACK] -= hypre_MPI_Wtime(); +#endif + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - if (cf_marker[i] == relax_points - && l1_norms[i] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; - } - u_data[i] += res / l1_norms[i]; - } +#ifdef HYPRE_USING_PERSISTENT_COMM + persistent_comm_handle = hypre_ParCSRCommPkgGetPersistentCommHandle(1, comm_pkg); + v_buf_data = (HYPRE_Real *) hypre_ParCSRCommHandleSendDataBuffer(persistent_comm_handle); + Vext_data = (HYPRE_Real *) hypre_ParCSRCommHandleRecvDataBuffer(persistent_comm_handle); +#else + v_buf_data = hypre_CTAlloc(HYPRE_Real, + hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + + Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); +#endif + + if (num_cols_offd) + { + A_offd_j = hypre_CSRMatrixJ(A_offd); + A_offd_data = hypre_CSRMatrixData(A_offd); } - } - } - } - else - { + + HYPRE_Int begin = hypre_ParCSRCommPkgSendMapStart(comm_pkg, 0); + HYPRE_Int end = hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends); #ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#pragma omp parallel for HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - { - Vtemp_data[i] = u_data[i]; + for (i = begin; i < end; i++) + { + v_buf_data[i - begin] + = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,i)]; + } + +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_PACK_UNPACK] += hypre_MPI_Wtime(); + hypre_profile_times[HYPRE_TIMER_ID_HALO_EXCHANGE] -= hypre_MPI_Wtime(); +#endif + +#ifdef HYPRE_USING_PERSISTENT_COMM + hypre_ParCSRPersistentCommHandleStart(persistent_comm_handle, HYPRE_MEMORY_HOST, v_buf_data); +#else + comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg, v_buf_data, Vext_data); +#endif + + /*----------------------------------------------------------------- + * Copy current approximation into temporary vector. + *-----------------------------------------------------------------*/ +#ifdef HYPRE_USING_PERSISTENT_COMM + hypre_ParCSRPersistentCommHandleWait(persistent_comm_handle, HYPRE_MEMORY_HOST, Vext_data); +#else + hypre_ParCSRCommHandleDestroy(comm_handle); +#endif + comm_handle = NULL; + +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_HALO_EXCHANGE] += hypre_MPI_Wtime(); +#endif + } + + // Check for ordering of matrix. If stored, get pointer, otherwise + // compute ordering and point matrix variable to array. + HYPRE_Int *proc_ordering; + if (!hypre_ParCSRMatrixProcOrdering(A)) { + proc_ordering = hypre_CTAlloc(HYPRE_Int, n, HYPRE_MEMORY_HOST); + hypre_topo_sort(A_diag_i, A_diag_j, A_diag_data, proc_ordering, n); + hypre_ParCSRMatrixProcOrdering(A) = proc_ordering; + } + else { + proc_ordering = hypre_ParCSRMatrixProcOrdering(A); } - prod = (1.0-relax_weight*omega); + + /*----------------------------------------------------------------- + * Relax all points. + *-----------------------------------------------------------------*/ +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_RELAX] -= hypre_MPI_Wtime(); +#endif + if (relax_points == 0) { - if (num_threads > 1) - { - tmp_data = Ztemp_data; + if (num_threads > 1) + { + tmp_data = Ztemp_data; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE #endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( l1_norms[i] != zero) + for (j = 0; j < num_threads; j++) { - res0 = 0.0; - res2 = 0.0; - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; + ns = j*size+j; + ne = (j+1)*size+j+1; } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + else { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* interior points first */ + { + HYPRE_Int row = proc_ordering[i]; + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point row; otherwise, skip it. + *-----------------------------------------------------------*/ + if ( A_diag_data[A_diag_i[row]] != zero) + { + res = f_data[row]; + for (jj = A_diag_i[row]+1; jj < A_diag_i[row+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + res -= A_diag_data[jj] * u_data[ii]; + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[row]; jj < A_offd_i[row+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[row] = res / A_diag_data[A_diag_i[row]]; + } } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / l1_norms[i]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / l1_norms[i];*/ } } - } - - } - else - { - for (i = 0; i < n; i++) /* interior points first */ + else { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( l1_norms[i] != zero) + for (i = 0; i < n; i++) /* interior points first */ { - res0 = 0.0; - res = f_data[i]; - res2 = 0.0; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + HYPRE_Int row = proc_ordering[i]; + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + if ( A_diag_data[A_diag_i[row]] != zero) { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + res = f_data[row]; + for (jj = A_diag_i[row]+1; jj < A_diag_i[row+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[row]; jj < A_offd_i[row+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[row] = res / A_diag_data[A_diag_i[row]]; } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / l1_norms[i]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / l1_norms[i];*/ } } - } } /*----------------------------------------------------------------- * Relax only C or F points as determined by relax_points. *-----------------------------------------------------------------*/ - else { - if (num_threads > 1) - { - tmp_data = Ztemp_data; + if (num_threads > 1) + { + tmp_data = Ztemp_data; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE #endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ns; i < ne; i++) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && l1_norms[i] != zero) + for (j = 0; j < num_threads; j++) { - res0 = 0.0; - res2 = 0.0; - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) - { - res2 += A_diag_data[jj] * Vtemp_data[ii]; - res0 -= A_diag_data[jj] * u_data[ii]; - } - else - res -= A_diag_data[jj] * tmp_data[ii]; + ns = j*size+j; + ne = (j+1)*size+j+1; } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + else { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* relax interior points */ + { + HYPRE_Int row = proc_ordering[i]; + /*----------------------------------------------------------- + * If row is of the right type ( C or F ) and diagonal is + * nonzero, relax point row; otherwise, skip it. + *-----------------------------------------------------------*/ + if (cf_marker[row] == relax_points + && A_diag_data[A_diag_i[row]] != zero) + { + res = f_data[row]; + for (jj = A_diag_i[row]+1; jj < A_diag_i[row+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + res -= A_diag_data[jj] * u_data[ii]; + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[row]; jj < A_offd_i[row+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[row] = res / A_diag_data[A_diag_i[row]]; + } } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / l1_norms[i]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / l1_norms[i];*/ } } - } - - } - else - { - for (i = 0; i < n; i++) /* relax interior points */ + else { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && l1_norms[i] != zero) + for (i = 0; i < n; i++) /* relax interior points */ { - res = f_data[i]; - res0 = 0.0; - res2 = 0.0; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) - { - ii = A_diag_j[jj]; - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + HYPRE_Int row = proc_ordering[i]; + /*----------------------------------------------------------- + * If row is of the right type ( C or F ) and diagonal is + * nonzero, relax point row; otherwise, skip it. + *-----------------------------------------------------------*/ + if (cf_marker[row] == relax_points + && A_diag_data[A_diag_i[row]] != zero) { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + res = f_data[row]; + for (jj = A_diag_i[row]+1; jj < A_diag_i[row+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[row]; jj < A_offd_i[row+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[row] = res / A_diag_data[A_diag_i[row]]; } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / l1_norms[i]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / l1_norms[i];*/ } } - } } - } - if (num_procs > 1) - { - hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); - hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); - } + +#ifndef HYPRE_USING_PERSISTENT_COMM + if (num_procs > 1) + { + hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); + hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); + } +#endif +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_RELAX] += hypre_MPI_Wtime(); +#endif } break; - case 14: /* hybrid L1 Gauss-Seidel backward solve */ + case 13: /* hybrid L1 Gauss-Seidel forward solve */ { - if (num_threads > 1) { Ztemp_local = hypre_ParVectorLocalVector(Ztemp); @@ -3558,451 +3347,912 @@ /*----------------------------------------------------------------- * Copy current approximation into temporary vector. *-----------------------------------------------------------------*/ - if (num_procs > 1) - { - num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + if (num_procs > 1) + { + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + + v_buf_data = hypre_CTAlloc(HYPRE_Real, + hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); - v_buf_data = hypre_CTAlloc(HYPRE_Real, - hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); - Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); + if (num_cols_offd) + { + A_offd_j = hypre_CSRMatrixJ(A_offd); + A_offd_data = hypre_CSRMatrixData(A_offd); + } - if (num_cols_offd) - { - A_offd_j = hypre_CSRMatrixJ(A_offd); - A_offd_data = hypre_CSRMatrixData(A_offd); - } + index = 0; + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg,i+1); j++) + v_buf_data[index++] + = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } - index = 0; - for (i = 0; i < num_sends; i++) - { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg,i+1); j++) - v_buf_data[index++] - = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; - } + comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg, v_buf_data, Vext_data); - comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg, v_buf_data, - Vext_data); + /*----------------------------------------------------------------- + * Copy current approximation into temporary vector. + *-----------------------------------------------------------------*/ + hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = NULL; + } /*----------------------------------------------------------------- - * Copy current approximation into temporary vector. + * Relax all points. *-----------------------------------------------------------------*/ - hypre_ParCSRCommHandleDestroy(comm_handle); - comm_handle = NULL; - } - - /*----------------------------------------------------------------- - * Relax all points. - *-----------------------------------------------------------------*/ - if (relax_weight == 1 && omega == 1) - { - if (relax_points == 0) + if (relax_weight == 1 && omega == 1) { - if (num_threads > 1) - { - tmp_data = Ztemp_data; + if (relax_points == 0) + { + if (num_threads > 1) + { + tmp_data = Ztemp_data; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; + for (i = 0; i < n; i++) + { + tmp_data[i] = u_data[i]; + } #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE #endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ne-1; i > ns-1; i--) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( l1_norms[i] != zero) - { - res = f_data[i]; - for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + for (j = 0; j < num_threads; j++) { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) { - res -= A_diag_data[jj] * u_data[ii]; + ns = j*size+j; + ne = (j+1)*size+j+1; } else - res -= A_diag_data[jj] * tmp_data[ii]; + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* interior points first */ + { + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( l1_norms[i] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res -= A_diag_data[jj] * u_data[ii]; + } + else + { + res -= A_diag_data[jj] * tmp_data[ii]; + } + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] += res / l1_norms[i]; + } + } } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + } + else + { + for (i = 0; i < n; i++) /* interior points first */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( l1_norms[i] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] += res / l1_norms[i]; + } } - u_data[i] += res / l1_norms[i]; } } - } - } - else - { - for (i = n-1; i > -1; i--) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ + /*----------------------------------------------------------------- + * Relax only C or F points as determined by relax_points. + *-----------------------------------------------------------------*/ - if ( l1_norms[i] != zero) + else + { + if (num_threads > 1) { - res = f_data[i]; - for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + tmp_data = Ztemp_data; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE +#endif + for (j = 0; j < num_threads; j++) { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* relax interior points */ + { + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && l1_norms[i] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res -= A_diag_data[jj] * u_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] += res / l1_norms[i]; + } + } } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + + } + else + { + for (i = 0; i < n; i++) /* relax interior points */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && l1_norms[i] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] += res / l1_norms[i]; + } } - u_data[i] += res / l1_norms[i]; } } - } } - - /*----------------------------------------------------------------- - * Relax only C or F points as determined by relax_points. - *-----------------------------------------------------------------*/ - else { - if (num_threads > 1) - { - tmp_data = Ztemp_data; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE -#endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else + for (i = 0; i < n; i++) { - ns = j*size+rest; - ne = (j+1)*size+rest; + Vtemp_data[i] = u_data[i]; } - for (i = ne-1; i > ns-1; i--) /* relax interior points */ + prod = (1.0-relax_weight*omega); + if (relax_points == 0) { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && l1_norms[i] != zero) + if (num_threads > 1) { - res = f_data[i]; - for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + tmp_data = Ztemp_data; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE +#endif + for (j = 0; j < num_threads; j++) { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) { - res -= A_diag_data[jj] * u_data[ii]; + ns = j*size+j; + ne = (j+1)*size+j+1; } else - res -= A_diag_data[jj] * tmp_data[ii]; + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* interior points first */ + { + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( l1_norms[i] != zero) + { + res0 = 0.0; + res2 = 0.0; + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / l1_norms[i]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / l1_norms[i];*/ + } + } } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + + } + else + { + for (i = 0; i < n; i++) /* interior points first */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( l1_norms[i] != zero) + { + res0 = 0.0; + res = f_data[i]; + res2 = 0.0; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / l1_norms[i]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / l1_norms[i];*/ + } } - u_data[i] += res / l1_norms[i]; } } - } - - } - else - { - for (i = n-1; i > -1; i--) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ + /*----------------------------------------------------------------- + * Relax only C or F points as determined by relax_points. + *-----------------------------------------------------------------*/ - if (cf_marker[i] == relax_points - && l1_norms[i] != zero) + else + { + if (num_threads > 1) { - res = f_data[i]; - for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + tmp_data = Ztemp_data; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE +#endif + for (j = 0; j < num_threads; j++) { - ii = A_diag_j[jj]; - res -= A_diag_data[jj] * u_data[ii]; + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ns; i < ne; i++) /* relax interior points */ + { + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && l1_norms[i] != zero) + { + res0 = 0.0; + res2 = 0.0; + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res2 += A_diag_data[jj] * Vtemp_data[ii]; + res0 -= A_diag_data[jj] * u_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / l1_norms[i]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / l1_norms[i];*/ + } + } } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + + } + else + { + for (i = 0; i < n; i++) /* relax interior points */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && l1_norms[i] != zero) + { + res = f_data[i]; + res0 = 0.0; + res2 = 0.0; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / l1_norms[i]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / l1_norms[i];*/ + } } - u_data[i] += res / l1_norms[i]; } } - } } - } - else - { -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < n; i++) + if (num_procs > 1) { - Vtemp_data[i] = u_data[i]; + hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); + hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); } - prod = (1.0-relax_weight*omega); - if (relax_points == 0) + } + break; + + case 14: /* hybrid L1 Gauss-Seidel backward solve */ + { + + if (num_threads > 1) + { + Ztemp_local = hypre_ParVectorLocalVector(Ztemp); + Ztemp_data = hypre_VectorData(Ztemp_local); + } + + /*----------------------------------------------------------------- + * Copy current approximation into temporary vector. + *-----------------------------------------------------------------*/ + if (num_procs > 1) + { + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + + v_buf_data = hypre_CTAlloc(HYPRE_Real, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + + Vext_data = hypre_CTAlloc(HYPRE_Real, num_cols_offd, HYPRE_MEMORY_HOST); + + if (num_cols_offd) + { + A_offd_j = hypre_CSRMatrixJ(A_offd); + A_offd_data = hypre_CSRMatrixData(A_offd); + } + + index = 0; + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg,i+1); j++) + { + v_buf_data[index++] = u_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } + } + + comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg, v_buf_data, Vext_data); + + /*----------------------------------------------------------------- + * Copy current approximation into temporary vector. + *-----------------------------------------------------------------*/ + hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = NULL; + } + + /*----------------------------------------------------------------- + * Relax all points. + *-----------------------------------------------------------------*/ + + if (relax_weight == 1 && omega == 1) { - if (num_threads > 1) - { - tmp_data = Ztemp_data; + if (relax_points == 0) + { + if (num_threads > 1) + { + tmp_data = Ztemp_data; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE #endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else - { - ns = j*size+rest; - ne = (j+1)*size+rest; - } - for (i = ne-1; i > ns-1; i--) /* interior points first */ - { - - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if ( l1_norms[i] != zero) - { - res0 = 0.0; - res2 = 0.0; - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + for (j = 0; j < num_threads; j++) { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) { - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; + ns = j*size+j; + ne = (j+1)*size+j+1; } else - res -= A_diag_data[jj] * tmp_data[ii]; + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ne-1; i > ns-1; i--) /* interior points first */ + { + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( l1_norms[i] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res -= A_diag_data[jj] * u_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] += res / l1_norms[i]; + } + } } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + + } + else + { + for (i = n-1; i > -1; i--) /* interior points first */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( l1_norms[i] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] += res / l1_norms[i]; + } } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / l1_norms[i]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / l1_norms[i];*/ } } - } - - } - else - { - for (i = n-1; i > -1; i--) /* interior points first */ - { - /*----------------------------------------------------------- - * If diagonal is nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ + /*----------------------------------------------------------------- + * Relax only C or F points as determined by relax_points. + *-----------------------------------------------------------------*/ - if ( l1_norms[i] != zero) + else + { + if (num_threads > 1) { - res0 = 0.0; - res = f_data[i]; - res2 = 0.0; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + tmp_data = Ztemp_data; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE +#endif + for (j = 0; j < num_threads; j++) { - ii = A_diag_j[jj]; - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ne-1; i > ns-1; i--) /* relax interior points */ + { + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && l1_norms[i] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res -= A_diag_data[jj] * u_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] += res / l1_norms[i]; + } + } } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + + } + else + { + for (i = n-1; i > -1; i--) /* relax interior points */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && l1_norms[i] != zero) + { + res = f_data[i]; + for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res -= A_diag_data[jj] * u_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] += res / l1_norms[i]; + } } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / l1_norms[i]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / l1_norms[i];*/ } } - } } - - /*----------------------------------------------------------------- - * Relax only C or F points as determined by relax_points. - *-----------------------------------------------------------------*/ - else { - if (num_threads > 1) - { - tmp_data = Ztemp_data; #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif - for (i = 0; i < n; i++) - tmp_data[i] = u_data[i]; -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE -#endif - for (j = 0; j < num_threads; j++) - { - size = n/num_threads; - rest = n - size*num_threads; - if (j < rest) - { - ns = j*size+j; - ne = (j+1)*size+j+1; - } - else + for (i = 0; i < n; i++) { - ns = j*size+rest; - ne = (j+1)*size+rest; + Vtemp_data[i] = u_data[i]; } - for (i = ne-1; i > ns-1; i--) /* relax interior points */ + prod = (1.0-relax_weight*omega); + if (relax_points == 0) { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ - - if (cf_marker[i] == relax_points - && l1_norms[i] != zero) + if (num_threads > 1) { - res0 = 0.0; - res2 = 0.0; - res = f_data[i]; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + tmp_data = Ztemp_data; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE +#endif + for (j = 0; j < num_threads; j++) { - ii = A_diag_j[jj]; - if (ii >= ns && ii < ne) + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) { - res2 += A_diag_data[jj] * Vtemp_data[ii]; - res0 -= A_diag_data[jj] * u_data[ii]; + ns = j*size+j; + ne = (j+1)*size+j+1; } else - res -= A_diag_data[jj] * tmp_data[ii]; + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ne-1; i > ns-1; i--) /* interior points first */ + { + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( l1_norms[i] != zero) + { + res0 = 0.0; + res2 = 0.0; + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / l1_norms[i]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / l1_norms[i];*/ + } + } } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + + } + else + { + for (i = n-1; i > -1; i--) /* interior points first */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If diagonal is nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if ( l1_norms[i] != zero) + { + res0 = 0.0; + res = f_data[i]; + res2 = 0.0; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / l1_norms[i]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / l1_norms[i];*/ + } } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / l1_norms[i]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / l1_norms[i];*/ } } - } - } - else - { - for (i = n-1; i > -1; i--) /* relax interior points */ - { - - /*----------------------------------------------------------- - * If i is of the right type ( C or F ) and diagonal is - - * nonzero, relax point i; otherwise, skip it. - *-----------------------------------------------------------*/ + /*----------------------------------------------------------------- + * Relax only C or F points as determined by relax_points. + *-----------------------------------------------------------------*/ - if (cf_marker[i] == relax_points - && l1_norms[i] != zero) + else + { + if (num_threads > 1) { - res = f_data[i]; - res0 = 0.0; - res2 = 0.0; - for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + tmp_data = Ztemp_data; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < n; i++) + tmp_data[i] = u_data[i]; +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i,ii,j,jj,ns,ne,res,rest,size) HYPRE_SMP_SCHEDULE +#endif + for (j = 0; j < num_threads; j++) { - ii = A_diag_j[jj]; - res0 -= A_diag_data[jj] * u_data[ii]; - res2 += A_diag_data[jj] * Vtemp_data[ii]; + size = n/num_threads; + rest = n - size*num_threads; + if (j < rest) + { + ns = j*size+j; + ne = (j+1)*size+j+1; + } + else + { + ns = j*size+rest; + ne = (j+1)*size+rest; + } + for (i = ne-1; i > ns-1; i--) /* relax interior points */ + { + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && l1_norms[i] != zero) + { + res0 = 0.0; + res2 = 0.0; + res = f_data[i]; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + if (ii >= ns && ii < ne) + { + res2 += A_diag_data[jj] * Vtemp_data[ii]; + res0 -= A_diag_data[jj] * u_data[ii]; + } + else + res -= A_diag_data[jj] * tmp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / l1_norms[i]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / l1_norms[i];*/ + } + } } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + + } + else + { + for (i = n-1; i > -1; i--) /* relax interior points */ { - ii = A_offd_j[jj]; - res -= A_offd_data[jj] * Vext_data[ii]; + + /*----------------------------------------------------------- + * If i is of the right type ( C or F ) and diagonal is + + * nonzero, relax point i; otherwise, skip it. + *-----------------------------------------------------------*/ + + if (cf_marker[i] == relax_points + && l1_norms[i] != zero) + { + res = f_data[i]; + res0 = 0.0; + res2 = 0.0; + for (jj = A_diag_i[i]+1; jj < A_diag_i[i+1]; jj++) + { + ii = A_diag_j[jj]; + res0 -= A_diag_data[jj] * u_data[ii]; + res2 += A_diag_data[jj] * Vtemp_data[ii]; + } + for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) + { + ii = A_offd_j[jj]; + res -= A_offd_data[jj] * Vext_data[ii]; + } + u_data[i] *= prod; + u_data[i] += relax_weight*(omega*res + res0 + + one_minus_omega*res2) / l1_norms[i]; + /*u_data[i] += omega*(relax_weight*res + res0 + + one_minus_weight*res2) / l1_norms[i];*/ + } } - u_data[i] *= prod; - u_data[i] += relax_weight*(omega*res + res0 + - one_minus_omega*res2) / l1_norms[i]; - /*u_data[i] += omega*(relax_weight*res + res0 + - one_minus_weight*res2) / l1_norms[i];*/ } } - } } - } - if (num_procs > 1) - { - hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); - hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); - } + if (num_procs > 1) + { + hypre_TFree(Vext_data, HYPRE_MEMORY_HOST); + hypre_TFree(v_buf_data, HYPRE_MEMORY_HOST); + } } break; @@ -4017,22 +4267,20 @@ /* all processors are needed for these routines */ A_CSR = hypre_ParCSRMatrixToCSRMatrixAll(A); f_vector = hypre_ParVectorToVectorAll(f); - if (n) - { - -#else - if (n) - { - A_CSR = hypre_ParCSRMatrixToCSRMatrixAll(A); - f_vector = hypre_ParVectorToVectorAll(f); -#endif - A_CSR_i = hypre_CSRMatrixI(A_CSR); - A_CSR_j = hypre_CSRMatrixJ(A_CSR); - A_CSR_data = hypre_CSRMatrixData(A_CSR); - f_vector_data = hypre_VectorData(f_vector); +#endif + if (n) + { +#ifndef HYPRE_NO_GLOBAL_PARTITION + A_CSR = hypre_ParCSRMatrixToCSRMatrixAll(A); + f_vector = hypre_ParVectorToVectorAll(f); +#endif + A_CSR_i = hypre_CSRMatrixI(A_CSR); + A_CSR_j = hypre_CSRMatrixJ(A_CSR); + A_CSR_data = hypre_CSRMatrixData(A_CSR); + f_vector_data = hypre_VectorData(f_vector); - A_mat = hypre_CTAlloc(HYPRE_Real, n_global*n_global, HYPRE_MEMORY_HOST); - b_vec = hypre_CTAlloc(HYPRE_Real, n_global, HYPRE_MEMORY_HOST); + A_mat = hypre_CTAlloc(HYPRE_Real, n_global*n_global, HYPRE_MEMORY_HOST); + b_vec = hypre_CTAlloc(HYPRE_Real, n_global, HYPRE_MEMORY_HOST); /*--------------------------------------------------------------- * Load CSR matrix into A_mat. @@ -4055,18 +4303,17 @@ u_data[i] = b_vec[first_index+i]; } - hypre_TFree(A_mat, HYPRE_MEMORY_HOST); + hypre_TFree(A_mat, HYPRE_MEMORY_HOST); hypre_TFree(b_vec, HYPRE_MEMORY_HOST); hypre_CSRMatrixDestroy(A_CSR); A_CSR = NULL; hypre_SeqVectorDestroy(f_vector); f_vector = NULL; - } #ifdef HYPRE_NO_GLOBAL_PARTITION else { - + hypre_CSRMatrixDestroy(A_CSR); A_CSR = NULL; hypre_SeqVectorDestroy(f_vector); @@ -4075,7 +4322,7 @@ #endif } - break; + break; case 98: /* Direct solve: use gaussian elimination & BLAS (with pivoting) */ { @@ -4091,22 +4338,20 @@ /* all processors are needed for these routines */ A_CSR = hypre_ParCSRMatrixToCSRMatrixAll(A); f_vector = hypre_ParVectorToVectorAll(f); - if (n) - { - -#else - if (n) - { - A_CSR = hypre_ParCSRMatrixToCSRMatrixAll(A); - f_vector = hypre_ParVectorToVectorAll(f); -#endif - A_CSR_i = hypre_CSRMatrixI(A_CSR); - A_CSR_j = hypre_CSRMatrixJ(A_CSR); - A_CSR_data = hypre_CSRMatrixData(A_CSR); - f_vector_data = hypre_VectorData(f_vector); +#endif + if (n) + { +#ifndef HYPRE_NO_GLOBAL_PARTITION + A_CSR = hypre_ParCSRMatrixToCSRMatrixAll(A); + f_vector = hypre_ParVectorToVectorAll(f); +#endif + A_CSR_i = hypre_CSRMatrixI(A_CSR); + A_CSR_j = hypre_CSRMatrixJ(A_CSR); + A_CSR_data = hypre_CSRMatrixData(A_CSR); + f_vector_data = hypre_VectorData(f_vector); A_mat = hypre_CTAlloc(HYPRE_Real, n_global*n_global, HYPRE_MEMORY_HOST); - b_vec = hypre_CTAlloc(HYPRE_Real, n_global, HYPRE_MEMORY_HOST); + b_vec = hypre_CTAlloc(HYPRE_Real, n_global, HYPRE_MEMORY_HOST); /*--------------------------------------------------------------- * Load CSR matrix into A_mat. @@ -4116,7 +4361,7 @@ { for (jj = A_CSR_i[i]; jj < A_CSR_i[i+1]; jj++) { - + /* need col major */ column = A_CSR_j[jj]; A_mat[i + n_global*column] = A_CSR_data[jj]; @@ -4128,7 +4373,7 @@ /* write over A with LU */ hypre_dgetrf(&n_global, &n_global, A_mat, &n_global, piv, &info); - + /*now b_vec = inv(A)*b_vec */ hypre_dgetrs("N", &n_global, &one_i, A_mat, &n_global, piv, b_vec, &n_global, &info); @@ -4139,270 +4384,27 @@ u_data[i] = b_vec[first_index+i]; } - hypre_TFree(A_mat, HYPRE_MEMORY_HOST); + hypre_TFree(A_mat, HYPRE_MEMORY_HOST); hypre_TFree(b_vec, HYPRE_MEMORY_HOST); hypre_CSRMatrixDestroy(A_CSR); A_CSR = NULL; hypre_SeqVectorDestroy(f_vector); f_vector = NULL; - } #ifdef HYPRE_NO_GLOBAL_PARTITION else { - + hypre_CSRMatrixDestroy(A_CSR); A_CSR = NULL; hypre_SeqVectorDestroy(f_vector); f_vector = NULL; } #endif - - } - break; - } - - return(relax_error); -} - -/*------------------------------------------------------------------------- - * - * Gaussian Elimination - * - *------------------------------------------------------------------------ */ - -HYPRE_Int hypre_GaussElimSetup (hypre_ParAMGData *amg_data, HYPRE_Int level, HYPRE_Int relax_type) -{ -#ifdef HYPRE_PROFILE - hypre_profile_times[HYPRE_TIMER_ID_GS_ELIM_SETUP] -= hypre_MPI_Wtime(); -#endif - - /* Par Data Structure variables */ - hypre_ParCSRMatrix *A = hypre_ParAMGDataAArray(amg_data)[level]; - hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); - HYPRE_Int num_rows = hypre_CSRMatrixNumRows(A_diag); - HYPRE_Int global_num_rows = (HYPRE_Int) hypre_ParCSRMatrixGlobalNumRows(A); - MPI_Comm comm = hypre_ParCSRMatrixComm(A); - MPI_Comm new_comm; - - /* Generate sub communicator */ - hypre_GenerateSubComm(comm, num_rows, &new_comm); - - if (num_rows) - { - hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); - HYPRE_BigInt *col_map_offd = hypre_ParCSRMatrixColMapOffd(A); - HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); - HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); - HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); - HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); - HYPRE_Real *A_diag_data = hypre_CSRMatrixData(A_diag); - HYPRE_Real *A_offd_data = hypre_CSRMatrixData(A_offd); - HYPRE_Real *A_mat, *A_mat_local; - HYPRE_Int *comm_info, *info, *displs; - HYPRE_Int *mat_info, *mat_displs; - HYPRE_Int new_num_procs, A_mat_local_size, i, jj, column; - HYPRE_BigInt first_row_index = hypre_ParCSRMatrixFirstRowIndex(A); - - hypre_MPI_Comm_size(new_comm, &new_num_procs); - comm_info = hypre_CTAlloc(HYPRE_Int, 2*new_num_procs+1, HYPRE_MEMORY_HOST); - mat_info = hypre_CTAlloc(HYPRE_Int, new_num_procs, HYPRE_MEMORY_HOST); - mat_displs = hypre_CTAlloc(HYPRE_Int, new_num_procs+1, HYPRE_MEMORY_HOST); - info = &comm_info[0]; - displs = &comm_info[new_num_procs]; - hypre_MPI_Allgather(&num_rows, 1, HYPRE_MPI_INT, info, 1, HYPRE_MPI_INT, new_comm); - displs[0] = 0; - mat_displs[0] = 0; - for (i=0; i < new_num_procs; i++) - { - displs[i+1] = displs[i]+info[i]; - mat_displs[i+1] = global_num_rows*displs[i+1]; - mat_info[i] = global_num_rows*info[i]; - } - hypre_ParAMGDataBVec(amg_data) = hypre_CTAlloc(HYPRE_Real, global_num_rows, HYPRE_MEMORY_HOST); - A_mat_local_size = global_num_rows*num_rows; - A_mat_local = hypre_CTAlloc(HYPRE_Real, A_mat_local_size, HYPRE_MEMORY_HOST); - A_mat = hypre_CTAlloc(HYPRE_Real, global_num_rows*global_num_rows, HYPRE_MEMORY_HOST); - /* load local matrix into A_mat_local */ - for (i = 0; i < num_rows; i++) - { - for (jj = A_diag_i[i]; jj < A_diag_i[i+1]; jj++) - { - /* need col major */ - column = A_diag_j[jj]+first_row_index; - A_mat_local[i*global_num_rows + column] = A_diag_data[jj]; - } - for (jj = A_offd_i[i]; jj < A_offd_i[i+1]; jj++) - { - /* need col major */ - column = col_map_offd[A_offd_j[jj]]; - A_mat_local[i*global_num_rows + column] = A_offd_data[jj]; - } - } - hypre_MPI_Allgatherv( A_mat_local, A_mat_local_size, HYPRE_MPI_REAL, A_mat, - mat_info, mat_displs, HYPRE_MPI_REAL, new_comm); - if (relax_type == 99) - { - HYPRE_Real *AT_mat; - AT_mat = hypre_CTAlloc(HYPRE_Real, global_num_rows*global_num_rows, HYPRE_MEMORY_HOST); - for (i=0; i < global_num_rows; i++) - for (jj=0; jj < global_num_rows; jj++) - AT_mat[i*global_num_rows + jj] = A_mat[i+ jj*global_num_rows]; - hypre_ParAMGDataAMat(amg_data) = AT_mat; - hypre_TFree(A_mat, HYPRE_MEMORY_HOST); - } - else - hypre_ParAMGDataAMat(amg_data) = A_mat; - hypre_ParAMGDataCommInfo(amg_data) = comm_info; - hypre_ParAMGDataNewComm(amg_data) = new_comm; - hypre_TFree(mat_info, HYPRE_MEMORY_HOST); - hypre_TFree(mat_displs, HYPRE_MEMORY_HOST); - hypre_TFree(A_mat_local, HYPRE_MEMORY_HOST); - } - -#ifdef HYPRE_PROFILE - hypre_profile_times[HYPRE_TIMER_ID_GS_ELIM_SETUP] += hypre_MPI_Wtime(); -#endif - - return hypre_error_flag; -} - - -HYPRE_Int hypre_GaussElimSolve (hypre_ParAMGData *amg_data, HYPRE_Int level, HYPRE_Int relax_type) -{ -#ifdef HYPRE_PROFILE - hypre_profile_times[HYPRE_TIMER_ID_GS_ELIM_SOLVE] -= hypre_MPI_Wtime(); -#endif - - hypre_ParCSRMatrix *A = hypre_ParAMGDataAArray(amg_data)[level]; - HYPRE_Int n = hypre_CSRMatrixNumRows(hypre_ParCSRMatrixDiag(A)); - HYPRE_Int error_flag = 0; - - if (n) - { - MPI_Comm new_comm = hypre_ParAMGDataNewComm(amg_data); - hypre_ParVector *f = hypre_ParAMGDataFArray(amg_data)[level]; - hypre_ParVector *u = hypre_ParAMGDataUArray(amg_data)[level]; - HYPRE_Real *A_mat = hypre_ParAMGDataAMat(amg_data); - HYPRE_Real *b_vec = hypre_ParAMGDataBVec(amg_data); - HYPRE_Real *f_data = hypre_VectorData(hypre_ParVectorLocalVector(f)); - HYPRE_Real *u_data = hypre_VectorData(hypre_ParVectorLocalVector(u)); - HYPRE_Real *A_tmp; - HYPRE_Int *comm_info = hypre_ParAMGDataCommInfo(amg_data); - HYPRE_Int *displs, *info; - HYPRE_Int n_global = (HYPRE_Int) hypre_ParCSRMatrixGlobalNumRows(A); - HYPRE_Int new_num_procs, i, my_info; - HYPRE_Int first_index = (HYPRE_Int) hypre_ParCSRMatrixFirstRowIndex(A); - HYPRE_Int one_i = 1; - - hypre_MPI_Comm_size(new_comm, &new_num_procs); - info = &comm_info[0]; - displs = &comm_info[new_num_procs]; - hypre_MPI_Allgatherv ( f_data, n, HYPRE_MPI_REAL, - b_vec, info, displs, - HYPRE_MPI_REAL, new_comm ); - - A_tmp = hypre_CTAlloc(HYPRE_Real, n_global*n_global, HYPRE_MEMORY_HOST); - for (i=0; i < n_global*n_global; i++) - A_tmp[i] = A_mat[i]; - - if (relax_type == 9) - { - hypre_gselim(A_tmp,b_vec,n_global,error_flag); - } - else if (relax_type == 99) /* use pivoting */ - { - HYPRE_Int *piv; - piv = hypre_CTAlloc(HYPRE_Int, n_global, HYPRE_MEMORY_HOST); - - /* write over A with LU */ - hypre_dgetrf(&n_global, &n_global, A_tmp, &n_global, piv, &my_info); - - /*now b_vec = inv(A)*b_vec */ - hypre_dgetrs("N", &n_global, &one_i, A_tmp, &n_global, piv, b_vec, &n_global, &my_info); - - hypre_TFree(piv, HYPRE_MEMORY_HOST); } - for (i = 0; i < n; i++) - { - u_data[i] = b_vec[first_index+i]; - } - hypre_TFree(A_tmp, HYPRE_MEMORY_HOST); + break; } - if (error_flag) hypre_error(HYPRE_ERROR_GENERIC); - -#ifdef HYPRE_PROFILE - hypre_profile_times[HYPRE_TIMER_ID_GS_ELIM_SOLVE] += hypre_MPI_Wtime(); -#endif - - return hypre_error_flag; -} -#if 0 -HYPRE_Int gselim(HYPRE_Real *A, - HYPRE_Real *x, - HYPRE_Int n) -{ - HYPRE_Int err_flag = 0; - HYPRE_Int j,k,m; - HYPRE_Real factor; - HYPRE_Real divA; - - if (n==1) /* A is 1x1 */ - { - if (A[0] != 0.0) - { - x[0] = x[0]/A[0]; - return(err_flag); - } - else - { - err_flag = 1; - return(err_flag); - } - } - else /* A is nxn. Forward elimination */ - { - for (k = 0; k < n-1; k++) - { - if (A[k*n+k] != 0.0) - { - divA = 1.0/A[k*n+k]; - for (j = k+1; j < n; j++) - { - if (A[j*n+k] != 0.0) - { - factor = A[j*n+k]*divA; - for (m = k+1; m < n; m++) - { - A[j*n+m] -= factor * A[k*n+m]; - } - /* Elimination step for rhs */ - x[j] -= factor * x[k]; - } - } - } - } - /* Back Substitution */ - for (k = n-1; k > 0; --k) - { - if (A[k*n+k] != 0.0) - { - x[k] /= A[k*n+k]; - for (j = 0; j < k; j++) - { - if (A[j*n+k] != 0.0) - { - x[j] -= x[k] * A[j*n+k]; - } - } - } - } - if (A[0] != 0.0) x[0] /= A[0]; - return(err_flag); - } + return (relax_error); } -#endif - - diff -Nru hypre-2.16.0/src/parcsr_ls/par_relax_interface.c hypre-2.18.2/src/parcsr_ls/par_relax_interface.c --- hypre-2.16.0/src/parcsr_ls/par_relax_interface.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_relax_interface.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -22,7 +13,6 @@ #include "_hypre_parcsr_ls.h" - /*-------------------------------------------------------------------------- * hypre_BoomerAMGRelax *--------------------------------------------------------------------------*/ @@ -47,12 +37,12 @@ if (cycle_type < 2) { relax_points[0] = 1; - relax_points[1] = -1; + relax_points[1] = -1; } else { - relax_points[0] = -1; - relax_points[1] = 1; + relax_points[0] = -1; + relax_points[1] = 1; } for (i=0; i < 2; i++) @@ -65,9 +55,9 @@ omega, l1_norms, u, - Vtemp, - Ztemp); - + Vtemp, + Ztemp); + } else { @@ -80,8 +70,8 @@ omega, l1_norms, u, - Vtemp, - Ztemp); + Vtemp, + Ztemp); } return Solve_err_flag; diff -Nru hypre-2.16.0/src/parcsr_ls/par_relax_more.c hypre-2.18.2/src/parcsr_ls/par_relax_more.c --- hypre-2.16.0/src/parcsr_ls/par_relax_more.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_relax_more.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + /****************************************************************************** @@ -658,51 +665,35 @@ hypre_ParVector *u, hypre_ParVector *Vtemp) { - HYPRE_Int i; HYPRE_Int relax_points[3]; HYPRE_Int relax_type = 0; - hypre_ParVector *Ztemp = NULL; - - relax_points[0] = -1; /*F */ relax_points[1] = 1; /*C */ relax_points[2] = -1; /*F */ - /* if we are on the coarsest level ,the cf_marker will be null - and we just do one sweep regular jacobi */ + /* cf == NULL --> size == 0 */ if (cf_marker == NULL) { - hypre_BoomerAMGRelax(A, - f, - cf_marker, - relax_type, - 0, - relax_weight, - 0.0, - NULL, - u, - Vtemp, Ztemp); + hypre_assert(hypre_CSRMatrixNumRows(hypre_ParCSRMatrixDiag(A)) == 0); } - else + + for (i=0; i < 3; i++) { - for (i=0; i < 3; i++) - hypre_BoomerAMGRelax(A, - f, - cf_marker, - relax_type, - relax_points[i], - relax_weight, - 0.0, - NULL, - u, - Vtemp, Ztemp); + hypre_BoomerAMGRelax(A, + f, + cf_marker, + relax_type, + relax_points[i], + relax_weight, + 0.0, + NULL, + u, + Vtemp, NULL); } - return hypre_error_flag; - } /*-------------------------------------------------------------------------- diff -Nru hypre-2.16.0/src/parcsr_ls/par_restr.c hypre-2.18.2/src/parcsr_ls/par_restr.c --- hypre-2.16.0/src/parcsr_ls/par_restr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_restr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,23 +1,20 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" #include "_hypre_blas.h" #include "_hypre_lapack.h" #define AIR_DEBUG 0 +#define EPSILON 1e-18 +#define EPSIMAC 1e-16 + +void hypre_fgmresT(HYPRE_Int n, HYPRE_Complex *A, HYPRE_Complex *b, HYPRE_Real tol, HYPRE_Int kdim, HYPRE_Complex *x, HYPRE_Real *relres, HYPRE_Int *iter, HYPRE_Int job); +void hypre_ordered_GS(const HYPRE_Complex L[], const HYPRE_Complex rhs[], HYPRE_Complex x[], const HYPRE_Int n); HYPRE_Int hypre_BoomerAMGBuildRestrAIR( hypre_ParCSRMatrix *A, @@ -26,23 +23,25 @@ HYPRE_BigInt *num_cpts_global, HYPRE_Int num_functions, HYPRE_Int *dof_func, + HYPRE_Real filter_thresholdR, HYPRE_Int debug_flag, - HYPRE_Real trunc_factor, - HYPRE_Int max_elmts, HYPRE_Int *col_offd_S_to_A, - hypre_ParCSRMatrix **R_ptr) { - + hypre_ParCSRMatrix **R_ptr, + HYPRE_Int is_triangular, + HYPRE_Int gmres_switch) +{ + MPI_Comm comm = hypre_ParCSRMatrixComm(A); hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); hypre_ParCSRCommHandle *comm_handle; /* diag part of A */ hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); - HYPRE_Real *A_diag_data = hypre_CSRMatrixData(A_diag); + HYPRE_Complex *A_diag_data = hypre_CSRMatrixData(A_diag); HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); /* off-diag part of A */ - hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); - HYPRE_Real *A_offd_data = hypre_CSRMatrixData(A_offd); + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + HYPRE_Complex *A_offd_data = hypre_CSRMatrixData(A_offd); HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); @@ -54,7 +53,7 @@ HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); /* off-diag part of S */ - hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); + hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); HYPRE_Int *S_offd_j = hypre_CSRMatrixJ(S_offd); /* Restriction matrix R */ @@ -63,10 +62,10 @@ hypre_CSRMatrix *R_diag; hypre_CSRMatrix *R_offd; /* arrays */ - HYPRE_Real *R_diag_data; + HYPRE_Complex *R_diag_data; HYPRE_Int *R_diag_i; HYPRE_Int *R_diag_j; - HYPRE_Real *R_offd_data; + HYPRE_Complex *R_offd_data; HYPRE_Int *R_offd_i; HYPRE_Int *R_offd_j; HYPRE_BigInt *col_map_offd_R = NULL; @@ -77,20 +76,25 @@ HYPRE_Int *dof_func_offd = NULL; /* ghost rows */ hypre_CSRMatrix *A_ext = NULL; - HYPRE_Real *A_ext_data = NULL; + HYPRE_Complex *A_ext_data = NULL; HYPRE_Int *A_ext_i = NULL; HYPRE_BigInt *A_ext_j = NULL; - - HYPRE_Int i, j, k, i1, k1, k2, rr, cc, ic, index, start, + + HYPRE_Int i, j, k, i1, k1, k2, rr, cc, ic, index, start, local_max_size, local_size, num_cols_offd_R; /* LAPACK */ - HYPRE_Real *DAi, *Dbi; + HYPRE_Complex *DAi, *Dbi, *Dxi; #if AIR_DEBUG - HYPRE_Real *TMPA, *TMPb, *TMPd; + HYPRE_Complex *TMPA, *TMPb, *TMPd; #endif HYPRE_Int *Ipi, lapack_info, ione = 1; char charT = 'T'; + char Aisol_method; + + /* if the size of local system is larger than gmres_switch, use GMRES */ + HYPRE_Int gmresAi_maxit = 50; + HYPRE_Real gmresAi_tol = 1e-3; HYPRE_Int my_id, num_procs; HYPRE_BigInt total_global_cpts/*, my_first_cpt*/; @@ -101,15 +105,11 @@ HYPRE_Int n_fine = hypre_CSRMatrixNumRows(A_diag); HYPRE_Int n_cpts = 0; /* my first column range */ - /* XXX is this also right? - HYPRE_Int col_start = hypre_ParCSRMatrixFirstColDiag(A); - HYPRE_Int col_end = hypre_ParCSRMatrixLastColDiag(A); - */ HYPRE_BigInt col_start = hypre_ParCSRMatrixFirstRowIndex(A); HYPRE_BigInt col_end = col_start + (HYPRE_BigInt)n_fine; /* MPI size and rank*/ - hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_size(comm, &num_procs); hypre_MPI_Comm_rank(comm, &my_id); /*-------------- global number of C points and my start position */ @@ -142,14 +142,14 @@ if (!comm_pkg) { hypre_MatvecCommPkgCreate(A); - comm_pkg = hypre_ParCSRMatrixCommPkg(A); + comm_pkg = hypre_ParCSRMatrixCommPkg(A); } /* number of sends to do (number of procs) */ num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - /* send buffer, of size send_map_starts[num_sends]), + /* send buffer, of size send_map_starts[num_sends]), * i.e., number of entries to send */ int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends),HYPRE_MEMORY_HOST); - /* copy CF markers of elements to send to buffer + /* copy CF markers of elements to send to buffer * RL: why copy them with two for loops? Why not just loop through all in one */ index = 0; for (i = 0; i < num_sends; i++) @@ -166,7 +166,7 @@ /* create a handle to start communication. 11: for integer */ comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, int_buf_data, CF_marker_offd); /* destroy the handle to finish communication */ - hypre_ParCSRCommHandleDestroy(comm_handle); + hypre_ParCSRCommHandleDestroy(comm_handle); /* do a similar communication for dof_func */ if (num_functions > 1) { @@ -180,7 +180,7 @@ } } comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, int_buf_data, dof_func_offd); - hypre_ParCSRCommHandleDestroy(comm_handle); + hypre_ParCSRCommHandleDestroy(comm_handle); } /*----------------------------------------------------------------------- @@ -242,13 +242,13 @@ /*------------- allocate arrays */ R_diag_i = hypre_CTAlloc(HYPRE_Int, n_cpts+1,HYPRE_MEMORY_HOST); R_diag_j = hypre_CTAlloc(HYPRE_Int, nnz_diag,HYPRE_MEMORY_HOST); - R_diag_data = hypre_CTAlloc(HYPRE_Real, nnz_diag,HYPRE_MEMORY_HOST); + R_diag_data = hypre_CTAlloc(HYPRE_Complex, nnz_diag,HYPRE_MEMORY_HOST); - /* not in ``if num_procs > 1'', + /* not in ``if num_procs > 1'', * allocation needed even for empty CSR */ R_offd_i = hypre_CTAlloc(HYPRE_Int, n_cpts+1,HYPRE_MEMORY_HOST); R_offd_j = hypre_CTAlloc(HYPRE_Int, nnz_offd,HYPRE_MEMORY_HOST); - R_offd_data = hypre_CTAlloc(HYPRE_Real, nnz_offd,HYPRE_MEMORY_HOST); + R_offd_data = hypre_CTAlloc(HYPRE_Complex, nnz_offd,HYPRE_MEMORY_HOST); /* redundant */ R_diag_i[0] = 0; @@ -257,14 +257,14 @@ /* reset counters */ cnt_diag = 0; cnt_offd = 0; - + /*---------------------------------------- .-. * Get the GHOST rows of A, (o o) boo! * i.e., adjacent rows to this proc | O \ * whose row indices are in A->col_map_offd \ \ *----------------------------------------- `~~~' */ /* external rows of A that are needed for perform A multiplication, - * the last arg means need data + * the last arg means need data * the number of rows is num_cols_A_offd */ if (num_procs > 1) { @@ -275,7 +275,7 @@ } /* marker array: if this point is i's strong F neighbors - * >= 0: yes, and is the local dense id + * >= 0: yes, and is the local dense id * == -1: no */ marker_diag = hypre_CTAlloc(HYPRE_Int, n_fine, HYPRE_MEMORY_HOST); for (i = 0; i < n_fine; i++) @@ -288,20 +288,24 @@ marker_offd[i] = -1; } - /* the local matrix and rhs (dense) - * column-major as always by BLAS/LAPACK */ - /* matrix */ - DAi = hypre_CTAlloc(HYPRE_Real, local_max_size * local_max_size, HYPRE_MEMORY_HOST); - /* rhs */ - Dbi = hypre_CTAlloc(HYPRE_Real, local_max_size, HYPRE_MEMORY_HOST); - /* pivot */ - Ipi = hypre_CTAlloc(HYPRE_Int, local_max_size, HYPRE_MEMORY_HOST); + // Allocate the rhs and dense local matrix in column-major form (for LAPACK) + DAi = hypre_CTAlloc(HYPRE_Complex, local_max_size*local_max_size, HYPRE_MEMORY_HOST); + Dbi = hypre_CTAlloc(HYPRE_Complex, local_max_size, HYPRE_MEMORY_HOST); + Dxi = hypre_CTAlloc(HYPRE_Complex, local_max_size, HYPRE_MEMORY_HOST); + Ipi = hypre_CTAlloc(HYPRE_Int, local_max_size, HYPRE_MEMORY_HOST); // pivot matrix + + // Allocate memory for GMRES if it will be used + HYPRE_Int kdim_max = hypre_min(gmresAi_maxit, local_max_size); + if (gmres_switch < local_max_size) + { + hypre_fgmresT(local_max_size, NULL, NULL, 0.0, kdim_max, NULL, NULL, NULL, -1); + } #if AIR_DEBUG /* FOR DEBUG */ - TMPA = hypre_CTAlloc(HYPRE_Real, local_max_size * local_max_size, HYPRE_MEMORY_HOST); - TMPb = hypre_CTAlloc(HYPRE_Real, local_max_size, HYPRE_MEMORY_HOST); - TMPd = hypre_CTAlloc(HYPRE_Real, local_max_size, HYPRE_MEMORY_HOST); + TMPA = hypre_CTAlloc(HYPRE_Complex, local_max_size * local_max_size, HYPRE_MEMORY_HOST); + TMPb = hypre_CTAlloc(HYPRE_Complex, local_max_size, HYPRE_MEMORY_HOST); + TMPd = hypre_CTAlloc(HYPRE_Complex, local_max_size, HYPRE_MEMORY_HOST); #endif /*----------------------------------------------------------------------- @@ -317,7 +321,7 @@ /* size of Ai, bi */ local_size = 0; - + /* If i is a C-point, build the restriction, from the F-points that * strongly influence i * Access S for the first time, mark the points we want */ @@ -368,18 +372,19 @@ } printf("\n"); - + exit(0); } */ /* Second, copy values to local system: Ai and bi from A */ - /* now we have marked all rows/cols we want. next we extract the entries + /* now we have marked all rows/cols we want. next we extract the entries * we need from these rows and put them in Ai and bi*/ /* clear DAi and bi */ - memset(DAi, 0, local_size * local_size * sizeof(HYPRE_Real)); - memset(Dbi, 0, local_size * sizeof(HYPRE_Real)); + memset(DAi, 0, local_size * local_size * sizeof(HYPRE_Complex)); + memset(Dxi, 0, local_size * sizeof(HYPRE_Complex)); + memset(Dbi, 0, local_size * sizeof(HYPRE_Complex)); /* we will populate Ai, bi row-by-row * rr is the local dense matrix row counter */ @@ -521,44 +526,98 @@ } hypre_assert(rr == local_size); + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * We have Ai and bi built. Solve the linear system by: + * - forward solve for triangular matrix + * - LU factorization (LAPACK) for local_size <= gmres_switch + * - Dense GMRES for local_size > gmres_switch + *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + Aisol_method = local_size <= gmres_switch ? 'L' : 'G'; if (local_size > 0) { - /* we have Ai and bi build - * solve the linear system by LAPACK : LU factorization */ + if (is_triangular) + { + hypre_ordered_GS(DAi, Dbi, Dxi, local_size); #if AIR_DEBUG - memcpy(TMPA, DAi, local_size*local_size*sizeof(HYPRE_Real)); - memcpy(TMPb, Dbi, local_size*sizeof(HYPRE_Real)); + HYPRE_Real alp = -1.0, err; + colmaj_mvT(DAi, Dxi, TMPd, local_size); + hypre_daxpy(&local_size, &alp, Dbi, &ione, TMPd, &ione); + err = hypre_dnrm2(&local_size, TMPd, &ione); + if (err > 1e-8) + { + hypre_printf("triangular solve res: %e\n", err); + exit(0); + } #endif - - hypre_dgetrf(&local_size, &local_size, DAi, &local_size, Ipi, - &lapack_info); - - hypre_assert(lapack_info == 0); - - if (lapack_info == 0) + } + // Solve using LAPACK and LU factorization + else if (Aisol_method == 'L') { - /* solve A_i^T x_i = b_i, - * solution is saved in b_i on return */ - hypre_dgetrs(&charT, &local_size, &ione, DAi, &local_size, - Ipi, Dbi, &local_size, &lapack_info); +#if AIR_DEBUG + memcpy(TMPA, DAi, local_size*local_size*sizeof(HYPRE_Complex)); + memcpy(TMPb, Dbi, local_size*sizeof(HYPRE_Complex)); +#endif + hypre_dgetrf(&local_size, &local_size, DAi, &local_size, Ipi, + &lapack_info); + hypre_assert(lapack_info == 0); - } + if (lapack_info == 0) + { + /* solve A_i^T x_i = b_i, + * solution is saved in b_i on return */ + hypre_dgetrs(&charT, &local_size, &ione, DAi, &local_size, + Ipi, Dbi, &local_size, &lapack_info); + hypre_assert(lapack_info == 0); + } #if AIR_DEBUG - HYPRE_Int one = 1; - HYPRE_Real alp = 1.0, bet = 0.0; - hypre_dgemv(&charT, &local_size, &local_size, &alp, TMPA, &local_size, Dbi, - &one, &bet, TMPd, &one); - alp = -1.0; - hypre_daxpy(&local_size, &alp, TMPb, &one, TMPd, &one); - HYPRE_Real err = hypre_dnrm2(&local_size, TMPd, &one); - if (err > 1e-8) - { - hypre_printf("local res norm %e\n", err); + HYPRE_Real alp = 1.0, bet = 0.0, err; + hypre_dgemv(&charT, &local_size, &local_size, &alp, TMPA, &local_size, Dbi, + &ione, &bet, TMPd, &ione); + alp = -1.0; + hypre_daxpy(&local_size, &alp, TMPb, &ione, TMPd, &ione); + err = hypre_dnrm2(&local_size, TMPd, &ione); + if (err > 1e-8) + { + hypre_printf("dense: local res norm %e\n", err); + exit(0); + } +#endif } + // Solve by GMRES + else + { + HYPRE_Real gmresAi_res; + HYPRE_Int gmresAi_niter; + HYPRE_Int kdim = hypre_min(gmresAi_maxit, local_size); + + hypre_fgmresT(local_size, DAi, Dbi, gmresAi_tol, kdim, Dxi, + &gmresAi_res, &gmresAi_niter, 0); + + if (gmresAi_res > gmresAi_tol) + { + hypre_printf("gmres/jacobi not converge to %e: final_res %e\n", gmresAi_tol, gmresAi_res); + } + +#if AIR_DEBUG + HYPRE_Real err, nrmb; + colmaj_mvT(DAi, Dxi, TMPd, local_size); + HYPRE_Real alp = -1.0; + nrmb = hypre_dnrm2(&local_size, Dbi, &ione); + hypre_daxpy(&local_size, &alp, Dbi, &ione, TMPd, &ione); + err = hypre_dnrm2(&local_size, TMPd, &ione); + if (err/nrmb > gmresAi_tol) + { + hypre_printf("GMRES/Jacobi: res norm %e, nrmb %e, relative %e\n", err, nrmb, err/nrmb); + hypre_printf("GMRES/Jacobi: relative %e\n", gmresAi_res); + exit(0); + } #endif + } } - + + HYPRE_Complex *Soli = (is_triangular || (Aisol_method=='G')) ? Dxi : Dbi; + /* now we are ready to fill this row of R */ /* diag part */ rr = 0; @@ -572,7 +631,7 @@ /* col idx: use i1, local idx */ R_diag_j[cnt_diag] = i1; /* copy the value */ - R_diag_data[cnt_diag++] = Dbi[rr++]; + R_diag_data[cnt_diag++] = Soli[rr++]; } } @@ -580,7 +639,7 @@ /* global col idx of this entry is ``col_start + i''; */ R_diag_j[cnt_diag] = i; R_diag_data[cnt_diag++] = 1.0; - + /* row ptr of the next row */ R_diag_i[ic+1] = cnt_diag; @@ -599,7 +658,7 @@ * and you will see why later (very soon!) */ R_offd_j[cnt_offd] = i1; /* copy the value */ - R_offd_data[cnt_offd++] = Dbi[rr++]; + R_offd_data[cnt_offd++] = Soli[rr++]; } } } @@ -608,7 +667,7 @@ /* we must have copied all entries */ hypre_assert(rr == local_size); - + /* reset markers */ for (j = S_diag_i[i]; j < S_diag_i[i+1]; j++) { @@ -642,7 +701,7 @@ hypre_assert(ic == n_cpts) hypre_assert(cnt_diag == nnz_diag) hypre_assert(cnt_offd == nnz_offd) - + /* num of cols in the offd part of R */ num_cols_offd_R = 0; /* to this point, marker_offd should be all -1 */ @@ -710,12 +769,19 @@ hypre_CSRMatrixJ(R_offd) = R_offd_j; /* R does not own ColStarts, since A does */ hypre_ParCSRMatrixOwnsColStarts(R) = 0; - + hypre_ParCSRMatrixColMapOffd(R) = col_map_offd_R; /* create CommPkg of R */ + hypre_ParCSRMatrixAssumedPartition(R) = hypre_ParCSRMatrixAssumedPartition(A); + hypre_ParCSRMatrixOwnsAssumedPartition(R) = 0; hypre_MatvecCommPkgCreate(R); + /* Filter small entries from R */ + if (filter_thresholdR > 0) { + hypre_ParCSRMatrixDropSmallEntries(R, filter_thresholdR, -1); + } + *R_ptr = R; /* free workspace */ @@ -727,6 +793,7 @@ hypre_TFree(marker_offd, HYPRE_MEMORY_HOST); hypre_TFree(DAi, HYPRE_MEMORY_HOST); hypre_TFree(Dbi, HYPRE_MEMORY_HOST); + hypre_TFree(Dxi, HYPRE_MEMORY_HOST); #if AIR_DEBUG hypre_TFree(TMPA, HYPRE_MEMORY_HOST); hypre_TFree(TMPb, HYPRE_MEMORY_HOST); @@ -738,6 +805,196 @@ hypre_CSRMatrixDestroy(A_ext); } + if (gmres_switch < local_max_size) + { + hypre_fgmresT(0, NULL, NULL, 0.0, 0, NULL, NULL, NULL, -2); + } + return 0; } + +/* Compute matvec A^Tx = y, where A is stored in column major form. */ +// This can also probably be accomplished with BLAS +static inline void colmaj_mvT(HYPRE_Complex *A, HYPRE_Complex *x, HYPRE_Complex *y, HYPRE_Int n) +{ + memset(y, 0, n*sizeof(HYPRE_Complex)); + HYPRE_Int i, j; + for (i = 0; i < n; i++) + { + HYPRE_Int row0 = i*n; + for (j = 0; j < n; j++) + { + y[i] += x[j] * A[row0 + j]; + } + } +} + +// TODO : need to initialize and de-initialize GMRES +void hypre_fgmresT(HYPRE_Int n, + HYPRE_Complex *A, + HYPRE_Complex *b, + HYPRE_Real tol, + HYPRE_Int kdim, + HYPRE_Complex *x, + HYPRE_Real *relres, + HYPRE_Int *iter, + HYPRE_Int job) +{ + + HYPRE_Int one=1, i, j, k; + static HYPRE_Complex *V=NULL, *Z=NULL, *H=NULL, *c=NULL, *s=NULL, *rs=NULL; + HYPRE_Complex *v, *z, *w; + HYPRE_Real t, normr, normr0, tolr; + + if (job == -1) + { + V = hypre_TAlloc(HYPRE_Complex, n*(kdim+1), HYPRE_MEMORY_HOST); + /* Z = hypre_TAlloc(HYPRE_Complex, n*kdim, HYPRE_MEMORY_HOST); */ + /* XXX NO PRECOND */ + Z = V; + H = hypre_TAlloc(HYPRE_Complex, (kdim+1)*kdim, HYPRE_MEMORY_HOST); + c = hypre_TAlloc(HYPRE_Complex, kdim, HYPRE_MEMORY_HOST); + s = hypre_TAlloc(HYPRE_Complex, kdim, HYPRE_MEMORY_HOST); + rs = hypre_TAlloc(HYPRE_Complex, kdim+1, HYPRE_MEMORY_HOST); + return; + } + else if (job == -2) + { + hypre_TFree(V, HYPRE_MEMORY_HOST); + /* hypre_TFree(Z, HYPRE_MEMORY_HOST); */ + Z = NULL; + hypre_TFree(H, HYPRE_MEMORY_HOST); + hypre_TFree(c, HYPRE_MEMORY_HOST); + hypre_TFree(s, HYPRE_MEMORY_HOST); + hypre_TFree(rs, HYPRE_MEMORY_HOST); + return; + } + + /* XXX: x_0 is all ZERO !!! so r0 = b */ + v = V; + memcpy(v, b, n*sizeof(HYPRE_Complex)); + normr0 = sqrt(hypre_ddot(&n, v, &one, v, &one)); + + if (normr0 < EPSIMAC) + { + return; + } + + tolr = tol * normr0; + + rs[0] = normr0; + t = 1.0 / normr0; + hypre_dscal(&n, &t, v, &one); + i = 0; + while (i < kdim) + { + i++; + // zi = M^{-1} * vi; + v = V + (i-1) * n; + z = Z + (i-1) * n; + /* XXX NO PRECOND */ + /* memcpy(z, v, n*sizeof(HYPRE_Complex)); */ + // w = v_{i+1} = A * zi + w = V + i * n; + colmaj_mvT(A, z, w, n); + // modified Gram-schmidt + for (j = 0; j < i; j++) + { + v = V + j * n; + H[j+(i-1)*kdim] = t = hypre_ddot(&n, v, &one, w, &one); + t = -t; + hypre_daxpy(&n, &t, v, &one, w, &one); + } + H[i+(i-1)*kdim] = t = sqrt(hypre_ddot(&n, w, &one, w, &one)); + if (fabs(t) > EPSILON) + { + t = 1.0 / t; + hypre_dscal(&n, &t, w, &one); + } + // Least square problem of H + for (j = 1; j < i; j++) + { + t = H[j-1+(i-1)*kdim]; + H[j-1+(i-1)*kdim] = c[j-1]*t + s[j-1]*H[j+(i-1)*kdim]; + H[j+(i-1)*kdim] = -s[j-1]*t + c[j-1]*H[j+(i-1)*kdim]; + } + HYPRE_Complex hii = H[i-1+(i-1)*kdim]; + HYPRE_Complex hii1 = H[i+(i-1)*kdim]; + HYPRE_Complex gam = sqrt(hii*hii + hii1*hii1); + + if (fabs(gam) < EPSILON) + { + gam = EPSIMAC; + } + c[i-1] = hii / gam; + s[i-1] = hii1 / gam; + rs[i] = -s[i-1] * rs[i-1]; + rs[i-1] = c[i-1] * rs[i-1]; + // residue norm + H[i-1+(i-1)*kdim] = c[i-1]*hii + s[i-1]*hii1; + normr = fabs(rs[i]); + if (normr <= tolr) + { + break; + } + } + + // solve the upper triangular system + rs[i-1] /= H[i-1+(i-1)*kdim]; + for (k = i-2; k >= 0; k--) + { + for (j = k+1; j < i; j++) + { + rs[k] -= H[k+j*kdim]*rs[j]; + } + rs[k] /= H[k+k*kdim]; + } + // get solution + for (j = 0; j < i; j++) + { + z = Z + j * n; + hypre_daxpy(&n, rs+j, z, &one, x, &one); + } + + *relres = normr / normr0; + *iter = i; +} + + +/* Ordered Gauss Seidel on A^T in column major format. Since we are + * solving A^T, equivalent to solving A in row major format. */ +void hypre_ordered_GS(const HYPRE_Complex L[], + const HYPRE_Complex rhs[], + HYPRE_Complex x[], + const HYPRE_Int n) +{ + // Get triangular ordering of L^T in col major as ordering of L in row major + HYPRE_Int ordering[n]; + hypre_dense_topo_sort(L, ordering, n, 0); + + // Ordered Gauss-Seidel iteration + HYPRE_Int i, col; + for (i=0; i 0) - { - hypre_printf(" Hybrid Coarsening (switch to CLJP when coarsening slows)\n"); - }*/ + /*if (coarsen_type > 0) + { + hypre_printf(" Hybrid Coarsening (switch to CLJP when coarsening slows)\n"); + }*/ if (agg_num_levels > 0) { - hypre_printf("\n No. of levels of aggressive coarsening: %d\n\n", agg_num_levels); - if (agg_interp_type == 4) - hypre_printf(" Interpolation on agg. levels= multipass interpolation\n"); - else if (agg_interp_type == 1) - hypre_printf(" Interpolation on agg. levels = 2-stage extended+i interpolation \n"); - else if (agg_interp_type == 2) - hypre_printf(" Interpolation on agg. levels = 2-stage std interpolation \n"); - else if (agg_interp_type == 3) - hypre_printf(" Interpolation on agg. levels = 2-stage extended interpolation \n"); + hypre_printf("\n No. of levels of aggressive coarsening: %d\n\n", agg_num_levels); + if (agg_interp_type == 4) + hypre_printf(" Interpolation on agg. levels= multipass interpolation\n"); + else if (agg_interp_type == 1) + hypre_printf(" Interpolation on agg. levels = 2-stage extended+i interpolation \n"); + else if (agg_interp_type == 2) + hypre_printf(" Interpolation on agg. levels = 2-stage std interpolation \n"); + else if (agg_interp_type == 3) + hypre_printf(" Interpolation on agg. levels = 2-stage extended interpolation \n"); } - + if (coarsen_type) - hypre_printf(" measures are determined %s\n\n", - (measure_type ? "globally" : "locally")); + hypre_printf(" measures are determined %s\n\n", + (measure_type ? "globally" : "locally")); #ifdef HYPRE_NO_GLOBAL_PARTITION hypre_printf( "\n No global partition option chosen.\n\n"); @@ -308,103 +301,149 @@ if (interp_type == 0) { - hypre_printf(" Interpolation = modified classical interpolation\n"); + hypre_printf(" Interpolation = modified classical interpolation\n"); } - else if (interp_type == 1) + else if (interp_type == 1) { - hypre_printf(" Interpolation = LS interpolation \n"); + hypre_printf(" Interpolation = LS interpolation \n"); } - else if (interp_type == 2) + else if (interp_type == 2) { - hypre_printf(" Interpolation = modified classical interpolation for hyperbolic PDEs\n"); + hypre_printf(" Interpolation = modified classical interpolation for hyperbolic PDEs\n"); } - else if (interp_type == 3) + else if (interp_type == 3) { - hypre_printf(" Interpolation = direct interpolation with separation of weights\n"); + hypre_printf(" Interpolation = direct interpolation with separation of weights\n"); } - else if (interp_type == 4) + else if (interp_type == 4) { - hypre_printf(" Interpolation = multipass interpolation\n"); + hypre_printf(" Interpolation = multipass interpolation\n"); } - else if (interp_type == 5) + else if (interp_type == 5) { - hypre_printf(" Interpolation = multipass interpolation with separation of weights\n"); + hypre_printf(" Interpolation = multipass interpolation with separation of weights\n"); } - else if (interp_type == 6) + else if (interp_type == 6) { - hypre_printf(" Interpolation = extended+i interpolation\n"); + hypre_printf(" Interpolation = extended+i interpolation\n"); } - else if (interp_type == 7) + else if (interp_type == 7) { - hypre_printf(" Interpolation = extended+i interpolation (if no common C point)\n"); + hypre_printf(" Interpolation = extended+i interpolation (if no common C point)\n"); } - else if (interp_type == 12) + else if (interp_type == 12) { - hypre_printf(" Interpolation = F-F interpolation\n"); + hypre_printf(" Interpolation = F-F interpolation\n"); } - else if (interp_type == 13) + else if (interp_type == 13) { - hypre_printf(" Interpolation = F-F1 interpolation\n"); + hypre_printf(" Interpolation = F-F1 interpolation\n"); } - else if (interp_type == 14) + else if (interp_type == 14) { - hypre_printf(" Interpolation = extended interpolation\n"); + hypre_printf(" Interpolation = extended interpolation\n"); } - else if (interp_type == 8) + else if (interp_type == 8) { - hypre_printf(" Interpolation = standard interpolation\n"); + hypre_printf(" Interpolation = standard interpolation\n"); } - else if (interp_type == 9) + else if (interp_type == 9) { - hypre_printf(" Interpolation = standard interpolation with separation of weights\n"); + hypre_printf(" Interpolation = standard interpolation with separation of weights\n"); } - else if (interp_type == 10) + else if (interp_type == 10) { - hypre_printf(" Interpolation = block classical interpolation for nodal systems AMG\n"); + hypre_printf(" Interpolation = block classical interpolation for nodal systems AMG\n"); } - else if (interp_type == 11) + else if (interp_type == 11) { - hypre_printf(" Interpolation = block classical interpolation with diagonal blocks\n"); - hypre_printf(" for nodal systems AMG\n"); + hypre_printf(" Interpolation = block classical interpolation with diagonal blocks\n"); + hypre_printf(" for nodal systems AMG\n"); } - else if (interp_type == 24) + else if (interp_type == 24) { - hypre_printf(" Interpolation = block direct interpolation \n"); - hypre_printf(" for nodal systems AMG\n"); + hypre_printf(" Interpolation = block direct interpolation \n"); + hypre_printf(" for nodal systems AMG\n"); } else if (interp_type == 100) { - hypre_printf(" Interpolation = one-point interpolation \n"); + hypre_printf(" Interpolation = one-point interpolation \n"); } if (restri_type == 1) { hypre_printf(" Restriction = local approximate ideal restriction (AIR-1)\n"); - } + } else if (restri_type == 2) { hypre_printf(" Restriction = local approximate ideal restriction (AIR-2)\n"); } + else if (restri_type == 15) + { + hypre_printf(" Restriction = local approximate ideal restriction (AIR-1.5)\n"); + } + else if (restri_type >= 3) + { + hypre_printf(" Restriction = local approximate ideal restriction (Neumann AIR-%.1f)\n", restri_type-3); + } if (block_mode) { hypre_printf( "\nBlock Operator Matrix Information:\n"); - hypre_printf( "(Row sums and weights use sum of all elements in the block -keeping signs)\n\n"); + hypre_printf( "(Row sums and weights use sum of all elements in the block -keeping signs)\n\n"); } - else + else { hypre_printf( "\nOperator Matrix Information:\n\n"); } - - hypre_printf(" nonzero entries p"); - hypre_printf("er row row sums\n"); - hypre_printf("lev rows entries sparse min max "); - hypre_printf("avg min max\n"); - hypre_printf("======================================="); - hypre_printf("============================\n"); + } + if (block_mode) + { + ndigits[0] = hypre_ndigits(hypre_ParCSRBlockMatrixGlobalNumRows(A_block_array[0])); + ndigits[1] = hypre_ndigits(hypre_ParCSRBlockMatrixNumNonzeros(A_block_array[0])); + } + else + { + ndigits[0] = hypre_ndigits(hypre_ParCSRMatrixGlobalNumRows(A_array[0])); + ndigits[1] = hypre_ndigits(hypre_ParCSRMatrixNumNonzeros(A_array[0])); } - + ndigits[0] = hypre_max(7, ndigits[0]); + ndigits[1] = hypre_max(8, ndigits[1]); + ndigits[2] = 4; + for (level = 0; level < num_levels; level++) + { + + if (block_mode) + { + fine_size = hypre_ParCSRBlockMatrixGlobalNumRows(A_block_array[level]); + global_nonzeros = hypre_ParCSRBlockMatrixNumNonzeros(A_block_array[level]); + ndigits[2] = hypre_max(hypre_ndigits((HYPRE_BigInt) global_nonzeros / fine_size ), ndigits[2]); + } + else + { + fine_size = hypre_ParCSRMatrixGlobalNumRows(A_array[level]); + global_nonzeros = hypre_ParCSRMatrixNumNonzeros(A_array[level]); + ndigits[2] = hypre_max(hypre_ndigits((HYPRE_BigInt) global_nonzeros / fine_size ), ndigits[2]); + } + + } + ndigits[2] = ndigits[2] + 2; + ndigits[3] = ndigits[0] + ndigits[1] + ndigits[2]; + + if(my_id == 0) + { + hypre_printf("%*s", (ndigits[0] + 13), "nonzero"); + hypre_printf("%*s", (ndigits[1] + 15), "entries/row"); + hypre_printf("%18s\n", "row sums"); + hypre_printf("%s %*s ", "lev", ndigits[0], "rows"); + hypre_printf("%*s", ndigits[1], "entries"); + hypre_printf("%7s %5s %4s", "sparse", "min", "max"); + hypre_printf("%*s %8s %11s\n", (ndigits[2] + 2), "avg", "min", "max"); + for (i = 0; i < (49 + ndigits[3]); i++) hypre_printf("%s", "="); + hypre_printf("\n"); + } + /*----------------------------------------------------- * Enter Statistics Loop *-----------------------------------------------------*/ @@ -415,36 +454,36 @@ num_variables = hypre_CTAlloc(HYPRE_Real, num_levels, HYPRE_MEMORY_HOST); for (level = 0; level < num_levels; level++) - { + { if (block_mode) { A_block_diag = hypre_ParCSRBlockMatrixDiag(A_block_array[level]); A_diag_data = hypre_CSRBlockMatrixData(A_block_diag); A_diag_i = hypre_CSRBlockMatrixI(A_block_diag); - - A_block_offd = hypre_ParCSRBlockMatrixOffd(A_block_array[level]); + + A_block_offd = hypre_ParCSRBlockMatrixOffd(A_block_array[level]); A_offd_data = hypre_CSRMatrixData(A_block_offd); A_offd_i = hypre_CSRMatrixI(A_block_offd); - + block_size = hypre_ParCSRBlockMatrixBlockSize(A_block_array[level]); bnnz = block_size*block_size; row_starts = hypre_ParCSRBlockMatrixRowStarts(A_block_array[level]); - + fine_size = hypre_ParCSRBlockMatrixGlobalNumRows(A_block_array[level]); global_nonzeros = hypre_ParCSRBlockMatrixDNumNonzeros(A_block_array[level]); num_coeffs[level] = global_nonzeros; num_mem[level] = global_nonzeros; num_variables[level] = (HYPRE_Real) fine_size; - + sparse = global_nonzeros /((HYPRE_Real) fine_size * (HYPRE_Real) fine_size); - + min_entries = 0; max_entries = 0; min_rowsum = 0.0; max_rowsum = 0.0; - + if (hypre_CSRBlockMatrixNumRows(A_block_diag)) { min_entries = (A_diag_i[1]-A_diag_i[0])+(A_offd_i[1]-A_offd_i[0]); @@ -453,21 +492,21 @@ hypre_CSRBlockMatrixBlockNorm(6, &A_diag_data[j*bnnz], &tmp_norm, block_size); min_rowsum += tmp_norm; } - + for (j = A_offd_i[0]; j < A_offd_i[1]; j++) { hypre_CSRBlockMatrixBlockNorm(6, &A_offd_data[j*bnnz], &tmp_norm, block_size); min_rowsum += tmp_norm; } - + max_rowsum = min_rowsum; - + for (j = 0; j < hypre_CSRBlockMatrixNumRows(A_block_diag); j++) { entries = (A_diag_i[j+1]-A_diag_i[j])+(A_offd_i[j+1]-A_offd_i[j]); min_entries = hypre_min(entries, min_entries); max_entries = hypre_max(entries, max_entries); - + rowsum = 0.0; for (i = A_diag_i[j]; i < A_diag_i[j+1]; i++) { @@ -490,17 +529,17 @@ A_diag = hypre_ParCSRMatrixDiag(A_array[level]); A_diag_data = hypre_CSRMatrixData(A_diag); A_diag_i = hypre_CSRMatrixI(A_diag); - - A_offd = hypre_ParCSRMatrixOffd(A_array[level]); + + A_offd = hypre_ParCSRMatrixOffd(A_array[level]); A_offd_data = hypre_CSRMatrixData(A_offd); A_offd_i = hypre_CSRMatrixI(A_offd); - + row_starts = hypre_ParCSRMatrixRowStarts(A_array[level]); - + fine_size = hypre_ParCSRMatrixGlobalNumRows(A_array[level]); global_nonzeros = hypre_ParCSRMatrixDNumNonzeros(A_array[level]); num_coeffs[level] = global_nonzeros; - if (level == 0) + if (level == 0) num_mem[level] += global_nonzeros; if (level == 0 && (additive == 0 || mult_additive == 0) ) num_mem[level] += global_nonzeros; @@ -510,14 +549,14 @@ num_mem[level] += global_nonzeros; } num_variables[level] = (HYPRE_Real) fine_size; - + sparse = global_nonzeros /((HYPRE_Real) fine_size * (HYPRE_Real) fine_size); min_entries = 0; max_entries = 0; min_rowsum = 0.0; max_rowsum = 0.0; - + if (hypre_CSRMatrixNumRows(A_diag)) { min_entries = (A_diag_i[1]-A_diag_i[0])+(A_offd_i[1]-A_offd_i[0]); @@ -525,100 +564,112 @@ min_rowsum += A_diag_data[j]; for (j = A_offd_i[0]; j < A_offd_i[1]; j++) min_rowsum += A_offd_data[j]; - + max_rowsum = min_rowsum; - + for (j = 0; j < hypre_CSRMatrixNumRows(A_diag); j++) { entries = (A_diag_i[j+1]-A_diag_i[j])+(A_offd_i[j+1]-A_offd_i[j]); min_entries = hypre_min(entries, min_entries); max_entries = hypre_max(entries, max_entries); - + rowsum = 0.0; for (i = A_diag_i[j]; i < A_diag_i[j+1]; i++) rowsum += A_diag_data[i]; - + for (i = A_offd_i[j]; i < A_offd_i[j+1]; i++) rowsum += A_offd_data[i]; - + min_rowsum = hypre_min(rowsum, min_rowsum); max_rowsum = hypre_max(rowsum, max_rowsum); } } avg_entries = global_nonzeros / ((HYPRE_Real) fine_size); } - -#ifdef HYPRE_NO_GLOBAL_PARTITION - numrows = (HYPRE_Int)(row_starts[1]-row_starts[0]); - if (!numrows) /* if we don't have any rows, then don't have this count toward - min row sum or min num entries */ - { - min_entries = 1000000; - min_rowsum = 1.0e7; - } - - send_buff[0] = - (HYPRE_Real) min_entries; - send_buff[1] = (HYPRE_Real) max_entries; - send_buff[2] = - min_rowsum; - send_buff[3] = max_rowsum; - - hypre_MPI_Reduce(send_buff, gather_buff, 4, HYPRE_MPI_REAL, hypre_MPI_MAX, 0, comm); - - if (my_id ==0) - { - global_min_e = - (HYPRE_Int)gather_buff[0]; - global_max_e = (HYPRE_Int)gather_buff[1]; - global_min_rsum = - gather_buff[2]; - global_max_rsum = gather_buff[3]; - - hypre_printf( "%2d %7b %8.0f %0.3f %4d %4d", - level, fine_size, global_nonzeros, sparse, global_min_e, - global_max_e); - hypre_printf(" %4.1f %10.3e %10.3e\n", avg_entries, - global_min_rsum, global_max_rsum); - } - +#ifdef HYPRE_NO_GLOBAL_PARTITION + + numrows = (HYPRE_Int)(row_starts[1]-row_starts[0]); + if (!numrows) /* if we don't have any rows, then don't have this count toward + min row sum or min num entries */ + { + min_entries = 1000000; + min_rowsum = 1.0e7; + } + + send_buff[0] = - (HYPRE_Real) min_entries; + send_buff[1] = (HYPRE_Real) max_entries; + send_buff[2] = - min_rowsum; + send_buff[3] = max_rowsum; + + hypre_MPI_Reduce(send_buff, gather_buff, 4, HYPRE_MPI_REAL, hypre_MPI_MAX, 0, comm); + + if (my_id ==0) + { + global_min_e = - (HYPRE_Int)gather_buff[0]; + global_max_e = (HYPRE_Int)gather_buff[1]; + global_min_rsum = - gather_buff[2]; + global_max_rsum = gather_buff[3]; + + hypre_printf("%3d %*b %*.0f %0.3f %4d %4d", + level, ndigits[0], fine_size, ndigits[1], global_nonzeros, + sparse, global_min_e, global_max_e); + hypre_printf(" %*.1f %10.3e %10.3e\n", ndigits[2], avg_entries, + global_min_rsum, global_max_rsum); + } + #else - send_buff[0] = (HYPRE_Real) min_entries; - send_buff[1] = (HYPRE_Real) max_entries; - send_buff[2] = min_rowsum; - send_buff[3] = max_rowsum; - - hypre_MPI_Gather(send_buff,4,HYPRE_MPI_REAL,gather_buff,4,HYPRE_MPI_REAL,0,comm); - - if (my_id == 0) - { - global_min_e = 1000000; - global_max_e = 0; - global_min_rsum = 1.0e7; - global_max_rsum = 0.0; - for (j = 0; j < num_procs; j++) - { - numrows = row_starts[j+1]-row_starts[j]; - if (numrows) - { - global_min_e = hypre_min(global_min_e, (HYPRE_Int) gather_buff[j*4]); - global_min_rsum = hypre_min(global_min_rsum, gather_buff[j*4 +2]); - } - global_max_e = hypre_max(global_max_e, (HYPRE_Int) gather_buff[j*4 +1]); - global_max_rsum = hypre_max(global_max_rsum, gather_buff[j*4 +3]); - } - - hypre_printf( "%2d %7b %8.0f %0.3f %4d %4d", - level, fine_size, global_nonzeros, sparse, global_min_e, - global_max_e); - hypre_printf(" %4.1f %10.3e %10.3e\n", avg_entries, - global_min_rsum, global_max_rsum); - } + send_buff[0] = (HYPRE_Real) min_entries; + send_buff[1] = (HYPRE_Real) max_entries; + send_buff[2] = min_rowsum; + send_buff[3] = max_rowsum; + + hypre_MPI_Gather(send_buff,4,HYPRE_MPI_REAL,gather_buff,4,HYPRE_MPI_REAL,0,comm); + + if (my_id == 0) + { + global_min_e = 1000000; + global_max_e = 0; + global_min_rsum = 1.0e7; + global_max_rsum = 0.0; + for (j = 0; j < num_procs; j++) + { + numrows = row_starts[j+1]-row_starts[j]; + if (numrows) + { + global_min_e = hypre_min(global_min_e, (HYPRE_Int) gather_buff[j*4]); + global_min_rsum = hypre_min(global_min_rsum, gather_buff[j*4 +2]); + } + global_max_e = hypre_max(global_max_e, (HYPRE_Int) gather_buff[j*4 +1]); + global_max_rsum = hypre_max(global_max_rsum, gather_buff[j*4 +3]); + } + + hypre_printf("%3d %*b %*.0f %0.3f %4d %4d", + level, ndigits[0], fine_size, ndigits[1], global_nonzeros, + sparse, global_min_e, global_max_e); + hypre_printf(" %*.1f %10.3e %10.3e\n", ndigits[2], avg_entries, + global_min_rsum, global_max_rsum); + } #endif - + + } + + ndigits[0] = 5; + if ((num_levels - 1)) + { + if (block_mode) + { + ndigits[0] = hypre_max(hypre_ndigits(hypre_ParCSRBlockMatrixGlobalNumRows(P_block_array[0])), ndigits[0]); + } + else + { + ndigits[0] = hypre_max(hypre_ndigits(hypre_ParCSRMatrixGlobalNumRows(P_array[0])), ndigits[0]); + } } - if (my_id == 0) { if (block_mode) @@ -626,60 +677,59 @@ hypre_printf( "\n\nBlock Interpolation Matrix Information:\n\n"); hypre_printf( "(Row sums and weights use sum of all elements in the block - keeping signs)\n\n"); } - else + else { hypre_printf( "\n\nInterpolation Matrix Information:\n"); - + } - - hypre_printf(" entries/row min max"); - hypre_printf(" row sums\n"); - hypre_printf("lev rows cols min max "); - hypre_printf(" weight weight min max \n"); - hypre_printf("======================================="); - hypre_printf("==========================\n"); + + hypre_printf("%*s ", (2*ndigits[0] + 21), "entries/row"); + hypre_printf("%10s %10s %19s\n", "min", "max", "row sums"); + hypre_printf("lev %*s x %-*s min max avgW", ndigits[0], "rows", ndigits[0], "cols"); + hypre_printf("%11s %11s %9s %11s\n", "weight", "weight", "min", "max"); + for (i = 0; i < (70 + 2*ndigits[0]); i++) hypre_printf("%s", "="); + hypre_printf("\n"); } - + /*----------------------------------------------------- * Enter Statistics Loop *-----------------------------------------------------*/ - for (level = 0; level < num_levels-1; level++) { - + if (block_mode) { P_block_diag = hypre_ParCSRBlockMatrixDiag(P_block_array[level]); P_diag_data = hypre_CSRBlockMatrixData(P_block_diag); P_diag_i = hypre_CSRBlockMatrixI(P_block_diag); - - P_block_offd = hypre_ParCSRBlockMatrixOffd(P_block_array[level]); + + P_block_offd = hypre_ParCSRBlockMatrixOffd(P_block_array[level]); P_offd_data = hypre_CSRBlockMatrixData(P_block_offd); P_offd_i = hypre_CSRBlockMatrixI(P_block_offd); - + row_starts = hypre_ParCSRBlockMatrixRowStarts(P_block_array[level]); - + fine_size = hypre_ParCSRBlockMatrixGlobalNumRows(P_block_array[level]); coarse_size = hypre_ParCSRBlockMatrixGlobalNumCols(P_block_array[level]); global_nonzeros = hypre_ParCSRBlockMatrixDNumNonzeros(P_block_array[level]); num_mem[level] += global_nonzeros; - + min_weight = 1.0; max_weight = 0.0; max_rowsum = 0.0; min_rowsum = 0.0; min_entries = 0; max_entries = 0; - + if (hypre_CSRBlockMatrixNumRows(P_block_diag)) { - if (hypre_CSRBlockMatrixNumCols(P_block_diag)) + if (hypre_CSRBlockMatrixNumCols(P_block_diag)) { hypre_CSRBlockMatrixBlockNorm(6, &P_diag_data[0], &tmp_norm, block_size); min_weight = tmp_norm; } - + for (j = P_diag_i[0]; j < P_diag_i[1]; j++) { @@ -694,27 +744,27 @@ } for (j = P_offd_i[0]; j < P_offd_i[1]; j++) - { + { hypre_CSRBlockMatrixBlockNorm(6, &P_offd_data[j*bnnz], &tmp_norm, block_size); - min_weight = hypre_min(min_weight, tmp_norm); - - if (tmp_norm != 1.0) - max_weight = hypre_max(max_weight, tmp_norm); + min_weight = hypre_min(min_weight, tmp_norm); + + if (tmp_norm != 1.0) + max_weight = hypre_max(max_weight, tmp_norm); min_rowsum += tmp_norm; } - + max_rowsum = min_rowsum; - - min_entries = (P_diag_i[1]-P_diag_i[0])+(P_offd_i[1]-P_offd_i[0]); + + min_entries = (P_diag_i[1]-P_diag_i[0])+(P_offd_i[1]-P_offd_i[0]); max_entries = 0; - + for (j = 0; j < hypre_CSRBlockMatrixNumRows(P_block_diag); j++) { entries = (P_diag_i[j+1]-P_diag_i[j])+(P_offd_i[j+1]-P_offd_i[j]); min_entries = hypre_min(entries, min_entries); max_entries = hypre_max(entries, max_entries); - + rowsum = 0.0; for (i = P_diag_i[j]; i < P_diag_i[j+1]; i++) { @@ -726,51 +776,51 @@ rowsum += tmp_norm; } - + for (i = P_offd_i[j]; i < P_offd_i[j+1]; i++) { hypre_CSRBlockMatrixBlockNorm(6, &P_offd_data[i*bnnz], &tmp_norm, block_size); min_weight = hypre_min(min_weight, tmp_norm); - if (tmp_norm != 1.0) + if (tmp_norm != 1.0) max_weight = hypre_max(max_weight, P_offd_data[i]); rowsum += tmp_norm; } - + min_rowsum = hypre_min(rowsum, min_rowsum); max_rowsum = hypre_max(rowsum, max_rowsum); } - + } - avg_entries = ((HYPRE_Real) global_nonzeros) / ((HYPRE_Real) fine_size); + avg_entries = ((HYPRE_Real) (global_nonzeros - coarse_size)) / ((HYPRE_Real) (fine_size - coarse_size)); } - else + else { P_diag = hypre_ParCSRMatrixDiag(P_array[level]); P_diag_data = hypre_CSRMatrixData(P_diag); P_diag_i = hypre_CSRMatrixI(P_diag); - - P_offd = hypre_ParCSRMatrixOffd(P_array[level]); + + P_offd = hypre_ParCSRMatrixOffd(P_array[level]); P_offd_data = hypre_CSRMatrixData(P_offd); P_offd_i = hypre_CSRMatrixI(P_offd); - + row_starts = hypre_ParCSRMatrixRowStarts(P_array[level]); - + fine_size = hypre_ParCSRMatrixGlobalNumRows(P_array[level]); coarse_size = hypre_ParCSRMatrixGlobalNumCols(P_array[level]); hypre_ParCSRMatrixSetDNumNonzeros(P_array[level]); global_nonzeros = hypre_ParCSRMatrixDNumNonzeros(P_array[level]); num_mem[level] += (HYPRE_Real) global_nonzeros; - + min_weight = 1.0; max_weight = 0.0; max_rowsum = 0.0; min_rowsum = 0.0; min_entries = 0; max_entries = 0; - + if (hypre_CSRMatrixNumRows(P_diag)) { if (P_diag_data) min_weight = P_diag_data[0]; @@ -782,24 +832,24 @@ min_rowsum += P_diag_data[j]; } for (j = P_offd_i[0]; j < P_offd_i[1]; j++) - { - min_weight = hypre_min(min_weight, P_offd_data[j]); + { + min_weight = hypre_min(min_weight, P_offd_data[j]); if (P_offd_data[j] != 1.0) - max_weight = hypre_max(max_weight, P_offd_data[j]); + max_weight = hypre_max(max_weight, P_offd_data[j]); min_rowsum += P_offd_data[j]; } - + max_rowsum = min_rowsum; - - min_entries = (P_diag_i[1]-P_diag_i[0])+(P_offd_i[1]-P_offd_i[0]); + + min_entries = (P_diag_i[1]-P_diag_i[0])+(P_offd_i[1]-P_offd_i[0]); max_entries = 0; - + for (j = 0; j < hypre_CSRMatrixNumRows(P_diag); j++) { entries = (P_diag_i[j+1]-P_diag_i[j])+(P_offd_i[j+1]-P_offd_i[j]); min_entries = hypre_min(entries, min_entries); max_entries = hypre_max(entries, max_entries); - + rowsum = 0.0; for (i = P_diag_i[j]; i < P_diag_i[j+1]; i++) { @@ -808,21 +858,21 @@ max_weight = hypre_max(max_weight, P_diag_data[i]); rowsum += P_diag_data[i]; } - + for (i = P_offd_i[j]; i < P_offd_i[j+1]; i++) { min_weight = hypre_min(min_weight, P_offd_data[i]); - if (P_offd_data[i] != 1.0) + if (P_offd_data[i] != 1.0) max_weight = hypre_max(max_weight, P_offd_data[i]); rowsum += P_offd_data[i]; } - + min_rowsum = hypre_min(rowsum, min_rowsum); max_rowsum = hypre_max(rowsum, max_rowsum); } - + } - avg_entries = ((HYPRE_Real) global_nonzeros) / ((HYPRE_Real) fine_size); + avg_entries = ((HYPRE_Real) (global_nonzeros - coarse_size)) / ((HYPRE_Real) (fine_size - coarse_size)); } #ifdef HYPRE_NO_GLOBAL_PARTITION @@ -834,8 +884,8 @@ min_entries = 1000000; min_rowsum = 1.0e7; min_weight = 1.0e7; - } - + } + send_buff[0] = - (HYPRE_Real) min_entries; send_buff[1] = (HYPRE_Real) max_entries; send_buff[2] = - min_rowsum; @@ -854,25 +904,26 @@ global_min_wt = -gather_buff[4]; global_max_wt = gather_buff[5]; - hypre_printf( "%2d %5b x %-5b %3d %3d", - level, fine_size, coarse_size, global_min_e, global_max_e); - hypre_printf(" %10.3e %9.3e %9.3e %9.3e\n", - global_min_wt, global_max_wt, - global_min_rsum, global_max_rsum); + hypre_printf("%3d %*b x %-*b %3d %3d", + level, ndigits[0], fine_size, ndigits[0], coarse_size, + global_min_e, global_max_e); + hypre_printf(" %4.1f %10.3e %10.3e %10.3e %10.3e\n", + avg_entries, global_min_wt, global_max_wt, + global_min_rsum, global_max_rsum); } #else - + send_buff[0] = (HYPRE_Real) min_entries; send_buff[1] = (HYPRE_Real) max_entries; send_buff[2] = min_rowsum; send_buff[3] = max_rowsum; send_buff[4] = min_weight; send_buff[5] = max_weight; - + hypre_MPI_Gather(send_buff,6,HYPRE_MPI_REAL,gather_buff,6,HYPRE_MPI_REAL,0,comm); - + if (my_id == 0) { global_min_e = 1000000; @@ -881,7 +932,7 @@ global_max_rsum = 0.0; global_min_wt = 1.0e7; global_max_wt = 0.0; - + for (j = 0; j < num_procs; j++) { numrows = row_starts[j+1] - row_starts[j]; @@ -895,12 +946,13 @@ global_max_rsum = hypre_max(global_max_rsum, gather_buff[j*6+3]); global_max_wt = hypre_max(global_max_wt, gather_buff[j*6+5]); } - - hypre_printf( "%2d %5b x %-5b %3d %3d", - level, fine_size, coarse_size, global_min_e, global_max_e); - hypre_printf(" %10.3e %9.3e %9.3e %9.3e\n", - global_min_wt, global_max_wt, - global_min_rsum, global_max_rsum); + + hypre_printf("%3d %*b x %-*b %3d %3d", + level, ndigits[0], fine_size, ndigits[0], coarse_size, + global_min_e, global_max_e); + hypre_printf(" %4.1f %10.3e %10.3e %10.3e %10.3e\n", + avg_entries, global_min_wt, global_max_wt, + global_min_rsum, global_max_rsum); } #endif @@ -918,22 +970,29 @@ } if (num_variables[0] != 0) grid_cmplxty = total_variables / num_variables[0]; - + if (my_id == 0 ) { - hypre_printf("\n\n Complexity: grid = %f\n",grid_cmplxty); + hypre_printf("\n\n"); + hypre_printf(" Complexity: grid = %f\n",grid_cmplxty); hypre_printf(" operator = %f\n",operat_cmplxty); hypre_printf(" memory = %f\n",memory_cmplxty); + hypre_printf("\n\n"); } - if (my_id == 0) hypre_printf("\n\n"); - if (my_id == 0) - { + { hypre_printf("\n\nBoomerAMG SOLVER PARAMETERS:\n\n"); hypre_printf( " Maximum number of cycles: %d \n",max_iter); - hypre_printf( " Stopping Tolerance: %e \n",tol); - hypre_printf( " Cycle type (1 = V, 2 = W, etc.): %d\n\n", cycle_type); + hypre_printf( " Stopping Tolerance: %e \n",tol); + if (fcycle) + { + hypre_printf( " Full Multigrid. Cycle type (1 = V, 2 = W, etc.): %d\n\n", cycle_type); + } + else + { + hypre_printf( " Cycle type (1 = V, 2 = W, etc.): %d\n\n", cycle_type); + } if (additive == 0 || mult_additive == 0 || simple == 0) { @@ -950,15 +1009,15 @@ { hypre_printf( " Visiting Grid: down up coarse\n"); hypre_printf( " Number of sweeps: %4d %2d %4d \n", - num_grid_sweeps[1], - num_grid_sweeps[1],(2*num_grid_sweeps[1])); + num_grid_sweeps[1], + num_grid_sweeps[1],(2*num_grid_sweeps[1])); hypre_printf( " Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: %2d %2d %2d \n", add_rlx, add_rlx, add_rlx); } else { hypre_printf( " Visiting Grid: down up\n"); hypre_printf( " Number of sweeps: %4d %2d\n", - num_grid_sweeps[1], num_grid_sweeps[1]); + num_grid_sweeps[1], num_grid_sweeps[1]); hypre_printf( " Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: %2d %2d\n", add_rlx, add_rlx); } if (add_lvl < num_levels -1) @@ -967,23 +1026,23 @@ hypre_printf( "Multiplicative portion: \n"); hypre_printf( " Visiting Grid: down up coarse\n"); hypre_printf( " Number of sweeps: %4d %2d %4d\n", - num_grid_sweeps[1], num_grid_sweeps[2], num_grid_sweeps[3]); + num_grid_sweeps[1], num_grid_sweeps[2], num_grid_sweeps[3]); hypre_printf( " Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: %4d %2d %4d\n", - grid_relax_type[1], grid_relax_type[2], grid_relax_type[3]); + grid_relax_type[1], grid_relax_type[2], grid_relax_type[3]); } if (add_rlx == 0) hypre_printf( " Relaxation Weight: %e \n", add_rlx_wt); hypre_printf( " Point types, partial sweeps (1=C, -1=F):\n"); hypre_printf( " Pre-CG relaxation (down):"); for (j = 0; j < num_grid_sweeps[1]; j++) - hypre_printf(" %2d", zero); + hypre_printf(" %2d", zero); hypre_printf( "\n"); hypre_printf( " Post-CG relaxation (up):"); for (j = 0; j < num_grid_sweeps[2]; j++) - hypre_printf(" %2d", zero); + hypre_printf(" %2d", zero); hypre_printf( "\n"); hypre_printf( " Coarsest grid:"); for (j = 0; j < num_grid_sweeps[3]; j++) - hypre_printf(" %2d", zero); + hypre_printf(" %2d", zero); hypre_printf( "\n\n"); } else if (additive > 0 || mult_additive > 0 || simple > 0) @@ -995,50 +1054,50 @@ { hypre_printf( " Visiting Grid: down up coarse\n"); hypre_printf( " Number of sweeps: %4d %2d %4d\n", - num_grid_sweeps[1], num_grid_sweeps[2], num_grid_sweeps[3]); + num_grid_sweeps[1], num_grid_sweeps[2], num_grid_sweeps[3]); hypre_printf( " Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: %4d %2d %4d\n", - grid_relax_type[1], grid_relax_type[2], grid_relax_type[3]); + grid_relax_type[1], grid_relax_type[2], grid_relax_type[3]); } else { hypre_printf( " Visiting Grid: down up \n"); hypre_printf( " Number of sweeps: %4d %2d \n", - num_grid_sweeps[1], num_grid_sweeps[2]); + num_grid_sweeps[1], num_grid_sweeps[2]); hypre_printf( " Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: %4d %2d \n", - grid_relax_type[1], grid_relax_type[2]); + grid_relax_type[1], grid_relax_type[2]); } hypre_printf( " Point types, partial sweeps (1=C, -1=F):\n"); if (grid_relax_points && grid_relax_type[1] != 8) { hypre_printf( " Pre-CG relaxation (down):"); for (j = 0; j < num_grid_sweeps[1]; j++) - hypre_printf(" %2d", grid_relax_points[1][j]); + hypre_printf(" %2d", grid_relax_points[1][j]); hypre_printf( "\n"); hypre_printf( " Post-CG relaxation (up):"); for (j = 0; j < num_grid_sweeps[2]; j++) - hypre_printf(" %2d", grid_relax_points[2][j]); + hypre_printf(" %2d", grid_relax_points[2][j]); hypre_printf( "\n"); } else if (relax_order == 1 && grid_relax_type[1] != 8) { hypre_printf( " Pre-CG relaxation (down):"); for (j = 0; j < num_grid_sweeps[1]; j++) - hypre_printf(" %2d %2d", one, minus_one); + hypre_printf(" %2d %2d", one, minus_one); hypre_printf( "\n"); hypre_printf( " Post-CG relaxation (up):"); for (j = 0; j < num_grid_sweeps[2]; j++) - hypre_printf(" %2d %2d", minus_one, one); + hypre_printf(" %2d %2d", minus_one, one); hypre_printf( "\n"); } - else + else { hypre_printf( " Pre-CG relaxation (down):"); for (j = 0; j < num_grid_sweeps[1]; j++) - hypre_printf(" %2d", zero); + hypre_printf(" %2d", zero); hypre_printf( "\n"); hypre_printf( " Post-CG relaxation (up):"); for (j = 0; j < num_grid_sweeps[2]; j++) - hypre_printf(" %2d", zero); + hypre_printf(" %2d", zero); hypre_printf( "\n"); } hypre_printf( "\n\n"); @@ -1053,93 +1112,93 @@ { hypre_printf( " Visiting Grid: down up coarse\n"); hypre_printf( " Number of sweeps: %4d %2d %4d \n", - num_grid_sweeps[1], - num_grid_sweeps[1],(2*num_grid_sweeps[1])); + num_grid_sweeps[1], + num_grid_sweeps[1],(2*num_grid_sweeps[1])); hypre_printf( " Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: %2d %2d %2d \n", add_rlx, add_rlx, add_rlx); } else { hypre_printf( " Visiting Grid: down up\n"); hypre_printf( " Number of sweeps: %4d %2d\n", - num_grid_sweeps[1], num_grid_sweeps[1]); + num_grid_sweeps[1], num_grid_sweeps[1]); hypre_printf( " Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: %2d %2d\n", add_rlx, add_rlx); } if (add_rlx == 0) hypre_printf( " Relaxation Weight: %e \n", add_rlx_wt); hypre_printf( " Point types, partial sweeps (1=C, -1=F):\n"); hypre_printf( " Pre-CG relaxation (down):"); for (j = 0; j < num_grid_sweeps[1]; j++) - hypre_printf(" %2d", zero); + hypre_printf(" %2d", zero); hypre_printf( "\n"); hypre_printf( " Post-CG relaxation (up):"); for (j = 0; j < num_grid_sweeps[2]; j++) - hypre_printf(" %2d", zero); + hypre_printf(" %2d", zero); hypre_printf( "\n"); hypre_printf( " Coarsest grid:"); for (j = 0; j < num_grid_sweeps[3]; j++) - hypre_printf(" %2d", zero); + hypre_printf(" %2d", zero); hypre_printf( "\n\n"); } - else + else { hypre_printf( " Relaxation Parameters:\n"); hypre_printf( " Visiting Grid: down up coarse\n"); hypre_printf( " Number of sweeps: %4d %2d %4d \n", - num_grid_sweeps[1], - num_grid_sweeps[2],num_grid_sweeps[3]); + num_grid_sweeps[1], + num_grid_sweeps[2],num_grid_sweeps[3]); hypre_printf( " Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: %4d %2d %4d \n", - grid_relax_type[1], - grid_relax_type[2],grid_relax_type[3]); + grid_relax_type[1], + grid_relax_type[2],grid_relax_type[3]); hypre_printf( " Point types, partial sweeps (1=C, -1=F):\n"); if (grid_relax_points && grid_relax_type[1] != 8) { hypre_printf( " Pre-CG relaxation (down):"); for (j = 0; j < num_grid_sweeps[1]; j++) - hypre_printf(" %2d", grid_relax_points[1][j]); + hypre_printf(" %2d", grid_relax_points[1][j]); hypre_printf( "\n"); hypre_printf( " Post-CG relaxation (up):"); for (j = 0; j < num_grid_sweeps[2]; j++) - hypre_printf(" %2d", grid_relax_points[2][j]); + hypre_printf(" %2d", grid_relax_points[2][j]); hypre_printf( "\n"); hypre_printf( " Coarsest grid:"); for (j = 0; j < num_grid_sweeps[3]; j++) - hypre_printf(" %2d", grid_relax_points[3][j]); + hypre_printf(" %2d", grid_relax_points[3][j]); hypre_printf( "\n\n"); } else if (relax_order == 1 && grid_relax_type[1] != 8) { hypre_printf( " Pre-CG relaxation (down):"); for (j = 0; j < num_grid_sweeps[1]; j++) - hypre_printf(" %2d %2d", one, minus_one); + hypre_printf(" %2d %2d", one, minus_one); hypre_printf( "\n"); hypre_printf( " Post-CG relaxation (up):"); for (j = 0; j < num_grid_sweeps[2]; j++) - hypre_printf(" %2d %2d", minus_one, one); + hypre_printf(" %2d %2d", minus_one, one); hypre_printf( "\n"); hypre_printf( " Coarsest grid:"); for (j = 0; j < num_grid_sweeps[3]; j++) - hypre_printf(" %2d", zero); + hypre_printf(" %2d", zero); hypre_printf( "\n\n"); } - else + else { hypre_printf( " Pre-CG relaxation (down):"); for (j = 0; j < num_grid_sweeps[1]; j++) - hypre_printf(" %2d", zero); + hypre_printf(" %2d", zero); hypre_printf( "\n"); hypre_printf( " Post-CG relaxation (up):"); for (j = 0; j < num_grid_sweeps[2]; j++) - hypre_printf(" %2d", zero); + hypre_printf(" %2d", zero); hypre_printf( "\n"); hypre_printf( " Coarsest grid:"); for (j = 0; j < num_grid_sweeps[3]; j++) - hypre_printf(" %2d", zero); + hypre_printf(" %2d", zero); hypre_printf( "\n\n"); } } if (smooth_type == 6) for (j=0; j < smooth_num_levels; j++) hypre_printf( " Schwarz Relaxation Weight %f level %d\n", - hypre_ParAMGDataSchwarzRlxWeight(amg_data),j); + hypre_ParAMGDataSchwarzRlxWeight(amg_data),j); if (smooth_type == 7) for (j=0; j < smooth_num_levels; j++) hypre_printf( " Pilut smoother level %d\n", j); @@ -1151,10 +1210,10 @@ hypre_printf( " Euclid smoother level %d\n", j); for (j=0; j < num_levels; j++) if (relax_weight[j] != 1) - hypre_printf( " Relaxation Weight %f level %d\n",relax_weight[j],j); + hypre_printf( " Relaxation Weight %f level %d\n",relax_weight[j],j); for (j=0; j < num_levels; j++) if (omega[j] != 1) - hypre_printf( " Outer relaxation weight %f level %d\n",omega[j],j); + hypre_printf( " Outer relaxation weight %f level %d\n",omega[j],j); } hypre_TFree(num_coeffs, HYPRE_MEMORY_HOST); @@ -1162,9 +1221,9 @@ hypre_TFree(num_variables, HYPRE_MEMORY_HOST); hypre_TFree(send_buff, HYPRE_MEMORY_HOST); hypre_TFree(gather_buff, HYPRE_MEMORY_HOST); - + return(0); -} +} @@ -1175,127 +1234,137 @@ HYPRE_Int hypre_BoomerAMGWriteSolverParams(void* data) -{ +{ hypre_ParAMGData *amg_data = (hypre_ParAMGData*) data; - + /* amg solve params */ - HYPRE_Int num_levels; + HYPRE_Int num_levels; HYPRE_Int max_iter; - HYPRE_Int cycle_type; - HYPRE_Int *num_grid_sweeps; - HYPRE_Int *grid_relax_type; - HYPRE_Int **grid_relax_points; + HYPRE_Int cycle_type; + HYPRE_Int fcycle; + HYPRE_Int *num_grid_sweeps; + HYPRE_Int *grid_relax_type; + HYPRE_Int **grid_relax_points; HYPRE_Int relax_order; HYPRE_Real *relax_weight; HYPRE_Real *omega; HYPRE_Real tol; - HYPRE_Int smooth_type; - HYPRE_Int smooth_num_levels; + HYPRE_Int smooth_type; + HYPRE_Int smooth_num_levels; /* amg output params */ HYPRE_Int amg_print_level; - + HYPRE_Int j; HYPRE_Int one = 1; HYPRE_Int minus_one = -1; HYPRE_Int zero = 0; - - + + /*---------------------------------------------------------- * Get the amg_data data *----------------------------------------------------------*/ num_levels = hypre_ParAMGDataNumLevels(amg_data); max_iter = hypre_ParAMGDataMaxIter(amg_data); - cycle_type = hypre_ParAMGDataCycleType(amg_data); - num_grid_sweeps = hypre_ParAMGDataNumGridSweeps(amg_data); + cycle_type = hypre_ParAMGDataCycleType(amg_data); + fcycle = hypre_ParAMGDataFCycle(amg_data); + num_grid_sweeps = hypre_ParAMGDataNumGridSweeps(amg_data); grid_relax_type = hypre_ParAMGDataGridRelaxType(amg_data); grid_relax_points = hypre_ParAMGDataGridRelaxPoints(amg_data); relax_order = hypre_ParAMGDataRelaxOrder(amg_data); - relax_weight = hypre_ParAMGDataRelaxWeight(amg_data); - omega = hypre_ParAMGDataOmega(amg_data); - smooth_type = hypre_ParAMGDataSmoothType(amg_data); - smooth_num_levels = hypre_ParAMGDataSmoothNumLevels(amg_data); + relax_weight = hypre_ParAMGDataRelaxWeight(amg_data); + omega = hypre_ParAMGDataOmega(amg_data); + smooth_type = hypre_ParAMGDataSmoothType(amg_data); + smooth_num_levels = hypre_ParAMGDataSmoothNumLevels(amg_data); tol = hypre_ParAMGDataTol(amg_data); - + amg_print_level = hypre_ParAMGDataPrintLevel(amg_data); - + /*---------------------------------------------------------- * AMG info *----------------------------------------------------------*/ - + if (amg_print_level == 1 || amg_print_level == 3) - { + { hypre_printf("\n\nBoomerAMG SOLVER PARAMETERS:\n\n"); hypre_printf( " Maximum number of cycles: %d \n",max_iter); - hypre_printf( " Stopping Tolerance: %e \n",tol); - hypre_printf( " Cycle type (1 = V, 2 = W, etc.): %d\n\n", cycle_type); + hypre_printf( " Stopping Tolerance: %e \n",tol); + if (fcycle) + { + hypre_printf( " Full Multigrid. Cycle type (1 = V, 2 = W, etc.): %d\n\n", cycle_type); + } + else + { + hypre_printf( " Cycle type (1 = V, 2 = W, etc.): %d\n\n", cycle_type); + } hypre_printf( " Relaxation Parameters:\n"); hypre_printf( " Visiting Grid: down up coarse\n"); hypre_printf( " Number of sweeps: %4d %2d %4d \n", - num_grid_sweeps[1], - num_grid_sweeps[2],num_grid_sweeps[3]); + num_grid_sweeps[1], + num_grid_sweeps[2],num_grid_sweeps[3]); hypre_printf( " Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: %4d %2d %4d \n", - grid_relax_type[1], - grid_relax_type[2],grid_relax_type[3]); + grid_relax_type[1], + grid_relax_type[2],grid_relax_type[3]); hypre_printf( " Point types, partial sweeps (1=C, -1=F):\n"); if (grid_relax_points) { hypre_printf( " Pre-CG relaxation (down):"); for (j = 0; j < num_grid_sweeps[1]; j++) - hypre_printf(" %2d", grid_relax_points[1][j]); + hypre_printf(" %2d", grid_relax_points[1][j]); hypre_printf( "\n"); hypre_printf( " Post-CG relaxation (up):"); for (j = 0; j < num_grid_sweeps[2]; j++) - hypre_printf(" %2d", grid_relax_points[2][j]); + hypre_printf(" %2d", grid_relax_points[2][j]); hypre_printf( "\n"); hypre_printf( " Coarsest grid:"); for (j = 0; j < num_grid_sweeps[3]; j++) - hypre_printf(" %2d", grid_relax_points[3][j]); + hypre_printf(" %2d", grid_relax_points[3][j]); hypre_printf( "\n\n"); } else if (relax_order == 1) { hypre_printf( " Pre-CG relaxation (down):"); for (j = 0; j < num_grid_sweeps[1]; j++) - hypre_printf(" %2d %2d", one, minus_one); + hypre_printf(" %2d %2d", one, minus_one); hypre_printf( "\n"); hypre_printf( " Post-CG relaxation (up):"); for (j = 0; j < num_grid_sweeps[2]; j++) - hypre_printf(" %2d %2d", minus_one, one); + hypre_printf(" %2d %2d", minus_one, one); hypre_printf( "\n"); hypre_printf( " Coarsest grid:"); for (j = 0; j < num_grid_sweeps[3]; j++) - hypre_printf(" %2d", zero); + hypre_printf(" %2d", zero); hypre_printf( "\n\n"); } - else + else { hypre_printf( " Pre-CG relaxation (down):"); for (j = 0; j < num_grid_sweeps[1]; j++) - hypre_printf(" %2d", zero); + hypre_printf(" %2d", zero); hypre_printf( "\n"); hypre_printf( " Post-CG relaxation (up):"); for (j = 0; j < num_grid_sweeps[2]; j++) - hypre_printf(" %2d", zero); + hypre_printf(" %2d", zero); hypre_printf( "\n"); hypre_printf( " Coarsest grid:"); for (j = 0; j < num_grid_sweeps[3]; j++) - hypre_printf(" %2d", zero); + hypre_printf(" %2d", zero); hypre_printf( "\n\n"); } if (smooth_type == 6) for (j=0; j < smooth_num_levels; j++) hypre_printf( " Schwarz Relaxation Weight %f level %d\n", - hypre_ParAMGDataSchwarzRlxWeight(amg_data),j); + hypre_ParAMGDataSchwarzRlxWeight(amg_data),j); for (j=0; j < num_levels; j++) if (relax_weight[j] != 1) - hypre_printf( " Relaxation Weight %f level %d\n",relax_weight[j],j); + hypre_printf( " Relaxation Weight %f level %d\n",relax_weight[j],j); for (j=0; j < num_levels; j++) if (omega[j] != 1) - hypre_printf( " Outer relaxation weight %f level %d\n",omega[j],j); + hypre_printf( " Outer relaxation weight %f level %d\n",omega[j],j); hypre_printf( " Output flag (print_level): %d \n", amg_print_level); } - + return 0; } + diff -Nru hypre-2.16.0/src/parcsr_ls/par_strength.c hypre-2.18.2/src/parcsr_ls/par_strength.c --- hypre-2.16.0/src/parcsr_ls/par_strength.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_strength.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -71,7 +63,7 @@ _hypre_parcsr_ls.h @return Error code. - + @param A [IN] coefficient matrix @param strength_threshold [IN] @@ -80,12 +72,12 @@ parameter used to modify definition of strength for diagonal dominant matrices @param S_ptr [OUT] strength matrix - + @see */ /*--------------------------------------------------------------------------*/ HYPRE_Int -hypre_BoomerAMGCreateS(hypre_ParCSRMatrix *A, +hypre_BoomerAMGCreateSHost(hypre_ParCSRMatrix *A, HYPRE_Real strength_threshold, HYPRE_Real max_row_sum, HYPRE_Int num_functions, @@ -116,7 +108,7 @@ HYPRE_Int num_nonzeros_diag; HYPRE_Int num_nonzeros_offd = 0; HYPRE_Int num_cols_offd = 0; - + hypre_ParCSRMatrix *S; hypre_CSRMatrix *S_diag; HYPRE_Int *S_diag_i; @@ -126,10 +118,10 @@ HYPRE_Int *S_offd_i = NULL; HYPRE_Int *S_offd_j = NULL; /* HYPRE_Real *S_offd_data; */ - + HYPRE_Real diag, row_scale, row_sum; HYPRE_Int i, jA, jS; - + HYPRE_Int ierr = 0; HYPRE_Int *dof_func_offd; @@ -138,7 +130,7 @@ HYPRE_Int index, start, j; HYPRE_Int *prefix_sum_workspace; - + /*-------------------------------------------------------------- * Compute a ParCSR strength matrix, S. * @@ -160,8 +152,8 @@ num_nonzeros_offd = A_offd_i[num_variables]; S = hypre_ParCSRMatrixCreate(comm, global_num_vars, global_num_vars, - row_starts, row_starts, - num_cols_offd, num_nonzeros_diag, num_nonzeros_offd); + row_starts, row_starts, + num_cols_offd, num_nonzeros_diag, num_nonzeros_offd); /* row_starts is owned by A, col_starts = row_starts */ hypre_ParCSRMatrixSetRowStartsOwner(S,0); S_diag = hypre_ParCSRMatrixDiag(S); @@ -187,7 +179,9 @@ HYPRE_BigInt *col_map_offd_S = hypre_TAlloc(HYPRE_BigInt, num_cols_offd, HYPRE_MEMORY_HOST); hypre_ParCSRMatrixColMapOffd(S) = col_map_offd_S; if (num_functions > 1) + { dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); + } S_offd_j = hypre_TAlloc(HYPRE_Int, num_nonzeros_offd, HYPRE_MEMORY_HOST); @@ -196,39 +190,39 @@ #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif for (i = 0; i < num_cols_offd; i++) + { col_map_offd_S[i] = col_map_offd_A[i]; + } } - /*------------------------------------------------------------------- * Get the dof_func data for the off-processor columns *-------------------------------------------------------------------*/ - if (!comm_pkg) { hypre_MatvecCommPkgCreate(A); - comm_pkg = hypre_ParCSRMatrixCommPkg(A); + comm_pkg = hypre_ParCSRMatrixCommPkg(A); } num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); if (num_functions > 1) { - int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, - num_sends), HYPRE_MEMORY_HOST); + int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + HYPRE_MEMORY_HOST); index = 0; for (i = 0; i < num_sends; i++) { start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] - = dof_func[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + { + int_buf_data[index++] = dof_func[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } } - - comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, - dof_func_offd); - hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, dof_func_offd); + + hypre_ParCSRCommHandleDestroy(comm_handle); hypre_TFree(int_buf_data, HYPRE_MEMORY_HOST); } @@ -236,7 +230,6 @@ prefix_sum_workspace = hypre_TAlloc(HYPRE_Int, 2*(hypre_NumThreads() + 1), HYPRE_MEMORY_HOST); /* give S same nonzero structure as A */ - #ifdef HYPRE_USING_OPENMP #pragma omp parallel private(i,diag,row_scale,row_sum,jA,jS) #endif @@ -352,9 +345,9 @@ else { if (num_functions > 1) - { - if (diag < 0) - { + { + if (diag < 0) + { for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) { if (A_diag_data[jA] <= strength_threshold * row_scale @@ -414,8 +407,8 @@ } /* num_functions > 1 */ else { - if (diag < 0) - { + if (diag < 0) + { for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) { if (A_diag_data[jA] <= strength_threshold * row_scale) @@ -517,6 +510,9 @@ hypre_CSRMatrixJ(S_diag) = S_diag_j; hypre_CSRMatrixJ(S_offd) = S_offd_j; + hypre_CSRMatrixMemoryLocation(S_diag) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixMemoryLocation(S_offd) = HYPRE_MEMORY_HOST; + hypre_ParCSRMatrixCommPkg(S) = NULL; *S_ptr = S; @@ -533,14 +529,55 @@ return (ierr); } -/* - Create Strength matrix from CF marker array data. Provides a more +/* ----------------------------------------------------------------------- */ +HYPRE_Int +hypre_BoomerAMGCreateS(hypre_ParCSRMatrix *A, + HYPRE_Real strength_threshold, + HYPRE_Real max_row_sum, + HYPRE_Int num_functions, + HYPRE_Int *dof_func, + hypre_ParCSRMatrix **S_ptr) +{ +#if defined(HYPRE_USING_CUDA) + //hypre_SetExecPolicy(HYPRE_EXEC_DEVICE); +#endif + + HYPRE_Int exec = hypre_GetExecPolicy1( hypre_CSRMatrixMemoryLocation(hypre_ParCSRMatrixDiag(A)) ); + + hypre_assert(exec != HYPRE_EXEC_UNSET); + + HYPRE_Int ierr = 0; + + if (exec == HYPRE_EXEC_HOST) + { + /* printf(" createS Host \n");*/ + ierr = hypre_BoomerAMGCreateSHost(A,strength_threshold,max_row_sum,num_functions,dof_func,S_ptr); + } +#if defined(HYPRE_USING_CUDA) + else + { + /* printf(" createS Device \n");*/ + ierr = hypre_BoomerAMGCreateSDevice(A,strength_threshold,max_row_sum,num_functions,dof_func,S_ptr); + } +#endif + +#if defined(HYPRE_USING_CUDA) + //hypre_SetExecPolicy(HYPRE_EXEC_HOST); +#endif + + return ierr; +} + + +/* ----------------------------------------------------------------------- */ +/* + Create Strength matrix from CF marker array data. Provides a more general form to build S for specific nodes of the 'global' matrix - (for example, F points or A_FF part), given the entire matrix. + (for example, F points or A_FF part), given the entire matrix. These nodes have the SMRK tag. - - Currently assumes num_functions == 1, hence separate routine is used - for now. Could possibly be merged with BoomerAMGCreateS() to yield a + + Currently assumes num_functions == 1, hence separate routine is used + for now. Could possibly be merged with BoomerAMGCreateS() to yield a more general function. */ HYPRE_Int @@ -574,7 +611,7 @@ HYPRE_Int num_nonzeros_diag; HYPRE_Int num_nonzeros_offd = 0; HYPRE_Int num_cols_offd = 0; - + hypre_ParCSRMatrix *S; hypre_CSRMatrix *S_diag; HYPRE_Int *S_diag_i; @@ -584,14 +621,14 @@ HYPRE_Int *S_offd_i = NULL; HYPRE_Int *S_offd_j = NULL; /* HYPRE_Real *S_offd_data; */ - + HYPRE_Real diag, row_scale, row_sum; HYPRE_Int i, jj, jA, jS; - + HYPRE_Int ierr = 0; HYPRE_Int *prefix_sum_workspace; - + /*-------------------------------------------------------------- * Compute a ParCSR strength matrix, S. * @@ -672,7 +709,7 @@ { hypre_MatvecCommPkgCreate(A); - comm_pkg = hypre_ParCSRMatrixCommPkg(A); + comm_pkg = hypre_ParCSRMatrixCommPkg(A); } /*HYPRE_Int prefix_sum_workspace[2*(hypre_NumThreads() + 1)];*/ @@ -729,7 +766,7 @@ if (CF_marker[jj] == SMRK) { row_scale = hypre_min(row_scale, A_diag_data[jA]); row_sum += A_diag_data[jA]; - } + } } for (jA = A_offd_i[i]; jA < A_offd_i[i+1]; jA++) { @@ -764,8 +801,8 @@ } else { - if (diag < 0) - { + if (diag < 0) + { for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) { jj = A_diag_j[jA]; @@ -909,6 +946,9 @@ hypre_CSRMatrixJ(S_diag) = S_diag_j; hypre_CSRMatrixJ(S_offd) = S_offd_j; + hypre_CSRMatrixMemoryLocation(S_diag) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixMemoryLocation(S_offd) = HYPRE_MEMORY_HOST; + hypre_ParCSRMatrixCommPkg(S) = NULL; *S_ptr = S; @@ -971,7 +1011,7 @@ _hypre_parcsr_ls.h @return Error code. - + @param A [IN] coefficient matrix @param strength_threshold [IN] @@ -980,7 +1020,7 @@ parameter used to modify definition of strength for diagonal dominant matrices @param S_ptr [OUT] strength matrix - + @see */ /*--------------------------------------------------------------------------*/ @@ -1012,7 +1052,7 @@ HYPRE_Int num_nonzeros_diag; HYPRE_Int num_nonzeros_offd = 0; HYPRE_Int num_cols_offd = 0; - + hypre_ParCSRMatrix *S; hypre_CSRMatrix *S_diag; HYPRE_Int *S_diag_i; @@ -1022,17 +1062,17 @@ HYPRE_Int *S_offd_i = NULL; HYPRE_Int *S_offd_j = NULL; /* HYPRE_Real *S_offd_data; */ - + HYPRE_Real diag, row_scale, row_sum; HYPRE_Int i, jA, jS; - + HYPRE_Int ierr = 0; HYPRE_Int *dof_func_offd; HYPRE_Int num_sends; HYPRE_Int *int_buf_data; HYPRE_Int index, start, j; - + /*-------------------------------------------------------------- * Compute a ParCSR strength matrix, S. * @@ -1056,6 +1096,7 @@ S = hypre_ParCSRMatrixCreate(comm, global_num_vars, global_num_vars, row_starts, row_starts, num_cols_offd, num_nonzeros_diag, num_nonzeros_offd); + /* row_starts is owned by A, col_starts = row_starts */ hypre_ParCSRMatrixSetRowStartsOwner(S,0); S_diag = hypre_ParCSRMatrixDiag(S); @@ -1068,6 +1109,9 @@ S_diag_j = hypre_CSRMatrixJ(S_diag); S_offd_i = hypre_CSRMatrixI(S_offd); + hypre_CSRMatrixMemoryLocation(S_diag) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixMemoryLocation(S_offd) = HYPRE_MEMORY_HOST; + dof_func_offd = NULL; if (num_cols_offd) @@ -1089,27 +1133,26 @@ { hypre_MatvecCommPkgCreate(A); - comm_pkg = hypre_ParCSRMatrixCommPkg(A); + comm_pkg = hypre_ParCSRMatrixCommPkg(A); } num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); if (num_functions > 1) { - int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, + int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); index = 0; for (i = 0; i < num_sends; i++) { start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); for (j=start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) - int_buf_data[index++] + int_buf_data[index++] = dof_func[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; } - - comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, - dof_func_offd); - hypre_ParCSRCommHandleDestroy(comm_handle); + comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data, dof_func_offd); + + hypre_ParCSRCommHandleDestroy(comm_handle); hypre_TFree(int_buf_data, HYPRE_MEMORY_HOST); } @@ -1125,7 +1168,7 @@ /* compute scaling factor and row sum */ row_scale = 0.0; - row_sum = diag; + row_sum = fabs(diag); if (num_functions > 1) { for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) @@ -1160,8 +1203,8 @@ } /* compute row entries of S */ - S_diag_j[A_diag_i[i]] = -1; - if ((fabs(row_sum) > fabs(diag)*max_row_sum) && (max_row_sum < 1.0)) + S_diag_j[A_diag_i[i]] = -1; /* reject diag entry */ + if ( fabs(row_sum) < fabs(diag)*(2.0-max_row_sum) && max_row_sum < 1.0 ) { /* make all dependencies weak */ for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) @@ -1176,7 +1219,7 @@ else { if (num_functions > 1) - { + { for (jA = A_diag_i[i]+1; jA < A_diag_i[i+1]; jA++) { if (fabs(A_diag_data[jA]) <= strength_threshold * row_scale @@ -1269,7 +1312,7 @@ /*--------------------------------------------------------------------------*/ HYPRE_Int -hypre_BoomerAMGCreateSCommPkg(hypre_ParCSRMatrix *A, +hypre_BoomerAMGCreateSCommPkg(hypre_ParCSRMatrix *A, hypre_ParCSRMatrix *S, HYPRE_Int **col_offd_S_to_A_ptr) { @@ -1281,7 +1324,7 @@ hypre_ParCSRCommHandle *comm_handle; hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); HYPRE_BigInt *col_map_offd_A = hypre_ParCSRMatrixColMapOffd(A); - + hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); @@ -1289,11 +1332,11 @@ HYPRE_BigInt *col_map_offd_S = hypre_ParCSRMatrixColMapOffd(S); HYPRE_Int *recv_procs_A = hypre_ParCSRCommPkgRecvProcs(comm_pkg_A); - HYPRE_Int *recv_vec_starts_A = + HYPRE_Int *recv_vec_starts_A = hypre_ParCSRCommPkgRecvVecStarts(comm_pkg_A); - HYPRE_Int *send_procs_A = + HYPRE_Int *send_procs_A = hypre_ParCSRCommPkgSendProcs(comm_pkg_A); - HYPRE_Int *send_map_starts_A = + HYPRE_Int *send_map_starts_A = hypre_ParCSRCommPkgSendMapStarts(comm_pkg_A); HYPRE_Int *recv_procs_S; HYPRE_Int *recv_vec_starts_S; @@ -1308,12 +1351,12 @@ HYPRE_Int *recv_change; HYPRE_Int num_variables = hypre_CSRMatrixNumRows(S_diag); - HYPRE_Int num_cols_offd_A = hypre_CSRMatrixNumCols(A_offd); + HYPRE_Int num_cols_offd_A = hypre_CSRMatrixNumCols(A_offd); HYPRE_Int num_cols_offd_S; HYPRE_Int i, j, jcol; HYPRE_Int proc, cnt, proc_cnt, total_nz; HYPRE_BigInt first_row; - + HYPRE_Int ierr = 0; HYPRE_Int num_sends_A = hypre_ParCSRCommPkgNumSends(comm_pkg_A); @@ -1356,7 +1399,7 @@ } - num_cols_offd_S = cnt; + num_cols_offd_S = cnt; recv_change = NULL; recv_procs_S = NULL; send_change = NULL; @@ -1418,7 +1461,7 @@ recv_vec_starts_S[i] = recv_vec_starts_A[i]; } recv_vec_starts_S[num_recvs_A] = recv_vec_starts_A[num_recvs_A]; - } + } requests = hypre_CTAlloc(hypre_MPI_Request, num_sends_A+num_recvs_A, HYPRE_MEMORY_HOST); j=0; @@ -1492,7 +1535,7 @@ send_map_elmts_S[i] = (HYPRE_Int)(big_send_map_elmts_S[i]-first_row); hypre_ParCSRCommPkgSendMapElmts(comm_pkg_S) = send_map_elmts_S; - + hypre_ParCSRMatrixCommPkg(S) = comm_pkg_S; hypre_ParCSRMatrixColMapOffd(S) = col_map_offd_S; hypre_CSRMatrixNumCols(S_offd) = num_cols_offd_S; @@ -1504,15 +1547,16 @@ *col_offd_S_to_A_ptr = col_offd_S_to_A; return ierr; -} +} /*-------------------------------------------------------------------------- * hypre_BoomerAMGCreate2ndS : creates strength matrix on coarse points * for second coarsening pass in aggressive coarsening (S*S+2S) *--------------------------------------------------------------------------*/ -HYPRE_Int hypre_BoomerAMGCreate2ndS( hypre_ParCSRMatrix *S, HYPRE_Int *CF_marker, - HYPRE_Int num_paths, HYPRE_BigInt *coarse_row_starts, hypre_ParCSRMatrix **C_ptr) +HYPRE_Int hypre_BoomerAMGCreate2ndS( hypre_ParCSRMatrix *S, HYPRE_Int *CF_marker, + HYPRE_Int num_paths, HYPRE_BigInt *coarse_row_starts, + hypre_ParCSRMatrix **C_ptr) { #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_CREATE_2NDS] -= hypre_MPI_Wtime(); @@ -1524,18 +1568,18 @@ hypre_ParCSRCommHandle *comm_handle; hypre_CSRMatrix *S_diag = hypre_ParCSRMatrixDiag(S); - + HYPRE_Int *S_diag_i = hypre_CSRMatrixI(S_diag); HYPRE_Int *S_diag_j = hypre_CSRMatrixJ(S_diag); hypre_CSRMatrix *S_offd = hypre_ParCSRMatrixOffd(S); - + HYPRE_Int *S_offd_i = hypre_CSRMatrixI(S_offd); HYPRE_Int *S_offd_j = hypre_CSRMatrixJ(S_offd); HYPRE_Int num_cols_diag_S = hypre_CSRMatrixNumCols(S_diag); HYPRE_Int num_cols_offd_S = hypre_CSRMatrixNumCols(S_offd); - + hypre_ParCSRMatrix *S2; HYPRE_BigInt *col_map_offd_C = NULL; @@ -1552,7 +1596,7 @@ HYPRE_Int *C_offd_j=NULL; HYPRE_Int num_cols_offd_C = 0; - + HYPRE_Int *S_ext_diag_i = NULL; HYPRE_Int *S_ext_diag_j = NULL; HYPRE_Int S_ext_diag_size = 0; @@ -1586,7 +1630,7 @@ HYPRE_Int i1, i2, i3; HYPRE_BigInt big_i1; HYPRE_Int jj1, jj2, jrow, j_cnt; - + /*HYPRE_Int cnt, cnt_offd, cnt_diag;*/ HYPRE_Int num_procs, my_id; HYPRE_Int index; @@ -1609,7 +1653,7 @@ /*----------------------------------------------------------------------- * Extract S_ext, i.e. portion of B that is stored on neighbor procs - * and needed locally for matrix matrix product + * and needed locally for matrix matrix product *-----------------------------------------------------------------------*/ hypre_MPI_Comm_size(comm, &num_procs); @@ -1699,7 +1743,7 @@ comm_handle = hypre_ParCSRCommHandleCreate( 21, comm_pkg, big_int_buf_data, fine_to_coarse_offd); - + hypre_ParCSRCommHandleDestroy(comm_handle); int_buf_data = hypre_TAlloc(HYPRE_Int, end, HYPRE_MEMORY_HOST); @@ -1710,10 +1754,10 @@ { int_buf_data[index - begin] = CF_marker[send_map_elmts[index]]; } - + comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, int_buf_data, CF_marker_offd); - + hypre_ParCSRCommHandleDestroy(comm_handle); hypre_TFree(int_buf_data, HYPRE_MEMORY_HOST); hypre_TFree(big_int_buf_data, HYPRE_MEMORY_HOST); @@ -1746,19 +1790,19 @@ S_int_i[j - begin + 1] = index; num_nonzeros += S_int_i[j - begin + 1]; } - + /*-------------------------------------------------------------------------- * initialize communication *--------------------------------------------------------------------------*/ if (num_procs > 1) - comm_handle = + comm_handle = hypre_ParCSRCommHandleCreate(11,comm_pkg,&S_int_i[1],&S_ext_i[1]); if (num_nonzeros) S_int_j = hypre_TAlloc(HYPRE_BigInt, num_nonzeros, HYPRE_MEMORY_HOST); tmp_send_map_starts = hypre_CTAlloc(HYPRE_Int, num_sends+1, HYPRE_MEMORY_HOST); tmp_recv_vec_starts = hypre_CTAlloc(HYPRE_Int, num_recvs+1, HYPRE_MEMORY_HOST); - + tmp_send_map_starts[0] = 0; j_cnt = 0; for (i=0; i < num_sends; i++) @@ -1779,17 +1823,17 @@ } tmp_send_map_starts[i+1] = j_cnt; } - + tmp_comm_pkg = hypre_CTAlloc(hypre_ParCSRCommPkg, 1, HYPRE_MEMORY_HOST); hypre_ParCSRCommPkgComm(tmp_comm_pkg) = comm; hypre_ParCSRCommPkgNumSends(tmp_comm_pkg) = num_sends; hypre_ParCSRCommPkgNumRecvs(tmp_comm_pkg) = num_recvs; - hypre_ParCSRCommPkgSendProcs(tmp_comm_pkg) = + hypre_ParCSRCommPkgSendProcs(tmp_comm_pkg) = hypre_ParCSRCommPkgSendProcs(comm_pkg); - hypre_ParCSRCommPkgRecvProcs(tmp_comm_pkg) = + hypre_ParCSRCommPkgRecvProcs(tmp_comm_pkg) = hypre_ParCSRCommPkgRecvProcs(comm_pkg); hypre_ParCSRCommPkgSendMapStarts(tmp_comm_pkg) = tmp_send_map_starts; - + hypre_ParCSRCommHandleDestroy(comm_handle); comm_handle = NULL; /*-------------------------------------------------------------------------- @@ -1800,9 +1844,9 @@ for (i=0; i < recv_vec_starts[num_recvs]; i++) S_ext_i[i+1] += S_ext_i[i]; - + num_nonzeros = S_ext_i[recv_vec_starts[num_recvs]]; - + if (num_nonzeros) S_ext_j = hypre_TAlloc(HYPRE_BigInt, num_nonzeros, HYPRE_MEMORY_HOST); tmp_recv_vec_starts[0] = 0; @@ -1810,7 +1854,7 @@ tmp_recv_vec_starts[i+1] = S_ext_i[recv_vec_starts[i+1]]; hypre_ParCSRCommPkgRecvVecStarts(tmp_comm_pkg) = tmp_recv_vec_starts; - + comm_handle = hypre_ParCSRCommHandleCreate(21,tmp_comm_pkg,S_int_j,S_ext_j); hypre_ParCSRCommHandleDestroy(comm_handle); comm_handle = NULL; @@ -1833,7 +1877,6 @@ S_ext_offd_i = hypre_TAlloc(HYPRE_Int, num_cols_offd_S+1, HYPRE_MEMORY_HOST); S_ext_offd_i[0] = 0; - hypre_UnorderedBigIntSet found_set; hypre_UnorderedBigIntSetCreate(&found_set, S_ext_i[num_cols_offd_S] + num_cols_offd_S, 16*hypre_NumThreads()); @@ -1888,8 +1931,8 @@ { big_i1 = S_ext_j[j]; if (big_i1 < my_first_cpt || big_i1 > my_last_cpt) - S_big_offd_j[S_ext_offd_size_private++] = big_i1; - //S_ext_offd_j[S_ext_offd_size_private++] = big_i1; + S_big_offd_j[S_ext_offd_size_private++] = big_i1; + //S_ext_offd_j[S_ext_offd_size_private++] = big_i1; else S_ext_diag_j[S_ext_diag_size_private++] = (HYPRE_Int)(big_i1 - my_first_cpt); } @@ -1899,7 +1942,7 @@ } // omp parallel temp = hypre_UnorderedBigIntSetCopyToArray(&found_set, &num_cols_offd_C); - + hypre_UnorderedBigIntSetDestroy(&found_set); hypre_TFree(S_ext_i, HYPRE_MEMORY_HOST); @@ -2114,11 +2157,11 @@ for (ic = ic_begin; ic < ic_end; ic++) { /*-------------------------------------------------------------------- - * Set marker for diagonal entry, C_{i1,i1} (for square matrices). + * Set marker for diagonal entry, C_{i1,i1} (for square matrices). *--------------------------------------------------------------------*/ i1 = coarse_to_fine[ic]; - + HYPRE_Int jj_row_begin_diag = num_nonzeros_diag; HYPRE_Int jj_row_begin_offd = num_nonzeros_offd; @@ -2206,11 +2249,11 @@ for (ic = ic_begin; ic < ic_end; ic++) { /*-------------------------------------------------------------------- - * Set marker for diagonal entry, C_{i1,i1} (for square matrices). + * Set marker for diagonal entry, C_{i1,i1} (for square matrices). *--------------------------------------------------------------------*/ i1 = coarse_to_fine[ic]; - + HYPRE_Int jj_row_begin_diag = jj_count_diag; HYPRE_Int jj_row_begin_offd = jj_count_offd; @@ -2400,11 +2443,11 @@ for (ic = ic_begin; ic < ic_end; ic++) { /*-------------------------------------------------------------------- - * Set marker for diagonal entry, C_{i1,i1} (for square matrices). + * Set marker for diagonal entry, C_{i1,i1} (for square matrices). *--------------------------------------------------------------------*/ i1 = coarse_to_fine[ic]; - + HYPRE_Int jj_row_begin_diag = num_nonzeros_diag; HYPRE_Int jj_row_begin_offd = num_nonzeros_offd; @@ -2495,11 +2538,11 @@ for (ic = ic_begin; ic < ic_end; ic++) { /*-------------------------------------------------------------------- - * Set marker for diagonal entry, C_{i1,i1} (for square matrices). + * Set marker for diagonal entry, C_{i1,i1} (for square matrices). *--------------------------------------------------------------------*/ i1 = coarse_to_fine[ic]; - + HYPRE_Int jj_row_begin_diag = jj_count_diag; HYPRE_Int jj_row_begin_offd = jj_count_offd; @@ -2633,23 +2676,23 @@ } /* num_paths > 1 */ } /* omp parallel */ - S2 = hypre_ParCSRMatrixCreate(comm, global_num_coarse, + S2 = hypre_ParCSRMatrixCreate(comm, global_num_coarse, global_num_coarse, coarse_row_starts, coarse_row_starts, num_cols_offd_C, C_diag_i[num_coarse], C_offd_i[num_coarse]); hypre_ParCSRMatrixOwnsRowStarts(S2) = 0; C_diag = hypre_ParCSRMatrixDiag(S2); - hypre_CSRMatrixI(C_diag) = C_diag_i; - if (C_diag_i[num_coarse]) hypre_CSRMatrixJ(C_diag) = C_diag_j; + hypre_CSRMatrixI(C_diag) = C_diag_i; + if (C_diag_i[num_coarse]) hypre_CSRMatrixJ(C_diag) = C_diag_j; C_offd = hypre_ParCSRMatrixOffd(S2); - hypre_CSRMatrixI(C_offd) = C_offd_i; + hypre_CSRMatrixI(C_offd) = C_offd_i; hypre_ParCSRMatrixOffd(S2) = C_offd; if (num_cols_offd_C) { - if (C_offd_i[num_coarse]) hypre_CSRMatrixJ(C_offd) = C_offd_j; + if (C_offd_i[num_coarse]) hypre_CSRMatrixJ(C_offd) = C_offd_j; hypre_ParCSRMatrixColMapOffd(S2) = col_map_offd_C; } @@ -2665,8 +2708,8 @@ hypre_TFree(S_marker_array, HYPRE_MEMORY_HOST); hypre_TFree(S_marker_offd_array, HYPRE_MEMORY_HOST); - hypre_TFree(S_marker, HYPRE_MEMORY_HOST); - hypre_TFree(S_marker_offd, HYPRE_MEMORY_HOST); + hypre_TFree(S_marker, HYPRE_MEMORY_HOST); + hypre_TFree(S_marker_offd, HYPRE_MEMORY_HOST); hypre_TFree(S_ext_diag_i, HYPRE_MEMORY_HOST); hypre_TFree(fine_to_coarse, HYPRE_MEMORY_HOST); hypre_TFree(coarse_to_fine, HYPRE_MEMORY_HOST); @@ -2679,13 +2722,16 @@ { hypre_TFree(S_ext_offd_j, HYPRE_MEMORY_HOST); } - if (num_cols_offd_S) + if (num_cols_offd_S) { hypre_TFree(map_S_to_C, HYPRE_MEMORY_HOST); hypre_TFree(CF_marker_offd, HYPRE_MEMORY_HOST); hypre_TFree(fine_to_coarse_offd, HYPRE_MEMORY_HOST); } + hypre_CSRMatrixMemoryLocation(C_diag) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixMemoryLocation(C_offd) = HYPRE_MEMORY_HOST; + *C_ptr = S2; #ifdef HYPRE_PROFILE @@ -2696,8 +2742,7 @@ hypre_TFree(num_coarse_prefix_sum, HYPRE_MEMORY_HOST); return 0; - -} +} /*-------------------------------------------------------------------------- * hypre_BoomerAMGCorrectCFMarker : corrects CF_marker after aggr. coarsening diff -Nru hypre-2.16.0/src/parcsr_ls/par_strength_device.c hypre-2.18.2/src/parcsr_ls/par_strength_device.c --- hypre-2.16.0/src/parcsr_ls/par_strength_device.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_strength_device.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,356 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#include "_hypre_parcsr_ls.h" + +#if defined(HYPRE_USING_CUDA) + +__global__ void hypre_BoomerAMGCreateS_rowcount( HYPRE_Int nr_of_rows, + HYPRE_Real max_row_sum, HYPRE_Real strength_threshold, + HYPRE_Real* A_diag_data, HYPRE_Int* A_diag_i, HYPRE_Int* A_diag_j, + HYPRE_Real* A_offd_data, HYPRE_Int* A_offd_i, HYPRE_Int* A_offd_j, + HYPRE_Int* S_temp_diag_j, HYPRE_Int* S_temp_offd_j, + HYPRE_Int num_functions, HYPRE_Int* dof_func, HYPRE_Int* dof_func_offd, + HYPRE_Int* jS_diag, HYPRE_Int* jS_offd ); + + +/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +HYPRE_Int +hypre_BoomerAMGCreateSDevice(hypre_ParCSRMatrix *A, + HYPRE_Real strength_threshold, + HYPRE_Real max_row_sum, + HYPRE_Int num_functions, + HYPRE_Int *dof_func, + hypre_ParCSRMatrix **S_ptr) +{ +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_CREATES] -= hypre_MPI_Wtime(); +#endif + + MPI_Comm comm = hypre_ParCSRMatrixComm(A); + hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); + hypre_ParCSRCommHandle *comm_handle; + hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); + HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); + HYPRE_Real *A_diag_data = hypre_CSRMatrixData(A_diag); + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); + HYPRE_Real *A_offd_data = hypre_CSRMatrixData(A_offd); + HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); + HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); + HYPRE_Int *row_starts = hypre_ParCSRMatrixRowStarts(A); + HYPRE_Int num_variables = hypre_CSRMatrixNumRows(A_diag); + HYPRE_Int global_num_vars = hypre_ParCSRMatrixGlobalNumRows(A); + HYPRE_Int num_nonzeros_diag; + HYPRE_Int num_nonzeros_offd; + HYPRE_Int num_cols_offd = hypre_CSRMatrixNumCols(A_offd); + hypre_ParCSRMatrix *S; + hypre_CSRMatrix *S_diag; + HYPRE_Int *S_diag_i; + HYPRE_Int *S_diag_j, *S_temp_diag_j; + /* HYPRE_Real *S_diag_data; */ + hypre_CSRMatrix *S_offd; + HYPRE_Int *S_offd_i = NULL; + HYPRE_Int *S_offd_j = NULL, *S_temp_offd_j = NULL; + /* HYPRE_Real *S_offd_data; */ + HYPRE_Int i; + HYPRE_Int ierr = 0; + HYPRE_Int *dof_func_offd_dev = NULL; + HYPRE_Int *dof_func_dev = NULL; + HYPRE_Int num_sends; + HYPRE_Int index, start, j; + + /*-------------------------------------------------------------- + * Compute a ParCSR strength matrix, S. + * + * For now, the "strength" of dependence/influence is defined in + * the following way: i depends on j if + * aij > hypre_max (k != i) aik, aii < 0 + * or + * aij < hypre_min (k != i) aik, aii >= 0 + * Then S_ij = 1, else S_ij = 0. + * + * NOTE: the entries are negative initially, corresponding + * to "unaccounted-for" dependence. + *----------------------------------------------------------------*/ + + num_nonzeros_diag = hypre_CSRMatrixNumNonzeros(A_diag); + num_nonzeros_offd = hypre_CSRMatrixNumNonzeros(A_offd); + + S_diag_i = hypre_CTAlloc(HYPRE_Int, num_variables+1, HYPRE_MEMORY_SHARED); + S_offd_i = hypre_CTAlloc(HYPRE_Int, num_variables+1, HYPRE_MEMORY_SHARED); + S_temp_diag_j = hypre_CTAlloc(HYPRE_Int, num_nonzeros_diag, HYPRE_MEMORY_DEVICE); + S_temp_offd_j = hypre_CTAlloc(HYPRE_Int, num_nonzeros_offd, HYPRE_MEMORY_DEVICE); + + if (num_functions > 1) + { + dof_func_offd_dev = hypre_CTAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_DEVICE); + } + + /*------------------------------------------------------------------- + * Get the dof_func data for the off-processor columns + *-------------------------------------------------------------------*/ + if (!comm_pkg) + { + hypre_MatvecCommPkgCreate(A); + comm_pkg = hypre_ParCSRMatrixCommPkg(A); + } + + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + + if (num_functions > 1 ) + { + HYPRE_Int *int_buf_data = hypre_CTAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + index = 0; + for (i = 0; i < num_sends; i++) + { + start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++) + { + int_buf_data[index++] = dof_func[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)]; + } + } + comm_handle = hypre_ParCSRCommHandleCreate_v2(11, comm_pkg, HYPRE_MEMORY_HOST, int_buf_data, + HYPRE_MEMORY_DEVICE, dof_func_offd_dev); + hypre_ParCSRCommHandleDestroy(comm_handle); + + hypre_TFree(int_buf_data, HYPRE_MEMORY_HOST); + + dof_func_dev = hypre_CTAlloc(HYPRE_Int, num_variables, HYPRE_MEMORY_DEVICE); + hypre_TMemcpy(dof_func_dev, dof_func, HYPRE_Int, num_variables, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_HOST); + } + + /* count the row nnz of S */ + dim3 bDim = hypre_GetDefaultCUDABlockDimension(); + dim3 gDim = hypre_GetDefaultCUDAGridDimension(num_variables, "warp", bDim); + + HYPRE_CUDA_LAUNCH( hypre_BoomerAMGCreateS_rowcount, gDim, bDim, + num_variables, max_row_sum, strength_threshold, + A_diag_data, A_diag_i, A_diag_j, + A_offd_data, A_offd_i, A_offd_j, + S_temp_diag_j, S_temp_offd_j, + num_functions, dof_func_dev, dof_func_offd_dev, + S_diag_i, S_offd_i ); + + hypreDevice_IntegerExclusiveScan(num_variables + 1, S_diag_i); + hypreDevice_IntegerExclusiveScan(num_variables + 1, S_offd_i); + + HYPRE_Int *tmp, S_num_nonzeros_diag, S_num_nonzeros_offd; + + hypre_TMemcpy(&S_num_nonzeros_diag, &S_diag_i[num_variables], HYPRE_Int, 1, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); + hypre_TMemcpy(&S_num_nonzeros_offd, &S_offd_i[num_variables], HYPRE_Int, 1, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); + + S_diag_j = hypre_TAlloc(HYPRE_Int, S_num_nonzeros_diag, HYPRE_MEMORY_SHARED); + S_offd_j = hypre_TAlloc(HYPRE_Int, S_num_nonzeros_offd, HYPRE_MEMORY_SHARED); + + /* remove those -1's */ + tmp = HYPRE_THRUST_CALL(copy_if, S_temp_diag_j, S_temp_diag_j + num_nonzeros_diag, S_diag_j, is_nonnegative()); + + hypre_assert(S_num_nonzeros_diag == tmp - S_diag_j); + + tmp = HYPRE_THRUST_CALL(copy_if, S_temp_offd_j, S_temp_offd_j + num_nonzeros_offd, S_offd_j, is_nonnegative()); + + hypre_assert(S_num_nonzeros_offd == tmp - S_offd_j); + + S = hypre_ParCSRMatrixCreate(comm, global_num_vars, global_num_vars, row_starts, row_starts, + num_cols_offd, num_nonzeros_diag, num_nonzeros_offd); + + /* row_starts is owned by A, col_starts = row_starts */ + hypre_ParCSRMatrixSetRowStartsOwner(S,0); + + S_diag = hypre_ParCSRMatrixDiag(S); + S_offd = hypre_ParCSRMatrixOffd(S); + + hypre_CSRMatrixNumNonzeros(S_diag) = S_num_nonzeros_diag; + hypre_CSRMatrixNumNonzeros(S_offd) = S_num_nonzeros_offd; + hypre_CSRMatrixI(S_diag) = S_diag_i; + hypre_CSRMatrixJ(S_diag) = S_diag_j; + hypre_CSRMatrixI(S_offd) = S_offd_i; + hypre_CSRMatrixJ(S_offd) = S_offd_j; + + hypre_ParCSRMatrixCommPkg(S) = NULL; + + hypre_ParCSRMatrixColMapOffd(S) = hypre_TAlloc(HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST); + hypre_TMemcpy(hypre_ParCSRMatrixColMapOffd(S), hypre_ParCSRMatrixColMapOffd(A), + HYPRE_Int, num_cols_offd, HYPRE_MEMORY_HOST, HYPRE_MEMORY_HOST); + + *S_ptr = S; + + hypre_TFree(dof_func_offd_dev, HYPRE_MEMORY_DEVICE); + hypre_TFree(dof_func_dev, HYPRE_MEMORY_DEVICE); + hypre_TFree(S_temp_diag_j, HYPRE_MEMORY_DEVICE); + hypre_TFree(S_temp_offd_j, HYPRE_MEMORY_DEVICE); + +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_CREATES] += hypre_MPI_Wtime(); +#endif + + return (ierr); +} + +/*-----------------------------------------------------------------------*/ + __global__ void hypre_BoomerAMGCreateS_rowcount( HYPRE_Int nr_of_rows, + HYPRE_Real max_row_sum, + HYPRE_Real strength_threshold, + HYPRE_Real *A_diag_data, + HYPRE_Int *A_diag_i, + HYPRE_Int *A_diag_j, + HYPRE_Real *A_offd_data, + HYPRE_Int *A_offd_i, + HYPRE_Int *A_offd_j, + HYPRE_Int *S_temp_diag_j, + HYPRE_Int *S_temp_offd_j, + HYPRE_Int num_functions, + HYPRE_Int *dof_func, + HYPRE_Int *dof_func_offd, + HYPRE_Int *jS_diag, + HYPRE_Int *jS_offd ) +{ + /*-----------------------------------------------------------------------*/ + /* + Input: nr_of_rows - Number of rows in matrix (local in processor) + A_diag_data, A_diag_i, A_diag_j - CSR representation of A_diag + A_offd_data, A_offd_i, A_offd_j - CSR representation of A_offd + num_function - Number of degrees of freedom per grid point + dof_func - vector over nonzero elements of A_diag, indicating the degree of freedom + dof_func_offd - vector over nonzero elements of A_offd, indicating the degree of freedom + + Output: S_temp_diag_j - S_diag_j vector before compression, i.e.,elements that are -1 should be removed + S_temp_offd_j - S_offd_j vector before compression, i.e.,elements that are -1 should be removed + jS_diag - S_diag_i vector for compressed S_diag + jS_offd - S_offd_i vector for compressed S_offd + */ + /*-----------------------------------------------------------------------*/ + + HYPRE_Real row_scale = 0.0, row_sum = 0.0, row_max = 0.0, row_min = 0.0, diag = 0.0; + HYPRE_Int row_nnz_diag = 0, row_nnz_offd = 0, diag_pos = -1; + + HYPRE_Int row = hypre_cuda_get_grid_warp_id<1,1>(); + + if (row >= nr_of_rows) + { + return; + } + + HYPRE_Int lane = hypre_cuda_get_lane_id<1>(); + HYPRE_Int p_diag, q_diag, p_offd, q_offd; + + /* diag part */ + if (lane < 2) + { + p_diag = read_only_load(A_diag_i + row + lane); + } + q_diag = __shfl_sync(HYPRE_WARP_FULL_MASK, p_diag, 1); + p_diag = __shfl_sync(HYPRE_WARP_FULL_MASK, p_diag, 0); + + for (HYPRE_Int i = p_diag + lane; __any_sync(HYPRE_WARP_FULL_MASK, i < q_diag); i += HYPRE_WARP_SIZE) + { + if (i < q_diag) + { + const HYPRE_Int col = read_only_load(&A_diag_j[i]); + + if ( num_functions == 1 || row == col || + read_only_load(&dof_func[row]) == read_only_load(&dof_func[col]) ) + { + const HYPRE_Real v = read_only_load(&A_diag_data[i]); + row_sum += v; + if (row == col) + { + diag = v; + diag_pos = i; + } + else + { + row_max = hypre_max(row_max, v); + row_min = hypre_min(row_min, v); + } + } + } + } + + /* offd part */ + if (lane < 2) + { + p_offd = read_only_load(A_offd_i + row + lane); + } + q_offd = __shfl_sync(HYPRE_WARP_FULL_MASK, p_offd, 1); + p_offd = __shfl_sync(HYPRE_WARP_FULL_MASK, p_offd, 0); + + for (HYPRE_Int i = p_offd + lane; __any_sync(HYPRE_WARP_FULL_MASK, i < q_offd); i += HYPRE_WARP_SIZE) + { + if (i < q_offd) + { + if ( num_functions == 1 || + read_only_load(&dof_func[row]) == read_only_load(&dof_func_offd[read_only_load(&A_offd_j[i])]) ) + { + const HYPRE_Real v = read_only_load(&A_offd_data[i]); + row_sum += v; + row_max = hypre_max(row_max, v); + row_min = hypre_min(row_min, v); + } + } + } + + diag = warp_allreduce_sum(diag); + + /* sign of diag */ + const HYPRE_Int sdiag = diag > 0.0 ? 1 : -1; + + /* compute scaling factor and row sum */ + row_sum = warp_allreduce_sum(row_sum); + + if (diag > 0.0) + { + row_scale = warp_allreduce_min(row_min); + } + else + { + row_scale = warp_allreduce_max(row_max); + } + + /* compute row of S */ + HYPRE_Int all_weak = max_row_sum < 1.0 && fabs(row_sum) > fabs(diag) * max_row_sum; + const HYPRE_Real thresh = sdiag * strength_threshold * row_scale; + + for (HYPRE_Int i = p_diag + lane; __any_sync(HYPRE_WARP_FULL_MASK, i < q_diag); i += HYPRE_WARP_SIZE) + { + if (i < q_diag) + { + const HYPRE_Int cond = all_weak == 0 && diag_pos != i && + ( num_functions == 1 || read_only_load(&dof_func[row]) == + read_only_load(&dof_func[read_only_load(&A_diag_j[i])]) ) && + sdiag * read_only_load(&A_diag_data[i]) < thresh; + S_temp_diag_j[i] = cond * (1 + read_only_load(&A_diag_j[i])) - 1; + row_nnz_diag += cond; + } + } + + for (HYPRE_Int i = p_offd + lane; __any_sync(HYPRE_WARP_FULL_MASK, i < q_offd); i += HYPRE_WARP_SIZE) + { + if (i < q_offd) + { + const HYPRE_Int cond = all_weak == 0 && + ( num_functions == 1 || read_only_load(&dof_func[row]) == + read_only_load(&dof_func_offd[read_only_load(&A_offd_j[i])]) ) && + sdiag * read_only_load(&A_offd_data[i]) < thresh; + S_temp_offd_j[i] = cond * (1 + read_only_load(&A_offd_j[i])) - 1; + row_nnz_offd += cond; + } + } + + row_nnz_diag = warp_reduce_sum(row_nnz_diag); + row_nnz_offd = warp_reduce_sum(row_nnz_offd); + + if (0 == lane) + { + jS_diag[row] = row_nnz_diag; + jS_offd[row] = row_nnz_offd; + } +} + +#endif /* #if defined(HYPRE_USING_CUDA) */ + diff -Nru hypre-2.16.0/src/parcsr_ls/par_sv_interp.c hypre-2.18.2/src/parcsr_ls/par_sv_interp.c --- hypre-2.16.0/src/parcsr_ls/par_sv_interp.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_sv_interp.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + diff -Nru hypre-2.16.0/src/parcsr_ls/par_sv_interp_ln.c hypre-2.18.2/src/parcsr_ls/par_sv_interp_ln.c --- hypre-2.16.0/src/parcsr_ls/par_sv_interp_ln.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_sv_interp_ln.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + #include "_hypre_parcsr_ls.h" #include "Common.h" diff -Nru hypre-2.16.0/src/parcsr_ls/par_sv_interp_lsfit.c hypre-2.18.2/src/parcsr_ls/par_sv_interp_lsfit.c --- hypre-2.16.0/src/parcsr_ls/par_sv_interp_lsfit.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_sv_interp_lsfit.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + #include "_hypre_parcsr_ls.h" #include "Common.h" #include "_hypre_blas.h" diff -Nru hypre-2.16.0/src/parcsr_ls/partial.c hypre-2.18.2/src/parcsr_ls/partial.c --- hypre-2.16.0/src/parcsr_ls/partial.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/partial.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" #include "aux_interp.h" @@ -793,6 +788,9 @@ hypre_CSRMatrixJ(P_offd) = P_offd_j; hypre_ParCSRMatrixOwnsRowStarts(P) = 0; + hypre_CSRMatrixMemoryLocation(P_diag) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixMemoryLocation(P_offd) = HYPRE_MEMORY_HOST; + /* Compress P, removing coefficients smaller than trunc_factor * Max */ if (trunc_factor != 0.0 || max_elmts > 0) { @@ -1784,6 +1782,9 @@ hypre_CSRMatrixJ(P_offd) = P_offd_j; hypre_ParCSRMatrixOwnsRowStarts(P) = 0; + hypre_CSRMatrixMemoryLocation(P_diag) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixMemoryLocation(P_offd) = HYPRE_MEMORY_HOST; + /* Compress P, removing coefficients smaller than trunc_factor * Max */ if (trunc_factor != 0.0 || max_elmts > 0) { @@ -2542,6 +2543,9 @@ hypre_CSRMatrixJ(P_offd) = P_offd_j; hypre_ParCSRMatrixOwnsRowStarts(P) = 0; + hypre_CSRMatrixMemoryLocation(P_diag) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixMemoryLocation(P_offd) = HYPRE_MEMORY_HOST; + /* Compress P, removing coefficients smaller than trunc_factor * Max */ if (trunc_factor != 0.0 || max_elmts > 0) { @@ -2591,3 +2595,4 @@ return hypre_error_flag; } + diff -Nru hypre-2.16.0/src/parcsr_ls/par_vardifconv.c hypre-2.18.2/src/parcsr_ls/par_vardifconv.c --- hypre-2.16.0/src/parcsr_ls/par_vardifconv.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_vardifconv.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,19 +1,10 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ - - #include "_hypre_parcsr_ls.h" /*-------------------------------------------------------------------------- diff -Nru hypre-2.16.0/src/parcsr_ls/par_vardifconv_rs.c hypre-2.18.2/src/parcsr_ls/par_vardifconv_rs.c --- hypre-2.16.0/src/parcsr_ls/par_vardifconv_rs.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/par_vardifconv_rs.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" diff -Nru hypre-2.16.0/src/parcsr_ls/pcg_par.c hypre-2.18.2/src/parcsr_ls/pcg_par.c --- hypre-2.16.0/src/parcsr_ls/pcg_par.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/pcg_par.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" diff -Nru hypre-2.16.0/src/parcsr_ls/schwarz.c hypre-2.18.2/src/parcsr_ls/schwarz.c --- hypre-2.16.0/src/parcsr_ls/schwarz.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/schwarz.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_ls.h" #include "Common.h" @@ -414,7 +409,7 @@ if (use_nonsymm) uplo = 'N'; -/*x_vector = hypre_ParVectorLocalVector(par_x);*/ + /*x_vector = hypre_ParVectorLocalVector(par_x);*/ A_diag_i = hypre_CSRMatrixI(A_diag); A_diag_j = hypre_CSRMatrixJ(A_diag); A_diag_data = hypre_CSRMatrixData(A_diag); @@ -755,9 +750,13 @@ if (num_procs > 1) + { hypre_parCorrRes(par_A,par_x,rhs_vector,&rhs); + } else + { rhs = hypre_VectorData(rhs_vector); + } /* forward solve: ----------------------------------------------- */ @@ -851,11 +850,14 @@ jj = 0; for (j=i_domain_dof[i]; j < i_domain_dof[i+1]; j++) { - x[j_domain_dof[j]]+= relax_wt*aux[jj++]; + x[j_domain_dof[j]] += relax_wt*aux[jj++]; } } - if (num_procs > 1) hypre_TFree(rhs, HYPRE_MEMORY_SHARED); + if (num_procs > 1) + { + hypre_TFree(rhs, HYPRE_MEMORY_SHARED); + } return hypre_error_flag; } @@ -913,9 +915,13 @@ uplo = 'N'; if (num_procs > 1) + { hypre_parCorrRes(par_A,par_x,rhs_vector,&rhs); + } else + { rhs = hypre_VectorData(rhs_vector); + } /* forward solve: ----------------------------------------------- */ @@ -1023,7 +1029,10 @@ } } - if (num_procs > 1) hypre_TFree(rhs, HYPRE_MEMORY_HOST); + if (num_procs > 1) + { + hypre_TFree(rhs, HYPRE_MEMORY_SHARED); + } return hypre_error_flag; } @@ -1078,9 +1087,13 @@ x[i] = 0.e0; */ if (num_procs > 1) + { hypre_parCorrRes(par_A,par_x,rhs_vector,&rhs); + } else + { rhs = hypre_VectorData(rhs_vector); + } /* forward solve: ----------------------------------------------- */ @@ -1127,7 +1140,10 @@ piv_counter += matrix_size; } - if (num_procs > 1) hypre_TFree(rhs, HYPRE_MEMORY_HOST); + if (num_procs > 1) + { + hypre_TFree(rhs, HYPRE_MEMORY_SHARED); + } return hypre_error_flag; } @@ -1187,9 +1203,13 @@ uplo = 'N'; if (num_procs > 1) + { hypre_parCorrRes(par_A,par_x,rhs_vector,&rhs); + } else + { rhs = hypre_VectorData(rhs_vector); + } /* forward solve: ----------------------------------------------- */ @@ -1242,7 +1262,10 @@ } } - if (num_procs > 1) hypre_TFree(rhs, HYPRE_MEMORY_HOST); + if (num_procs > 1) + { + hypre_TFree(rhs, HYPRE_MEMORY_SHARED); + } return hypre_error_flag; } @@ -1790,6 +1813,8 @@ domain_structure = hypre_CSRMatrixCreate(num_domains, max_local_dof_counter, i_domain_dof[num_domains]); + hypre_CSRMatrixMemoryLocation(domain_structure) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixI(domain_structure) = i_domain_dof; hypre_CSRMatrixJ(domain_structure) = j_domain_dof; hypre_CSRMatrixData(domain_structure) = domain_matrixinverse; @@ -2468,9 +2493,9 @@ HYPRE_Int hypre_parCorrRes( hypre_ParCSRMatrix *A, - hypre_ParVector *x, - hypre_Vector *rhs, - HYPRE_Real **tmp_ptr) + hypre_ParVector *x, + hypre_Vector *rhs, + HYPRE_Real **tmp_ptr ) { HYPRE_Int i, j, index, start; HYPRE_Int num_sends, num_cols_offd; @@ -2493,8 +2518,8 @@ if (num_cols_offd) { num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - x_buf_data = hypre_CTAlloc(HYPRE_Real, - hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + x_buf_data = hypre_CTAlloc(HYPRE_Real, + hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); index = 0; for (i = 0; i < num_sends; i++) @@ -2513,6 +2538,7 @@ x_tmp_data); tmp_vector = hypre_SeqVectorCreate(local_size); + hypre_VectorMemoryLocation(tmp_vector) = HYPRE_MEMORY_SHARED; hypre_SeqVectorInitialize(tmp_vector); hypre_SeqVectorCopy(rhs,tmp_vector); @@ -2527,6 +2553,7 @@ else { tmp_vector = hypre_SeqVectorCreate(local_size); + hypre_VectorMemoryLocation(tmp_vector) = HYPRE_MEMORY_SHARED; hypre_SeqVectorInitialize(tmp_vector); hypre_SeqVectorCopy(rhs,tmp_vector); } diff -Nru hypre-2.16.0/src/parcsr_ls/schwarz.h hypre-2.18.2/src/parcsr_ls/schwarz.h --- hypre-2.16.0/src/parcsr_ls/schwarz.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/schwarz.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_Schwarz_DATA_HEADER #define hypre_Schwarz_DATA_HEADER diff -Nru hypre-2.16.0/src/parcsr_ls/superlu.c hypre-2.18.2/src/parcsr_ls/superlu.c --- hypre-2.16.0/src/parcsr_ls/superlu.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_ls/superlu.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,7 +1,14 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + #include "_hypre_parcsr_ls.h" #include -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU /*#include "superlu.h"*/ #include @@ -56,12 +63,12 @@ num_rows, hypre_ParCSRMatrixFirstRowIndex(A), hypre_CSRMatrixData(A_local), - hypre_CSRMatrixJ(A_local),hypre_CSRMatrixI(A_local), + hypre_CSRMatrixBigJ(A_local),hypre_CSRMatrixI(A_local), SLU_NR_loc, SLU_D, SLU_GE); hypre_CSRMatrixData(A_local) = NULL; hypre_CSRMatrixI(A_local) = NULL; - hypre_CSRMatrixJ(A_local) = NULL; + hypre_CSRMatrixBigJ(A_local) = NULL; hypre_CSRMatrixDestroy(A_local); /*Create process grid */ @@ -96,7 +103,7 @@ dslu_data->berr = hypre_CTAlloc(HYPRE_Real, 1, HYPRE_MEMORY_HOST); dslu_data->berr[0] = 0.0; - + pdgssvx(&(dslu_data->dslu_options), &(dslu_data->A_dslu), &(dslu_data->dslu_ScalePermstruct), NULL, num_rows, nrhs, &(dslu_data->dslu_data_grid), &(dslu_data->dslu_data_LU), diff -Nru hypre-2.16.0/src/parcsr_mv/CMakeLists.txt hypre-2.18.2/src/parcsr_mv/CMakeLists.txt --- hypre-2.16.0/src/parcsr_mv/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,41 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(HDRS + HYPRE_parcsr_mv.h + _hypre_parcsr_mv.h +) + +set(SRCS + communicationT.c + F90_HYPRE_parcsr_matrix.c + F90_HYPRE_parcsr_vector.c + F90_parcsr_matrix.c + F90_par_vector.c + HYPRE_parcsr_matrix.c + HYPRE_parcsr_vector.c + new_commpkg.c + numbers.c + par_csr_aat.c + par_csr_assumed_part.c + par_csr_bool_matop.c + par_csr_bool_matrix.c + par_csr_communication.c + par_csr_matop.c + par_csr_matrix.c + par_csr_matop_marked.c + par_csr_matvec.c + par_vector.c + par_make_system.c + par_csr_triplemat.c +) + +convert_filenames_to_full_paths(HDRS) +convert_filenames_to_full_paths(SRCS) + +set(HYPRE_HEADERS ${HYPRE_HEADERS} ${HDRS} PARENT_SCOPE) +set(HYPRE_SOURCES ${HYPRE_SOURCES} ${SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/parcsr_mv/communicationT.c hypre-2.18.2/src/parcsr_mv/communicationT.c --- hypre-2.16.0/src/parcsr_mv/communicationT.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/communicationT.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_mv.h" @@ -163,8 +155,8 @@ HYPRE_BigInt col, kc; HYPRE_Int * recv_sz_buf; HYPRE_Int * row_marker; - - hypre_MPI_Comm_size(comm, &num_procs); + + hypre_MPI_Comm_size(comm, &num_procs); hypre_MPI_Comm_rank(comm, &my_id); info = hypre_CTAlloc(HYPRE_Int, num_procs, HYPRE_MEMORY_HOST); @@ -229,8 +221,8 @@ num_recvs=num_procs-1; local_info = num_procs + num_cols_offd + num_cols_diag; - - hypre_MPI_Allgather(&local_info, 1, HYPRE_MPI_INT, info, 1, HYPRE_MPI_INT, comm); + + hypre_MPI_Allgather(&local_info, 1, HYPRE_MPI_INT, info, 1, HYPRE_MPI_INT, comm); /* ---------------------------------------------------------------------- * generate information to be send: tmp contains for each recv_proc: @@ -241,8 +233,8 @@ displs = hypre_CTAlloc(HYPRE_Int, num_procs+1, HYPRE_MEMORY_HOST); displs[0] = 0; for (i=1; i < num_procs+1; i++) - displs[i] = displs[i-1]+info[i-1]; - recv_buf = hypre_CTAlloc(HYPRE_BigInt, displs[num_procs], HYPRE_MEMORY_HOST); + displs[i] = displs[i-1]+info[i-1]; + recv_buf = hypre_CTAlloc(HYPRE_BigInt, displs[num_procs], HYPRE_MEMORY_HOST); tmp = hypre_CTAlloc(HYPRE_BigInt, local_info, HYPRE_MEMORY_HOST); j = 0; @@ -250,13 +242,13 @@ j2 = j++; tmp[j2] = 0; for (k=0; k < num_cols_offd; k++) - if (col_map_offd[k] >= col_starts[i] && + if (col_map_offd[k] >= col_starts[i] && col_map_offd[k] < col_starts[i+1]) { tmp[j++] = col_map_offd[k]; ++(tmp[j2]); }; for (k=0; k < num_cols_diag; k++) - if ( (HYPRE_BigInt)k+first_col_diag >= col_starts[i] && + if ( (HYPRE_BigInt)k+first_col_diag >= col_starts[i] && (HYPRE_BigInt)k+first_col_diag < col_starts[i+1] ) { tmp[j++] = (HYPRE_BigInt)k + first_col_diag; ++(tmp[j2]); @@ -264,16 +256,16 @@ } hypre_MPI_Allgatherv(tmp,local_info,HYPRE_MPI_BIG_INT,recv_buf,info,displs,HYPRE_MPI_INT,comm); - + /* ---------------------------------------------------------------------- * determine send_procs and actual elements to be send (in send_map_elmts) - * and send_map_starts whose i-th entry points to the beginning of the + * and send_map_starts whose i-th entry points to the beginning of the * elements to be send to proc. i * ---------------------------------------------------------------------*/ /* Meanings of arrays being set here, more verbosely stated: send_procs: processors p to send to - send_map_starts: for each p, gives range of indices in send_map_elmts; + send_map_starts: for each p, gives range of indices in send_map_elmts; send_map_elmts: Each element is a send_map_elmts[i], with i in a range given by send_map_starts[p..p+1], for some p. This element is is the global column number for a column in the offd block of p which is to be multiplied @@ -290,9 +282,9 @@ send_map_starts = hypre_CTAlloc(HYPRE_Int, num_sends+1, HYPRE_MEMORY_HOST); send_map_elmts = hypre_CTAlloc(HYPRE_Int, num_elmts, HYPRE_MEMORY_HOST); row_marker = hypre_CTAlloc(HYPRE_Int, num_rows_diag, HYPRE_MEMORY_HOST); - + index = 0; - index2 = 0; + index2 = 0; send_map_starts[0] = 0; for (i=0; i < num_procs; i++) { send_map_starts[index+1] = send_map_starts[index]; @@ -315,7 +307,7 @@ send_map_elmts[index2++] = col - offset; */ /* Plan to send all of my rows which use this column... */ hypre_RowsWithColumn( &rowmin, &rowmax, col, - num_rows_diag, + num_rows_diag, firstColDiag, colMapOffd, mat_i_diag, mat_j_diag, mat_i_offd, mat_j_offd ); @@ -333,7 +325,7 @@ if ( kc+first_col_diag==col && i!=my_id ) { / * this processor has the same column as proc. i (but is different) * / pmatch = 1; -/ * this would be right if we could send columns, but we can't ... >>> * / +/ * this would be right if we could send columns, but we can't ... * / send_procs[index] = i; ++send_map_starts[index+1]; send_map_elmts[index2++] = col - offset; @@ -347,12 +339,12 @@ /* this processor has the same column as proc. i (but is different) */ pmatch = 1; send_procs[index] = i; -/* this would be right if we could send columns, but we can't ... >>> +/* this would be right if we could send columns, but we can't ... ++send_map_starts[index+1]; send_map_elmts[index2++] = col - offset;*/ /* Plan to send all of my rows which use this column... */ hypre_RowsWithColumn( &rowmin, &rowmax, col, - num_rows_diag, + num_rows_diag, firstColDiag, colMapOffd, mat_i_diag, mat_j_diag, mat_i_offd, mat_j_offd ); @@ -408,7 +400,7 @@ displs[p+1] = displs[p] + all_num_sends3[p]; }; recv_sz_buf = hypre_CTAlloc( HYPRE_Int, displs[num_procs] , HYPRE_MEMORY_HOST); - + /* scatter-gather size of row info to send, and proc. to send to */ index = 0; for ( i=0; i @@ -13,21 +20,6 @@ extern "C" { #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - #ifndef HYPRE_PAR_CSR_COMMUNICATION_HEADER #define HYPRE_PAR_CSR_COMMUNICATION_HEADER @@ -36,7 +28,6 @@ * Structure containing information for doing communications *--------------------------------------------------------------------------*/ -/*#define HYPRE_USING_PERSISTENT_COMM*/ // JSP: can be defined by configure #ifdef HYPRE_USING_PERSISTENT_COMM typedef enum CommPkgJobType { @@ -48,28 +39,39 @@ HYPRE_COMM_PKG_JOB_BIGINT_TRANSPOSE, NUM_OF_COMM_PKG_JOB_TYPE, } CommPkgJobType; +#endif + +/*-------------------------------------------------------------------------- + * hypre_ParCSRCommHandle, hypre_ParCSRPersistentCommHandle + *--------------------------------------------------------------------------*/ +struct _hypre_ParCSRCommPkg; typedef struct { - void *send_data; - void *recv_data; - + struct _hypre_ParCSRCommPkg *comm_pkg; + HYPRE_Int send_memory_location; + HYPRE_Int recv_memory_location; + HYPRE_Int num_send_bytes; + HYPRE_Int num_recv_bytes; + void *send_data; + void *recv_data; + void *send_data_buffer; + void *recv_data_buffer; HYPRE_Int num_requests; hypre_MPI_Request *requests; +} hypre_ParCSRCommHandle; - HYPRE_Int own_send_data, own_recv_data; +typedef hypre_ParCSRCommHandle hypre_ParCSRPersistentCommHandle; -} hypre_ParCSRPersistentCommHandle; -#endif - -typedef struct +typedef struct _hypre_ParCSRCommPkg { - MPI_Comm comm; + MPI_Comm comm; HYPRE_Int num_sends; HYPRE_Int *send_procs; HYPRE_Int *send_map_starts; HYPRE_Int *send_map_elmts; + HYPRE_Int *device_send_map_elmts; HYPRE_Int num_recvs; HYPRE_Int *recv_procs; @@ -82,73 +84,81 @@ #ifdef HYPRE_USING_PERSISTENT_COMM hypre_ParCSRPersistentCommHandle *persistent_comm_handles[NUM_OF_COMM_PKG_JOB_TYPE]; #endif -} hypre_ParCSRCommPkg; - -/*-------------------------------------------------------------------------- - * hypre_ParCSRCommHandle: - *--------------------------------------------------------------------------*/ - -typedef struct -{ - hypre_ParCSRCommPkg *comm_pkg; - void *send_data; - void *recv_data; - HYPRE_Int num_requests; - hypre_MPI_Request *requests; - -} hypre_ParCSRCommHandle; + /* temporary memory for matvec. cudaMalloc is expensive. alloc once and reuse */ +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + HYPRE_Complex *tmp_data; + HYPRE_Complex *buf_data; +#endif +} hypre_ParCSRCommPkg; /*-------------------------------------------------------------------------- * Accessor macros: hypre_ParCSRCommPkg *--------------------------------------------------------------------------*/ - -#define hypre_ParCSRCommPkgComm(comm_pkg) (comm_pkg -> comm) - -#define hypre_ParCSRCommPkgNumSends(comm_pkg) (comm_pkg -> num_sends) -#define hypre_ParCSRCommPkgSendProcs(comm_pkg) (comm_pkg -> send_procs) -#define hypre_ParCSRCommPkgSendProc(comm_pkg, i) (comm_pkg -> send_procs[i]) -#define hypre_ParCSRCommPkgSendMapStarts(comm_pkg) (comm_pkg -> send_map_starts) -#define hypre_ParCSRCommPkgSendMapStart(comm_pkg,i)(comm_pkg -> send_map_starts[i]) -#define hypre_ParCSRCommPkgSendMapElmts(comm_pkg) (comm_pkg -> send_map_elmts) -#define hypre_ParCSRCommPkgSendMapElmt(comm_pkg,i) (comm_pkg -> send_map_elmts[i]) - -#define hypre_ParCSRCommPkgNumRecvs(comm_pkg) (comm_pkg -> num_recvs) -#define hypre_ParCSRCommPkgRecvProcs(comm_pkg) (comm_pkg -> recv_procs) -#define hypre_ParCSRCommPkgRecvProc(comm_pkg, i) (comm_pkg -> recv_procs[i]) -#define hypre_ParCSRCommPkgRecvVecStarts(comm_pkg) (comm_pkg -> recv_vec_starts) -#define hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i)(comm_pkg -> recv_vec_starts[i]) - -#define hypre_ParCSRCommPkgSendMPITypes(comm_pkg) (comm_pkg -> send_mpi_types) -#define hypre_ParCSRCommPkgSendMPIType(comm_pkg,i) (comm_pkg -> send_mpi_types[i]) -#define hypre_ParCSRCommPkgRecvMPITypes(comm_pkg) (comm_pkg -> recv_mpi_types) -#define hypre_ParCSRCommPkgRecvMPIType(comm_pkg,i) (comm_pkg -> recv_mpi_types[i]) +#define hypre_ParCSRCommPkgComm(comm_pkg) (comm_pkg -> comm) +#define hypre_ParCSRCommPkgNumSends(comm_pkg) (comm_pkg -> num_sends) +#define hypre_ParCSRCommPkgSendProcs(comm_pkg) (comm_pkg -> send_procs) +#define hypre_ParCSRCommPkgSendProc(comm_pkg, i) (comm_pkg -> send_procs[i]) +#define hypre_ParCSRCommPkgSendMapStarts(comm_pkg) (comm_pkg -> send_map_starts) +#define hypre_ParCSRCommPkgSendMapStart(comm_pkg,i) (comm_pkg -> send_map_starts[i]) +#define hypre_ParCSRCommPkgSendMapElmts(comm_pkg) (comm_pkg -> send_map_elmts) +#define hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg) (comm_pkg -> device_send_map_elmts) +#define hypre_ParCSRCommPkgSendMapElmt(comm_pkg,i) (comm_pkg -> send_map_elmts[i]) +#define hypre_ParCSRCommPkgDeviceSendMapElmt(comm_pkg,i) (comm_pkg -> device_send_map_elmts[i]) +#define hypre_ParCSRCommPkgNumRecvs(comm_pkg) (comm_pkg -> num_recvs) +#define hypre_ParCSRCommPkgRecvProcs(comm_pkg) (comm_pkg -> recv_procs) +#define hypre_ParCSRCommPkgRecvProc(comm_pkg, i) (comm_pkg -> recv_procs[i]) +#define hypre_ParCSRCommPkgRecvVecStarts(comm_pkg) (comm_pkg -> recv_vec_starts) +#define hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i) (comm_pkg -> recv_vec_starts[i]) +#define hypre_ParCSRCommPkgSendMPITypes(comm_pkg) (comm_pkg -> send_mpi_types) +#define hypre_ParCSRCommPkgSendMPIType(comm_pkg,i) (comm_pkg -> send_mpi_types[i]) +#define hypre_ParCSRCommPkgRecvMPITypes(comm_pkg) (comm_pkg -> recv_mpi_types) +#define hypre_ParCSRCommPkgRecvMPIType(comm_pkg,i) (comm_pkg -> recv_mpi_types[i]) + +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) +#define hypre_ParCSRCommPkgTmpData(comm_pkg) ((comm_pkg) -> tmp_data) +#define hypre_ParCSRCommPkgBufData(comm_pkg) ((comm_pkg) -> buf_data) +#endif + +static inline void +hypre_ParCSRCommPkgCopySendMapElmtsToDevice(hypre_ParCSRCommPkg *comm_pkg) +{ +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + if (hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg) == NULL) + { + HYPRE_Int num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg) = + hypre_TAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + HYPRE_MEMORY_DEVICE); + + hypre_TMemcpy(hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg), + hypre_ParCSRCommPkgSendMapElmts(comm_pkg), + HYPRE_Int, + hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_HOST); + } +#endif +} /*-------------------------------------------------------------------------- * Accessor macros: hypre_ParCSRCommHandle *--------------------------------------------------------------------------*/ - -#define hypre_ParCSRCommHandleCommPkg(comm_handle) (comm_handle -> comm_pkg) -#define hypre_ParCSRCommHandleSendData(comm_handle) (comm_handle -> send_data) -#define hypre_ParCSRCommHandleRecvData(comm_handle) (comm_handle -> recv_data) -#define hypre_ParCSRCommHandleNumRequests(comm_handle) (comm_handle -> num_requests) -#define hypre_ParCSRCommHandleRequests(comm_handle) (comm_handle -> requests) -#define hypre_ParCSRCommHandleRequest(comm_handle, i) (comm_handle -> requests[i]) -#endif /* HYPRE_PAR_CSR_COMMUNICATION_HEADER */ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ +#define hypre_ParCSRCommHandleCommPkg(comm_handle) (comm_handle -> comm_pkg) +#define hypre_ParCSRCommHandleSendMemoryLocation(comm_handle) (comm_handle -> send_memory_location) +#define hypre_ParCSRCommHandleRecvMemoryLocation(comm_handle) (comm_handle -> recv_memory_location) +#define hypre_ParCSRCommHandleNumSendBytes(comm_handle) (comm_handle -> num_send_bytes) +#define hypre_ParCSRCommHandleNumRecvBytes(comm_handle) (comm_handle -> num_recv_bytes) +#define hypre_ParCSRCommHandleSendData(comm_handle) (comm_handle -> send_data) +#define hypre_ParCSRCommHandleRecvData(comm_handle) (comm_handle -> recv_data) +#define hypre_ParCSRCommHandleSendDataBuffer(comm_handle) (comm_handle -> send_data_buffer) +#define hypre_ParCSRCommHandleRecvDataBuffer(comm_handle) (comm_handle -> recv_data_buffer) +#define hypre_ParCSRCommHandleNumRequests(comm_handle) (comm_handle -> num_requests) +#define hypre_ParCSRCommHandleRequests(comm_handle) (comm_handle -> requests) +#define hypre_ParCSRCommHandleRequest(comm_handle, i) (comm_handle -> requests[i]) +#endif /* HYPRE_PAR_CSR_COMMUNICATION_HEADER */ #ifndef hypre_PARCSR_ASSUMED_PART #define hypre_PARCSR_ASSUMED_PART @@ -160,7 +170,7 @@ HYPRE_Int storage_length; HYPRE_Int *proc_list; HYPRE_BigInt *row_start_list; - HYPRE_BigInt *row_end_list; + HYPRE_BigInt *row_end_list; HYPRE_Int *sort_index; } hypre_IJAssumedPart; @@ -169,51 +179,23 @@ #endif /* hypre_PARCSR_ASSUMED_PART */ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef hypre_NEW_COMMPKG #define hypre_NEW_COMMPKG typedef struct { HYPRE_Int length; - HYPRE_Int storage_length; + HYPRE_Int storage_length; HYPRE_Int *id; HYPRE_Int *vec_starts; - HYPRE_Int element_storage_length; + HYPRE_Int element_storage_length; HYPRE_BigInt *elements; HYPRE_Real *d_elements; /* Is this used anywhere? */ void *v_elements; - -} hypre_ProcListElements; - -#endif /* hypre_NEW_COMMPKG */ - -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - +} hypre_ProcListElements; +#endif /* hypre_NEW_COMMPKG */ /****************************************************************************** * @@ -241,10 +223,10 @@ HYPRE_BigInt first_index; HYPRE_BigInt last_index; HYPRE_BigInt *partitioning; - /* stores actual length of data in local vector to allow memory + /* stores actual length of data in local vector to allow memory * manipulations for temporary vectors*/ - HYPRE_Int actual_local_size; - hypre_Vector *local_vector; + HYPRE_Int actual_local_size; + hypre_Vector *local_vector; /* Does the Vector create/destroy `data'? */ HYPRE_Int owns_data; @@ -278,18 +260,6 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - /****************************************************************************** * * Header info for Parallel CSR Matrix data structures @@ -317,7 +287,7 @@ HYPRE_BigInt global_num_cols; HYPRE_BigInt first_row_index; HYPRE_BigInt first_col_diag; - /* need to know entire local range in case row_starts and col_starts + /* need to know entire local range in case row_starts and col_starts are null (i.e., bgl) AHB 6/05*/ HYPRE_BigInt last_row_index; HYPRE_BigInt last_col_diag; @@ -325,23 +295,24 @@ hypre_CSRMatrix *diag; hypre_CSRMatrix *offd; hypre_CSRMatrix *diagT, *offdT; - /* JSP: transposed matrices are created lazily and optional */ - HYPRE_BigInt *col_map_offd; - /* maps columns of offd to global columns */ - HYPRE_BigInt *row_starts; - /* array of length num_procs+1, row_starts[i] contains the - global number of the first row on proc i, - first_row_index = row_starts[my_id], - row_starts[num_procs] = global_num_rows */ + /* JSP: transposed matrices are created lazily and optional */ + HYPRE_BigInt *col_map_offd; + HYPRE_BigInt *device_col_map_offd; + /* maps columns of offd to global columns */ + HYPRE_BigInt *row_starts; + /* array of length num_procs+1, row_starts[i] contains the + global number of the first row on proc i, + first_row_index = row_starts[my_id], + row_starts[num_procs] = global_num_rows */ HYPRE_BigInt *col_starts; - /* array of length num_procs+1, col_starts[i] contains the - global number of the first column of diag on proc i, - first_col_diag = col_starts[my_id], - col_starts[num_procs] = global_num_cols */ + /* array of length num_procs+1, col_starts[i] contains the + global number of the first column of diag on proc i, + first_col_diag = col_starts[my_id], + col_starts[num_procs] = global_num_cols */ hypre_ParCSRCommPkg *comm_pkg; hypre_ParCSRCommPkg *comm_pkgT; - + /* Does the ParCSRMatrix create/destroy `diag', `offd', `col_map_offd'? */ HYPRE_Int owns_data; /* Does the ParCSRMatrix create/destroy `row_starts', `col_starts'? */ @@ -359,6 +330,15 @@ hypre_IJAssumedPart *assumed_partition; /* only populated if no_global_partition option is used (compile-time option)*/ + HYPRE_Int owns_assumed_partition; + /* Array to store ordering of local diagonal block to relax. In particular, + used for triangulr matrices that are not ordered to be triangular. */ + HYPRE_Int *proc_ordering; + + /* Save block diagonal inverse */ + HYPRE_Int bdiag_size; + HYPRE_Complex *bdiaginv; + hypre_ParCSRCommPkg *bdiaginv_comm_pkg; } hypre_ParCSRMatrix; @@ -366,35 +346,37 @@ * Accessor functions for the Parallel CSR Matrix structure *--------------------------------------------------------------------------*/ -#define hypre_ParCSRMatrixComm(matrix) ((matrix) -> comm) -#define hypre_ParCSRMatrixGlobalNumRows(matrix) ((matrix) -> global_num_rows) -#define hypre_ParCSRMatrixGlobalNumCols(matrix) ((matrix) -> global_num_cols) -#define hypre_ParCSRMatrixFirstRowIndex(matrix) ((matrix) -> first_row_index) -#define hypre_ParCSRMatrixFirstColDiag(matrix) ((matrix) -> first_col_diag) -#define hypre_ParCSRMatrixLastRowIndex(matrix) ((matrix) -> last_row_index) -#define hypre_ParCSRMatrixLastColDiag(matrix) ((matrix) -> last_col_diag) -#define hypre_ParCSRMatrixDiag(matrix) ((matrix) -> diag) -#define hypre_ParCSRMatrixOffd(matrix) ((matrix) -> offd) +#define hypre_ParCSRMatrixComm(matrix) ((matrix) -> comm) +#define hypre_ParCSRMatrixGlobalNumRows(matrix) ((matrix) -> global_num_rows) +#define hypre_ParCSRMatrixGlobalNumCols(matrix) ((matrix) -> global_num_cols) +#define hypre_ParCSRMatrixFirstRowIndex(matrix) ((matrix) -> first_row_index) +#define hypre_ParCSRMatrixFirstColDiag(matrix) ((matrix) -> first_col_diag) +#define hypre_ParCSRMatrixLastRowIndex(matrix) ((matrix) -> last_row_index) +#define hypre_ParCSRMatrixLastColDiag(matrix) ((matrix) -> last_col_diag) +#define hypre_ParCSRMatrixDiag(matrix) ((matrix) -> diag) +#define hypre_ParCSRMatrixOffd(matrix) ((matrix) -> offd) #define hypre_ParCSRMatrixDiagT(matrix) ((matrix) -> diagT) #define hypre_ParCSRMatrixOffdT(matrix) ((matrix) -> offdT) -#define hypre_ParCSRMatrixColMapOffd(matrix) ((matrix) -> col_map_offd) -#define hypre_ParCSRMatrixRowStarts(matrix) ((matrix) -> row_starts) -#define hypre_ParCSRMatrixColStarts(matrix) ((matrix) -> col_starts) -#define hypre_ParCSRMatrixCommPkg(matrix) ((matrix) -> comm_pkg) -#define hypre_ParCSRMatrixCommPkgT(matrix) ((matrix) -> comm_pkgT) -#define hypre_ParCSRMatrixOwnsData(matrix) ((matrix) -> owns_data) -#define hypre_ParCSRMatrixOwnsRowStarts(matrix) ((matrix) -> owns_row_starts) -#define hypre_ParCSRMatrixOwnsColStarts(matrix) ((matrix) -> owns_col_starts) -#define hypre_ParCSRMatrixNumRows(matrix) \ -hypre_CSRMatrixNumRows(hypre_ParCSRMatrixDiag(matrix)) -#define hypre_ParCSRMatrixNumCols(matrix) \ -hypre_CSRMatrixNumCols(hypre_ParCSRMatrixDiag(matrix)) -#define hypre_ParCSRMatrixNumNonzeros(matrix) ((matrix) -> num_nonzeros) -#define hypre_ParCSRMatrixDNumNonzeros(matrix) ((matrix) -> d_num_nonzeros) -#define hypre_ParCSRMatrixRowindices(matrix) ((matrix) -> rowindices) -#define hypre_ParCSRMatrixRowvalues(matrix) ((matrix) -> rowvalues) -#define hypre_ParCSRMatrixGetrowactive(matrix) ((matrix) -> getrowactive) +#define hypre_ParCSRMatrixColMapOffd(matrix) ((matrix) -> col_map_offd) +#define hypre_ParCSRMatrixDeviceColMapOffd(matrix) ((matrix) -> device_col_map_offd) +#define hypre_ParCSRMatrixRowStarts(matrix) ((matrix) -> row_starts) +#define hypre_ParCSRMatrixColStarts(matrix) ((matrix) -> col_starts) +#define hypre_ParCSRMatrixCommPkg(matrix) ((matrix) -> comm_pkg) +#define hypre_ParCSRMatrixCommPkgT(matrix) ((matrix) -> comm_pkgT) +#define hypre_ParCSRMatrixOwnsData(matrix) ((matrix) -> owns_data) +#define hypre_ParCSRMatrixOwnsRowStarts(matrix) ((matrix) -> owns_row_starts) +#define hypre_ParCSRMatrixOwnsColStarts(matrix) ((matrix) -> owns_col_starts) +#define hypre_ParCSRMatrixNumNonzeros(matrix) ((matrix) -> num_nonzeros) +#define hypre_ParCSRMatrixDNumNonzeros(matrix) ((matrix) -> d_num_nonzeros) +#define hypre_ParCSRMatrixRowindices(matrix) ((matrix) -> rowindices) +#define hypre_ParCSRMatrixRowvalues(matrix) ((matrix) -> rowvalues) +#define hypre_ParCSRMatrixGetrowactive(matrix) ((matrix) -> getrowactive) #define hypre_ParCSRMatrixAssumedPartition(matrix) ((matrix) -> assumed_partition) +#define hypre_ParCSRMatrixOwnsAssumedPartition(matrix) ((matrix) -> owns_assumed_partition) +#define hypre_ParCSRMatrixProcOrdering(matrix) ((matrix) -> proc_ordering) + +#define hypre_ParCSRMatrixNumRows(matrix) hypre_CSRMatrixNumRows(hypre_ParCSRMatrixDiag(matrix)) +#define hypre_ParCSRMatrixNumCols(matrix) hypre_CSRMatrixNumCols(hypre_ParCSRMatrixDiag(matrix)) /*-------------------------------------------------------------------------- * Parallel CSR Boolean Matrix @@ -411,8 +393,8 @@ HYPRE_BigInt last_col_diag; hypre_CSRBooleanMatrix *diag; hypre_CSRBooleanMatrix *offd; - HYPRE_BigInt *col_map_offd; - HYPRE_BigInt *row_starts; + HYPRE_BigInt *col_map_offd; + HYPRE_BigInt *row_starts; HYPRE_BigInt *col_starts; hypre_ParCSRCommPkg *comm_pkg; hypre_ParCSRCommPkg *comm_pkgT; @@ -454,21 +436,6 @@ #define hypre_ParCSRBooleanMatrix_Get_Getrowactive(matrix) ((matrix)->getrowactive) #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - /****************************************************************************** * * Tree structure for keeping track of numbers (e.g. column numbers) - @@ -514,18 +481,6 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - /****************************************************************************** * * Header info for Parallel Chord Matrix data structures @@ -553,8 +508,8 @@ HYPRE_Int *inprocessor; /* receiving in idof from different (in)processors; ---------------------- */ - HYPRE_Int *num_idofs_inprocessor; - HYPRE_Int **idof_inprocessor; + HYPRE_Int *num_idofs_inprocessor; + HYPRE_Int **idof_inprocessor; /* symmetric information: ----------------------------------------------- */ /* this can be replaces by CSR format: ---------------------------------- */ @@ -604,7 +559,7 @@ #define hypre_ParChordMatrixNumRdofs(matrix) ((matrix) -> num_rdofs) #define hypre_ParChordMatrixFirstindexIdof(matrix) ((matrix) -> firstindex_idof) -#define hypre_ParChordMatrixFirstindexRdof(matrix) ((matrix) -> firstindex_rdof) +#define hypre_ParChordMatrixFirstindexRdof(matrix) ((matrix) -> firstindex_rdof) /* participation of rdof in different processors; ---------- */ @@ -615,18 +570,6 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - #ifndef hypre_PAR_MAKE_SYSTEM #define hypre_PAR_MAKE_SYSTEM @@ -768,6 +711,7 @@ /* par_csr_communication.c */ hypre_ParCSRCommHandle *hypre_ParCSRCommHandleCreate ( HYPRE_Int job , hypre_ParCSRCommPkg *comm_pkg , void *send_data , void *recv_data ); +hypre_ParCSRCommHandle *hypre_ParCSRCommHandleCreate_v2 ( HYPRE_Int job, hypre_ParCSRCommPkg *comm_pkg, HYPRE_Int send_memory_location, void *send_data_in, HYPRE_Int recv_memory_location, void *recv_data_in ); HYPRE_Int hypre_ParCSRCommHandleDestroy ( hypre_ParCSRCommHandle *comm_handle ); void hypre_ParCSRCommPkgCreate_core ( MPI_Comm comm , HYPRE_BigInt *col_map_offd , HYPRE_BigInt first_col_diag , HYPRE_BigInt *col_starts , HYPRE_Int num_cols_diag , HYPRE_Int num_cols_offd , HYPRE_Int *p_num_recvs , HYPRE_Int **p_recv_procs , HYPRE_Int **p_recv_vec_starts , HYPRE_Int *p_num_sends , HYPRE_Int **p_send_procs , HYPRE_Int **p_send_map_starts , HYPRE_Int **p_send_map_elmts ); HYPRE_Int @@ -776,8 +720,7 @@ HYPRE_Int hypre_MatvecCommPkgDestroy ( hypre_ParCSRCommPkg *comm_pkg ); HYPRE_Int hypre_BuildCSRMatrixMPIDataType ( HYPRE_Int num_nonzeros , HYPRE_Int num_rows , HYPRE_Complex *a_data , HYPRE_Int *a_i , HYPRE_Int *a_j , hypre_MPI_Datatype *csr_matrix_datatype ); HYPRE_Int hypre_BuildCSRJDataType ( HYPRE_Int num_nonzeros , HYPRE_Complex *a_data , HYPRE_Int *a_j , hypre_MPI_Datatype *csr_jdata_datatype ); -HYPRE_Int hypre_ParCSRFindExtendCommPkg ( hypre_ParCSRMatrix *A , HYPRE_Int newoff , HYPRE_BigInt *found , hypre_ParCSRCommPkg **extend_comm_pkg ); - +HYPRE_Int hypre_ParCSRFindExtendCommPkg(MPI_Comm comm, HYPRE_BigInt global_num_cols, HYPRE_BigInt first_col_diag, HYPRE_Int num_cols_diag, HYPRE_BigInt *col_starts, hypre_IJAssumedPart *apart, HYPRE_Int indices_len, HYPRE_BigInt *indices, hypre_ParCSRCommPkg **extend_comm_pkg); /* par_csr_matop.c */ void hypre_ParMatmul_RowSizes ( HYPRE_Int **C_diag_i , HYPRE_Int **C_offd_i , HYPRE_Int *A_diag_i , HYPRE_Int *A_diag_j , HYPRE_Int *A_offd_i , HYPRE_Int *A_offd_j , HYPRE_Int *B_diag_i , HYPRE_Int *B_diag_j , HYPRE_Int *B_offd_i , HYPRE_Int *B_offd_j , HYPRE_Int *B_ext_diag_i , HYPRE_Int *B_ext_diag_j , HYPRE_Int *B_ext_offd_i , HYPRE_Int *B_ext_offd_j , HYPRE_Int *map_B_to_C , HYPRE_Int *C_diag_size , HYPRE_Int *C_offd_size , HYPRE_Int num_rows_diag_A , HYPRE_Int num_cols_offd_A , HYPRE_Int allsquare , HYPRE_Int num_cols_diag_B , HYPRE_Int num_cols_offd_B , HYPRE_Int num_cols_offd_C ); hypre_ParCSRMatrix *hypre_ParMatmul ( hypre_ParCSRMatrix *A , hypre_ParCSRMatrix *B ); @@ -785,6 +728,9 @@ void hypre_ParCSRMatrixExtractBExt_Arrays_Overlap ( HYPRE_Int **pB_ext_i , HYPRE_BigInt **pB_ext_j , HYPRE_Complex **pB_ext_data , HYPRE_BigInt **pB_ext_row_map , HYPRE_Int *num_nonzeros , HYPRE_Int data , HYPRE_Int find_row_map , MPI_Comm comm , hypre_ParCSRCommPkg *comm_pkg , HYPRE_Int num_cols_B , HYPRE_Int num_recvs , HYPRE_Int num_sends , HYPRE_BigInt first_col_diag , HYPRE_BigInt *row_starts , HYPRE_Int *recv_vec_starts , HYPRE_Int *send_map_starts , HYPRE_Int *send_map_elmts , HYPRE_Int *diag_i , HYPRE_Int *diag_j , HYPRE_Int *offd_i , HYPRE_Int *offd_j , HYPRE_BigInt *col_map_offd , HYPRE_Real *diag_data , HYPRE_Real *offd_data, hypre_ParCSRCommHandle **comm_handle_idx, hypre_ParCSRCommHandle **comm_handle_data, HYPRE_Int *CF_marker, HYPRE_Int *CF_marker_offd, HYPRE_Int skip_fine, HYPRE_Int skip_same_sign ); hypre_CSRMatrix *hypre_ParCSRMatrixExtractBExt ( hypre_ParCSRMatrix *B , hypre_ParCSRMatrix *A , HYPRE_Int data ); hypre_CSRMatrix *hypre_ParCSRMatrixExtractBExt_Overlap ( hypre_ParCSRMatrix *B , hypre_ParCSRMatrix *A , HYPRE_Int data, hypre_ParCSRCommHandle **comm_handle_idx, hypre_ParCSRCommHandle **comm_handle_data, HYPRE_Int *CF_marker, HYPRE_Int *CF_marker_offd, HYPRE_Int skip_fine, HYPRE_Int skip_same_sign ); +HYPRE_Int hypre_ParCSRMatrixExtractBExtDeviceInit( hypre_ParCSRMatrix *B, hypre_ParCSRMatrix *A, HYPRE_Int want_data, void **request_ptr); +hypre_CSRMatrix* hypre_ParCSRMatrixExtractBExtDeviceWait(void *request); +hypre_CSRMatrix* hypre_ParCSRMatrixExtractBExtDevice( hypre_ParCSRMatrix *B, hypre_ParCSRMatrix *A, HYPRE_Int want_data ); HYPRE_Int hypre_ParCSRMatrixTranspose ( hypre_ParCSRMatrix *A , hypre_ParCSRMatrix **AT_ptr , HYPRE_Int data ); void hypre_ParCSRMatrixGenSpanningTree ( hypre_ParCSRMatrix *G_csr , HYPRE_Int **indices , HYPRE_Int G_type ); void hypre_ParCSRMatrixExtractSubmatrices ( hypre_ParCSRMatrix *A_csr , HYPRE_Int *indices2 , hypre_ParCSRMatrix ***submatrices ); @@ -792,27 +738,30 @@ HYPRE_Complex hypre_ParCSRMatrixLocalSumElts ( hypre_ParCSRMatrix *A ); HYPRE_Int hypre_ParCSRMatrixAminvDB ( hypre_ParCSRMatrix *A , hypre_ParCSRMatrix *B , HYPRE_Complex *d , hypre_ParCSRMatrix **C_ptr ); hypre_ParCSRMatrix *hypre_ParTMatmul ( hypre_ParCSRMatrix *A , hypre_ParCSRMatrix *B ); +HYPRE_Real hypre_ParCSRMatrixFnorm( hypre_ParCSRMatrix *A ); +HYPRE_Int hypre_ExchangeExternalRowsInit( hypre_CSRMatrix *B_ext, hypre_ParCSRCommPkg *comm_pkg_A, void **request_ptr); +hypre_CSRMatrix* hypre_ExchangeExternalRowsWait(void *vequest); +HYPRE_Int hypre_ExchangeExternalRowsDeviceInit( hypre_CSRMatrix *B_ext, hypre_ParCSRCommPkg *comm_pkg_A, void **request_ptr); +hypre_CSRMatrix* hypre_ExchangeExternalRowsDeviceWait(void *vrequest); + #ifdef HYPRE_USING_PERSISTENT_COMM -hypre_ParCSRPersistentCommHandle * -hypre_ParCSRCommPkgGetPersistentCommHandle(HYPRE_Int job, - hypre_ParCSRCommPkg *comm_pkg); - -hypre_ParCSRPersistentCommHandle * -hypre_ParCSRPersistentCommHandleCreate(HYPRE_Int job, - hypre_ParCSRCommPkg *comm_pkg, - void *send_data, - void *recv_data); -void -hypre_ParCSRPersistentCommHandleDestroy(hypre_ParCSRPersistentCommHandle *comm_handle); -void hypre_ParCSRPersistentCommHandleStart(hypre_ParCSRPersistentCommHandle *comm_handle); -void hypre_ParCSRPersistentCommHandleWait(hypre_ParCSRPersistentCommHandle *comm_handle); +hypre_ParCSRPersistentCommHandle* hypre_ParCSRPersistentCommHandleCreate(HYPRE_Int job, hypre_ParCSRCommPkg *comm_pkg); +hypre_ParCSRPersistentCommHandle* hypre_ParCSRCommPkgGetPersistentCommHandle(HYPRE_Int job, hypre_ParCSRCommPkg *comm_pkg); +void hypre_ParCSRPersistentCommHandleDestroy(hypre_ParCSRPersistentCommHandle *comm_handle); +void hypre_ParCSRPersistentCommHandleStart(hypre_ParCSRPersistentCommHandle *comm_handle, HYPRE_Int send_memory_location, void *send_data); +void hypre_ParCSRPersistentCommHandleWait(hypre_ParCSRPersistentCommHandle *comm_handle, HYPRE_Int recv_memory_location, void *recv_data); #endif -HYPRE_Int hypre_ParcsrGetExternalRows( hypre_ParCSRMatrix *A, HYPRE_Int indices_len, HYPRE_BigInt *indices, hypre_CSRMatrix **A_ext, hypre_ParCSRCommPkg **commpkg_out); +HYPRE_Int hypre_ParcsrGetExternalRowsInit( hypre_ParCSRMatrix *A, HYPRE_Int indices_len, HYPRE_BigInt *indices, hypre_ParCSRCommPkg *comm_pkg, HYPRE_Int want_data, void **request_ptr); +hypre_CSRMatrix* hypre_ParcsrGetExternalRowsWait(void *vrequest); +HYPRE_Int hypre_ParcsrGetExternalRowsDeviceInit( hypre_ParCSRMatrix *A, HYPRE_Int indices_len, HYPRE_BigInt *indices, hypre_ParCSRCommPkg *comm_pkg, HYPRE_Int want_data, void **request_ptr); +hypre_CSRMatrix* hypre_ParcsrGetExternalRowsDeviceWait(void *vrequest); -HYPRE_Int hypre_ParvecBdiagInvScal( hypre_ParVector *b, HYPRE_Int blockSize, hypre_ParVector **bs, HYPRE_Complex *bdiaginv, hypre_ParCSRCommPkg *comm_pkg); +HYPRE_Int hypre_ParvecBdiagInvScal( hypre_ParVector *b, HYPRE_Int blockSize, hypre_ParVector **bs, hypre_ParCSRMatrix *A); -HYPRE_Int hypre_ParcsrBdiagInvScal( hypre_ParCSRMatrix *A, HYPRE_Int blockSize, hypre_ParCSRMatrix **As, HYPRE_Complex **bdiaginv, hypre_ParCSRCommPkg **commpkg_out); +HYPRE_Int hypre_ParcsrBdiagInvScal( hypre_ParCSRMatrix *A, HYPRE_Int blockSize, hypre_ParCSRMatrix **As); + +HYPRE_Int hypre_ParCSRMatrixExtractSubmatrixFC( hypre_ParCSRMatrix *A, HYPRE_Int *CF_marker, HYPRE_BigInt *cpts_starts, const char *job, hypre_ParCSRMatrix **B_ptr, HYPRE_Real strength_thresh); HYPRE_Int hypre_ParcsrAdd( HYPRE_Complex alpha, hypre_ParCSRMatrix *A, HYPRE_Complex beta, hypre_ParCSRMatrix *B, hypre_ParCSRMatrix **Cout); @@ -823,11 +772,12 @@ hypre_ParCSRMatrix *hypre_ParMatMinus_F ( hypre_ParCSRMatrix *P , hypre_ParCSRMatrix *C , HYPRE_Int *CF_marker ); void hypre_ParCSRMatrixZero_F ( hypre_ParCSRMatrix *P , HYPRE_Int *CF_marker ); void hypre_ParCSRMatrixCopy_C ( hypre_ParCSRMatrix *P , hypre_ParCSRMatrix *C , HYPRE_Int *CF_marker ); -//void hypre_ParCSRMatrixDropEntries ( hypre_ParCSRMatrix *C , hypre_ParCSRMatrix *P , HYPRE_Int *CF_marker ); +void hypre_ParCSRMatrixDropEntries ( hypre_ParCSRMatrix *C , hypre_ParCSRMatrix *P , HYPRE_Int *CF_marker ); /* par_csr_matrix.c */ hypre_ParCSRMatrix *hypre_ParCSRMatrixCreate ( MPI_Comm comm , HYPRE_BigInt global_num_rows , HYPRE_BigInt global_num_cols , HYPRE_BigInt *row_starts , HYPRE_BigInt *col_starts , HYPRE_Int num_cols_offd , HYPRE_Int num_nonzeros_diag , HYPRE_Int num_nonzeros_offd ); HYPRE_Int hypre_ParCSRMatrixDestroy ( hypre_ParCSRMatrix *matrix ); +HYPRE_Int hypre_ParCSRMatrixInitialize_v2( hypre_ParCSRMatrix *matrix, HYPRE_Int memory_location ); HYPRE_Int hypre_ParCSRMatrixInitialize ( hypre_ParCSRMatrix *matrix ); HYPRE_Int hypre_ParCSRMatrixSetNumNonzeros ( hypre_ParCSRMatrix *matrix ); HYPRE_Int hypre_ParCSRMatrixSetDNumNonzeros ( hypre_ParCSRMatrix *matrix ); @@ -844,15 +794,18 @@ hypre_ParCSRMatrix *hypre_CSRMatrixToParCSRMatrix ( MPI_Comm comm , hypre_CSRMatrix *A , HYPRE_BigInt *row_starts , HYPRE_BigInt *col_starts ); HYPRE_Int GenerateDiagAndOffd ( hypre_CSRMatrix *A , hypre_ParCSRMatrix *matrix , HYPRE_BigInt first_col_diag , HYPRE_BigInt last_col_diag ); hypre_CSRMatrix *hypre_MergeDiagAndOffd ( hypre_ParCSRMatrix *par_matrix ); +hypre_CSRMatrix *hypre_MergeDiagAndOffdDevice ( hypre_ParCSRMatrix *par_matrix ); hypre_CSRMatrix *hypre_ParCSRMatrixToCSRMatrixAll ( hypre_ParCSRMatrix *par_matrix ); HYPRE_Int hypre_ParCSRMatrixCopy ( hypre_ParCSRMatrix *A , hypre_ParCSRMatrix *B , HYPRE_Int copy_data ); HYPRE_Int hypre_FillResponseParToCSRMatrix ( void *p_recv_contact_buf , HYPRE_Int contact_size , HYPRE_Int contact_proc , void *ro , MPI_Comm comm , void **p_send_response_buf , HYPRE_Int *response_message_size ); -hypre_ParCSRMatrix *hypre_ParCSRMatrixCompleteClone ( hypre_ParCSRMatrix *A ); hypre_ParCSRMatrix *hypre_ParCSRMatrixUnion ( hypre_ParCSRMatrix *A , hypre_ParCSRMatrix *B ); -#ifdef HYPRE_USING_GPU -hypre_int hypre_ParCSRMatrixIsManaged(hypre_ParCSRMatrix *a); +hypre_ParCSRMatrix* hypre_ParCSRMatrixClone ( hypre_ParCSRMatrix *A, HYPRE_Int copy_data ); +#define hypre_ParCSRMatrixCompleteClone(A) hypre_ParCSRMatrixClone(A,0) +hypre_ParCSRMatrix* hypre_ParCSRMatrixClone_v2 ( hypre_ParCSRMatrix *A, HYPRE_Int copy_data, HYPRE_Int memory_location ); +#ifdef HYPRE_USING_CUDA +//hypre_int hypre_ParCSRMatrixIsManaged(hypre_ParCSRMatrix *a); #endif -HYPRE_Int hypre_ParCSRMatrixDropSmallEntries( hypre_ParCSRMatrix *A, HYPRE_Real tol); +HYPRE_Int hypre_ParCSRMatrixDropSmallEntries( hypre_ParCSRMatrix *A, HYPRE_Real tol, HYPRE_Int type); /* par_csr_matvec.c */ // y = alpha*A*x + beta*b @@ -862,6 +815,18 @@ HYPRE_Int hypre_ParCSRMatrixMatvecT ( HYPRE_Complex alpha , hypre_ParCSRMatrix *A , hypre_ParVector *x , HYPRE_Complex beta , hypre_ParVector *y ); HYPRE_Int hypre_ParCSRMatrixMatvec_FF ( HYPRE_Complex alpha , hypre_ParCSRMatrix *A , hypre_ParVector *x , HYPRE_Complex beta , hypre_ParVector *y , HYPRE_Int *CF_marker , HYPRE_Int fpt ); +/* par_csr_triplemat.c */ +hypre_ParCSRMatrix *hypre_ParCSRMatMat( hypre_ParCSRMatrix *A, hypre_ParCSRMatrix *B ); +hypre_ParCSRMatrix *hypre_ParCSRMatMatHost( hypre_ParCSRMatrix *A, hypre_ParCSRMatrix *B ); +hypre_ParCSRMatrix *hypre_ParCSRMatMatDevice( hypre_ParCSRMatrix *A, hypre_ParCSRMatrix *B ); + +hypre_ParCSRMatrix *hypre_ParCSRTMatMatKTHost( hypre_ParCSRMatrix *A, hypre_ParCSRMatrix *B, HYPRE_Int keep_transpose); +hypre_ParCSRMatrix *hypre_ParCSRTMatMatKTDevice( hypre_ParCSRMatrix *A, hypre_ParCSRMatrix *B, HYPRE_Int keep_transpose); +hypre_ParCSRMatrix *hypre_ParCSRTMatMatKT( hypre_ParCSRMatrix *A, hypre_ParCSRMatrix *B, HYPRE_Int keep_transpose); +hypre_ParCSRMatrix *hypre_ParCSRTMatMat( hypre_ParCSRMatrix *A, hypre_ParCSRMatrix *B); +hypre_ParCSRMatrix *hypre_ParCSRMatrixRAPKT( hypre_ParCSRMatrix *R, hypre_ParCSRMatrix *A, hypre_ParCSRMatrix *P , HYPRE_Int keepTranspose ); +hypre_ParCSRMatrix *hypre_ParCSRMatrixRAP( hypre_ParCSRMatrix *R, hypre_ParCSRMatrix *A, hypre_ParCSRMatrix *P ); + /* par_make_system.c */ HYPRE_ParCSR_System_Problem *HYPRE_Generate2DSystem ( HYPRE_ParCSRMatrix H_L1 , HYPRE_ParCSRMatrix H_L2 , HYPRE_ParVector H_b1 , HYPRE_ParVector H_b2 , HYPRE_ParVector H_x1 , HYPRE_ParVector H_x2 , HYPRE_Complex *M_vals ); HYPRE_Int HYPRE_Destroy2DSystem ( HYPRE_ParCSR_System_Problem *sys_prob ); @@ -882,7 +847,7 @@ hypre_ParVector *hypre_ParVectorCloneShallow ( hypre_ParVector *x ); HYPRE_Int hypre_ParVectorScale ( HYPRE_Complex alpha , hypre_ParVector *y ); HYPRE_Int hypre_ParVectorAxpy ( HYPRE_Complex alpha , hypre_ParVector *x , hypre_ParVector *y ); -HYPRE_Int hypre_ParVectorMassAxpy ( HYPRE_Complex *alpha, hypre_ParVector **x, hypre_ParVector *y, HYPRE_Int k, HYPRE_Int unroll); +HYPRE_Int hypre_ParVectorMassAxpy ( HYPRE_Complex *alpha, hypre_ParVector **x, hypre_ParVector *y, HYPRE_Int k, HYPRE_Int unroll); HYPRE_Real hypre_ParVectorInnerProd ( hypre_ParVector *x , hypre_ParVector *y ); HYPRE_Int hypre_ParVectorMassInnerProd ( hypre_ParVector *x , hypre_ParVector **y , HYPRE_Int k, HYPRE_Int unroll, HYPRE_Real *prod ); HYPRE_Int hypre_ParVectorMassDotpTwo ( hypre_ParVector *x , hypre_ParVector *y , hypre_ParVector **z, HYPRE_Int k, HYPRE_Int unroll, HYPRE_Real *prod_x , HYPRE_Real *prod_y ); @@ -893,8 +858,8 @@ HYPRE_Int hypre_FillResponseParToVectorAll ( void *p_recv_contact_buf , HYPRE_Int contact_size , HYPRE_Int contact_proc , void *ro , MPI_Comm comm , void **p_send_response_buf , HYPRE_Int *response_message_size ); HYPRE_Complex hypre_ParVectorLocalSumElts ( hypre_ParVector *vector ); HYPRE_Int hypre_ParVectorGetValues ( hypre_ParVector *vector, HYPRE_Int num_values, HYPRE_BigInt *indices , HYPRE_Complex *values); -#ifdef HYPRE_USING_GPU -hypre_int hypre_ParVectorIsManaged(hypre_ParVector *vector); +#ifdef HYPRE_USING_CUDA +//hypre_int hypre_ParVectorIsManaged(hypre_ParVector *vector); #endif #ifdef __cplusplus diff -Nru hypre-2.16.0/src/parcsr_mv/HYPRE_parcsr_mv.h hypre-2.18.2/src/parcsr_mv/HYPRE_parcsr_mv.h --- hypre-2.16.0/src/parcsr_mv/HYPRE_parcsr_mv.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/HYPRE_parcsr_mv.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_mv/HYPRE_parcsr_vector.c hypre-2.18.2/src/parcsr_mv/HYPRE_parcsr_vector.c --- hypre-2.16.0/src/parcsr_mv/HYPRE_parcsr_vector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/HYPRE_parcsr_vector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_mv/Makefile hypre-2.18.2/src/parcsr_mv/Makefile --- hypre-2.16.0/src/parcsr_mv/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config @@ -51,9 +43,12 @@ par_csr_bool_matrix.c\ par_csr_communication.c\ par_csr_matop.c\ + par_csr_matop_device.c\ par_csr_matrix.c\ par_csr_matop_marked.c\ par_csr_matvec.c\ + par_csr_triplemat.c\ + par_csr_triplemat_device.c\ par_vector.c\ par_make_system.c diff -Nru hypre-2.16.0/src/parcsr_mv/new_commpkg.c hypre-2.18.2/src/parcsr_mv/new_commpkg.c --- hypre-2.16.0/src/parcsr_mv/new_commpkg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/new_commpkg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*---------------------------------------------------- * Communication package that uses an assumed partition @@ -386,7 +378,7 @@ send_proc_obj.vec_starts = hypre_CTAlloc(HYPRE_Int, send_proc_obj.storage_length + 1, HYPRE_MEMORY_HOST); send_proc_obj.vec_starts[0] = 0; send_proc_obj.element_storage_length = num_cols_off_d; - send_proc_obj.elements = hypre_CTAlloc(HYPRE_BigInt, send_proc_obj.element_storage_length, HYPRE_MEMORY_SHARED); + send_proc_obj.elements = hypre_CTAlloc(HYPRE_BigInt, send_proc_obj.element_storage_length, HYPRE_MEMORY_HOST); response_obj2.fill_response = hypre_FillResponseIJDetermineSendProcs; response_obj2.data1 = NULL; @@ -437,7 +429,7 @@ orig_order = hypre_CTAlloc(HYPRE_Int, num_sends, HYPRE_MEMORY_HOST); orig_send_map_starts = hypre_CTAlloc(HYPRE_Int, num_sends+1, HYPRE_MEMORY_HOST); - orig_send_elements = hypre_CTAlloc(HYPRE_BigInt, send_proc_obj.vec_starts[num_sends], HYPRE_MEMORY_SHARED); + orig_send_elements = hypre_CTAlloc(HYPRE_BigInt, send_proc_obj.vec_starts[num_sends], HYPRE_MEMORY_HOST); orig_send_map_starts[0] = 0; /* copy send map starts and elements */ @@ -468,7 +460,7 @@ } /* clean up */ hypre_TFree(orig_order, HYPRE_MEMORY_HOST); - hypre_TFree(orig_send_elements, HYPRE_MEMORY_SHARED); + hypre_TFree(orig_send_elements, HYPRE_MEMORY_HOST); hypre_TFree(orig_send_map_starts, HYPRE_MEMORY_HOST); } @@ -502,20 +494,20 @@ if (num_sends) { - HYPRE_Int *tmp_elements = hypre_CTAlloc(HYPRE_Int, send_proc_obj.vec_starts[num_sends], HYPRE_MEMORY_SHARED); + HYPRE_Int *tmp_elements = hypre_CTAlloc(HYPRE_Int, send_proc_obj.vec_starts[num_sends], HYPRE_MEMORY_HOST); for (i=0; istorage_length +=20; /*add space for 20 more processors*/ send_proc_obj->id = hypre_TReAlloc(send_proc_obj->id, HYPRE_Int, - send_proc_obj->storage_length, HYPRE_MEMORY_HOST); + send_proc_obj->storage_length, HYPRE_MEMORY_HOST); send_proc_obj->vec_starts = hypre_TReAlloc(send_proc_obj->vec_starts, HYPRE_Int, send_proc_obj->storage_length + 1, HYPRE_MEMORY_HOST); } @@ -790,7 +782,7 @@ elength = hypre_max(contact_size, 50); elength += index; send_proc_obj->elements = hypre_TReAlloc(send_proc_obj->elements, - HYPRE_BigInt, elength, HYPRE_MEMORY_SHARED); + HYPRE_BigInt, elength, HYPRE_MEMORY_HOST); send_proc_obj->element_storage_length = elength; } /*populate send_proc_obj*/ diff -Nru hypre-2.16.0/src/parcsr_mv/new_commpkg.h hypre-2.18.2/src/parcsr_mv/new_commpkg.h --- hypre-2.16.0/src/parcsr_mv/new_commpkg.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/new_commpkg.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_NEW_COMMPKG #define hypre_NEW_COMMPKG diff -Nru hypre-2.16.0/src/parcsr_mv/numbers.c hypre-2.18.2/src/parcsr_mv/numbers.c --- hypre-2.16.0/src/parcsr_mv/numbers.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/numbers.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/parcsr_mv/numbers.h hypre-2.18.2/src/parcsr_mv/numbers.h --- hypre-2.16.0/src/parcsr_mv/numbers.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/numbers.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_mv/par_chord_matrix.h hypre-2.18.2/src/parcsr_mv/par_chord_matrix.h --- hypre-2.16.0/src/parcsr_mv/par_chord_matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_chord_matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_mv/parchord_to_parcsr.c hypre-2.18.2/src/parcsr_mv/parchord_to_parcsr.c --- hypre-2.16.0/src/parcsr_mv/parchord_to_parcsr.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/parchord_to_parcsr.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* ----------------------------------------------------------------------- */ /* */ @@ -98,7 +93,7 @@ hypre_assert( (*row_starts)[my_id] == (*row_starts)[my_id-1] + (HYPRE_BigInt)lastlens[0] ); hypre_TFree( request , HYPRE_MEMORY_HOST); hypre_TFree( status , HYPRE_MEMORY_HOST); - + /* Get the upper bound for all the rows */ hypre_MPI_Bcast( lens, 2, HYPRE_MPI_INT, num_procs-1, comm ); (*row_starts)[num_procs] = (*row_starts)[num_procs-1] + (HYPRE_Int)lens[0]; @@ -245,8 +240,8 @@ hypre_TFree(a_i, HYPRE_MEMORY_HOST); hypre_CSRMatrixData(local_A) = NULL; hypre_CSRMatrixI(local_A) = NULL; - hypre_CSRMatrixJ(local_A) = NULL; - } + hypre_CSRMatrixJ(local_A) = NULL; + } hypre_CSRMatrixDestroy(local_A); hypre_TFree(local_num_rows, HYPRE_MEMORY_HOST); /* hypre_TFree(csr_matrix_datatypes);*/ @@ -440,7 +435,7 @@ /* offd block: */ - /* >>> offd_cols_me duplicates rdofs */ + /* offd_cols_me duplicates rdofs */ offd_cols_me = hypre_NumbersNewNode(); for ( row=0; row=0 ); @@ -638,7 +633,7 @@ hypre_ParChordMatrixNumRdofs(Ac) = num_rdofs; hypre_ParChordMatrixNumRdofsToprocessor(Ac) = num_rdofs_toprocessor; hypre_ParChordMatrixRdofToprocessor(Ac) = rdof_toprocessor; - + /* >>> to set... diff -Nru hypre-2.16.0/src/parcsr_mv/par_csr_aat.c hypre-2.18.2/src/parcsr_mv/par_csr_aat.c --- hypre-2.16.0/src/parcsr_mv/par_csr_aat.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_csr_aat.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* Will compute A*A^T, A a Boolean matrix or matrix of doubles. based on par_csr_matop.c and mli_pcsr_bool_matop.c */ diff -Nru hypre-2.16.0/src/parcsr_mv/par_csr_assumed_part.c hypre-2.18.2/src/parcsr_mv/par_csr_assumed_part.c --- hypre-2.16.0/src/parcsr_mv/par_csr_assumed_part.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_csr_assumed_part.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,22 +1,14 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ -/*---------------------------------------------------- +/*---------------------------------------------------- * Functions for the IJ assumed partition * (Some of these were formerly in new_commpkg.c) - * AHB 4/06 + * AHB 4/06 *-----------------------------------------------------*/ #include "_hypre_parcsr_mv.h" @@ -29,19 +21,16 @@ * Reconcile assumed partition with actual partition. Essentially * each processor ends of with a partition of its assumed partition. *--------------------------------------------------------------------*/ - - -HYPRE_Int -hypre_LocateAssummedPartition(MPI_Comm comm, HYPRE_BigInt row_start, HYPRE_BigInt row_end, - HYPRE_BigInt global_first_row, HYPRE_BigInt global_num_rows, - hypre_IJAssumedPart *part, HYPRE_Int myid) -{ - +HYPRE_Int +hypre_LocateAssummedPartition(MPI_Comm comm, HYPRE_BigInt row_start, HYPRE_BigInt row_end, + HYPRE_BigInt global_first_row, HYPRE_BigInt global_num_rows, + hypre_IJAssumedPart *part, HYPRE_Int myid) +{ HYPRE_Int i; HYPRE_BigInt *contact_list; HYPRE_Int contact_list_length, contact_list_storage; - + HYPRE_BigInt contact_row_start[2], contact_row_end[2], contact_ranges; HYPRE_Int owner_start, owner_end; HYPRE_BigInt tmp_row_start, tmp_row_end; @@ -50,86 +39,81 @@ /*HYPRE_Int locate_row_start[2]; */ HYPRE_Int locate_ranges; - HYPRE_Int locate_row_count, rows_found; - + HYPRE_Int locate_row_count, rows_found; + HYPRE_BigInt tmp_range[2]; - HYPRE_BigInt *sortme; + HYPRE_BigInt *sortme; HYPRE_Int *si; - const HYPRE_Int flag1 = 17; + const HYPRE_Int flag1 = 17; hypre_MPI_Request *requests; hypre_MPI_Status status0, *statuses; - - - /*----------------------------------------------------------- - * Contact ranges - + * Contact ranges - * which rows do I have that others are assumed responsible for? * (at most two ranges - maybe none) *-----------------------------------------------------------*/ - - contact_row_start[0]=0; contact_row_end[0]=0; contact_row_start[1]=0; contact_row_end[1]=0; contact_ranges = 0; - - if (row_start <= row_end ) { /*must own at least one row*/ - if ( part->row_end < row_start || row_end < part->row_start ) + if (row_start <= row_end ) + { /*must own at least one row*/ + if ( part->row_end < row_start || row_end < part->row_start ) { /*no overlap - so all of my rows and only one range*/ contact_row_start[0] = row_start; contact_row_end[0] = row_end; contact_ranges++; } else /* the two regions overlap - so one or two ranges */ - { + { /* check for contact rows on the low end of the local range */ - if (row_start < part->row_start) - { + if (row_start < part->row_start) + { contact_row_start[0] = row_start; - contact_row_end[0] = part->row_start - 1; - contact_ranges++; - } - if (part->row_end < row_end) /* check the high end */ + contact_row_end[0] = part->row_start - 1; + contact_ranges++; + } + if (part->row_end < row_end) /* check the high end */ { - if (contact_ranges) /* already found one range */ + if (contact_ranges) /* already found one range */ { - contact_row_start[1] = part->row_end +1; - contact_row_end[1] = row_end; - } - else - { - contact_row_start[0] = part->row_end +1; - contact_row_end[0] = row_end; - } - contact_ranges++; - } + contact_row_start[1] = part->row_end +1; + contact_row_end[1] = row_end; + } + else + { + contact_row_start[0] = part->row_end +1; + contact_row_end[0] = row_end; + } + contact_ranges++; + } } } /*----------------------------------------------------------- - * Contact: find out who is assumed responsible for these - * ranges of contact rows and contact them + * Contact: find out who is assumed responsible for these + * ranges of contact rows and contact them * *-----------------------------------------------------------*/ - + contact_list_length = 0; - contact_list_storage = 5; + contact_list_storage = 5; contact_list = hypre_TAlloc(HYPRE_BigInt, contact_list_storage*3, HYPRE_MEMORY_HOST); /*each contact needs 3 ints */ for (i=0; i= contact_row_end[i]) - { - tmp_row_end = contact_row_end[i]; - complete = 1; - } + { + tmp_row_end = contact_row_end[i]; + complete = 1; + } if (tmp_row_start < contact_row_start[i]) - { - tmp_row_start = contact_row_start[i]; + { + tmp_row_start = contact_row_start[i]; } @@ -176,7 +160,7 @@ CONTACT(contact_list_length, 1) = tmp_row_start; /* start row */ CONTACT(contact_list_length, 2) = tmp_row_end; /*end row */ contact_list_length++; - owner_start++; /*processors are seqential */ + owner_start++; /*processors are seqential */ } } } @@ -185,15 +169,15 @@ statuses = hypre_CTAlloc(hypre_MPI_Status, contact_list_length, HYPRE_MEMORY_HOST); /*send out messages */ - for (i=0; i< contact_list_length; i++) + for (i=0; i< contact_list_length; i++) { - hypre_MPI_Isend(&CONTACT(i,1) ,2, HYPRE_MPI_BIG_INT, CONTACT(i,0), flag1 , + hypre_MPI_Isend(&CONTACT(i,1) ,2, HYPRE_MPI_BIG_INT, CONTACT(i,0), flag1 , comm, &requests[i]); /*hypre_MPI_COMM_WORLD, &requests[i]);*/ } /*----------------------------------------------------------- - * Locate ranges - + * Locate ranges - * which rows in my assumed range do I not own * (at most two ranges - maybe none) * locate_row_count = total number of rows I must locate @@ -201,37 +185,37 @@ locate_row_count = 0; - + /*locate_row_start[0]=0; locate_row_start[1]=0;*/ locate_ranges = 0; - if (part->row_end < row_start || row_end < part->row_start ) - /*no overlap - so all of my assumed rows */ + if (part->row_end < row_start || row_end < part->row_start ) + /*no overlap - so all of my assumed rows */ { /*locate_row_start[0] = part->row_start;*/ locate_ranges++; - locate_row_count += part->row_end - part->row_start + 1; + locate_row_count += part->row_end - part->row_start + 1; } else /* the two regions overlap */ { - if (part->row_start < row_start) + if (part->row_start < row_start) {/* check for locate rows on the low end of the local range */ /*locate_row_start[0] = part->row_start;*/ locate_ranges++; locate_row_count += (row_start-1) - part->row_start + 1; - } + } if (row_end < part->row_end) /* check the high end */ { - /*if (locate_ranges)*/ /* already have one range */ + /*if (locate_ranges)*/ /* already have one range */ /*{ - locate_row_start[1] = row_end +1; - } - else - { - locate_row_start[0] = row_end +1; - }*/ + locate_row_start[1] = row_end +1; + } + else + { + locate_row_start[0] = row_end +1; + }*/ locate_ranges++; locate_row_count += part->row_end - (row_end + 1) + 1; } @@ -240,14 +224,14 @@ /*----------------------------------------------------------- * Receive messages from other procs telling us where - * all our locate rows actually reside + * all our locate rows actually reside *-----------------------------------------------------------*/ - /* we will keep a partition of our assumed partition - list ourselves + /* we will keep a partition of our assumed partition - list ourselves first. We will sort later with an additional index. In practice, this should only contain a few processors */ - + /*which part do I own?*/ tmp_row_start = hypre_max(part->row_start, row_start); tmp_row_end = hypre_min(row_end, part->row_end); @@ -259,42 +243,42 @@ part->row_end_list[0] = tmp_row_end; part->length++; } - + /* now look for messages that tell us which processor has our locate rows */ /* these will be blocking receives as we know how many to expect and they should be waiting (and we don't want to continue on without them) */ rows_found = 0; - while (rows_found != locate_row_count) { - - hypre_MPI_Recv( tmp_range, 2 , HYPRE_MPI_BIG_INT, hypre_MPI_ANY_SOURCE, - flag1 , comm, &status0); - /*flag1 , hypre_MPI_COMM_WORLD, &status0);*/ - + while (rows_found != locate_row_count) + { + hypre_MPI_Recv( tmp_range, 2 , HYPRE_MPI_BIG_INT, hypre_MPI_ANY_SOURCE, + flag1 , comm, &status0); + /*flag1 , hypre_MPI_COMM_WORLD, &status0);*/ + if (part->length==part->storage_length) { - part->storage_length+=10; - part->proc_list = hypre_TReAlloc(part->proc_list, HYPRE_Int, part->storage_length, HYPRE_MEMORY_HOST); - part->row_start_list = hypre_TReAlloc(part->row_start_list, HYPRE_BigInt, part->storage_length, HYPRE_MEMORY_HOST); - part->row_end_list = hypre_TReAlloc(part->row_end_list, HYPRE_BigInt, part->storage_length, HYPRE_MEMORY_HOST); + part->storage_length+=10; + part->proc_list = hypre_TReAlloc(part->proc_list, HYPRE_Int, part->storage_length, HYPRE_MEMORY_HOST); + part->row_start_list = hypre_TReAlloc(part->row_start_list, HYPRE_BigInt, part->storage_length, HYPRE_MEMORY_HOST); + part->row_end_list = hypre_TReAlloc(part->row_end_list, HYPRE_BigInt, part->storage_length, HYPRE_MEMORY_HOST); } part->row_start_list[part->length] = tmp_range[0]; - part->row_end_list[part->length] = tmp_range[1]; + part->row_end_list[part->length] = tmp_range[1]; part->proc_list[part->length] = status0.hypre_MPI_SOURCE; rows_found += tmp_range[1]- tmp_range[0] + 1; - + part->length++; - } + } - /*In case the partition of the assumed partition is longish, + /*In case the partition of the assumed partition is longish, we would like to know the sorted order */ - si= hypre_CTAlloc(HYPRE_Int, part->length, HYPRE_MEMORY_HOST); - sortme = hypre_CTAlloc(HYPRE_BigInt, part->length, HYPRE_MEMORY_HOST); + si= hypre_CTAlloc(HYPRE_Int, part->length, HYPRE_MEMORY_HOST); + sortme = hypre_CTAlloc(HYPRE_BigInt, part->length, HYPRE_MEMORY_HOST); - for (i=0; ilength; i++) + for (i=0; ilength; i++) { si[i] = i; sortme[i] = part->row_start_list[i]; @@ -303,90 +287,99 @@ part->sort_index = si; /*free the requests */ - hypre_MPI_Waitall(contact_list_length, requests, + hypre_MPI_Waitall(contact_list_length, requests, statuses); - + hypre_TFree(statuses, HYPRE_MEMORY_HOST); hypre_TFree(requests, HYPRE_MEMORY_HOST); - + hypre_TFree(sortme, HYPRE_MEMORY_HOST); hypre_TFree(contact_list, HYPRE_MEMORY_HOST); return hypre_error_flag; - + +} + + +hypre_IJAssumedPart* +hypre_AssumedPartitionCreate(MPI_Comm comm, + HYPRE_Int global_num, + HYPRE_Int start, + HYPRE_Int end) +{ + hypre_IJAssumedPart *apart; + HYPRE_Int myid; + + hypre_MPI_Comm_rank(comm, &myid ); + + /* allocate space */ + apart = hypre_CTAlloc(hypre_IJAssumedPart, 1, HYPRE_MEMORY_HOST); + + + hypre_GetAssumedPartitionRowRange( comm, myid, 0, global_num, + &(apart->row_start), &(apart->row_end)); + + /*allocate some space for the partition of the assumed partition */ + apart->length = 0; + /*room for 10 owners of the assumed partition*/ + apart->storage_length = 10; /*need to be >=1 */ + apart->proc_list = hypre_TAlloc(HYPRE_Int, apart->storage_length, HYPRE_MEMORY_HOST); + apart->row_start_list = hypre_TAlloc(HYPRE_BigInt, apart->storage_length, HYPRE_MEMORY_HOST); + apart->row_end_list = hypre_TAlloc(HYPRE_BigInt, apart->storage_length, HYPRE_MEMORY_HOST); + + /* now we want to reconcile our actual partition with the assumed partition */ + hypre_LocateAssummedPartition(comm, start, end, 0, global_num, apart, myid); + + return apart; } /*-------------------------------------------------------------------- * hypre_ParCSRMatrixCreateAssumedPartition - - * Each proc gets it own range. Then + * Each proc gets it own range. Then * each needs to reconcile its actual range with its assumed * range - the result is essentila a partition of its assumed range - - * this is the assumed partition. + * this is the assumed partition. *--------------------------------------------------------------------*/ - - HYPRE_Int -hypre_ParCSRMatrixCreateAssumedPartition( hypre_ParCSRMatrix *matrix) +hypre_ParCSRMatrixCreateAssumedPartition( hypre_ParCSRMatrix *matrix) { - - HYPRE_BigInt global_num_cols; - HYPRE_Int myid; + /* HYPRE_Int myid; */ HYPRE_BigInt row_start=0, row_end=0, col_start = 0, col_end = 0; MPI_Comm comm; - + hypre_IJAssumedPart *apart; - global_num_cols = hypre_ParCSRMatrixGlobalNumCols(matrix); + global_num_cols = hypre_ParCSRMatrixGlobalNumCols(matrix); comm = hypre_ParCSRMatrixComm(matrix); - + /* find out my actualy range of rows and columns */ hypre_ParCSRMatrixGetLocalRange( matrix, - &row_start, &row_end , + &row_start, &row_end, /* these two are not used */ &col_start, &col_end ); - hypre_MPI_Comm_rank(comm, &myid ); - - /* allocate space */ - apart = hypre_CTAlloc(hypre_IJAssumedPart, 1, HYPRE_MEMORY_HOST); - - /* get my assumed partitioning - we want partitioning of the vector that the + /* get my assumed partitioning - we want partitioning of the vector that the matrix multiplies - so we use the col start and end */ - hypre_GetAssumedPartitionRowRange( comm, myid, 0, global_num_cols, - &(apart->row_start), &(apart->row_end)); - - /*allocate some space for the partition of the assumed partition */ - apart->length = 0; - /*room for 10 owners of the assumed partition*/ - apart->storage_length = 10; /*need to be >=1 */ - apart->proc_list = hypre_TAlloc(HYPRE_Int, apart->storage_length, HYPRE_MEMORY_HOST); - apart->row_start_list = hypre_TAlloc(HYPRE_BigInt, apart->storage_length, HYPRE_MEMORY_HOST); - apart->row_end_list = hypre_TAlloc(HYPRE_BigInt, apart->storage_length, HYPRE_MEMORY_HOST); - - - /* now we want to reconcile our actual partition with the assumed partition */ - hypre_LocateAssummedPartition(comm, col_start, col_end, 0, global_num_cols, apart, myid); + apart = hypre_AssumedPartitionCreate(comm, global_num_cols, col_start, col_end); /* this partition will be saved in the matrix data structure until the matrix is destroyed */ hypre_ParCSRMatrixAssumedPartition(matrix) = apart; - - return hypre_error_flag; - + return hypre_error_flag; } /*-------------------------------------------------------------------- * hypre_AssumedPartitionDestroy *--------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_AssumedPartitionDestroy(hypre_IJAssumedPart *apart ) { - if(apart->storage_length > 0) - { + if (apart->storage_length > 0) + { hypre_TFree(apart->proc_list, HYPRE_MEMORY_HOST); hypre_TFree(apart->row_start_list, HYPRE_MEMORY_HOST); hypre_TFree(apart->row_end_list, HYPRE_MEMORY_HOST); @@ -394,9 +387,8 @@ } hypre_TFree(apart, HYPRE_MEMORY_HOST); - - return hypre_error_flag; + return hypre_error_flag; } /*-------------------------------------------------------------------- @@ -407,43 +399,41 @@ HYPRE_Int -hypre_GetAssumedPartitionProcFromRow( MPI_Comm comm, HYPRE_BigInt row, - HYPRE_BigInt global_first_row, - HYPRE_BigInt global_num_rows, HYPRE_Int *proc_id) +hypre_GetAssumedPartitionProcFromRow( MPI_Comm comm, HYPRE_BigInt row, + HYPRE_BigInt global_first_row, + HYPRE_BigInt global_num_rows, HYPRE_Int *proc_id) { - HYPRE_Int num_procs; - HYPRE_BigInt size, switch_row, extra; - - + HYPRE_BigInt size, switch_row, extra; + + hypre_MPI_Comm_size(comm, &num_procs ); /*hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs );*/ - + /* j = floor[(row*p/N] - this overflows*/ /* *proc_id = (row*num_procs)/global_num_rows;*/ - + /* this looks a bit odd, but we have to be very careful that - this function and the next are inverses - and rounding + this function and the next are inverses - and rounding errors make this difficult!!!!! */ size = global_num_rows / (HYPRE_BigInt)num_procs; extra = global_num_rows - size*(HYPRE_BigInt)num_procs; switch_row = global_first_row + (size + 1)*extra; - + if (row >= switch_row) { *proc_id = (HYPRE_Int)(extra + (row - switch_row)/size); } else { - *proc_id = (HYPRE_Int)((row - global_first_row)/(size+1)); + *proc_id = (HYPRE_Int)((row - global_first_row)/(size+1)); } return hypre_error_flag; - - } + /*-------------------------------------------------------------------- * hypre_GetAssumedPartitionRowRange * Assumed partition for IJ case. Given a particular processor id, return @@ -453,13 +443,11 @@ HYPRE_Int hypre_GetAssumedPartitionRowRange( MPI_Comm comm, HYPRE_Int proc_id, HYPRE_BigInt global_first_row, - HYPRE_BigInt global_num_rows, HYPRE_BigInt *row_start, HYPRE_BigInt* row_end) + HYPRE_BigInt global_num_rows, HYPRE_BigInt *row_start, HYPRE_BigInt* row_end) { - HYPRE_Int num_procs; HYPRE_Int extra; - HYPRE_BigInt size; - + HYPRE_BigInt size; hypre_MPI_Comm_size(comm, &num_procs ); /*hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs );*/ @@ -474,7 +462,7 @@ *row_start = global_first_row + size*(HYPRE_BigInt)proc_id; *row_start += (HYPRE_BigInt) hypre_min(proc_id, extra); - + *row_end = global_first_row + size*(HYPRE_BigInt)(proc_id+1); *row_end += (HYPRE_BigInt)hypre_min(proc_id+1, extra); @@ -482,7 +470,6 @@ return hypre_error_flag; - } @@ -491,33 +478,31 @@ * Essentially the same as for a matrix! - * Each proc gets it own range. Then + * Each proc gets it own range. Then * each needs to reconcile its actual range with its assumed * range - the result is essentila a partition of its assumed range - - * this is the assumed partition. + * this is the assumed partition. *--------------------------------------------------------------------*/ HYPRE_Int -hypre_ParVectorCreateAssumedPartition( hypre_ParVector *vector) +hypre_ParVectorCreateAssumedPartition( hypre_ParVector *vector) { - - HYPRE_BigInt global_num; HYPRE_Int myid; HYPRE_BigInt start=0, end=0; MPI_Comm comm; - + hypre_IJAssumedPart *apart; - global_num = hypre_ParVectorGlobalSize(vector); + global_num = hypre_ParVectorGlobalSize(vector); comm = hypre_ParVectorComm(vector); - + /* find out my actualy range of rows */ start = hypre_ParVectorFirstIndex(vector); end = hypre_ParVectorLastIndex(vector); - + hypre_MPI_Comm_rank(comm, &myid ); /* allocate space */ @@ -525,13 +510,13 @@ /* get my assumed partitioning - we want partitioning of the vector that the matrix multiplies - so we use the col start and end */ - hypre_GetAssumedPartitionRowRange( comm, myid, 0, global_num, &(apart->row_start), + hypre_GetAssumedPartitionRowRange( comm, myid, 0, global_num, &(apart->row_start), &(apart->row_end)); /*allocate some space for the partition of the assumed partition */ apart->length = 0; - /*room for 10 owners of the assumed partition*/ - apart->storage_length = 10; /*need to be >=1 */ + /*room for 10 owners of the assumed partition*/ + apart->storage_length = 10; /*need to be >=1 */ apart->proc_list = hypre_TAlloc(HYPRE_Int, apart->storage_length, HYPRE_MEMORY_HOST); apart->row_start_list = hypre_TAlloc(HYPRE_BigInt, apart->storage_length, HYPRE_MEMORY_HOST); apart->row_end_list = hypre_TAlloc(HYPRE_BigInt, apart->storage_length, HYPRE_MEMORY_HOST); @@ -542,8 +527,7 @@ /* this partition will be saved in the vector data structure until the vector is destroyed */ hypre_ParVectorAssumedPartition(vector) = apart; - - return hypre_error_flag; - + return hypre_error_flag; } + diff -Nru hypre-2.16.0/src/parcsr_mv/par_csr_assumed_part.h hypre-2.18.2/src/parcsr_mv/par_csr_assumed_part.h --- hypre-2.16.0/src/parcsr_mv/par_csr_assumed_part.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_csr_assumed_part.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_PARCSR_ASSUMED_PART #define hypre_PARCSR_ASSUMED_PART @@ -19,9 +14,9 @@ HYPRE_BigInt row_start; HYPRE_BigInt row_end; HYPRE_Int storage_length; - HYPRE_Int *proc_list; - HYPRE_BigInt *row_start_list; - HYPRE_BigInt *row_end_list; + HYPRE_Int *proc_list; + HYPRE_BigInt *row_start_list; + HYPRE_BigInt *row_end_list; HYPRE_Int *sort_index; } hypre_IJAssumedPart; diff -Nru hypre-2.16.0/src/parcsr_mv/par_csr_bool_matop.c hypre-2.18.2/src/parcsr_mv/par_csr_bool_matop.c --- hypre-2.16.0/src/parcsr_mv/par_csr_bool_matop.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_csr_bool_matop.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_mv.h" diff -Nru hypre-2.16.0/src/parcsr_mv/par_csr_bool_matrix.c hypre-2.18.2/src/parcsr_mv/par_csr_bool_matrix.c --- hypre-2.16.0/src/parcsr_mv/par_csr_bool_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_csr_bool_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/parcsr_mv/par_csr_communication.c hypre-2.18.2/src/parcsr_mv/par_csr_communication.c --- hypre-2.16.0/src/parcsr_mv/par_csr_communication.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_csr_communication.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_mv.h" @@ -20,24 +15,24 @@ CommPkgJobType job_type = HYPRE_COMM_PKG_JOB_COMPLEX; switch (job) { - case 1: - job_type = HYPRE_COMM_PKG_JOB_COMPLEX; - break; - case 2: - job_type = HYPRE_COMM_PKG_JOB_COMPLEX_TRANSPOSE; - break; - case 11: - job_type = HYPRE_COMM_PKG_JOB_INT; - break; - case 12: - job_type = HYPRE_COMM_PKG_JOB_INT_TRANSPOSE; - break; - case 21: - job_type = HYPRE_COMM_PKG_JOB_BIGINT; - break; - case 22: - job_type = HYPRE_COMM_PKG_JOB_BIGINT_TRANSPOSE; - break; + case 1: + job_type = HYPRE_COMM_PKG_JOB_COMPLEX; + break; + case 2: + job_type = HYPRE_COMM_PKG_JOB_COMPLEX_TRANSPOSE; + break; + case 11: + job_type = HYPRE_COMM_PKG_JOB_INT; + break; + case 12: + job_type = HYPRE_COMM_PKG_JOB_INT_TRANSPOSE; + break; + case 21: + job_type = HYPRE_COMM_PKG_JOB_BIGINT; + break; + case 22: + job_type = HYPRE_COMM_PKG_JOB_BIGINT_TRANSPOSE; + break; } // switch (job) return job_type; @@ -47,18 +42,13 @@ * When send_data and recv_data are NULL, buffers are internally allocated * and CommHandle owns the buffer */ -hypre_ParCSRPersistentCommHandle * -hypre_ParCSRPersistentCommHandleCreate( HYPRE_Int job, - hypre_ParCSRCommPkg *comm_pkg, - void *send_data, - void *recv_data) +hypre_ParCSRPersistentCommHandle* +hypre_ParCSRPersistentCommHandleCreate( HYPRE_Int job, hypre_ParCSRCommPkg *comm_pkg ) { - HYPRE_Int i; - - hypre_ParCSRPersistentCommHandle *comm_handle = hypre_CTAlloc(hypre_ParCSRPersistentCommHandle, 1, HYPRE_MEMORY_HOST); + HYPRE_Int i; + size_t num_bytes_send, num_bytes_recv; - if (!send_data) comm_handle->own_send_data = 1; - if (!recv_data) comm_handle->own_recv_data = 1; + hypre_ParCSRPersistentCommHandle *comm_handle = hypre_CTAlloc(hypre_ParCSRPersistentCommHandle, 1, HYPRE_MEMORY_HOST); CommPkgJobType job_type = getJobTypeOf(job); @@ -67,173 +57,142 @@ MPI_Comm comm = hypre_ParCSRCommPkgComm(comm_pkg); HYPRE_Int num_requests = num_sends + num_recvs; - hypre_MPI_Request *requests = hypre_CTAlloc(hypre_MPI_Request, num_requests, HYPRE_MEMORY_HOST); + hypre_MPI_Request *requests = hypre_CTAlloc(hypre_MPI_Request, num_requests, HYPRE_MEMORY_HOST); hypre_ParCSRCommHandleNumRequests(comm_handle) = num_requests; hypre_ParCSRCommHandleRequests(comm_handle) = requests; + void *send_buff = NULL, *recv_buff = NULL; + switch (job_type) { case HYPRE_COMM_PKG_JOB_COMPLEX: - if (!send_data) - { - //send_data = hypre_TAlloc(HYPRE_Complex, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST_PINNED); - send_data = hypre_TAlloc(HYPRE_Complex, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends),HYPRE_MEMORY_SHARED); - } - if (!recv_data) - { - //recv_data = hypre_TAlloc(HYPRE_Complex, hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs), HYPRE_MEMORY_HOST); - recv_data = hypre_TAlloc(HYPRE_Complex, hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs), HYPRE_MEMORY_SHARED); - } + num_bytes_send = sizeof(HYPRE_Complex) * hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends); + num_bytes_recv = sizeof(HYPRE_Complex) * hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs); + send_buff = hypre_TAlloc(HYPRE_Complex, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + recv_buff = hypre_TAlloc(HYPRE_Complex, hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs), HYPRE_MEMORY_HOST); for (i = 0; i < num_recvs; ++i) { HYPRE_Int ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); HYPRE_Int vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, i); HYPRE_Int vec_len = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, i + 1) - vec_start; - hypre_MPI_Recv_init((HYPRE_Complex *)recv_data + vec_start, vec_len, HYPRE_MPI_COMPLEX, - ip, 0, comm, requests + i); + hypre_MPI_Recv_init( (HYPRE_Complex *)recv_buff + vec_start, vec_len, HYPRE_MPI_COMPLEX, + ip, 0, comm, requests + i ); } for (i = 0; i < num_sends; ++i) { HYPRE_Int ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); HYPRE_Int vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); HYPRE_Int vec_len = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i + 1) - vec_start; - - hypre_MPI_Send_init((HYPRE_Complex *)send_data + vec_start, vec_len, HYPRE_MPI_COMPLEX, - ip, 0, comm, requests + num_recvs + i); + hypre_MPI_Send_init( (HYPRE_Complex *)send_buff + vec_start, vec_len, HYPRE_MPI_COMPLEX, + ip, 0, comm, requests + num_recvs + i ); } break; case HYPRE_COMM_PKG_JOB_COMPLEX_TRANSPOSE: - if (!recv_data) - { - //recv_data = hypre_TAlloc(HYPRE_Complex, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); - recv_data = hypre_TAlloc(HYPRE_Complex, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_SHARED); - } - if (!send_data) - { - //send_data = hypre_TAlloc(HYPRE_Complex, hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs), HYPRE_MEMORY_HOST); - send_data = hypre_TAlloc(HYPRE_Complex, hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs), HYPRE_MEMORY_SHARED); - } + num_bytes_recv = sizeof(HYPRE_Complex) * hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends); + num_bytes_send = sizeof(HYPRE_Complex) * hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs); + recv_buff = hypre_TAlloc(HYPRE_Complex, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + send_buff = hypre_TAlloc(HYPRE_Complex, hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs), HYPRE_MEMORY_HOST); for (i = 0; i < num_sends; ++i) { HYPRE_Int ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); HYPRE_Int vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); HYPRE_Int vec_len = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i + 1) - vec_start; - hypre_MPI_Recv_init((HYPRE_Complex *)recv_data + vec_start, vec_len, HYPRE_MPI_COMPLEX, - ip, 0, comm, requests + i); + hypre_MPI_Recv_init( (HYPRE_Complex *)recv_buff + vec_start, vec_len, HYPRE_MPI_COMPLEX, + ip, 0, comm, requests + i ); } for (i = 0; i < num_recvs; ++i) { HYPRE_Int ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); HYPRE_Int vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, i); HYPRE_Int vec_len = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, i + 1) - vec_start; - - hypre_MPI_Send_init((HYPRE_Complex *)send_data + vec_start, vec_len, HYPRE_MPI_COMPLEX, - ip, 0, comm, requests + num_sends + i); + hypre_MPI_Send_init( (HYPRE_Complex *)send_buff + vec_start, vec_len, HYPRE_MPI_COMPLEX, + ip, 0, comm, requests + num_sends + i ); } break; case HYPRE_COMM_PKG_JOB_INT: - if (!send_data) - { - send_data = hypre_TAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); - } - if (!recv_data) - { - recv_data = hypre_TAlloc(HYPRE_Int, hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs), HYPRE_MEMORY_HOST); - } + num_bytes_send = sizeof(HYPRE_Int) * hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends); + num_bytes_recv = sizeof(HYPRE_Int) * hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs); + send_buff = hypre_TAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + recv_buff = hypre_TAlloc(HYPRE_Int, hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs), HYPRE_MEMORY_HOST); for (i = 0; i < num_recvs; ++i) { HYPRE_Int ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); HYPRE_Int vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, i); HYPRE_Int vec_len = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, i + 1) - vec_start; - hypre_MPI_Recv_init((HYPRE_Int *)recv_data + vec_start, vec_len, HYPRE_MPI_INT, - ip, 0, comm, requests + i); + hypre_MPI_Recv_init( (HYPRE_Int *)recv_buff + vec_start, vec_len, HYPRE_MPI_INT, + ip, 0, comm, requests + i ); } for (i = 0; i < num_sends; ++i) { HYPRE_Int ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); HYPRE_Int vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); HYPRE_Int vec_len = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i + 1) - vec_start; - - hypre_MPI_Send_init((HYPRE_Int *)send_data + vec_start, vec_len, HYPRE_MPI_INT, - ip, 0, comm, requests + num_recvs + i); + hypre_MPI_Send_init( (HYPRE_Int *)send_buff + vec_start, vec_len, HYPRE_MPI_INT, + ip, 0, comm, requests + num_recvs + i ); } break; case HYPRE_COMM_PKG_JOB_INT_TRANSPOSE: - if (!recv_data) - { - recv_data = hypre_TAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); - } - if (!send_data) - { - send_data = hypre_TAlloc(HYPRE_Int, hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs), HYPRE_MEMORY_HOST); - } + num_bytes_recv = sizeof(HYPRE_Int) * hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends); + num_bytes_send = sizeof(HYPRE_Int) * hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs); + recv_buff = hypre_TAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + send_buff = hypre_TAlloc(HYPRE_Int, hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs), HYPRE_MEMORY_HOST); for (i = 0; i < num_sends; ++i) { HYPRE_Int ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); HYPRE_Int vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); HYPRE_Int vec_len = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i + 1) - vec_start; - hypre_MPI_Recv_init((HYPRE_Int *)recv_data + vec_start, vec_len, HYPRE_MPI_INT, - ip, 0, comm, requests + i); + hypre_MPI_Recv_init( (HYPRE_Int *)recv_buff + vec_start, vec_len, HYPRE_MPI_INT, + ip, 0, comm, requests + i ); } for (i = 0; i < num_recvs; ++i) { HYPRE_Int ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); HYPRE_Int vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, i); HYPRE_Int vec_len = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, i + 1) - vec_start; - - hypre_MPI_Send_init((HYPRE_Int *)send_data + vec_start, vec_len, HYPRE_MPI_INT, - ip, 0, comm, requests + num_sends + i); + hypre_MPI_Send_init( (HYPRE_Int *)send_buff + vec_start, vec_len, HYPRE_MPI_INT, + ip, 0, comm, requests + num_sends + i ); } break; case HYPRE_COMM_PKG_JOB_BIGINT: - if (!send_data) - { - send_data = hypre_TAlloc(HYPRE_BigInt, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); - } - if (!recv_data) - { - recv_data = hypre_TAlloc(HYPRE_BigInt, hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs), HYPRE_MEMORY_HOST); - } + num_bytes_send = sizeof(HYPRE_BigInt) * hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends); + num_bytes_recv = sizeof(HYPRE_BigInt) * hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs); + send_buff = hypre_TAlloc(HYPRE_BigInt, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + recv_buff = hypre_TAlloc(HYPRE_BigInt, hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs), HYPRE_MEMORY_HOST); for (i = 0; i < num_recvs; ++i) { HYPRE_Int ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); HYPRE_Int vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, i); HYPRE_Int vec_len = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, i + 1) - vec_start; - hypre_MPI_Recv_init((HYPRE_BigInt *)recv_data + (HYPRE_BigInt)vec_start, vec_len, HYPRE_MPI_BIG_INT, - ip, 0, comm, requests + i); + hypre_MPI_Recv_init( (HYPRE_BigInt *)recv_buff + (HYPRE_BigInt)vec_start, vec_len, HYPRE_MPI_BIG_INT, + ip, 0, comm, requests + i ); } for (i = 0; i < num_sends; ++i) { HYPRE_Int ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); HYPRE_Int vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); HYPRE_Int vec_len = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i + 1) - vec_start; - - hypre_MPI_Send_init((HYPRE_BigInt *)send_data + (HYPRE_BigInt)vec_start, vec_len, HYPRE_MPI_BIG_INT, - ip, 0, comm, requests + num_recvs + i); + hypre_MPI_Send_init( (HYPRE_BigInt *)send_buff + (HYPRE_BigInt)vec_start, vec_len, HYPRE_MPI_BIG_INT, + ip, 0, comm, requests + num_recvs + i); } break; case HYPRE_COMM_PKG_JOB_BIGINT_TRANSPOSE: - if (!recv_data) - { - recv_data = hypre_TAlloc(HYPRE_BigInt, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); - } - if (!send_data) - { - send_data = hypre_TAlloc(HYPRE_BigInt, hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs), HYPRE_MEMORY_HOST); - } + num_bytes_recv = sizeof(HYPRE_BigInt) * hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends); + num_bytes_send = sizeof(HYPRE_BigInt) * hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs); + recv_buff = hypre_TAlloc(HYPRE_BigInt, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), HYPRE_MEMORY_HOST); + send_buff = hypre_TAlloc(HYPRE_BigInt, hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs), HYPRE_MEMORY_HOST); for (i = 0; i < num_sends; ++i) { HYPRE_Int ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); HYPRE_Int vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); HYPRE_Int vec_len = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i + 1) - vec_start; - hypre_MPI_Recv_init((HYPRE_BigInt *)recv_data + (HYPRE_BigInt)vec_start, vec_len, HYPRE_MPI_BIG_INT, - ip, 0, comm, requests + i); + hypre_MPI_Recv_init( (HYPRE_BigInt *)recv_buff + (HYPRE_BigInt)vec_start, vec_len, HYPRE_MPI_BIG_INT, + ip, 0, comm, requests + i ); } for (i = 0; i < num_recvs; ++i) { @@ -241,8 +200,8 @@ HYPRE_Int vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, i); HYPRE_Int vec_len = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, i + 1) - vec_start; - hypre_MPI_Send_init((HYPRE_BigInt *)send_data + (HYPRE_BigInt)vec_start, vec_len, HYPRE_MPI_BIG_INT, - ip, 0, comm, requests + num_sends + i); + hypre_MPI_Send_init( (HYPRE_BigInt *)send_buff + (HYPRE_BigInt)vec_start, vec_len, HYPRE_MPI_BIG_INT, + ip, 0, comm, requests + num_sends + i); } break; default: @@ -250,48 +209,53 @@ break; } // switch (job_type) - hypre_ParCSRCommHandleRecvData(comm_handle) = recv_data; - hypre_ParCSRCommHandleSendData(comm_handle) = send_data; + hypre_ParCSRCommHandleRecvDataBuffer(comm_handle) = recv_buff; + hypre_ParCSRCommHandleSendDataBuffer(comm_handle) = send_buff; + hypre_ParCSRCommHandleNumSendBytes(comm_handle) = num_bytes_send; + hypre_ParCSRCommHandleNumRecvBytes(comm_handle) = num_bytes_recv; return ( comm_handle ); } -hypre_ParCSRPersistentCommHandle * -hypre_ParCSRCommPkgGetPersistentCommHandle( HYPRE_Int job, - hypre_ParCSRCommPkg *comm_pkg ) +hypre_ParCSRPersistentCommHandle* +hypre_ParCSRCommPkgGetPersistentCommHandle( HYPRE_Int job, hypre_ParCSRCommPkg *comm_pkg ) { CommPkgJobType type = getJobTypeOf(job); if (!comm_pkg->persistent_comm_handles[type]) { - comm_pkg->persistent_comm_handles[type] = - hypre_ParCSRPersistentCommHandleCreate(job, comm_pkg, NULL, NULL); - // data is owned by persistent comm handle + /* data is owned by persistent comm handle */ + comm_pkg->persistent_comm_handles[type] = hypre_ParCSRPersistentCommHandleCreate(job, comm_pkg); } + return comm_pkg->persistent_comm_handles[type]; } void hypre_ParCSRPersistentCommHandleDestroy( hypre_ParCSRPersistentCommHandle *comm_handle ) { - if (comm_handle->own_send_data) - { - hypre_TFree(comm_handle->send_data, HYPRE_MEMORY_SHARED); - //hypre_TFree(comm_handle->send_data, HYPRE_MEMORY_HOST); - } - if (comm_handle->own_recv_data) - { - hypre_TFree(comm_handle->recv_data, HYPRE_MEMORY_SHARED); - //hypre_TFree(comm_handle->recv_data, HYPRE_MEMORY_HOST); - } + hypre_TFree(hypre_ParCSRCommHandleSendDataBuffer(comm_handle), HYPRE_MEMORY_HOST); + hypre_TFree(hypre_ParCSRCommHandleRecvDataBuffer(comm_handle), HYPRE_MEMORY_HOST); hypre_TFree(comm_handle->requests, HYPRE_MEMORY_HOST); hypre_TFree(comm_handle, HYPRE_MEMORY_HOST); } -void hypre_ParCSRPersistentCommHandleStart( hypre_ParCSRPersistentCommHandle *comm_handle ) +void hypre_ParCSRPersistentCommHandleStart( hypre_ParCSRPersistentCommHandle *comm_handle, + HYPRE_Int send_memory_location, + void *send_data ) { + hypre_ParCSRCommHandleSendData(comm_handle) = send_data; + hypre_ParCSRCommHandleSendMemoryLocation(comm_handle) = send_memory_location; + if (hypre_ParCSRCommHandleNumRequests(comm_handle) > 0) { + hypre_TMemcpy( hypre_ParCSRCommHandleSendDataBuffer(comm_handle), + send_data, + char, + hypre_ParCSRCommHandleNumSendBytes(comm_handle), + HYPRE_MEMORY_HOST, + send_memory_location ); + HYPRE_Int ret = hypre_MPI_Startall(hypre_ParCSRCommHandleNumRequests(comm_handle), hypre_ParCSRCommHandleRequests(comm_handle)); if (hypre_MPI_SUCCESS != ret) @@ -302,8 +266,13 @@ } } -void hypre_ParCSRPersistentCommHandleWait( hypre_ParCSRPersistentCommHandle *comm_handle ) +void hypre_ParCSRPersistentCommHandleWait( hypre_ParCSRPersistentCommHandle *comm_handle, + HYPRE_Int recv_memory_location, + void *recv_data ) { + hypre_ParCSRCommHandleRecvData(comm_handle) = recv_data; + hypre_ParCSRCommHandleRecvMemoryLocation(comm_handle) = recv_memory_location; + if (hypre_ParCSRCommHandleNumRequests(comm_handle) > 0) { HYPRE_Int ret = hypre_MPI_Waitall(hypre_ParCSRCommHandleNumRequests(comm_handle), @@ -314,40 +283,61 @@ hypre_error_w_msg(HYPRE_ERROR_GENERIC,"MPI error\n"); /*hypre_printf("MPI error %d in %s (%s, line %u)\n", ret, __FUNCTION__, __FILE__, __LINE__);*/ } + + hypre_TMemcpy(recv_data, + hypre_ParCSRCommHandleRecvDataBuffer(comm_handle), + char, + hypre_ParCSRCommHandleNumRecvBytes(comm_handle), + recv_memory_location, + HYPRE_MEMORY_HOST); } } #endif // HYPRE_USING_PERSISTENT_COMM -hypre_ParCSRCommHandle * +hypre_ParCSRCommHandle* hypre_ParCSRCommHandleCreate ( HYPRE_Int job, hypre_ParCSRCommPkg *comm_pkg, - void *send_data, + void *send_data, void *recv_data ) { + return hypre_ParCSRCommHandleCreate_v2(job, comm_pkg, HYPRE_MEMORY_HOST, send_data, + HYPRE_MEMORY_HOST, recv_data); +} + +hypre_ParCSRCommHandle* +hypre_ParCSRCommHandleCreate_v2 ( HYPRE_Int job, + hypre_ParCSRCommPkg *comm_pkg, + HYPRE_Int send_memory_location, + void *send_data_in, + HYPRE_Int recv_memory_location, + void *recv_data_in ) +{ HYPRE_Int num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); HYPRE_Int num_recvs = hypre_ParCSRCommPkgNumRecvs(comm_pkg); MPI_Comm comm = hypre_ParCSRCommPkgComm(comm_pkg); - + HYPRE_Int num_send_bytes = 0; + HYPRE_Int num_recv_bytes = 0; hypre_ParCSRCommHandle *comm_handle; HYPRE_Int num_requests; hypre_MPI_Request *requests; - HYPRE_Int i, j; HYPRE_Int my_id, num_procs; HYPRE_Int ip, vec_start, vec_len; - + void *send_data; + void *recv_data; + /*-------------------------------------------------------------------- * hypre_Initialize sets up a communication handle, - * posts receives and initiates sends. It always requires num_sends, + * posts receives and initiates sends. It always requires num_sends, * num_recvs, recv_procs and send_procs to be set in comm_pkg. * There are different options for job: * job = 1 : is used to initialize communication exchange for the parts - * of vector needed to perform a Matvec, it requires send_data - * and recv_data to be doubles, recv_vec_starts and + * of vector needed to perform a Matvec, it requires send_data + * and recv_data to be doubles, recv_vec_starts and * send_map_starts need to be set in comm_pkg. * job = 2 : is used to initialize communication exchange for the parts - * of vector needed to perform a MatvecT, it requires send_data - * and recv_data to be doubles, recv_vec_starts and + * of vector needed to perform a MatvecT, it requires send_data + * and recv_data to be doubles, recv_vec_starts and * send_map_starts need to be set in comm_pkg. * job = 11: similar to job = 1, but exchanges data of type HYPRE_Int (not HYPRE_Complex), * requires send_data and recv_data to be ints @@ -364,14 +354,67 @@ * default: ignores send_data and recv_data, requires send_mpi_types * and recv_mpi_types to be set in comm_pkg. * datatypes need to point to absolute - * addresses, e.g. generated using hypre_MPI_Address . + * addresses, e.g. generated using hypre_MPI_Address . *--------------------------------------------------------------------*/ +#ifndef HYPRE_WITH_GPU_AWARE_MPI + switch (job) + { + case 1: + num_send_bytes = hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends) * sizeof(HYPRE_Complex); + num_recv_bytes = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs) * sizeof(HYPRE_Complex); + break; + case 2: + num_send_bytes = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs) * sizeof(HYPRE_Complex); + num_recv_bytes = hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends) * sizeof(HYPRE_Complex); + break; + case 11: + num_send_bytes = hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends) * sizeof(HYPRE_Int); + num_recv_bytes = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs) * sizeof(HYPRE_Int); + break; + case 12: + num_send_bytes = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs) * sizeof(HYPRE_Int); + num_recv_bytes = hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends) * sizeof(HYPRE_Int); + break; + case 21: + num_send_bytes = hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends) * sizeof(HYPRE_BigInt); + num_recv_bytes = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs) * sizeof(HYPRE_BigInt); + break; + case 22: + num_send_bytes = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs) * sizeof(HYPRE_BigInt); + num_recv_bytes = hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends) * sizeof(HYPRE_BigInt); + break; + } + + /* send from actually device memory */ + if ( hypre_GetActualMemLocation(send_memory_location) == HYPRE_MEMORY_DEVICE ) + { + send_data = hypre_TAlloc(char, num_send_bytes, HYPRE_MEMORY_HOST); + hypre_TMemcpy(send_data, send_data_in, char, num_send_bytes, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); + } + else + { + send_data = send_data_in; + } + + /* receive from actually device memory */ + if ( hypre_GetActualMemLocation(recv_memory_location) == HYPRE_MEMORY_DEVICE ) + { + recv_data = hypre_TAlloc(char, num_recv_bytes, HYPRE_MEMORY_HOST); + } + else + { + recv_data = recv_data_in; + } +#else /* #ifndef HYPRE_WITH_GPU_AWARE_MPI */ + send_data = send_data_in; + recv_data = recv_data_in; +#endif num_requests = num_sends + num_recvs; - requests = hypre_CTAlloc(hypre_MPI_Request, num_requests, HYPRE_MEMORY_HOST); - - hypre_MPI_Comm_size(comm,&num_procs); - hypre_MPI_Comm_rank(comm,&my_id); + requests = hypre_CTAlloc(hypre_MPI_Request, num_requests, HYPRE_MEMORY_HOST); + + hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_rank(comm, &my_id); j = 0; switch (job) @@ -382,7 +425,7 @@ HYPRE_Complex *d_recv_data = (HYPRE_Complex *) recv_data; for (i = 0; i < num_recvs; i++) { - ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); + ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i); vec_len = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i+1)-vec_start; hypre_MPI_Irecv(&d_recv_data[vec_start], vec_len, HYPRE_MPI_COMPLEX, @@ -390,9 +433,9 @@ } for (i = 0; i < num_sends; i++) { + ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); vec_len = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1)-vec_start; - ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); hypre_MPI_Isend(&d_send_data[vec_start], vec_len, HYPRE_MPI_COMPLEX, ip, 0, comm, &requests[j++]); } @@ -404,15 +447,15 @@ HYPRE_Complex *d_recv_data = (HYPRE_Complex *) recv_data; for (i = 0; i < num_sends; i++) { + ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); vec_len = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1) - vec_start; - ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); hypre_MPI_Irecv(&d_recv_data[vec_start], vec_len, HYPRE_MPI_COMPLEX, ip, 0, comm, &requests[j++]); } for (i = 0; i < num_recvs; i++) { - ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); + ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i); vec_len = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i+1)-vec_start; hypre_MPI_Isend(&d_send_data[vec_start], vec_len, HYPRE_MPI_COMPLEX, @@ -426,7 +469,7 @@ HYPRE_Int *i_recv_data = (HYPRE_Int *) recv_data; for (i = 0; i < num_recvs; i++) { - ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); + ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i); vec_len = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i+1)-vec_start; hypre_MPI_Irecv(&i_recv_data[vec_start], vec_len, HYPRE_MPI_INT, @@ -434,9 +477,9 @@ } for (i = 0; i < num_sends; i++) { + ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); vec_len = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1)-vec_start; - ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); hypre_MPI_Isend(&i_send_data[vec_start], vec_len, HYPRE_MPI_INT, ip, 0, comm, &requests[j++]); } @@ -448,15 +491,15 @@ HYPRE_Int *i_recv_data = (HYPRE_Int *) recv_data; for (i = 0; i < num_sends; i++) { + ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); vec_len = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1) - vec_start; - ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); hypre_MPI_Irecv(&i_recv_data[vec_start], vec_len, HYPRE_MPI_INT, ip, 0, comm, &requests[j++]); } for (i = 0; i < num_recvs; i++) { - ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); + ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i); vec_len = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i+1)-vec_start; hypre_MPI_Isend(&i_send_data[vec_start], vec_len, HYPRE_MPI_INT, @@ -470,7 +513,7 @@ HYPRE_BigInt *i_recv_data = (HYPRE_BigInt *) recv_data; for (i = 0; i < num_recvs; i++) { - ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); + ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i); vec_len = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i+1)-vec_start; hypre_MPI_Irecv(&i_recv_data[vec_start], vec_len, HYPRE_MPI_BIG_INT, @@ -480,7 +523,7 @@ { vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); vec_len = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1)-vec_start; - ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); + ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); hypre_MPI_Isend(&i_send_data[vec_start], vec_len, HYPRE_MPI_BIG_INT, ip, 0, comm, &requests[j++]); } @@ -494,13 +537,13 @@ { vec_start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); vec_len = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1) - vec_start; - ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); + ip = hypre_ParCSRCommPkgSendProc(comm_pkg, i); hypre_MPI_Irecv(&i_recv_data[vec_start], vec_len, HYPRE_MPI_BIG_INT, ip, 0, comm, &requests[j++]); } for (i = 0; i < num_recvs; i++) { - ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); + ip = hypre_ParCSRCommPkgRecvProc(comm_pkg, i); vec_start = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i); vec_len = hypre_ParCSRCommPkgRecvVecStart(comm_pkg,i+1)-vec_start; hypre_MPI_Isend(&i_send_data[vec_start], vec_len, HYPRE_MPI_BIG_INT, @@ -515,11 +558,17 @@ comm_handle = hypre_CTAlloc(hypre_ParCSRCommHandle, 1, HYPRE_MEMORY_HOST); - hypre_ParCSRCommHandleCommPkg(comm_handle) = comm_pkg; - hypre_ParCSRCommHandleSendData(comm_handle) = send_data; - hypre_ParCSRCommHandleRecvData(comm_handle) = recv_data; - hypre_ParCSRCommHandleNumRequests(comm_handle) = num_requests; - hypre_ParCSRCommHandleRequests(comm_handle) = requests; + hypre_ParCSRCommHandleCommPkg(comm_handle) = comm_pkg; + hypre_ParCSRCommHandleSendMemoryLocation(comm_handle) = send_memory_location; + hypre_ParCSRCommHandleRecvMemoryLocation(comm_handle) = recv_memory_location; + hypre_ParCSRCommHandleNumSendBytes(comm_handle) = num_send_bytes; + hypre_ParCSRCommHandleNumRecvBytes(comm_handle) = num_recv_bytes; + hypre_ParCSRCommHandleSendData(comm_handle) = send_data_in; + hypre_ParCSRCommHandleRecvData(comm_handle) = recv_data_in; + hypre_ParCSRCommHandleSendDataBuffer(comm_handle) = send_data; + hypre_ParCSRCommHandleRecvDataBuffer(comm_handle) = recv_data; + hypre_ParCSRCommHandleNumRequests(comm_handle) = num_requests; + hypre_ParCSRCommHandleRequests(comm_handle) = requests; return ( comm_handle ); } @@ -527,18 +576,40 @@ HYPRE_Int hypre_ParCSRCommHandleDestroy( hypre_ParCSRCommHandle *comm_handle ) { - hypre_MPI_Status *status0; + if ( comm_handle == NULL ) + { + return hypre_error_flag; + } - if ( comm_handle==NULL ) return hypre_error_flag; if (hypre_ParCSRCommHandleNumRequests(comm_handle)) { - status0 = hypre_CTAlloc(hypre_MPI_Status, + hypre_MPI_Status *status0; + status0 = hypre_CTAlloc(hypre_MPI_Status, hypre_ParCSRCommHandleNumRequests(comm_handle), HYPRE_MEMORY_HOST); hypre_MPI_Waitall(hypre_ParCSRCommHandleNumRequests(comm_handle), hypre_ParCSRCommHandleRequests(comm_handle), status0); hypre_TFree(status0, HYPRE_MEMORY_HOST); } +#ifndef HYPRE_WITH_GPU_AWARE_MPI + if ( hypre_GetActualMemLocation(hypre_ParCSRCommHandleSendMemoryLocation(comm_handle)) == HYPRE_MEMORY_DEVICE ) + { + hypre_TFree(hypre_ParCSRCommHandleSendDataBuffer(comm_handle), HYPRE_MEMORY_HOST); + } + + if ( hypre_GetActualMemLocation(hypre_ParCSRCommHandleRecvMemoryLocation(comm_handle)) == HYPRE_MEMORY_DEVICE ) + { + hypre_TMemcpy( hypre_ParCSRCommHandleRecvData(comm_handle), + hypre_ParCSRCommHandleRecvDataBuffer(comm_handle), + char, + hypre_ParCSRCommHandleNumRecvBytes(comm_handle), + HYPRE_MEMORY_DEVICE, + HYPRE_MEMORY_HOST ); + + hypre_TFree(hypre_ParCSRCommHandleRecvDataBuffer(comm_handle), HYPRE_MEMORY_HOST); + } +#endif + hypre_TFree(hypre_ParCSRCommHandleRequests(comm_handle), HYPRE_MEMORY_HOST); hypre_TFree(comm_handle, HYPRE_MEMORY_HOST); @@ -583,9 +654,9 @@ HYPRE_Int ip, vec_start, vec_len, num_requests; hypre_MPI_Request *requests; - hypre_MPI_Status *status; + hypre_MPI_Status *status; - hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_size(comm, &num_procs); hypre_MPI_Comm_rank(comm, &my_id); proc_mark = hypre_CTAlloc(HYPRE_Int, num_procs, HYPRE_MEMORY_HOST); @@ -607,7 +678,7 @@ j = 0; for (i=0; i < num_cols_offd; i++) { - if (num_cols_diag) + if (num_cols_diag) proc_num = hypre_min(num_procs-1, (HYPRE_Int)(offd_col / (HYPRE_BigInt)num_cols_diag)); while (col_starts[proc_num] > offd_col ) proc_num = proc_num-1; @@ -618,7 +689,7 @@ while (col_starts[proc_num+1] > offd_col) { proc_add[num_recvs]++; - if (j < num_cols_offd-1) + if (j < num_cols_offd-1) { j++; offd_col = col_map_offd[j]; @@ -635,8 +706,8 @@ } local_info = 2*num_recvs; - - hypre_MPI_Allgather(&local_info, 1, HYPRE_MPI_INT, info, 1, HYPRE_MPI_INT, comm); + + hypre_MPI_Allgather(&local_info, 1, HYPRE_MPI_INT, info, 1, HYPRE_MPI_INT, comm); /* ---------------------------------------------------------------------- * generate information to be sent: tmp contains for each recv_proc: @@ -647,8 +718,8 @@ displs = hypre_CTAlloc(HYPRE_Int, num_procs+1, HYPRE_MEMORY_HOST); displs[0] = 0; for (i=1; i < num_procs+1; i++) - displs[i] = displs[i-1]+info[i-1]; - recv_buf = hypre_CTAlloc(HYPRE_Int, displs[num_procs], HYPRE_MEMORY_HOST); + displs[i] = displs[i-1]+info[i-1]; + recv_buf = hypre_CTAlloc(HYPRE_Int, displs[num_procs], HYPRE_MEMORY_HOST); recv_procs = NULL; tmp = NULL; @@ -693,12 +764,12 @@ break; } j++; - } + } } - + /* ---------------------------------------------------------------------- * determine send_procs and actual elements to be send (in send_map_elmts) - * and send_map_starts whose i-th entry points to the beginning of the + * and send_map_starts whose i-th entry points to the beginning of the * elements to be send to proc. i * ---------------------------------------------------------------------*/ @@ -708,7 +779,7 @@ if (num_sends) { send_procs = hypre_CTAlloc(HYPRE_Int, num_sends, HYPRE_MEMORY_HOST); - send_map_elmts = hypre_CTAlloc(HYPRE_Int, proc_add[num_sends], HYPRE_MEMORY_SHARED); + send_map_elmts = hypre_CTAlloc(HYPRE_Int, proc_add[num_sends], HYPRE_MEMORY_HOST); big_buf_data = hypre_CTAlloc(HYPRE_BigInt, proc_add[num_sends], HYPRE_MEMORY_HOST); } send_map_starts = hypre_CTAlloc(HYPRE_Int, num_sends+1, HYPRE_MEMORY_HOST); @@ -758,13 +829,13 @@ } hypre_TFree(proc_add, HYPRE_MEMORY_HOST); - hypre_TFree(proc_mark, HYPRE_MEMORY_HOST); + hypre_TFree(proc_mark, HYPRE_MEMORY_HOST); hypre_TFree(tmp, HYPRE_MEMORY_HOST); hypre_TFree(recv_buf, HYPRE_MEMORY_HOST); hypre_TFree(displs, HYPRE_MEMORY_HOST); hypre_TFree(info, HYPRE_MEMORY_HOST); hypre_TFree(big_buf_data, HYPRE_MEMORY_HOST); - + /* finish up with the hand-coded call-by-reference... */ *p_num_recvs = num_recvs; *p_recv_procs = recv_procs; @@ -794,14 +865,14 @@ HYPRE_Int *send_procs; HYPRE_Int *send_map_starts; HYPRE_Int *send_map_elmts; - + HYPRE_Int num_recvs; HYPRE_Int *recv_procs; HYPRE_Int *recv_vec_starts; hypre_ParCSRCommPkgCreate_core ( comm, col_map_offd, first_col_diag, col_starts, - num_cols_diag, num_cols_offd, + num_cols_diag, num_cols_offd, &num_recvs, &recv_procs, &recv_vec_starts, &num_sends, &send_procs, &send_map_starts, &send_map_elmts ); @@ -814,15 +885,15 @@ hypre_ParCSRCommPkgSendProcs (comm_pkg) = send_procs; hypre_ParCSRCommPkgSendMapStarts(comm_pkg) = send_map_starts; hypre_ParCSRCommPkgSendMapElmts (comm_pkg) = send_map_elmts; - + return hypre_error_flag; } /* ---------------------------------------------------------------------- * hypre_MatvecCommPkgCreate - * generates the comm_pkg for A + * generates the comm_pkg for A * if no row and/or column partitioning is given, the routine determines - * them with MPE_Decomp1d + * them with MPE_Decomp1d * ---------------------------------------------------------------------*/ HYPRE_Int @@ -833,11 +904,12 @@ HYPRE_BigInt *col_map_offd = hypre_ParCSRMatrixColMapOffd(A); HYPRE_Int num_cols_offd = hypre_CSRMatrixNumCols(hypre_ParCSRMatrixOffd(A)); #ifdef HYPRE_NO_GLOBAL_PARTITION - HYPRE_BigInt global_num_cols = hypre_ParCSRMatrixGlobalNumCols(A); - /* Create the assumed partition */ + HYPRE_BigInt global_num_cols = hypre_ParCSRMatrixGlobalNumCols(A); + /* Create the assumed partition and should own it */ if (hypre_ParCSRMatrixAssumedPartition(A) == NULL) { hypre_ParCSRMatrixCreateAssumedPartition(A); + hypre_ParCSRMatrixOwnsAssumedPartition(A) = 1; } hypre_IJAssumedPart *apart = hypre_ParCSRMatrixAssumedPartition(A); #else @@ -850,14 +922,14 @@ hypre_ParCSRCommPkg *comm_pkg = hypre_CTAlloc(hypre_ParCSRCommPkg, 1,HYPRE_MEMORY_HOST); hypre_ParCSRMatrixCommPkg(A) = comm_pkg; #ifdef HYPRE_NO_GLOBAL_PARTITION - hypre_ParCSRCommPkgCreateApart ( comm, col_map_offd, first_col_diag, + hypre_ParCSRCommPkgCreateApart ( comm, col_map_offd, first_col_diag, num_cols_offd, global_num_cols, apart, comm_pkg ); #else - hypre_ParCSRCommPkgCreate ( comm, col_map_offd, first_col_diag, + hypre_ParCSRCommPkgCreate ( comm, col_map_offd, first_col_diag, col_starts, - num_cols_diag, num_cols_offd, + num_cols_diag, num_cols_offd, comm_pkg ); #endif @@ -882,11 +954,12 @@ if (hypre_ParCSRCommPkgNumSends(comm_pkg)) { hypre_TFree(hypre_ParCSRCommPkgSendProcs(comm_pkg), HYPRE_MEMORY_HOST); - hypre_TFree(hypre_ParCSRCommPkgSendMapElmts(comm_pkg), HYPRE_MEMORY_SHARED); + hypre_TFree(hypre_ParCSRCommPkgSendMapElmts(comm_pkg), HYPRE_MEMORY_HOST); + hypre_TFree(hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg), HYPRE_MEMORY_DEVICE); } hypre_TFree(hypre_ParCSRCommPkgSendMapStarts(comm_pkg), HYPRE_MEMORY_HOST); /* if (hypre_ParCSRCommPkgSendMPITypes(comm_pkg)) - hypre_TFree(hypre_ParCSRCommPkgSendMPITypes(comm_pkg), HYPRE_MEMORY_HOST); */ + hypre_TFree(hypre_ParCSRCommPkgSendMPITypes(comm_pkg), HYPRE_MEMORY_HOST); */ if (hypre_ParCSRCommPkgNumRecvs(comm_pkg)) { hypre_TFree(hypre_ParCSRCommPkgRecvProcs(comm_pkg), HYPRE_MEMORY_HOST); @@ -894,6 +967,12 @@ hypre_TFree(hypre_ParCSRCommPkgRecvVecStarts(comm_pkg), HYPRE_MEMORY_HOST); /* if (hypre_ParCSRCommPkgRecvMPITypes(comm_pkg)) hypre_TFree(hypre_ParCSRCommPkgRecvMPITypes(comm_pkg), HYPRE_MEMORY_HOST); */ + +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_MEMORY) + hypre_TFree(hypre_ParCSRCommPkgTmpData(comm_pkg), HYPRE_MEMORY_DEVICE); + hypre_TFree(hypre_ParCSRCommPkgBufData(comm_pkg), HYPRE_MEMORY_DEVICE); +#endif + hypre_TFree(comm_pkg, HYPRE_MEMORY_HOST); return hypre_error_flag; @@ -902,41 +981,31 @@ /* AHB 11/06 : alternate to the extend function below - creates a * second comm pkg based on indices - this makes it easier to use the * global partition - * RL: reanme and move it here - * */ + * RL: renamed and moved it here + */ HYPRE_Int -hypre_ParCSRFindExtendCommPkg(hypre_ParCSRMatrix *A, HYPRE_Int indices_len, HYPRE_BigInt *indices, +hypre_ParCSRFindExtendCommPkg(MPI_Comm comm, + HYPRE_BigInt global_num, + HYPRE_BigInt my_first, + HYPRE_Int local_num, + HYPRE_BigInt *starts, + hypre_IJAssumedPart *apart, + HYPRE_Int indices_len, + HYPRE_BigInt *indices, hypre_ParCSRCommPkg **extend_comm_pkg) - { - MPI_Comm comm = hypre_ParCSRMatrixComm(A); - HYPRE_BigInt first_col_diag = hypre_ParCSRMatrixFirstColDiag(A); -#ifdef HYPRE_NO_GLOBAL_PARTITION - HYPRE_BigInt global_num_cols = hypre_ParCSRMatrixGlobalNumCols(A); - /* Create the assumed partition */ - if (hypre_ParCSRMatrixAssumedPartition(A) == NULL) - { - hypre_ParCSRMatrixCreateAssumedPartition(A); - } - hypre_IJAssumedPart *apart = hypre_ParCSRMatrixAssumedPartition(A); -#else - HYPRE_BigInt *col_starts = hypre_ParCSRMatrixColStarts(A); - HYPRE_Int num_cols_diag = hypre_CSRMatrixNumCols(hypre_ParCSRMatrixDiag(A)); -#endif /*----------------------------------------------------------- * setup commpkg *----------------------------------------------------------*/ hypre_ParCSRCommPkg *new_comm_pkg = hypre_CTAlloc(hypre_ParCSRCommPkg, 1, HYPRE_MEMORY_HOST); *extend_comm_pkg = new_comm_pkg; + #ifdef HYPRE_NO_GLOBAL_PARTITION - hypre_ParCSRCommPkgCreateApart ( comm, indices, first_col_diag, - indices_len, global_num_cols, - apart, + hypre_assert(apart != NULL); + hypre_ParCSRCommPkgCreateApart ( comm, indices, my_first, indices_len, global_num, apart, new_comm_pkg ); #else - hypre_ParCSRCommPkgCreate ( comm, indices, first_col_diag, - col_starts, - num_cols_diag, indices_len, + hypre_ParCSRCommPkgCreate ( comm, indices, my_first, starts, local_num, indices_len, new_comm_pkg ); #endif @@ -949,7 +1018,7 @@ HYPRE_Int num_rows, HYPRE_Complex *a_data, HYPRE_Int *a_i, - HYPRE_Int *a_j, + HYPRE_Int *a_j, hypre_MPI_Datatype *csr_matrix_datatype ) { HYPRE_Int block_lens[3]; @@ -982,19 +1051,19 @@ HYPRE_Int block_lens[2]; hypre_MPI_Aint displs[2]; hypre_MPI_Datatype types[2]; - + block_lens[0] = num_nonzeros; block_lens[1] = num_nonzeros; - + types[0] = HYPRE_MPI_COMPLEX; types[1] = HYPRE_MPI_INT; - + hypre_MPI_Address(a_data, &displs[0]); hypre_MPI_Address(a_j, &displs[1]); - + hypre_MPI_Type_struct(2,block_lens,displs,types,csr_jdata_datatype); hypre_MPI_Type_commit(csr_jdata_datatype); - + return hypre_error_flag; } diff -Nru hypre-2.16.0/src/parcsr_mv/par_csr_communication.h hypre-2.18.2/src/parcsr_mv/par_csr_communication.h --- hypre-2.16.0/src/parcsr_mv/par_csr_communication.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_csr_communication.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef HYPRE_PAR_CSR_COMMUNICATION_HEADER #define HYPRE_PAR_CSR_COMMUNICATION_HEADER @@ -51,18 +43,18 @@ { MPI_Comm comm; - HYPRE_Int num_sends; - HYPRE_Int *send_procs; - HYPRE_Int *send_map_starts; - HYPRE_Int *send_map_elmts; - - HYPRE_Int num_recvs; - HYPRE_Int *recv_procs; - HYPRE_Int *recv_vec_starts; + HYPRE_Int num_sends; + HYPRE_Int *send_procs; + HYPRE_Int *send_map_starts; + HYPRE_Int *send_map_elmts; + + HYPRE_Int num_recvs; + HYPRE_Int *recv_procs; + HYPRE_Int *recv_vec_starts; /* remote communication information */ - hypre_MPI_Datatype *send_mpi_types; - hypre_MPI_Datatype *recv_mpi_types; + hypre_MPI_Datatype *send_mpi_types; + hypre_MPI_Datatype *recv_mpi_types; #ifdef HYPRE_USING_PERSISTENT_COMM hypre_ParCSRPersistentCommHandle *persistent_comm_handles[NUM_OF_COMM_PKG_JOB_TYPE]; @@ -76,8 +68,8 @@ typedef struct { hypre_ParCSRCommPkg *comm_pkg; - void *send_data; - void *recv_data; + void *send_data; + void *recv_data; HYPRE_Int num_requests; hypre_MPI_Request *requests; @@ -87,9 +79,9 @@ /*-------------------------------------------------------------------------- * Accessor macros: hypre_ParCSRCommPkg *--------------------------------------------------------------------------*/ - + #define hypre_ParCSRCommPkgComm(comm_pkg) (comm_pkg -> comm) - + #define hypre_ParCSRCommPkgNumSends(comm_pkg) (comm_pkg -> num_sends) #define hypre_ParCSRCommPkgSendProcs(comm_pkg) (comm_pkg -> send_procs) #define hypre_ParCSRCommPkgSendProc(comm_pkg, i) (comm_pkg -> send_procs[i]) @@ -113,7 +105,7 @@ /*-------------------------------------------------------------------------- * Accessor macros: hypre_ParCSRCommHandle *--------------------------------------------------------------------------*/ - + #define hypre_ParCSRCommHandleCommPkg(comm_handle) (comm_handle -> comm_pkg) #define hypre_ParCSRCommHandleSendData(comm_handle) (comm_handle -> send_data) #define hypre_ParCSRCommHandleRecvData(comm_handle) (comm_handle -> recv_data) diff -Nru hypre-2.16.0/src/parcsr_mv/par_csr_matop.c hypre-2.18.2/src/parcsr_mv/par_csr_matop.c --- hypre-2.16.0/src/parcsr_mv/par_csr_matop.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_csr_matop.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_utilities.h" #include "hypre_hopscotch_hash.h" @@ -16,22 +11,6 @@ #include "_hypre_lapack.h" #include "_hypre_blas.h" -/* RDF: The following prototype already exists in _hypre_parcsr_ls.h, so - * something needs to be reorganized here.*/ - -#ifdef __cplusplus -extern "C" { -#endif - - hypre_CSRMatrix * - hypre_ExchangeRAPData( hypre_CSRMatrix *RAP_int, hypre_ParCSRCommPkg *comm_pkg_RT); -/* reference seems necessary to prevent a problem with the - "headers" script... */ - -#ifdef __cplusplus -} -#endif - /* The following function was formerly part of hypre_ParMatmul but was removed so it can also be used for multiplication of Boolean matrices @@ -1648,6 +1627,7 @@ ); B_ext = hypre_CSRMatrixCreate(num_rows_B_ext,num_cols_B,num_nonzeros); + hypre_CSRMatrixMemoryLocation(B_ext) = HYPRE_MEMORY_HOST; hypre_CSRMatrixI(B_ext) = B_ext_i; hypre_CSRMatrixBigJ(B_ext) = B_ext_j; if (data) hypre_CSRMatrixData(B_ext) = B_ext_data; @@ -1658,22 +1638,47 @@ hypre_CSRMatrix * hypre_ParCSRMatrixExtractBExt( hypre_ParCSRMatrix *B, hypre_ParCSRMatrix *A, - HYPRE_Int data ) + HYPRE_Int want_data ) { + +#if 0 hypre_ParCSRCommHandle *comm_handle_idx, *comm_handle_data; - hypre_CSRMatrix *B_ext = hypre_ParCSRMatrixExtractBExt_Overlap(B, A, data, &comm_handle_idx, &comm_handle_data, NULL, NULL, 0, 0); + hypre_CSRMatrix *B_ext = hypre_ParCSRMatrixExtractBExt_Overlap(B, A, want_data, &comm_handle_idx, &comm_handle_data, NULL, NULL, 0, 0); HYPRE_Int *send_idx = (HYPRE_Int *)comm_handle_idx->send_data; hypre_ParCSRCommHandleDestroy(comm_handle_idx); hypre_TFree(send_idx, HYPRE_MEMORY_HOST); - if (data) + if (want_data) { HYPRE_Real *send_data = (HYPRE_Real *)comm_handle_data->send_data; hypre_ParCSRCommHandleDestroy(comm_handle_data); hypre_TFree(send_data, HYPRE_MEMORY_HOST); } +#else + hypre_assert( hypre_CSRMatrixMemoryLocation(hypre_ParCSRMatrixDiag(B)) == + hypre_CSRMatrixMemoryLocation(hypre_ParCSRMatrixOffd(B)) ); + + hypre_assert( hypre_GetActualMemLocation(hypre_CSRMatrixMemoryLocation(hypre_ParCSRMatrixDiag(B))) != HYPRE_MEMORY_DEVICE ); + + hypre_CSRMatrix *B_ext; + void *request; + + if (!hypre_ParCSRMatrixCommPkg(A)) + { + hypre_MatvecCommPkgCreate(A); + } + + hypre_ParcsrGetExternalRowsInit(B, + hypre_CSRMatrixNumCols(hypre_ParCSRMatrixOffd(A)), + hypre_ParCSRMatrixColMapOffd(A), + hypre_ParCSRMatrixCommPkg(A), + want_data, + &request); + + B_ext = hypre_ParcsrGetExternalRowsWait(request); +#endif return B_ext; } @@ -1683,9 +1688,9 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_ParCSRMatrixTranspose( hypre_ParCSRMatrix *A, +hypre_ParCSRMatrixTranspose( hypre_ParCSRMatrix *A, hypre_ParCSRMatrix **AT_ptr, - HYPRE_Int data ) + HYPRE_Int data ) { hypre_ParCSRCommHandle *comm_handle; MPI_Comm comm = hypre_ParCSRMatrixComm(A); @@ -1988,8 +1993,9 @@ hypre_ParCSRMatrixOwnsRowStarts(AT) = 1; hypre_ParCSRMatrixOwnsColStarts(AT) = 1; if (row_starts_AT == col_starts_AT) + { hypre_ParCSRMatrixOwnsColStarts(AT) = 0; - + } hypre_ParCSRMatrixCommPkg(AT) = NULL; hypre_ParCSRMatrixCommPkgT(AT) = NULL; @@ -1997,6 +2003,8 @@ hypre_ParCSRMatrixRowvalues(AT) = NULL; hypre_ParCSRMatrixGetrowactive(AT) = 0; + hypre_ParCSRMatrixOwnsAssumedPartition(AT) = 1; + *AT_ptr = AT; return ierr; @@ -3006,7 +3014,7 @@ comm_pkg_B = hypre_ParCSRMatrixCommPkg(B); } - C = hypre_ParCSRMatrixCompleteClone(B); + C = hypre_ParCSRMatrixClone(B, 0); /*hypre_ParCSRMatrixInitialize(C);*/ C_diag = hypre_ParCSRMatrixDiag(C); @@ -3155,7 +3163,7 @@ recv_vec_starts_C = hypre_CTAlloc(HYPRE_Int, num_recvs_B+1, HYPRE_MEMORY_HOST); send_procs_C = hypre_CTAlloc(HYPRE_Int, num_sends_B, HYPRE_MEMORY_HOST); send_map_starts_C = hypre_CTAlloc(HYPRE_Int, num_sends_B+1, HYPRE_MEMORY_HOST); - send_map_elmts_C = hypre_CTAlloc(HYPRE_Int, send_map_starts_B[num_sends_B], HYPRE_MEMORY_SHARED); + send_map_elmts_C = hypre_CTAlloc(HYPRE_Int, send_map_starts_B[num_sends_B], HYPRE_MEMORY_HOST); for (i=0; i < num_recvs_B; i++) recv_procs_C[i] = recv_procs_B[i]; @@ -3314,6 +3322,7 @@ { hypre_CSRMatrix *C_int_diag; hypre_CSRMatrix *C_int_offd; + void *request; C_tmp_offd = hypre_CSRMatrixMultiply(AT_diag, B_offd); C_int_diag = hypre_CSRMatrixMultiply(AT_offd, B_diag); C_int_offd = hypre_CSRMatrixMultiply(AT_offd, B_offd); @@ -3322,7 +3331,8 @@ C_int = hypre_MergeDiagAndOffd(B); hypre_ParCSRMatrixDiag(B) = B_diag; hypre_ParCSRMatrixOffd(B) = B_offd; - C_ext = hypre_ExchangeRAPData(C_int, comm_pkg_A); + hypre_ExchangeExternalRowsInit(C_int, comm_pkg_A, &request); + C_ext = hypre_ExchangeExternalRowsWait(request); C_ext_i = hypre_CSRMatrixI(C_ext); C_ext_j = hypre_CSRMatrixBigJ(C_ext); C_ext_data = hypre_CSRMatrixData(C_ext); @@ -3472,8 +3482,8 @@ C_diag_i = hypre_CTAlloc(HYPRE_Int, num_cols_diag_A+1, HYPRE_MEMORY_SHARED); C_offd_i = hypre_CTAlloc(HYPRE_Int, num_cols_diag_A+1, HYPRE_MEMORY_SHARED); - C_diag_array = hypre_CTAlloc(HYPRE_Int, max_num_threads, HYPRE_MEMORY_SHARED); - C_offd_array = hypre_CTAlloc(HYPRE_Int, max_num_threads, HYPRE_MEMORY_SHARED); + C_diag_array = hypre_CTAlloc(HYPRE_Int, max_num_threads, HYPRE_MEMORY_HOST); + C_offd_array = hypre_CTAlloc(HYPRE_Int, max_num_threads, HYPRE_MEMORY_HOST); #ifdef HYPRE_USING_OPENMP #pragma omp parallel @@ -3664,8 +3674,8 @@ hypre_TFree(B_marker, HYPRE_MEMORY_HOST); hypre_TFree(B_marker_offd, HYPRE_MEMORY_HOST); } /*end parallel region */ - hypre_TFree(C_diag_array, HYPRE_MEMORY_SHARED); - hypre_TFree(C_offd_array, HYPRE_MEMORY_SHARED); + hypre_TFree(C_diag_array, HYPRE_MEMORY_HOST); + hypre_TFree(C_offd_array, HYPRE_MEMORY_HOST); } /*C = hypre_ParCSRMatrixCreate(comm, n_cols_A, n_cols_B, col_starts_A, @@ -3799,8 +3809,7 @@ hypre_ParvecBdiagInvScal( hypre_ParVector *b, HYPRE_Int blockSize, hypre_ParVector **bs, - HYPRE_Complex *bdiaginv, - hypre_ParCSRCommPkg *comm_pkg) + hypre_ParCSRMatrix *A) { MPI_Comm comm = hypre_ParCSRMatrixComm(b); HYPRE_Int num_procs, my_id; @@ -3815,10 +3824,15 @@ HYPRE_BigInt first_row_block = first_row / (HYPRE_BigInt)(blockSize) * (HYPRE_BigInt)blockSize; HYPRE_BigInt end_row_block = hypre_min( (last_row / (HYPRE_BigInt)blockSize + 1) * (HYPRE_BigInt)blockSize, nrow_global ); + hypre_assert(blockSize == A->bdiag_size); + HYPRE_Complex *bdiaginv = A->bdiaginv; + hypre_ParCSRCommPkg *comm_pkg = A->bdiaginv_comm_pkg; + + HYPRE_Complex *dense = bdiaginv; + //for (i=first_row_block; i < end_row; i+=blockSize) ; //printf("===[%d %d), [ %d %d ) %d === \n", first_row, end_row, first_row_block, end_row_block, i); - HYPRE_Complex *dense = bdiaginv; /* local vector of b */ hypre_Vector *b_local = hypre_ParVectorLocalVector(b); HYPRE_Complex *b_local_data = hypre_VectorData(b_local); @@ -3925,9 +3939,7 @@ HYPRE_Int hypre_ParcsrBdiagInvScal( hypre_ParCSRMatrix *A, HYPRE_Int blockSize, - hypre_ParCSRMatrix **As, - HYPRE_Complex **bdiaginv, - hypre_ParCSRCommPkg **commpkg_out ) + hypre_ParCSRMatrix **As) { MPI_Comm comm = hypre_ParCSRMatrixComm(A); HYPRE_Int num_procs, my_id; @@ -3963,6 +3975,8 @@ HYPRE_BigInt nrow_global = hypre_ParCSRMatrixGlobalNumRows(A); HYPRE_BigInt ncol_global = hypre_ParCSRMatrixGlobalNumCols(A); + HYPRE_BigInt *row_starts = hypre_ParCSRMatrixRowStarts(A); + void *request; /* if square globally and locally */ HYPRE_Int square2 = (nrow_global == ncol_global) && (nrow_local == ncol_local) && @@ -4043,7 +4057,14 @@ hypre_assert(j == num_ext_rows); - hypre_ParcsrGetExternalRows(A, num_ext_rows, ext_indices, &A_ext, commpkg_out); + /* create CommPkg for external rows */ + hypre_ParCSRFindExtendCommPkg(comm, nrow_global, first_row, nrow_local, row_starts, + hypre_ParCSRMatrixAssumedPartition(A), + num_ext_rows, ext_indices, &A->bdiaginv_comm_pkg); + + hypre_ParcsrGetExternalRowsInit(A, num_ext_rows, ext_indices, A->bdiaginv_comm_pkg, 1, &request); + A_ext = hypre_ParcsrGetExternalRowsWait(request); + hypre_TFree(ext_indices, HYPRE_MEMORY_HOST); A_ext_i = hypre_CSRMatrixI(A_ext); @@ -4497,12 +4518,16 @@ hypre_ParCSRMatrixColMapOffd(Anew) = col_map_offd_A_new; + hypre_ParCSRMatrixSetNumNonzeros(Anew); + hypre_ParCSRMatrixDNumNonzeros(Anew) = (HYPRE_Real) hypre_ParCSRMatrixNumNonzeros(Anew); + //printf("nnz_diag %d --> %d, nnz_offd %d --> %d\n", nnz_diag, nnz_diag_new, nnz_offd, nnz_offd_new); + /* create CommPkg of Anew */ hypre_MatvecCommPkgCreate(Anew); *As = Anew; - /* free workspace */ + /* if (bdiaginv) { *bdiaginv = dense_all; @@ -4511,6 +4536,12 @@ { hypre_TFree(dense_all, HYPRE_MEMORY_HOST); } + */ + /* save diagonal blocks in A */ + A->bdiag_size = blockSize; + A->bdiaginv = dense_all; + + /* free workspace */ hypre_TFree(IPIV, HYPRE_MEMORY_HOST); hypre_TFree(dgetri_work, HYPRE_MEMORY_HOST); hypre_TFree(marker_diag, HYPRE_MEMORY_HOST); @@ -4523,41 +4554,46 @@ HYPRE_Int -hypre_ParcsrGetExternalRows( hypre_ParCSRMatrix *A, - HYPRE_Int indices_len, - HYPRE_BigInt *indices, - hypre_CSRMatrix **A_ext, - hypre_ParCSRCommPkg **commpkg_out ) +hypre_ParcsrGetExternalRowsInit( hypre_ParCSRMatrix *A, + HYPRE_Int indices_len, + HYPRE_BigInt *indices, + hypre_ParCSRCommPkg *comm_pkg, + HYPRE_Int want_data, + void **request_ptr) { - HYPRE_Int i, j, k, i1, j1, start, end, - num_sends, num_rows_send, num_nnz_send, *send_i, - num_recvs, num_rows_recv, num_nnz_recv, *recv_i, - *send_jstarts, *recv_jstarts; + HYPRE_Int i, j, k; + HYPRE_Int num_sends, num_rows_send, num_nnz_send, *send_i, + num_recvs, num_rows_recv, num_nnz_recv, *recv_i, + *send_jstarts, *recv_jstarts, *send_i_offset; HYPRE_BigInt *send_j, *recv_j; - HYPRE_Complex *send_a, *recv_a; - hypre_ParCSRCommPkg *comm_pkg, *comm_pkg_j; - hypre_ParCSRCommHandle *comm_handle; + HYPRE_Complex *send_a = NULL, *recv_a = NULL; + hypre_ParCSRCommPkg *comm_pkg_j; + hypre_ParCSRCommHandle *comm_handle, *comm_handle_j, *comm_handle_a; + /* HYPRE_Int global_num_rows = hypre_ParCSRMatrixGlobalNumRows(A); */ /* diag part of A */ hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); HYPRE_Real *A_diag_a = hypre_CSRMatrixData(A_diag); HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); + /* HYPRE_Int local_num_rows = hypre_CSRMatrixNumRows(A_diag); */ /* off-diag part of A */ hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); HYPRE_Real *A_offd_a = hypre_CSRMatrixData(A_offd); HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); - - HYPRE_BigInt first_row = hypre_ParCSRMatrixFirstRowIndex(A); + /* HYPRE_BigInt *row_starts = hypre_ParCSRMatrixRowStarts(A); */ + /* HYPRE_BigInt first_row = hypre_ParCSRMatrixFirstRowIndex(A); */ + HYPRE_BigInt first_col = hypre_ParCSRMatrixFirstColDiag(A); HYPRE_BigInt *col_map_offd_A = hypre_ParCSRMatrixColMapOffd(A); - MPI_Comm comm = hypre_ParCSRMatrixComm(A); HYPRE_Int num_procs; + HYPRE_Int my_id; + void **vrequest; + hypre_CSRMatrix *A_ext; hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_rank(comm, &my_id); - /* create CommPkg for external rows */ - hypre_ParCSRFindExtendCommPkg(A, indices_len, indices, &comm_pkg); /* number of sends (#procs) */ num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); /* number of rows to send */ @@ -4570,8 +4606,9 @@ /* must be true if indices contains proper offd indices */ hypre_assert(indices_len == num_rows_recv); - /* the arrays to send and recv: we first send and recv the row lengths */ - send_i = hypre_CTAlloc(HYPRE_Int, num_rows_send, HYPRE_MEMORY_HOST); + /* send_i/recv_i: + * the arrays to send and recv: we first send and recv the row lengths */ + send_i = hypre_TAlloc(HYPRE_Int, num_rows_send, HYPRE_MEMORY_HOST); recv_i = hypre_CTAlloc(HYPRE_Int, num_rows_recv + 1, HYPRE_MEMORY_HOST); /* fill the send array with row lengths */ for (i = 0, num_nnz_send = 0; i < num_rows_send; i++) @@ -4581,46 +4618,74 @@ send_i[i] = A_diag_i[j+1] - A_diag_i[j] + A_offd_i[j+1] - A_offd_i[j]; num_nnz_send += send_i[i]; } - /* send this array out: note the shift in recv_i by one */ + + /* send this array out: note the shift in recv_i by one (async) */ comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, send_i, recv_i+1); - /* ... */ - hypre_ParCSRCommHandleDestroy(comm_handle); - /* prepare data to send out */ - send_j = hypre_CTAlloc(HYPRE_BigInt, num_nnz_send, HYPRE_MEMORY_HOST); - send_a = hypre_CTAlloc(HYPRE_Complex, num_nnz_send, HYPRE_MEMORY_HOST); + /* prepare data to send out. overlap with the above commmunication */ + send_j = hypre_TAlloc(HYPRE_BigInt, num_nnz_send, HYPRE_MEMORY_HOST); + if (want_data) + { + send_a = hypre_TAlloc(HYPRE_Complex, num_nnz_send, HYPRE_MEMORY_HOST); + } + + send_i_offset = hypre_TAlloc(HYPRE_Int, num_rows_send + 1, HYPRE_MEMORY_HOST); + send_i_offset[0] = 0; + hypre_TMemcpy(send_i_offset + 1, send_i, HYPRE_Int, num_rows_send, + HYPRE_MEMORY_HOST, HYPRE_MEMORY_HOST); + /* prefix sum. TODO: OMP parallelization */ + for (i = 1; i <= num_rows_send; i++) + { + send_i_offset[i] += send_i_offset[i-1]; + } + hypre_assert(send_i_offset[num_rows_send] == num_nnz_send); + /* pointers to each proc in send_j */ - send_jstarts = hypre_CTAlloc(HYPRE_Int, num_sends + 1, HYPRE_MEMORY_HOST); + send_jstarts = hypre_TAlloc(HYPRE_Int, num_sends + 1, HYPRE_MEMORY_HOST); +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i <= num_sends; i++) + { + send_jstarts[i] = send_i_offset[hypre_ParCSRCommPkgSendMapStart(comm_pkg, i)]; + } + hypre_assert(send_jstarts[num_sends] == num_nnz_send); + /* fill the CSR matrix: j and a */ - for (i = 0, i1 = 0; i < num_sends; i++) +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for HYPRE_SMP_SCHEDULE private(i,j,k) +#endif + for (i = 0; i < num_rows_send; i++) { - start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); - end = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); - for (j = start; j < end; j++) - { - /* will send row j1 to send_proc[i] */ - j1 = hypre_ParCSRCommPkgSendMapElmt(comm_pkg, j); - /* open row j1 and fill ja and a to send */ - for (k = A_diag_i[j1]; k < A_diag_i[j1+1]; k++) + HYPRE_Int i1 = send_i_offset[i]; + j = hypre_ParCSRCommPkgSendMapElmt(comm_pkg, i); + /* open row j and fill ja and a to send */ + for (k = A_diag_i[j]; k < A_diag_i[j+1]; k++) + { + send_j[i1] = first_col + A_diag_j[k]; + if (want_data) { - send_j[i1] = first_row + (HYPRE_BigInt)A_diag_j[k]; send_a[i1] = A_diag_a[k]; + } i1++; } if (num_procs > 1) { - for (k = A_offd_i[j1]; k < A_offd_i[j1+1]; k++) + for (k = A_offd_i[j]; k < A_offd_i[j+1]; k++) { send_j[i1] = col_map_offd_A[A_offd_j[k]]; + if (want_data) + { send_a[i1] = A_offd_a[k]; + } i1++; } } - } - send_jstarts[i+1] = i1; + hypre_assert(send_i_offset[i+1] == i1); } - hypre_assert(i1 == num_nnz_send); + /* finish the above communication: send_i/recv_i */ + hypre_ParCSRCommHandleDestroy(comm_handle); /* adjust recv_i to ptrs */ for (i = 1; i <= num_rows_recv; i++) @@ -4629,7 +4694,10 @@ } num_nnz_recv = recv_i[num_rows_recv]; recv_j = hypre_CTAlloc(HYPRE_BigInt, num_nnz_recv, HYPRE_MEMORY_HOST); - recv_a = hypre_CTAlloc(HYPRE_Complex, num_nnz_recv, HYPRE_MEMORY_HOST); + if (want_data) + { + recv_a = hypre_CTAlloc(HYPRE_Complex, num_nnz_recv, HYPRE_MEMORY_HOST); + } recv_jstarts = hypre_CTAlloc(HYPRE_Int, num_recvs + 1, HYPRE_MEMORY_HOST); for (i = 1; i <= num_recvs; i++) { @@ -4647,40 +4715,70 @@ hypre_ParCSRCommPkgRecvProcs (comm_pkg_j) = hypre_ParCSRCommPkgRecvProcs(comm_pkg); hypre_ParCSRCommPkgRecvVecStarts(comm_pkg_j) = recv_jstarts; - /* do communication */ + /* init communication */ /* ja */ - comm_handle = hypre_ParCSRCommHandleCreate(21, comm_pkg_j, send_j, recv_j); - /* ... */ - hypre_ParCSRCommHandleDestroy(comm_handle); - - /* a */ - comm_handle = hypre_ParCSRCommHandleCreate( 1, comm_pkg_j, send_a, recv_a); - /* ... */ - hypre_ParCSRCommHandleDestroy(comm_handle); - - /* A_ext is ready */ - *A_ext = hypre_CSRMatrixCreate(num_rows_recv, hypre_ParCSRMatrixGlobalNumCols(A), num_nnz_recv); - - hypre_CSRMatrixI (*A_ext) = recv_i; - hypre_CSRMatrixBigJ(*A_ext) = recv_j; - hypre_CSRMatrixData(*A_ext) = recv_a; - - if (commpkg_out) + comm_handle_j = hypre_ParCSRCommHandleCreate(21, comm_pkg_j, send_j, recv_j); + if (want_data) { - *commpkg_out = comm_pkg; + /* a */ + comm_handle_a = hypre_ParCSRCommHandleCreate(1, comm_pkg_j, send_a, recv_a); } else { - hypre_MatvecCommPkgDestroy(comm_pkg); + comm_handle_a = NULL; } + + /* create A_ext */ + A_ext = hypre_CSRMatrixCreate(num_rows_recv, hypre_ParCSRMatrixGlobalNumCols(A), num_nnz_recv); + hypre_CSRMatrixMemoryLocation(A_ext) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixI (A_ext) = recv_i; + hypre_CSRMatrixBigJ(A_ext) = recv_j; + hypre_CSRMatrixData(A_ext) = recv_a; + + /* output */ + vrequest = hypre_TAlloc(void *, 4, HYPRE_MEMORY_HOST); + vrequest[0] = (void *) comm_handle_j; + vrequest[1] = (void *) comm_handle_a; + vrequest[2] = (void *) A_ext; + vrequest[3] = (void *) comm_pkg_j; + + *request_ptr = (void *) vrequest; + + /* free */ hypre_TFree(send_i, HYPRE_MEMORY_HOST); + hypre_TFree(send_i_offset, HYPRE_MEMORY_HOST); + + return hypre_error_flag; +} + +hypre_CSRMatrix* +hypre_ParcsrGetExternalRowsWait(void *vrequest) +{ + void **request = (void **) vrequest; + + hypre_ParCSRCommHandle *comm_handle_j = (hypre_ParCSRCommHandle *) request[0]; + hypre_ParCSRCommHandle *comm_handle_a = (hypre_ParCSRCommHandle *) request[1]; + hypre_CSRMatrix *A_ext = (hypre_CSRMatrix *) request[2]; + hypre_ParCSRCommPkg *comm_pkg_j = (hypre_ParCSRCommPkg *) request[3]; + HYPRE_BigInt *send_j = (HYPRE_BigInt *) hypre_ParCSRCommHandleSendData(comm_handle_j); + + if (comm_handle_a) + { + HYPRE_Complex *send_a = (HYPRE_Complex *) hypre_ParCSRCommHandleSendData(comm_handle_a); + hypre_ParCSRCommHandleDestroy(comm_handle_a); + hypre_TFree(send_a, HYPRE_MEMORY_HOST); + } + + hypre_ParCSRCommHandleDestroy(comm_handle_j); hypre_TFree(send_j, HYPRE_MEMORY_HOST); - hypre_TFree(send_a, HYPRE_MEMORY_HOST); - hypre_TFree(send_jstarts, HYPRE_MEMORY_HOST); - hypre_TFree(recv_jstarts, HYPRE_MEMORY_HOST); + + hypre_TFree(hypre_ParCSRCommPkgSendMapStarts(comm_pkg_j), HYPRE_MEMORY_HOST); + hypre_TFree(hypre_ParCSRCommPkgRecvVecStarts(comm_pkg_j), HYPRE_MEMORY_HOST); hypre_TFree(comm_pkg_j, HYPRE_MEMORY_HOST); - return hypre_error_flag; + hypre_TFree(request, HYPRE_MEMORY_HOST); + + return A_ext; } /* C = alpha * A + beta * B @@ -4908,11 +5006,13 @@ hypre_CSRMatrixData(C_diag) = C_diag_a; hypre_CSRMatrixI(C_diag) = C_diag_i; hypre_CSRMatrixJ(C_diag) = C_diag_j; + hypre_CSRMatrixMemoryLocation(C_diag) = HYPRE_MEMORY_HOST; C_offd = hypre_ParCSRMatrixOffd(C); hypre_CSRMatrixData(C_offd) = C_offd_a; hypre_CSRMatrixI(C_offd) = C_offd_i; hypre_CSRMatrixJ(C_offd) = C_offd_j; + hypre_CSRMatrixMemoryLocation(C_offd) = HYPRE_MEMORY_HOST; hypre_ParCSRMatrixColMapOffd(C) = col_map_offd_C; @@ -4933,3 +5033,543 @@ return hypre_error_flag; } +HYPRE_Real +hypre_ParCSRMatrixFnorm( hypre_ParCSRMatrix *A ) +{ + + MPI_Comm comm = hypre_ParCSRMatrixComm(A); + HYPRE_Real f_diag, f_offd, local_result, result; + + f_diag = hypre_CSRMatrixFnorm(hypre_ParCSRMatrixDiag(A)); + f_offd = hypre_CSRMatrixFnorm(hypre_ParCSRMatrixOffd(A)); + local_result = f_diag * f_diag + f_offd * f_offd; + + hypre_MPI_Allreduce(&local_result, &result, 1, HYPRE_MPI_REAL, hypre_MPI_SUM, comm); + + return sqrt(result); +} + +HYPRE_Int +hypre_ExchangeExternalRowsInit( hypre_CSRMatrix *B_ext, + hypre_ParCSRCommPkg *comm_pkg_A, + void **request_ptr) +{ + MPI_Comm comm = hypre_ParCSRCommPkgComm(comm_pkg_A); + HYPRE_Int num_recvs = hypre_ParCSRCommPkgNumRecvs(comm_pkg_A); + HYPRE_Int *recv_procs = hypre_ParCSRCommPkgRecvProcs(comm_pkg_A); + HYPRE_Int *recv_vec_starts = hypre_ParCSRCommPkgRecvVecStarts(comm_pkg_A); + HYPRE_Int num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg_A); + HYPRE_Int *send_procs = hypre_ParCSRCommPkgSendProcs(comm_pkg_A); + HYPRE_Int *send_map_starts = hypre_ParCSRCommPkgSendMapStarts(comm_pkg_A); + + HYPRE_Int num_elmts_send = send_map_starts[num_sends]; + HYPRE_Int num_elmts_recv = recv_vec_starts[num_recvs]; + + HYPRE_Int *B_ext_i = B_ext ? hypre_CSRMatrixI(B_ext) : NULL; + HYPRE_BigInt *B_ext_j = B_ext ? hypre_CSRMatrixBigJ(B_ext) : NULL; + HYPRE_Complex *B_ext_data = B_ext ? hypre_CSRMatrixData(B_ext) : NULL; + HYPRE_Int B_ext_ncols = B_ext ? hypre_CSRMatrixNumCols(B_ext) : 0; + HYPRE_Int B_ext_nrows = B_ext ? hypre_CSRMatrixNumRows(B_ext) : 0; + HYPRE_Int *B_ext_rownnz = hypre_CTAlloc(HYPRE_Int, B_ext_nrows, HYPRE_MEMORY_HOST); + + hypre_assert(num_elmts_recv == B_ext_nrows); + + /* output matrix */ + hypre_CSRMatrix *B_int; + HYPRE_Int B_int_nrows = num_elmts_send; + HYPRE_Int B_int_ncols = B_ext_ncols; + HYPRE_Int *B_int_i = hypre_TAlloc(HYPRE_Int, B_int_nrows + 1, HYPRE_MEMORY_HOST); + HYPRE_BigInt *B_int_j = NULL; + HYPRE_Complex *B_int_data = NULL; + HYPRE_Int B_int_nnz; + + hypre_ParCSRCommHandle *comm_handle, *comm_handle_j, *comm_handle_a; + hypre_ParCSRCommPkg *comm_pkg_j; + + HYPRE_Int *jdata_recv_vec_starts; + HYPRE_Int *jdata_send_map_starts; + + HYPRE_Int i; + HYPRE_Int num_procs; + void **vrequest; + + hypre_MPI_Comm_size(comm, &num_procs); + + jdata_send_map_starts = hypre_TAlloc(HYPRE_Int, num_sends+1, HYPRE_MEMORY_HOST); + + /*-------------------------------------------------------------------------- + * B_ext_rownnz contains the number of elements of row j + * (to be determined through send_map_elmnts on the receiving end) + *--------------------------------------------------------------------------*/ + for (i = 0; i < B_ext_nrows; i++) + { + B_ext_rownnz[i] = B_ext_i[i+1] - B_ext_i[i]; + } + + /*-------------------------------------------------------------------------- + * initialize communication: send/recv the row nnz + * (note the use of comm_pkg_A, mode 12, as in transpose matvec + *--------------------------------------------------------------------------*/ + comm_handle = hypre_ParCSRCommHandleCreate(12, comm_pkg_A, B_ext_rownnz, B_int_i + 1); + + jdata_recv_vec_starts = hypre_TAlloc(HYPRE_Int, num_recvs + 1, HYPRE_MEMORY_HOST); + jdata_recv_vec_starts[0] = 0; + for (i = 1; i <= num_recvs; i++) + { + jdata_recv_vec_starts[i] = B_ext_i[recv_vec_starts[i]]; + } + + comm_pkg_j = hypre_CTAlloc(hypre_ParCSRCommPkg, 1, HYPRE_MEMORY_HOST); + hypre_ParCSRCommPkgComm(comm_pkg_j) = comm; + hypre_ParCSRCommPkgNumSends(comm_pkg_j) = num_recvs; + hypre_ParCSRCommPkgNumRecvs(comm_pkg_j) = num_sends; + hypre_ParCSRCommPkgSendProcs(comm_pkg_j) = recv_procs; + hypre_ParCSRCommPkgRecvProcs(comm_pkg_j) = send_procs; + + hypre_ParCSRCommHandleDestroy(comm_handle); + + /*-------------------------------------------------------------------------- + * compute B_int: row nnz to row ptrs + *--------------------------------------------------------------------------*/ + B_int_i[0] = 0; + for (i = 1; i <= B_int_nrows; i++) + { + B_int_i[i] += B_int_i[i-1]; + } + + B_int_nnz = B_int_i[B_int_nrows]; + + B_int_j = hypre_TAlloc(HYPRE_BigInt, B_int_nnz, HYPRE_MEMORY_HOST); + B_int_data = hypre_TAlloc(HYPRE_Complex, B_int_nnz, HYPRE_MEMORY_HOST); + + for (i = 0; i <= num_sends; i++) + { + jdata_send_map_starts[i] = B_int_i[send_map_starts[i]]; + } + + /* note the order of send/recv is reversed */ + hypre_ParCSRCommPkgRecvVecStarts(comm_pkg_j) = jdata_send_map_starts; + hypre_ParCSRCommPkgSendMapStarts(comm_pkg_j) = jdata_recv_vec_starts; + + /* send/recv CSR rows */ + comm_handle_a = hypre_ParCSRCommHandleCreate( 1, comm_pkg_j, B_ext_data, B_int_data); + comm_handle_j = hypre_ParCSRCommHandleCreate(21, comm_pkg_j, B_ext_j, B_int_j); + + /* create CSR */ + B_int = hypre_CSRMatrixCreate(B_int_nrows, B_int_ncols, B_int_nnz); + hypre_CSRMatrixMemoryLocation(B_int) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixI(B_int) = B_int_i; + hypre_CSRMatrixBigJ(B_int) = B_int_j; + hypre_CSRMatrixData(B_int) = B_int_data; + + /* output */ + vrequest = hypre_TAlloc(void *, 4, HYPRE_MEMORY_HOST); + vrequest[0] = (void *) comm_handle_j; + vrequest[1] = (void *) comm_handle_a; + vrequest[2] = (void *) B_int; + vrequest[3] = (void *) comm_pkg_j; + + *request_ptr = (void *) vrequest; + + hypre_TFree(B_ext_rownnz, HYPRE_MEMORY_HOST); + + return hypre_error_flag; +} + +hypre_CSRMatrix* +hypre_ExchangeExternalRowsWait(void *vrequest) +{ + void **request = (void **) vrequest; + + hypre_ParCSRCommHandle *comm_handle_j = (hypre_ParCSRCommHandle *) request[0]; + hypre_ParCSRCommHandle *comm_handle_a = (hypre_ParCSRCommHandle *) request[1]; + hypre_CSRMatrix *B_int = (hypre_CSRMatrix *) request[2]; + hypre_ParCSRCommPkg *comm_pkg_j = (hypre_ParCSRCommPkg *) request[3]; + + /* communication done */ + hypre_ParCSRCommHandleDestroy(comm_handle_a); + hypre_ParCSRCommHandleDestroy(comm_handle_j); + + hypre_TFree(hypre_ParCSRCommPkgSendMapStarts(comm_pkg_j), HYPRE_MEMORY_HOST); + hypre_TFree(hypre_ParCSRCommPkgRecvVecStarts(comm_pkg_j), HYPRE_MEMORY_HOST); + hypre_TFree(comm_pkg_j, HYPRE_MEMORY_HOST); + + hypre_TFree(request, HYPRE_MEMORY_HOST); + + return B_int; +} + + +/* ----------------------------------------------------------------------------- + * extract submatrix A_{FF}, A_{FC}, A_{CF} or A_{CC} + * char job[2] = "FF", "FC", "CF" or "CC" + * ----------------------------------------------------------------------------- */ + +HYPRE_Int +hypre_ParCSRMatrixExtractSubmatrixFC( hypre_ParCSRMatrix *A, + HYPRE_Int *CF_marker, + HYPRE_BigInt *cpts_starts_in, + const char *job, + hypre_ParCSRMatrix **B_ptr, + HYPRE_Real strength_thresh) +{ + MPI_Comm comm = hypre_ParCSRMatrixComm(A); + hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); + hypre_ParCSRCommHandle *comm_handle; + + /* diag part of A */ + hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); + HYPRE_Complex *A_diag_a = hypre_CSRMatrixData(A_diag); + HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); + HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); + /* off-diag part of A */ + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + HYPRE_Complex *A_offd_a = hypre_CSRMatrixData(A_offd); + HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); + HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); + + HYPRE_Int num_cols_A_offd = hypre_CSRMatrixNumCols(A_offd); + //HYPRE_Int *col_map_offd_A = hypre_ParCSRMatrixColMapOffd(A); + + hypre_ParCSRMatrix *B; + hypre_CSRMatrix *B_diag, *B_offd; + HYPRE_Real *B_maxel_row; + HYPRE_Int *B_diag_i, *B_diag_j, *B_offd_i, *B_offd_j; + HYPRE_Complex *B_diag_a, *B_offd_a; + HYPRE_Int num_cols_B_offd; + HYPRE_BigInt *col_map_offd_B; + + HYPRE_Int i, j, k, k1, k2; + HYPRE_BigInt B_nrow_global, B_ncol_global; + HYPRE_Int A_nlocal, B_nrow_local, B_ncol_local, + B_nnz_diag, B_nnz_offd; + HYPRE_BigInt total_global_fpts, total_global_cpts, *fpts_starts, *cpts_starts; + HYPRE_Int nf_local, nc_local; + HYPRE_Int row_set, col_set; + HYPRE_BigInt *B_row_starts, *B_col_starts, B_first_col; + HYPRE_Int my_id, num_procs, + *sub_idx_diag, *sub_idx_offd; + HYPRE_Int num_sends, *send_buf_data; + + /* MPI size and rank*/ + hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_rank(comm, &my_id); + + row_set = job[0] == 'F' ? -1 : 1; + col_set = job[1] == 'F' ? -1 : 1; + + A_nlocal = hypre_CSRMatrixNumRows(A_diag); + + /*-------------- global number of C points and local C points + * assuming cpts_starts is given */ + if (row_set == 1 || col_set == 1) + { + /* copy cpts_starts first */ + HYPRE_Int len; +#ifdef HYPRE_NO_GLOBAL_PARTITION + len = 2; +#else + len = num_procs + 1; +#endif + cpts_starts = hypre_TAlloc(HYPRE_BigInt, len, HYPRE_MEMORY_HOST); + memcpy(cpts_starts, cpts_starts_in, len*sizeof(HYPRE_BigInt)); + +#ifdef HYPRE_NO_GLOBAL_PARTITION + if (my_id == (num_procs -1)) + { + total_global_cpts = cpts_starts[1]; + } + hypre_MPI_Bcast(&total_global_cpts, 1, HYPRE_MPI_INT, num_procs-1, comm); + nc_local = (HYPRE_Int)(cpts_starts[1] - cpts_starts[0]); +#else + total_global_cpts = cpts_starts[num_procs]; + nc_local = (HYPRE_Int)(cpts_starts[my_id+1] - cpts_starts[my_id]); +#endif + } + + /*-------------- global number of F points, local F points, and F starts */ + if (row_set == -1 || col_set == -1) + { + nf_local = 0; + for (i = 0; i < A_nlocal; i++) + { + if (CF_marker[i] < 0) + { + nf_local++; + } + } +#ifdef HYPRE_NO_GLOBAL_PARTITION + fpts_starts = hypre_TAlloc(HYPRE_BigInt, 2, HYPRE_MEMORY_HOST); + hypre_MPI_Scan(&nf_local, fpts_starts+1, 1, HYPRE_MPI_BIG_INT, hypre_MPI_SUM, comm); + fpts_starts[0] = fpts_starts[1] - nf_local; + if (my_id == num_procs - 1) + { + total_global_fpts = fpts_starts[1]; + } + hypre_MPI_Bcast(&total_global_fpts, 1, HYPRE_MPI_INT, num_procs-1, comm); +#else + fpts_starts = hypre_TAlloc(HYPRE_BigInt, num_procs+1, HYPRE_MEMORY_HOST); + hypre_MPI_Allgather(&nf_local, 1, HYPRE_MPI_BIG_INT, &fpts_starts[1], 1, HYPRE_MPI_INT, comm); + for (i = 2; i < num_procs+1; i++) + { + fpts_starts[i] += fpts_starts[i-1]; + } + total_global_fpts = fpts_starts[num_procs]; +#endif + } + + if (row_set == -1 && col_set == -1) + { + /* FF */ + B_nrow_local = nf_local; + B_ncol_local = nf_local; + B_nrow_global = total_global_fpts; + B_ncol_global = total_global_fpts; + + B_row_starts = B_col_starts = fpts_starts; + } + else if (row_set == -1 && col_set == 1) + { + /* FC */ + B_nrow_local = nf_local; + B_ncol_local = nc_local; + B_nrow_global = total_global_fpts; + B_ncol_global = total_global_cpts; + + B_row_starts = fpts_starts; + B_col_starts = cpts_starts; + } + else if (row_set == 1 && col_set == -1) + { + /* CF */ + B_nrow_local = nc_local; + B_ncol_local = nf_local; + B_nrow_global = total_global_cpts; + B_ncol_global = total_global_fpts; + + B_row_starts = cpts_starts; + B_col_starts = fpts_starts; + } + else + { + /* CC */ + B_nrow_local = nc_local; + B_ncol_local = nc_local; + B_nrow_global = total_global_cpts; + B_ncol_global = total_global_cpts; + + B_row_starts = B_col_starts = cpts_starts; + } + + /* global index of my first col */ +#ifdef HYPRE_NO_GLOBAL_PARTITION + B_first_col = B_col_starts[0]; +#else + B_first_col = B_col_starts[my_id]; +#endif + + /* sub_idx_diag: [local] mapping from F+C to F/C, if not selected, be -1 */ + sub_idx_diag = hypre_TAlloc(HYPRE_Int, A_nlocal, HYPRE_MEMORY_HOST); + for (i = 0, k = 0; i < A_nlocal; i++) + { + HYPRE_Int CF_i = CF_marker[i] > 0 ? 1 : -1; + if (CF_i == col_set) + { + sub_idx_diag[i] = k++; + } + else + { + sub_idx_diag[i] = -1; + } + } + + hypre_assert(k == B_ncol_local); + + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + send_buf_data = hypre_TAlloc(HYPRE_Int, hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + HYPRE_MEMORY_HOST); + k = 0; + for (i = 0; i < num_sends; i++) + { + /* start pos of elements sent to send_proc[i] */ + HYPRE_Int si = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + HYPRE_Int ei = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); + /* loop through all elems to send_proc[i] */ + for (j = si; j < ei; j++) + { + /* j1: local idx */ + HYPRE_Int j1 = sub_idx_diag[hypre_ParCSRCommPkgSendMapElmt(comm_pkg, j)]; + if (j1 != -1) + { + /* adjust j1 to B global idx */ + j1 += B_first_col; + } + send_buf_data[k++] = j1; + } + } + + hypre_assert(k == hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends)); + + /* recv buffer */ + sub_idx_offd = hypre_TAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST); + /* create a handle to start communication. 11: for integer */ + comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, send_buf_data, sub_idx_offd); + /* destroy the handle to finish communication */ + hypre_ParCSRCommHandleDestroy(comm_handle); + + for (i = 0, num_cols_B_offd = 0; i < num_cols_A_offd; i++) + { + if (sub_idx_offd[i] != -1) + { + num_cols_B_offd ++; + } + } + col_map_offd_B = hypre_TAlloc(HYPRE_BigInt, num_cols_B_offd, HYPRE_MEMORY_HOST); + for (i = 0, k = 0; i < num_cols_A_offd; i++) + { + if (sub_idx_offd[i] != -1) + { + col_map_offd_B[k] = sub_idx_offd[i]; + sub_idx_offd[i] = k++; + } + } + + hypre_assert(k == num_cols_B_offd); + + /* count nnz and set ia */ + B_nnz_diag = B_nnz_offd = 0; + B_maxel_row = hypre_TAlloc(HYPRE_Real, B_nrow_local, HYPRE_MEMORY_HOST); + B_diag_i = hypre_TAlloc(HYPRE_Int, B_nrow_local+1, HYPRE_MEMORY_HOST); + B_offd_i = hypre_TAlloc(HYPRE_Int, B_nrow_local+1, HYPRE_MEMORY_HOST); + B_diag_i[0] = B_offd_i[0] = 0; + + for (i = 0, k = 0; i < A_nlocal; i++) + { + HYPRE_Int CF_i = CF_marker[i] > 0 ? 1 : -1; + if (CF_i != row_set) + { + continue; + } + k++; + + // Get max abs-value element of this row + HYPRE_Real temp_max = 0; + if (strength_thresh > 0) { + for (j = A_diag_i[i]+1; j < A_diag_i[i+1]; j++) { + if (hypre_cabs(A_diag_a[j]) > temp_max) { + temp_max = hypre_cabs(A_diag_a[j]); + } + } + for (j = A_offd_i[i]; j < A_offd_i[i+1]; j++) { + if (hypre_cabs(A_offd_a[j]) > temp_max) { + temp_max = hypre_cabs(A_offd_a[j]); + } + } + } + B_maxel_row[k-1] = temp_max; + + // add one for diagonal element + j = A_diag_i[i]; + if (sub_idx_diag[A_diag_j[j]] != -1) + { + B_nnz_diag++; + } + + // Count nnzs larger than tolerance times max row element + for (j = A_diag_i[i]+1; j < A_diag_i[i+1]; j++) { + if ( (sub_idx_diag[A_diag_j[j]] != -1) && + (hypre_cabs(A_diag_a[j]) > (strength_thresh*temp_max)) ) + { + B_nnz_diag++; + } + } + for (j = A_offd_i[i]; j < A_offd_i[i+1]; j++) + { + if ( (sub_idx_offd[A_offd_j[j]] != -1) && + (hypre_cabs(A_offd_a[j]) > (strength_thresh*temp_max)) ) + { + B_nnz_offd++; + } + } + B_diag_i[k] = B_nnz_diag; + B_offd_i[k] = B_nnz_offd; + } + + hypre_assert(k == B_nrow_local); + + B_diag_j = hypre_TAlloc(HYPRE_Int, B_nnz_diag, HYPRE_MEMORY_HOST); + B_diag_a = hypre_TAlloc(HYPRE_Complex, B_nnz_diag, HYPRE_MEMORY_HOST); + B_offd_j = hypre_TAlloc(HYPRE_Int, B_nnz_offd, HYPRE_MEMORY_HOST); + B_offd_a = hypre_TAlloc(HYPRE_Complex, B_nnz_offd, HYPRE_MEMORY_HOST); + + for (i = 0, k=0, k1 = 0, k2 = 0; i < A_nlocal; i++) + { + HYPRE_Int CF_i = CF_marker[i] > 0 ? 1 : -1; + if (CF_i != row_set) + { + continue; + } + HYPRE_Real maxel = B_maxel_row[k]; + k++; + + for (j = A_diag_i[i]; j < A_diag_i[i+1]; j++) + { + HYPRE_Int j1 = sub_idx_diag[A_diag_j[j]]; + if ( (j1 != -1) && ( (hypre_cabs(A_diag_a[j]) > (strength_thresh*maxel)) || j==A_diag_i[i] ) ) + { + B_diag_j[k1] = j1; + B_diag_a[k1] = A_diag_a[j]; + k1++; + } + } + for (j = A_offd_i[i]; j < A_offd_i[i+1]; j++) + { + HYPRE_Int j1 = sub_idx_offd[A_offd_j[j]]; + if ((j1 != -1) && (hypre_cabs(A_offd_a[j]) > (strength_thresh*maxel))) + { + hypre_assert(j1 >= 0 && j1 < num_cols_B_offd); + B_offd_j[k2] = j1; + B_offd_a[k2] = A_offd_a[j]; + k2++; + } + } + } + + hypre_assert(k1 == B_nnz_diag && k2 == B_nnz_offd); + + /* ready to create B = A(rowset, colset) */ + B = hypre_ParCSRMatrixCreate(comm, + B_nrow_global, + B_ncol_global, + B_row_starts, + B_col_starts, + num_cols_B_offd, + B_nnz_diag, + B_nnz_offd); + + B_diag = hypre_ParCSRMatrixDiag(B); + hypre_CSRMatrixData(B_diag) = B_diag_a; + hypre_CSRMatrixI(B_diag) = B_diag_i; + hypre_CSRMatrixJ(B_diag) = B_diag_j; + + B_offd = hypre_ParCSRMatrixOffd(B); + hypre_CSRMatrixData(B_offd) = B_offd_a; + hypre_CSRMatrixI(B_offd) = B_offd_i; + hypre_CSRMatrixJ(B_offd) = B_offd_j; + + hypre_ParCSRMatrixColMapOffd(B) = col_map_offd_B; + + hypre_ParCSRMatrixSetNumNonzeros(B); + hypre_ParCSRMatrixDNumNonzeros(B) = (HYPRE_Real) hypre_ParCSRMatrixNumNonzeros(B); + + hypre_MatvecCommPkgCreate(B); + + *B_ptr = B; + + hypre_TFree(B_maxel_row, HYPRE_MEMORY_HOST); + hypre_TFree(send_buf_data, HYPRE_MEMORY_HOST); + hypre_TFree(sub_idx_diag, HYPRE_MEMORY_HOST); + hypre_TFree(sub_idx_offd, HYPRE_MEMORY_HOST); + + return hypre_error_flag; +} diff -Nru hypre-2.16.0/src/parcsr_mv/par_csr_matop_device.c hypre-2.18.2/src/parcsr_mv/par_csr_matop_device.c --- hypre-2.16.0/src/parcsr_mv/par_csr_matop_device.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_csr_matop_device.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,521 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#include "_hypre_utilities.h" +#include "hypre_hopscotch_hash.h" +#include "_hypre_parcsr_mv.h" +#include "_hypre_lapack.h" +#include "_hypre_blas.h" + +#if defined(HYPRE_USING_CUDA) + +HYPRE_Int +hypre_ParcsrGetExternalRowsDeviceInit( hypre_ParCSRMatrix *A, + HYPRE_Int indices_len, + HYPRE_Int *indices, + hypre_ParCSRCommPkg *comm_pkg, + HYPRE_Int want_data, + void **request_ptr) +{ + HYPRE_Int i, j; + HYPRE_Int num_sends, num_rows_send, num_nnz_send, num_recvs, num_rows_recv, num_nnz_recv; + HYPRE_Int *d_send_i, *send_i, *d_send_map, *d_recv_i, *recv_i; + HYPRE_BigInt *d_send_j, *d_recv_j; + HYPRE_Int *send_jstarts, *recv_jstarts; + HYPRE_Complex *d_send_a = NULL, *d_recv_a = NULL; + hypre_ParCSRCommPkg *comm_pkg_j; + hypre_ParCSRCommHandle *comm_handle, *comm_handle_j, *comm_handle_a; + /* HYPRE_Int global_num_rows = hypre_ParCSRMatrixGlobalNumRows(A); */ + /* diag part of A */ + hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); + HYPRE_Complex *A_diag_a = hypre_CSRMatrixData(A_diag); + HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); + HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); + /* HYPRE_Int local_num_rows = hypre_CSRMatrixNumRows(A_diag); */ + /* off-diag part of A */ + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + HYPRE_Complex *A_offd_a = hypre_CSRMatrixData(A_offd); + HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); + HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); + + /* HYPRE_Int *row_starts = hypre_ParCSRMatrixRowStarts(A); */ + /* HYPRE_Int first_row = hypre_ParCSRMatrixFirstRowIndex(A); */ + HYPRE_Int first_col = hypre_ParCSRMatrixFirstColDiag(A); + HYPRE_Int *col_map_offd_A = hypre_ParCSRMatrixColMapOffd(A); + HYPRE_Int num_cols_A_offd = hypre_CSRMatrixNumCols(A_offd); + HYPRE_Int *d_col_map_offd_A = hypre_ParCSRMatrixDeviceColMapOffd(A); + + MPI_Comm comm = hypre_ParCSRMatrixComm(A); + + HYPRE_Int num_procs; + HYPRE_Int my_id; + void **vrequest; + + hypre_CSRMatrix *A_ext; + + hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_rank(comm, &my_id); + + /* number of sends (#procs) */ + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + /* number of rows to send */ + num_rows_send = hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends); + /* number of recvs (#procs) */ + num_recvs = hypre_ParCSRCommPkgNumRecvs(comm_pkg); + /* number of rows to recv */ + num_rows_recv = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs); + + /* must be true if indices contains proper offd indices */ + hypre_assert(indices_len == num_rows_recv); + + /* send_i/recv_i: + * the arrays to send and recv: we first send and recv the row lengths */ + d_send_i = hypre_TAlloc(HYPRE_Int, num_rows_send + 1, HYPRE_MEMORY_DEVICE); + d_send_map = hypre_TAlloc(HYPRE_Int, num_rows_send, HYPRE_MEMORY_DEVICE); + send_i = hypre_TAlloc(HYPRE_Int, num_rows_send, HYPRE_MEMORY_HOST); + recv_i = hypre_TAlloc(HYPRE_Int, num_rows_recv + 1, HYPRE_MEMORY_HOST); + d_recv_i = hypre_TAlloc(HYPRE_Int, num_rows_recv + 1, HYPRE_MEMORY_DEVICE); + + /* fill the send array with row lengths */ + hypre_TMemcpy(d_send_map, hypre_ParCSRCommPkgSendMapElmts(comm_pkg), HYPRE_Int, + num_rows_send, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_HOST); + + hypre_Memset(d_send_i, 0, sizeof(HYPRE_Int), HYPRE_MEMORY_DEVICE); + hypreDevice_GetRowNnz(num_rows_send, d_send_map, A_diag_i, A_offd_i, d_send_i+1); + + /* send array send_i out: deviceTohost first and MPI (async) + * note the shift in recv_i by one */ + hypre_TMemcpy(send_i, d_send_i+1, HYPRE_Int, num_rows_send, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); + + comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg, send_i, recv_i+1); + + hypreDevice_IntegerInclusiveScan(num_rows_send + 1, d_send_i); + + /* total number of nnz to send */ + hypre_TMemcpy(&num_nnz_send, d_send_i+num_rows_send, HYPRE_Int, 1, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); + + /* prepare data to send out. overlap with the above commmunication */ + d_send_j = hypre_TAlloc(HYPRE_BigInt, num_nnz_send, HYPRE_MEMORY_DEVICE); + if (want_data) + { + d_send_a = hypre_TAlloc(HYPRE_Complex, num_nnz_send, HYPRE_MEMORY_DEVICE); + } + + if (d_col_map_offd_A == NULL) + { + d_col_map_offd_A = hypre_TAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_DEVICE); + hypre_TMemcpy(d_col_map_offd_A, col_map_offd_A, HYPRE_Int, num_cols_A_offd, + HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_HOST); + hypre_ParCSRMatrixDeviceColMapOffd(A) = d_col_map_offd_A; + } + + /* job == 2, d_send_i is input that contains row ptrs (length num_rows_send) */ + hypreDevice_CopyParCSRRows(num_rows_send, d_send_map, 2, num_procs > 1, + first_col, d_col_map_offd_A, + A_diag_i, A_diag_j, A_diag_a, + A_offd_i, A_offd_j, A_offd_a, + d_send_i, d_send_j, d_send_a); + + /* pointers to each proc in send_j */ + send_jstarts = hypre_TAlloc(HYPRE_Int, num_sends + 1, HYPRE_MEMORY_HOST); + send_jstarts[0] = 0; + for (i = 1; i <= num_sends; i++) + { + send_jstarts[i] = send_jstarts[i-1]; + for ( j = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i-1); + j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + j++ ) + { + send_jstarts[i] += send_i[j]; + } + } + hypre_assert(send_jstarts[num_sends] == num_nnz_send); + + /* finish the above communication: send_i/recv_i */ + hypre_ParCSRCommHandleDestroy(comm_handle); + + /* adjust recv_i to ptrs */ + recv_i[0] = 0; + for (i = 1; i <= num_rows_recv; i++) + { + recv_i[i] += recv_i[i-1]; + } + num_nnz_recv = recv_i[num_rows_recv]; + + /* allocate device memory for j and a */ + d_recv_j = hypre_TAlloc(HYPRE_BigInt, num_nnz_recv, HYPRE_MEMORY_DEVICE); + if (want_data) + { + d_recv_a = hypre_TAlloc(HYPRE_Complex, num_nnz_recv, HYPRE_MEMORY_DEVICE); + } + + recv_jstarts = hypre_TAlloc(HYPRE_Int, num_recvs + 1, HYPRE_MEMORY_HOST); + recv_jstarts[0] = 0; + for (i = 1; i <= num_recvs; i++) + { + j = hypre_ParCSRCommPkgRecvVecStart(comm_pkg, i); + recv_jstarts[i] = recv_i[j]; + } + + /* ready to send and recv: create a communication package for data */ + comm_pkg_j = hypre_CTAlloc(hypre_ParCSRCommPkg, 1, HYPRE_MEMORY_HOST); + hypre_ParCSRCommPkgComm (comm_pkg_j) = comm; + hypre_ParCSRCommPkgNumSends (comm_pkg_j) = num_sends; + hypre_ParCSRCommPkgSendProcs (comm_pkg_j) = hypre_ParCSRCommPkgSendProcs(comm_pkg); + hypre_ParCSRCommPkgSendMapStarts(comm_pkg_j) = send_jstarts; + hypre_ParCSRCommPkgNumRecvs (comm_pkg_j) = num_recvs; + hypre_ParCSRCommPkgRecvProcs (comm_pkg_j) = hypre_ParCSRCommPkgRecvProcs(comm_pkg); + hypre_ParCSRCommPkgRecvVecStarts(comm_pkg_j) = recv_jstarts; + + /* init communication */ + /* ja */ + comm_handle_j = hypre_ParCSRCommHandleCreate_v2(21, comm_pkg_j, + HYPRE_MEMORY_DEVICE, d_send_j, + HYPRE_MEMORY_DEVICE, d_recv_j); + if (want_data) + { + /* a */ + comm_handle_a = hypre_ParCSRCommHandleCreate_v2(1, comm_pkg_j, + HYPRE_MEMORY_DEVICE, d_send_a, + HYPRE_MEMORY_DEVICE, d_recv_a); + } + else + { + comm_handle_a = NULL; + } + + hypre_TMemcpy(d_recv_i, recv_i, HYPRE_Int, num_rows_recv+1, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_HOST); + + /* create A_ext: on device */ + A_ext = hypre_CSRMatrixCreate(num_rows_recv, hypre_ParCSRMatrixGlobalNumCols(A), num_nnz_recv); + hypre_CSRMatrixI (A_ext) = d_recv_i; + hypre_CSRMatrixBigJ(A_ext) = d_recv_j; + hypre_CSRMatrixData(A_ext) = d_recv_a; + hypre_CSRMatrixMemoryLocation(A_ext) = HYPRE_MEMORY_DEVICE; + + /* output */ + vrequest = hypre_TAlloc(void *, 3, HYPRE_MEMORY_HOST); + vrequest[0] = (void *) comm_handle_j; + vrequest[1] = (void *) comm_handle_a; + vrequest[2] = (void *) A_ext; + + *request_ptr = (void *) vrequest; + + /* free */ + hypre_TFree(send_i, HYPRE_MEMORY_HOST); + hypre_TFree(recv_i, HYPRE_MEMORY_HOST); + hypre_TFree(d_send_i, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_send_map, HYPRE_MEMORY_DEVICE); + + hypre_TFree(hypre_ParCSRCommPkgSendMapStarts(comm_pkg_j), HYPRE_MEMORY_HOST); + hypre_TFree(hypre_ParCSRCommPkgRecvVecStarts(comm_pkg_j), HYPRE_MEMORY_HOST); + hypre_TFree(comm_pkg_j, HYPRE_MEMORY_HOST); + + return hypre_error_flag; +} + +hypre_CSRMatrix* +hypre_ParcsrGetExternalRowsDeviceWait(void *vrequest) +{ + void **request = (void **) vrequest; + + hypre_ParCSRCommHandle *comm_handle_j = (hypre_ParCSRCommHandle *) request[0]; + hypre_ParCSRCommHandle *comm_handle_a = (hypre_ParCSRCommHandle *) request[1]; + hypre_CSRMatrix *A_ext = (hypre_CSRMatrix *) request[2]; + + hypre_ParCSRCommHandleDestroy(comm_handle_j); + hypre_ParCSRCommHandleDestroy(comm_handle_a); + + hypre_TFree(request, HYPRE_MEMORY_HOST); + + return A_ext; +} + +hypre_CSRMatrix* +hypre_MergeDiagAndOffdDevice(hypre_ParCSRMatrix *A) +{ + MPI_Comm comm = hypre_ParCSRMatrixComm(A); + hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); + HYPRE_Complex *A_diag_a = hypre_CSRMatrixData(A_diag); + HYPRE_Int *A_diag_i = hypre_CSRMatrixI(A_diag); + HYPRE_Int *A_diag_j = hypre_CSRMatrixJ(A_diag); + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + HYPRE_Complex *A_offd_a = hypre_CSRMatrixData(A_offd); + HYPRE_Int *A_offd_i = hypre_CSRMatrixI(A_offd); + HYPRE_Int *A_offd_j = hypre_CSRMatrixJ(A_offd); + + HYPRE_Int local_num_rows = hypre_CSRMatrixNumRows(A_diag); + HYPRE_BigInt glbal_num_cols = hypre_ParCSRMatrixGlobalNumCols(A); + HYPRE_BigInt first_col = hypre_ParCSRMatrixFirstColDiag(A); + HYPRE_Int num_cols_A_offd = hypre_CSRMatrixNumCols(A_offd); + HYPRE_BigInt *col_map_offd_A = hypre_ParCSRMatrixColMapOffd(A); + HYPRE_BigInt *d_col_map_offd_A = hypre_ParCSRMatrixDeviceColMapOffd(A); + + hypre_CSRMatrix *B; + HYPRE_Int B_nrows = local_num_rows; + HYPRE_BigInt B_ncols = glbal_num_cols; + HYPRE_Int *B_i = hypre_TAlloc(HYPRE_Int, B_nrows + 1, HYPRE_MEMORY_DEVICE); + HYPRE_BigInt *B_j; + HYPRE_Complex *B_a; + HYPRE_Int B_nnz; + + HYPRE_Int num_procs; + + hypre_MPI_Comm_size(comm, &num_procs); + + hypre_Memset(B_i, 0, sizeof(HYPRE_Int), HYPRE_MEMORY_DEVICE); + + hypreDevice_GetRowNnz(B_nrows, NULL, A_diag_i, A_offd_i, B_i+1); + + hypreDevice_IntegerInclusiveScan(B_nrows+1, B_i); + + /* total number of nnz */ + hypre_TMemcpy(&B_nnz, B_i+B_nrows, HYPRE_Int, 1, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); + + B_j = hypre_TAlloc(HYPRE_BigInt, B_nnz, HYPRE_MEMORY_DEVICE); + B_a = hypre_TAlloc(HYPRE_Complex, B_nnz, HYPRE_MEMORY_DEVICE); + + if (d_col_map_offd_A == NULL) + { + d_col_map_offd_A = hypre_TAlloc(HYPRE_BigInt, num_cols_A_offd, HYPRE_MEMORY_DEVICE); + hypre_TMemcpy(d_col_map_offd_A, col_map_offd_A, HYPRE_BigInt, num_cols_A_offd, + HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_HOST); + hypre_ParCSRMatrixDeviceColMapOffd(A) = d_col_map_offd_A; + } + + hypreDevice_CopyParCSRRows(B_nrows, NULL, 2, num_procs > 1, first_col, d_col_map_offd_A, + A_diag_i, A_diag_j, A_diag_a, A_offd_i, A_offd_j, A_offd_a, + B_i, B_j, B_a); + + + /* output */ + B = hypre_CSRMatrixCreate(B_nrows, B_ncols, B_nnz); + hypre_CSRMatrixI (B) = B_i; + hypre_CSRMatrixBigJ(B) = B_j; + hypre_CSRMatrixData(B) = B_a; + hypre_CSRMatrixMemoryLocation(B) = HYPRE_MEMORY_DEVICE; + + return B; +} + +HYPRE_Int +hypre_ExchangeExternalRowsDeviceInit( hypre_CSRMatrix *B_ext, + hypre_ParCSRCommPkg *comm_pkg_A, + void **request_ptr) +{ + MPI_Comm comm = hypre_ParCSRCommPkgComm(comm_pkg_A); + HYPRE_Int num_recvs = hypre_ParCSRCommPkgNumRecvs(comm_pkg_A); + HYPRE_Int *recv_procs = hypre_ParCSRCommPkgRecvProcs(comm_pkg_A); + HYPRE_Int *recv_vec_starts = hypre_ParCSRCommPkgRecvVecStarts(comm_pkg_A); + HYPRE_Int num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg_A); + HYPRE_Int *send_procs = hypre_ParCSRCommPkgSendProcs(comm_pkg_A); + HYPRE_Int *send_map_starts = hypre_ParCSRCommPkgSendMapStarts(comm_pkg_A); + + HYPRE_Int num_elmts_send = send_map_starts[num_sends]; + HYPRE_Int num_elmts_recv = recv_vec_starts[num_recvs]; + + HYPRE_Int *B_ext_i_d = hypre_CSRMatrixI(B_ext); + HYPRE_BigInt *B_ext_j_d = hypre_CSRMatrixBigJ(B_ext); + HYPRE_Complex *B_ext_a_d = hypre_CSRMatrixData(B_ext); + HYPRE_Int B_ext_ncols = hypre_CSRMatrixNumCols(B_ext); + HYPRE_Int B_ext_nrows = hypre_CSRMatrixNumRows(B_ext); + HYPRE_Int B_ext_nnz = hypre_CSRMatrixNumNonzeros(B_ext); + HYPRE_Int *B_ext_rownnz_d = hypre_TAlloc(HYPRE_Int, B_ext_nrows + 1, HYPRE_MEMORY_DEVICE); + HYPRE_Int *B_ext_rownnz_h = hypre_TAlloc(HYPRE_Int, B_ext_nrows, HYPRE_MEMORY_HOST); + HYPRE_Int *B_ext_i_h = hypre_TAlloc(HYPRE_Int, B_ext_nrows + 1, HYPRE_MEMORY_HOST); + + hypre_assert(num_elmts_recv == B_ext_nrows); + + /* output matrix */ + hypre_CSRMatrix *B_int_d; + HYPRE_Int B_int_nrows = num_elmts_send; + HYPRE_Int B_int_ncols = B_ext_ncols; + HYPRE_Int *B_int_i_h = hypre_TAlloc(HYPRE_Int, B_int_nrows + 1, HYPRE_MEMORY_HOST); + HYPRE_Int *B_int_i_d = hypre_TAlloc(HYPRE_Int, B_int_nrows + 1, HYPRE_MEMORY_DEVICE); + HYPRE_BigInt *B_int_j_d = NULL; + HYPRE_Complex *B_int_a_d = NULL; + HYPRE_Int B_int_nnz; + + hypre_ParCSRCommHandle *comm_handle, *comm_handle_j, *comm_handle_a; + hypre_ParCSRCommPkg *comm_pkg_j; + + HYPRE_Int *jdata_recv_vec_starts; + HYPRE_Int *jdata_send_map_starts; + + HYPRE_Int i; + HYPRE_Int num_procs, my_id; + void **vrequest; + + hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_rank(comm, &my_id); + + jdata_send_map_starts = hypre_TAlloc(HYPRE_Int, num_sends+1, HYPRE_MEMORY_HOST); + + /*-------------------------------------------------------------------------- + * B_ext_rownnz contains the number of elements of row j + * (to be determined through send_map_elmnts on the receiving end) + *--------------------------------------------------------------------------*/ + HYPRE_THRUST_CALL(adjacent_difference, B_ext_i_d, B_ext_i_d + B_ext_nrows + 1, B_ext_rownnz_d); + hypre_TMemcpy(B_ext_rownnz_h, B_ext_rownnz_d + 1, HYPRE_Int, B_ext_nrows, + HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); + + /*-------------------------------------------------------------------------- + * initialize communication: send/recv the row nnz + * (note the use of comm_pkg_A, mode 12, as in transpose matvec + *--------------------------------------------------------------------------*/ + comm_handle = hypre_ParCSRCommHandleCreate(12, comm_pkg_A, B_ext_rownnz_h, B_int_i_h + 1); + + jdata_recv_vec_starts = hypre_TAlloc(HYPRE_Int, num_recvs + 1, HYPRE_MEMORY_HOST); + jdata_recv_vec_starts[0] = 0; + + B_ext_i_h[0] = 0; + hypre_TMemcpy(B_ext_i_h + 1, B_ext_rownnz_h, HYPRE_Int, B_ext_nrows, HYPRE_MEMORY_HOST, HYPRE_MEMORY_HOST); + for (i = 1; i <= B_ext_nrows; i++) + { + B_ext_i_h[i] += B_ext_i_h[i-1]; + } + + hypre_assert(B_ext_i_h[B_ext_nrows] == B_ext_nnz); + + for (i = 1; i <= num_recvs; i++) + { + jdata_recv_vec_starts[i] = B_ext_i_h[recv_vec_starts[i]]; + } + + comm_pkg_j = hypre_CTAlloc(hypre_ParCSRCommPkg, 1, HYPRE_MEMORY_HOST); + hypre_ParCSRCommPkgComm(comm_pkg_j) = comm; + hypre_ParCSRCommPkgNumSends(comm_pkg_j) = num_recvs; + hypre_ParCSRCommPkgNumRecvs(comm_pkg_j) = num_sends; + hypre_ParCSRCommPkgSendProcs(comm_pkg_j) = recv_procs; + hypre_ParCSRCommPkgRecvProcs(comm_pkg_j) = send_procs; + + hypre_ParCSRCommHandleDestroy(comm_handle); + + /*-------------------------------------------------------------------------- + * compute B_int: row nnz to row ptrs + *--------------------------------------------------------------------------*/ + B_int_i_h[0] = 0; + for (i = 1; i <= B_int_nrows; i++) + { + B_int_i_h[i] += B_int_i_h[i-1]; + } + + B_int_nnz = B_int_i_h[B_int_nrows]; + + B_int_j_d = hypre_TAlloc(HYPRE_BigInt, B_int_nnz, HYPRE_MEMORY_DEVICE); + B_int_a_d = hypre_TAlloc(HYPRE_Complex, B_int_nnz, HYPRE_MEMORY_DEVICE); + + for (i = 0; i <= num_sends; i++) + { + jdata_send_map_starts[i] = B_int_i_h[send_map_starts[i]]; + } + + /* note the order of send/recv is reversed */ + hypre_ParCSRCommPkgRecvVecStarts(comm_pkg_j) = jdata_send_map_starts; + hypre_ParCSRCommPkgSendMapStarts(comm_pkg_j) = jdata_recv_vec_starts; + + /* send/recv CSR rows */ + comm_handle_a = hypre_ParCSRCommHandleCreate_v2( 1, comm_pkg_j, + HYPRE_MEMORY_DEVICE, B_ext_a_d, + HYPRE_MEMORY_DEVICE, B_int_a_d ); + comm_handle_j = hypre_ParCSRCommHandleCreate_v2(21, comm_pkg_j, + HYPRE_MEMORY_DEVICE, B_ext_j_d, + HYPRE_MEMORY_DEVICE, B_int_j_d ); + + hypre_TMemcpy(B_int_i_d, B_int_i_h, HYPRE_Int, B_int_nrows+1, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_HOST); + + /* create CSR: on device */ + B_int_d = hypre_CSRMatrixCreate(B_int_nrows, B_int_ncols, B_int_nnz); + hypre_CSRMatrixI(B_int_d) = B_int_i_d; + hypre_CSRMatrixBigJ(B_int_d) = B_int_j_d; + hypre_CSRMatrixData(B_int_d) = B_int_a_d; + hypre_CSRMatrixMemoryLocation(B_int_d) = HYPRE_MEMORY_DEVICE; + + /* output */ + vrequest = hypre_TAlloc(void *, 3, HYPRE_MEMORY_HOST); + vrequest[0] = (void *) comm_handle_j; + vrequest[1] = (void *) comm_handle_a; + vrequest[2] = (void *) B_int_d; + + *request_ptr = (void *) vrequest; + + /* free */ + hypre_TFree(B_ext_rownnz_d, HYPRE_MEMORY_DEVICE); + hypre_TFree(B_ext_rownnz_h, HYPRE_MEMORY_HOST); + hypre_TFree(B_ext_i_h, HYPRE_MEMORY_HOST); + + hypre_TFree(hypre_ParCSRCommPkgSendMapStarts(comm_pkg_j), HYPRE_MEMORY_HOST); + hypre_TFree(hypre_ParCSRCommPkgRecvVecStarts(comm_pkg_j), HYPRE_MEMORY_HOST); + hypre_TFree(comm_pkg_j, HYPRE_MEMORY_HOST); + + return hypre_error_flag; +} + +hypre_CSRMatrix* +hypre_ExchangeExternalRowsDeviceWait(void *vrequest) +{ + void **request = (void **) vrequest; + + hypre_ParCSRCommHandle *comm_handle_j = (hypre_ParCSRCommHandle *) request[0]; + hypre_ParCSRCommHandle *comm_handle_a = (hypre_ParCSRCommHandle *) request[1]; + hypre_CSRMatrix *B_int_d = (hypre_CSRMatrix *) request[2]; + + /* communication done */ + hypre_ParCSRCommHandleDestroy(comm_handle_j); + hypre_ParCSRCommHandleDestroy(comm_handle_a); + + hypre_TFree(request, HYPRE_MEMORY_HOST); + + return B_int_d; +} + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +HYPRE_Int +hypre_ParCSRMatrixExtractBExtDeviceInit( hypre_ParCSRMatrix *B, + hypre_ParCSRMatrix *A, + HYPRE_Int want_data, + void **request_ptr) +{ + hypre_assert( hypre_CSRMatrixMemoryLocation(hypre_ParCSRMatrixDiag(B)) == + hypre_CSRMatrixMemoryLocation(hypre_ParCSRMatrixOffd(B)) ); + + /* + hypre_assert( hypre_GetActualMemLocation( + hypre_CSRMatrixMemoryLocation(hypre_ParCSRMatrixDiag(B))) == HYPRE_MEMORY_DEVICE ); + */ + + hypre_ParcsrGetExternalRowsDeviceInit(B, + hypre_CSRMatrixNumCols(hypre_ParCSRMatrixOffd(A)), + hypre_ParCSRMatrixColMapOffd(A), + hypre_ParCSRMatrixCommPkg(A), + want_data, + request_ptr); + return hypre_error_flag; +} + +hypre_CSRMatrix* +hypre_ParCSRMatrixExtractBExtDeviceWait(void *request) +{ + return hypre_ParcsrGetExternalRowsDeviceWait(request); +} + +hypre_CSRMatrix* +hypre_ParCSRMatrixExtractBExtDevice( hypre_ParCSRMatrix *B, + hypre_ParCSRMatrix *A, + HYPRE_Int want_data ) +{ + void *request; + hypre_ParCSRMatrixExtractBExtDeviceInit(B, A, want_data, &request); + return hypre_ParCSRMatrixExtractBExtDeviceWait(request); +} + +#endif // #if defined(HYPRE_USING_CUDA) + diff -Nru hypre-2.16.0/src/parcsr_mv/par_csr_matop_marked.c hypre-2.18.2/src/parcsr_mv/par_csr_matop_marked.c --- hypre-2.16.0/src/parcsr_mv/par_csr_matop_marked.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_csr_matop_marked.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_mv.h" #include "assert.h" diff -Nru hypre-2.16.0/src/parcsr_mv/par_csr_matrix.c hypre-2.18.2/src/parcsr_mv/par_csr_matrix.c --- hypre-2.16.0/src/parcsr_mv/par_csr_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_csr_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -40,7 +35,7 @@ containing the start row of the calling processor followed by the start row of the next processor - AHB 6/05 */ -hypre_ParCSRMatrix * +hypre_ParCSRMatrix* hypre_ParCSRMatrixCreate( MPI_Comm comm, HYPRE_BigInt global_num_rows, HYPRE_BigInt global_num_cols, @@ -54,7 +49,7 @@ HYPRE_Int num_procs, my_id; HYPRE_Int local_num_rows, local_num_cols; HYPRE_BigInt first_row_index, first_col_diag; - + matrix = hypre_CTAlloc(hypre_ParCSRMatrix, 1, HYPRE_MEMORY_HOST); hypre_MPI_Comm_rank(comm,&my_id); @@ -62,8 +57,8 @@ if (!row_starts) { - -#ifdef HYPRE_NO_GLOBAL_PARTITION + +#ifdef HYPRE_NO_GLOBAL_PARTITION hypre_GenerateLocalPartitioning(global_num_rows, num_procs, my_id, &row_starts); #else @@ -78,7 +73,7 @@ } else { -#ifdef HYPRE_NO_GLOBAL_PARTITION +#ifdef HYPRE_NO_GLOBAL_PARTITION hypre_GenerateLocalPartitioning(global_num_cols, num_procs, my_id, &col_starts); #else @@ -88,7 +83,7 @@ } #ifdef HYPRE_NO_GLOBAL_PARTITION - /* row_starts[0] is start of local rows. row_starts[1] is start of next + /* row_starts[0] is start of local rows. row_starts[1] is start of next processor's rows */ first_row_index = row_starts[0]; local_num_rows = row_starts[1]-first_row_index ; @@ -112,13 +107,16 @@ hypre_ParCSRMatrixGlobalNumCols(matrix) = global_num_cols; hypre_ParCSRMatrixFirstRowIndex(matrix) = first_row_index; hypre_ParCSRMatrixFirstColDiag(matrix) = first_col_diag; - + hypre_ParCSRMatrixLastRowIndex(matrix) = first_row_index + local_num_rows - 1; hypre_ParCSRMatrixLastColDiag(matrix) = first_col_diag + local_num_cols - 1; hypre_ParCSRMatrixColMapOffd(matrix) = NULL; + hypre_ParCSRMatrixDeviceColMapOffd(matrix) = NULL; + hypre_ParCSRMatrixProcOrdering(matrix) = NULL; hypre_ParCSRMatrixAssumedPartition(matrix) = NULL; + hypre_ParCSRMatrixOwnsAssumedPartition(matrix) = 1; /* When NO_GLOBAL_PARTITION is set we could make these null, instead of leaving the range. If that change is made, then when this create @@ -136,11 +134,17 @@ hypre_ParCSRMatrixOwnsRowStarts(matrix) = 1; hypre_ParCSRMatrixOwnsColStarts(matrix) = 1; if (row_starts == col_starts) + { hypre_ParCSRMatrixOwnsColStarts(matrix) = 0; + } hypre_ParCSRMatrixRowindices(matrix) = NULL; hypre_ParCSRMatrixRowvalues(matrix) = NULL; hypre_ParCSRMatrixGetrowactive(matrix) = 0; + matrix->bdiaginv = NULL; + matrix->bdiaginv_comm_pkg = NULL; + matrix->bdiag_size = -1; + return matrix; } @@ -148,7 +152,7 @@ * hypre_ParCSRMatrixDestroy *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_ParCSRMatrixDestroy( hypre_ParCSRMatrix *matrix ) { if (matrix) @@ -157,34 +161,67 @@ { hypre_CSRMatrixDestroy(hypre_ParCSRMatrixDiag(matrix)); hypre_CSRMatrixDestroy(hypre_ParCSRMatrixOffd(matrix)); + if ( hypre_ParCSRMatrixDiagT(matrix) ) { hypre_CSRMatrixDestroy(hypre_ParCSRMatrixDiagT(matrix)); } + if ( hypre_ParCSRMatrixOffdT(matrix) ) { hypre_CSRMatrixDestroy(hypre_ParCSRMatrixOffdT(matrix)); } + if (hypre_ParCSRMatrixColMapOffd(matrix)) { - /*ASSERT_HOST(hypre_ParCSRMatrixColMapOffd(matrix));*/ + /*ASSERT_HOST(hypre_ParCSRMatrixColMapOffd(matrix));*/ hypre_TFree(hypre_ParCSRMatrixColMapOffd(matrix), HYPRE_MEMORY_HOST); } + + if (hypre_ParCSRMatrixDeviceColMapOffd(matrix)) + { + hypre_TFree(hypre_ParCSRMatrixDeviceColMapOffd(matrix), HYPRE_MEMORY_DEVICE); + } + if (hypre_ParCSRMatrixCommPkg(matrix)) + { hypre_MatvecCommPkgDestroy(hypre_ParCSRMatrixCommPkg(matrix)); + } + if (hypre_ParCSRMatrixCommPkgT(matrix)) + { hypre_MatvecCommPkgDestroy(hypre_ParCSRMatrixCommPkgT(matrix)); + } } + if ( hypre_ParCSRMatrixOwnsRowStarts(matrix) ) + { hypre_TFree(hypre_ParCSRMatrixRowStarts(matrix), HYPRE_MEMORY_HOST); + } + if ( hypre_ParCSRMatrixOwnsColStarts(matrix) ) + { hypre_TFree(hypre_ParCSRMatrixColStarts(matrix), HYPRE_MEMORY_HOST); + } hypre_TFree(hypre_ParCSRMatrixRowindices(matrix), HYPRE_MEMORY_HOST); hypre_TFree(hypre_ParCSRMatrixRowvalues(matrix), HYPRE_MEMORY_HOST); - if (hypre_ParCSRMatrixAssumedPartition(matrix)) + if ( hypre_ParCSRMatrixAssumedPartition(matrix) && hypre_ParCSRMatrixOwnsAssumedPartition(matrix) ) + { hypre_AssumedPartitionDestroy(hypre_ParCSRMatrixAssumedPartition(matrix)); + } + + if ( hypre_ParCSRMatrixProcOrdering(matrix) ) + { + hypre_TFree(hypre_ParCSRMatrixProcOrdering(matrix), HYPRE_MEMORY_HOST); + } + + hypre_TFree(matrix->bdiaginv, HYPRE_MEMORY_HOST); + if (matrix->bdiaginv_comm_pkg) + { + hypre_MatvecCommPkgDestroy(matrix->bdiaginv_comm_pkg); + } hypre_TFree(matrix, HYPRE_MEMORY_HOST); } @@ -196,8 +233,8 @@ * hypre_ParCSRMatrixInitialize *--------------------------------------------------------------------------*/ -HYPRE_Int -hypre_ParCSRMatrixInitialize( hypre_ParCSRMatrix *matrix ) +HYPRE_Int +hypre_ParCSRMatrixInitialize_v2( hypre_ParCSRMatrix *matrix, HYPRE_Int memory_location ) { if (!matrix) { @@ -205,42 +242,68 @@ return hypre_error_flag; } - hypre_CSRMatrixInitialize(hypre_ParCSRMatrixDiag(matrix)); - hypre_CSRMatrixInitialize(hypre_ParCSRMatrixOffd(matrix)); - hypre_ParCSRMatrixColMapOffd(matrix) = - hypre_CTAlloc(HYPRE_BigInt, hypre_CSRMatrixNumCols( - hypre_ParCSRMatrixOffd(matrix)), HYPRE_MEMORY_HOST); + hypre_CSRMatrixInitialize_v2(hypre_ParCSRMatrixDiag(matrix), 0, memory_location); + hypre_CSRMatrixInitialize_v2(hypre_ParCSRMatrixOffd(matrix), 0, memory_location); + + hypre_ParCSRMatrixColMapOffd(matrix) = + hypre_CTAlloc(HYPRE_BigInt, hypre_CSRMatrixNumCols(hypre_ParCSRMatrixOffd(matrix)), + HYPRE_MEMORY_HOST); return hypre_error_flag; } +HYPRE_Int +hypre_ParCSRMatrixInitialize( hypre_ParCSRMatrix *matrix ) +{ + return hypre_ParCSRMatrixInitialize_v2(matrix, HYPRE_MEMORY_SHARED); +} + /*-------------------------------------------------------------------------- - * hypre_ParCSRMatrixBigInitialize + * hypre_ParCSRMatrixClone + * Creates and returns a new copy S of the argument A + * The following variables are not copied because they will be constructed + * later if needed: CommPkg, CommPkgT, rowindices, rowvalues *--------------------------------------------------------------------------*/ -HYPRE_Int -hypre_ParCSRMatrixBigInitialize( hypre_ParCSRMatrix *matrix ) +hypre_ParCSRMatrix* +hypre_ParCSRMatrixClone_v2(hypre_ParCSRMatrix *A, HYPRE_Int copy_data, HYPRE_Int memory_location) { - if (!matrix) - { - hypre_error_in_arg(1); - return hypre_error_flag; - } + hypre_ParCSRMatrix *S; - hypre_CSRMatrixInitialize(hypre_ParCSRMatrixDiag(matrix)); - hypre_CSRMatrixBigInitialize(hypre_ParCSRMatrixOffd(matrix)); - hypre_ParCSRMatrixColMapOffd(matrix) = - hypre_CTAlloc(HYPRE_BigInt, hypre_CSRMatrixNumCols( - hypre_ParCSRMatrixOffd(matrix)), HYPRE_MEMORY_HOST); + S = hypre_ParCSRMatrixCreate( hypre_ParCSRMatrixComm(A), + hypre_ParCSRMatrixGlobalNumRows(A), + hypre_ParCSRMatrixGlobalNumCols(A), + hypre_ParCSRMatrixRowStarts(A), + hypre_ParCSRMatrixColStarts(A), + hypre_CSRMatrixNumCols(hypre_ParCSRMatrixOffd(A)), + hypre_CSRMatrixNumNonzeros(hypre_ParCSRMatrixDiag(A)), + hypre_CSRMatrixNumNonzeros(hypre_ParCSRMatrixOffd(A)) ); - return hypre_error_flag; + /* !!! S does not own Row/Col-Starts */ + hypre_ParCSRMatrixSetRowStartsOwner(S, 0); + hypre_ParCSRMatrixSetColStartsOwner(S, 0); + + hypre_ParCSRMatrixNumNonzeros(S) = hypre_ParCSRMatrixNumNonzeros(A); + hypre_ParCSRMatrixDNumNonzeros(S) = hypre_ParCSRMatrixNumNonzeros(A); + + hypre_ParCSRMatrixInitialize_v2(S, memory_location); + + hypre_ParCSRMatrixCopy(A, S, copy_data); + + return S; +} + +hypre_ParCSRMatrix* +hypre_ParCSRMatrixClone(hypre_ParCSRMatrix *A, HYPRE_Int copy_data) +{ + return hypre_ParCSRMatrixClone_v2(A, copy_data, HYPRE_MEMORY_SHARED); } /*-------------------------------------------------------------------------- * hypre_ParCSRMatrixSetNumNonzeros *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_ParCSRMatrixSetNumNonzeros( hypre_ParCSRMatrix *matrix ) { MPI_Comm comm; @@ -274,7 +337,7 @@ * hypre_ParCSRMatrixSetDNumNonzeros *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_ParCSRMatrixSetDNumNonzeros( hypre_ParCSRMatrix *matrix ) { MPI_Comm comm; @@ -295,9 +358,11 @@ diag_i = hypre_CSRMatrixI(diag); offd = hypre_ParCSRMatrixOffd(matrix); offd_i = hypre_CSRMatrixI(offd); + local_num_rows = hypre_CSRMatrixNumRows(diag); - local_num_nonzeros = (HYPRE_Real) diag_i[local_num_rows] - + (HYPRE_Real) offd_i[local_num_rows]; + local_num_nonzeros = diag_i[local_num_rows]; + local_num_nonzeros += offd_i[local_num_rows]; + hypre_MPI_Allreduce(&local_num_nonzeros, &total_num_nonzeros, 1, HYPRE_MPI_REAL, hypre_MPI_SUM, comm); hypre_ParCSRMatrixDNumNonzeros(matrix) = total_num_nonzeros; @@ -308,7 +373,7 @@ * hypre_ParCSRMatrixSetDataOwner *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_ParCSRMatrixSetDataOwner( hypre_ParCSRMatrix *matrix, HYPRE_Int owns_data ) { @@ -327,7 +392,7 @@ * hypre_ParCSRMatrixSetRowStartsOwner *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_ParCSRMatrixSetRowStartsOwner( hypre_ParCSRMatrix *matrix, HYPRE_Int owns_row_starts ) { @@ -346,7 +411,7 @@ * hypre_ParCSRMatrixSetColStartsOwner *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_ParCSRMatrixSetColStartsOwner( hypre_ParCSRMatrix *matrix, HYPRE_Int owns_col_starts ) { @@ -420,7 +485,7 @@ for (i=0; i < num_cols_offd; i++) hypre_fscanf(fp, "%b", &col_map_offd[i]); - + fclose(fp); #ifdef HYPRE_NO_GLOBAL_PARTITION @@ -460,9 +525,9 @@ offd = hypre_CSRMatrixCreate(local_num_rows,0,0); hypre_CSRMatrixInitialize(offd); } - + matrix = hypre_CTAlloc(hypre_ParCSRMatrix, 1, HYPRE_MEMORY_HOST); - + hypre_ParCSRMatrixComm(matrix) = comm; hypre_ParCSRMatrixGlobalNumRows(matrix) = global_num_rows; hypre_ParCSRMatrixGlobalNumCols(matrix) = global_num_cols; @@ -504,7 +569,7 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_ParCSRMatrixPrint( hypre_ParCSRMatrix *matrix, +hypre_ParCSRMatrixPrint( hypre_ParCSRMatrix *matrix, const char *file_name ) { MPI_Comm comm; @@ -540,14 +605,14 @@ hypre_MPI_Comm_rank(comm, &my_id); hypre_MPI_Comm_size(comm, &num_procs); - + hypre_sprintf(new_file_d,"%s.D.%d",file_name,my_id); hypre_sprintf(new_file_o,"%s.O.%d",file_name,my_id); hypre_sprintf(new_file_info,"%s.INFO.%d",file_name,my_id); hypre_CSRMatrixPrint(hypre_ParCSRMatrixDiag(matrix),new_file_d); if (num_cols_offd != 0) hypre_CSRMatrixPrint(hypre_ParCSRMatrixOffd(matrix),new_file_o); - + fp = fopen(new_file_info, "w"); hypre_fprintf(fp, "%b\n", global_num_rows); hypre_fprintf(fp, "%b\n", global_num_cols); @@ -575,7 +640,7 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_ParCSRMatrixPrintIJ( const hypre_ParCSRMatrix *matrix, +hypre_ParCSRMatrixPrintIJ( const hypre_ParCSRMatrix *matrix, const HYPRE_Int base_i, const HYPRE_Int base_j, const char *filename ) @@ -618,7 +683,7 @@ col_starts = hypre_ParCSRMatrixColStarts(matrix); hypre_MPI_Comm_rank(comm, &myid); hypre_MPI_Comm_size(comm, &num_procs); - + hypre_sprintf(new_filename,"%s.%05d", filename, myid); if ((file = fopen(new_filename, "w")) == NULL) @@ -708,7 +773,7 @@ const char *filename, HYPRE_Int *base_i_ptr, HYPRE_Int *base_j_ptr, - hypre_ParCSRMatrix **matrix_ptr) + hypre_ParCSRMatrix **matrix_ptr) { HYPRE_BigInt global_num_rows; HYPRE_BigInt global_num_cols; @@ -743,7 +808,7 @@ hypre_MPI_Comm_size(comm, &num_procs); hypre_MPI_Comm_rank(comm, &myid); - + hypre_sprintf(new_filename,"%s.%05d", filename, myid); if ((file = fopen(new_filename, "r")) == NULL) @@ -770,7 +835,7 @@ equal = 1; for (i = 0; i <= num_procs; i++) { - row_starts[i] -= big_base_i; + row_starts[i] -= big_base_i; col_starts[i] -= big_base_j; if (row_starts[i] != col_starts[i]) equal = 0; } @@ -784,7 +849,7 @@ row_starts, col_starts, num_cols_offd, num_nonzeros_diag, num_nonzeros_offd); hypre_ParCSRMatrixInitialize(matrix); - + diag = hypre_ParCSRMatrixDiag(matrix); offd = hypre_ParCSRMatrixOffd(matrix); @@ -811,7 +876,7 @@ { /* read values */ hypre_fscanf(file, "%b %b %le", &I, &J, &data); - i2 = (HYPRE_Int)(I-big_base_i-first_row_index); + i2 = (HYPRE_Int)(I-big_base_i-first_row_index); J -= big_base_j; if (i2 > row_cnt) { @@ -821,12 +886,12 @@ } if (J < first_col_diag || J > last_col_diag) { - tmp_j[offd_cnt] = J; + tmp_j[offd_cnt] = J; offd_data[offd_cnt++] = data; } - else + else { - diag_j[diag_cnt] = (HYPRE_Int)(J - first_col_diag); + diag_j[diag_cnt] = (HYPRE_Int)(J - first_col_diag); diag_data[diag_cnt++] = data; } } @@ -875,7 +940,7 @@ } } } - + *base_i_ptr = base_i; *base_j_ptr = base_j; *matrix_ptr = matrix; @@ -889,13 +954,13 @@ * "End" is actually the row number of the last row on this processor. *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_ParCSRMatrixGetLocalRange( hypre_ParCSRMatrix *matrix, HYPRE_BigInt *row_start, HYPRE_BigInt *row_end, HYPRE_BigInt *col_start, HYPRE_BigInt *col_end ) -{ +{ HYPRE_Int my_id; if (!matrix) @@ -940,18 +1005,18 @@ * AJC 4/99. *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_ParCSRMatrixGetRow( hypre_ParCSRMatrix *mat, HYPRE_BigInt row, HYPRE_Int *size, HYPRE_BigInt **col_ind, HYPRE_Complex **values ) -{ +{ HYPRE_Int my_id; HYPRE_BigInt row_start, row_end; hypre_CSRMatrix *Aa; hypre_CSRMatrix *Ba; - + if (!mat) { hypre_error_in_arg(1); @@ -959,7 +1024,7 @@ } Aa = (hypre_CSRMatrix *) hypre_ParCSRMatrixDiag(mat); Ba = (hypre_CSRMatrix *) hypre_ParCSRMatrixOffd(mat); - + if (hypre_ParCSRMatrixGetrowactive(mat)) return(-1); hypre_MPI_Comm_rank( hypre_ParCSRMatrixComm(mat), &my_id ); @@ -976,7 +1041,7 @@ /* if buffer is not allocated and some information is requested, allocate buffer */ - if (!hypre_ParCSRMatrixRowvalues(mat) && ( col_ind || values )) + if (!hypre_ParCSRMatrixRowvalues(mat) && ( col_ind || values )) { /* allocate enough space to hold information from the longest row. @@ -986,13 +1051,13 @@ HYPRE_Int m = row_end-row_start; for ( i=0; i last_col_diag) { @@ -1415,7 +1480,7 @@ } hypre_TFree(marker, HYPRE_MEMORY_HOST); } - else + else { hypre_CSRMatrixNumNonzeros(diag) = num_nonzeros; hypre_CSRMatrixInitialize(diag); @@ -1439,7 +1504,7 @@ hypre_CSRMatrixNumCols(offd) = 0; hypre_CSRMatrixI(offd) = offd_i; } - + return hypre_error_flag; } @@ -1450,7 +1515,7 @@ hypre_CSRMatrix *offd = hypre_ParCSRMatrixOffd(par_matrix); hypre_CSRMatrix *matrix; - HYPRE_Int num_cols = hypre_ParCSRMatrixGlobalNumCols(par_matrix); + HYPRE_BigInt num_cols = hypre_ParCSRMatrixGlobalNumCols(par_matrix); HYPRE_BigInt first_col_diag = hypre_ParCSRMatrixFirstColDiag(par_matrix); HYPRE_BigInt *col_map_offd = hypre_ParCSRMatrixColMapOffd(par_matrix); HYPRE_Int num_rows = hypre_CSRMatrixNumRows(diag); @@ -1485,36 +1550,36 @@ #ifdef HYPRE_USING_OPENMP #pragma omp parallel for private(ii, i, j, count) HYPRE_SMP_SCHEDULE #endif - for (ii=0; ii < num_threads; ii++) - { - HYPRE_Int ns, ne; - if (ii < rest) - { - ns = ii*size+ii; - ne = (ii+1)*size+ii+1; - } - else - { - ns = ii*size+rest; - ne = (ii+1)*size+rest; - } - count = diag_i[ns]+offd_i[ns];; - for (i=ns; i < ne; i++) + for (ii=0; ii < num_threads; ii++) { - matrix_i[i] = count; - for (j=diag_i[i]; j < diag_i[i+1]; j++) + HYPRE_Int ns, ne; + if (ii < rest) { - matrix_data[count] = diag_data[j]; - matrix_j[count++] = (HYPRE_BigInt)diag_j[j]+first_col_diag; + ns = ii*size+ii; + ne = (ii+1)*size+ii+1; } - for (j=offd_i[i]; j < offd_i[i+1]; j++) + else { - matrix_data[count] = offd_data[j]; - matrix_j[count++] = col_map_offd[offd_j[j]]; + ns = ii*size+rest; + ne = (ii+1)*size+rest; } - } - } /* end parallel region */ - matrix_i[num_rows] = num_nonzeros; + count = diag_i[ns]+offd_i[ns];; + for (i=ns; i < ne; i++) + { + matrix_i[i] = count; + for (j=diag_i[i]; j < diag_i[i+1]; j++) + { + matrix_data[count] = diag_data[j]; + matrix_j[count++] = (HYPRE_BigInt)diag_j[j]+first_col_diag; + } + for (j=offd_i[i]; j < offd_i[i+1]; j++) + { + matrix_data[count] = offd_data[j]; + matrix_j[count++] = col_map_offd[offd_j[j]]; + } + } + } /* end parallel region */ + matrix_i[num_rows] = num_nonzeros; return matrix; } @@ -1540,11 +1605,11 @@ HYPRE_Int *matrix_i; HYPRE_Int *matrix_j; HYPRE_Complex *matrix_data; - + HYPRE_Int *local_matrix_i; HYPRE_Int *local_matrix_j; HYPRE_Complex *local_matrix_data; - + HYPRE_Int i, j; HYPRE_Int local_num_rows; HYPRE_Int local_num_nonzeros; @@ -1564,7 +1629,7 @@ #ifdef HYPRE_NO_GLOBAL_PARTITION HYPRE_Int *new_vec_starts; - + HYPRE_Int num_contacts; HYPRE_Int contact_proc_list[1]; HYPRE_Int contact_send_buf[1]; @@ -1574,12 +1639,12 @@ HYPRE_Int *response_recv_buf_starts = NULL; hypre_DataExchangeResponse response_obj; hypre_ProcListElements send_proc_obj; - + HYPRE_Int *send_info = NULL; hypre_MPI_Status status1; HYPRE_Int count, tag1 = 11112, tag2 = 22223, tag3 = 33334; HYPRE_Int start; - + #endif hypre_MPI_Comm_size(comm, &num_procs); @@ -1587,9 +1652,9 @@ #ifdef HYPRE_NO_GLOBAL_PARTITION - local_num_rows = (HYPRE_Int)(hypre_ParCSRMatrixLastRowIndex(par_matrix) - + local_num_rows = (HYPRE_Int)(hypre_ParCSRMatrixLastRowIndex(par_matrix) - hypre_ParCSRMatrixFirstRowIndex(par_matrix) + 1); - + local_matrix = hypre_MergeDiagAndOffd(par_matrix); /* creates matrix */ hypre_CSRMatrixBigJtoJ(local_matrix); /* copies big_j to j */ @@ -1597,7 +1662,7 @@ local_matrix_j = hypre_CSRMatrixJ(local_matrix); local_matrix_data = hypre_CSRMatrixData(local_matrix); - + /* determine procs that have vector data and store their ids in used_procs */ /* we need to do an exchange data for this. If I own row then I will contact processor 0 with the endpoint of my local range */ @@ -1609,7 +1674,7 @@ contact_send_buf[0] = (HYPRE_Int)hypre_ParCSRMatrixLastRowIndex(par_matrix); contact_send_buf_starts[0] = 0; contact_send_buf_starts[1] = 1; - + } else { @@ -1623,7 +1688,7 @@ send_proc_obj.storage_length = 10; send_proc_obj.id = hypre_CTAlloc(HYPRE_Int, send_proc_obj.storage_length, HYPRE_MEMORY_HOST); send_proc_obj.vec_starts = - hypre_CTAlloc(HYPRE_Int, send_proc_obj.storage_length + 1, HYPRE_MEMORY_HOST); + hypre_CTAlloc(HYPRE_Int, send_proc_obj.storage_length + 1, HYPRE_MEMORY_HOST); send_proc_obj.vec_starts[0] = 0; send_proc_obj.element_storage_length = 10; send_proc_obj.elements = @@ -1633,33 +1698,33 @@ response_obj.fill_response = hypre_FillResponseParToCSRMatrix; response_obj.data1 = NULL; response_obj.data2 = &send_proc_obj; /*this is where we keep info from contacts*/ - - - hypre_DataExchangeList(num_contacts, - contact_proc_list, contact_send_buf, - contact_send_buf_starts, sizeof(HYPRE_Int), - sizeof(HYPRE_Int), &response_obj, + + + hypre_DataExchangeList(num_contacts, + contact_proc_list, contact_send_buf, + contact_send_buf_starts, sizeof(HYPRE_Int), + sizeof(HYPRE_Int), &response_obj, max_response_size, 1, - comm, (void**) &response_recv_buf, + comm, (void**) &response_recv_buf, &response_recv_buf_starts); - + /* now processor 0 should have a list of ranges for processors that have rows - these are in send_proc_obj - it needs to create the new list of processors and also an array of vec starts - and send to those who own row*/ if (my_id) { - if (local_num_rows) + if (local_num_rows) { - /* look for a message from processor 0 */ + /* look for a message from processor 0 */ hypre_MPI_Probe(0, tag1, comm, &status1); hypre_MPI_Get_count(&status1, HYPRE_MPI_INT, &count); - + send_info = hypre_CTAlloc(HYPRE_Int, count, HYPRE_MEMORY_HOST); hypre_MPI_Recv(send_info, count, HYPRE_MPI_INT, 0, tag1, comm, &status1); - /* now unpack */ + /* now unpack */ num_types = send_info[0]; - used_procs = hypre_CTAlloc(HYPRE_Int, num_types, HYPRE_MEMORY_HOST); + used_procs = hypre_CTAlloc(HYPRE_Int, num_types, HYPRE_MEMORY_HOST); new_vec_starts = hypre_CTAlloc(HYPRE_Int, num_types+1, HYPRE_MEMORY_HOST); for (i=1; i<= num_types; i++) @@ -1692,9 +1757,9 @@ else /* my_id ==0 */ { num_types = send_proc_obj.length; - used_procs = hypre_CTAlloc(HYPRE_Int, num_types, HYPRE_MEMORY_HOST); + used_procs = hypre_CTAlloc(HYPRE_Int, num_types, HYPRE_MEMORY_HOST); new_vec_starts = hypre_CTAlloc(HYPRE_Int, num_types+1, HYPRE_MEMORY_HOST); - + new_vec_starts[0] = 0; for (i=0; i< num_types; i++) { @@ -1724,7 +1789,7 @@ { start = 1; } - + for (i=start; i < num_types; i++) { hypre_MPI_Isend(send_info, count, HYPRE_MPI_INT, used_procs[i], tag1, @@ -1744,8 +1809,8 @@ if(response_recv_buf_starts) hypre_TFree(response_recv_buf_starts, HYPRE_MEMORY_HOST); /* now proc 0 can exit if it has no rows */ - if (!local_num_rows) - { + if (!local_num_rows) + { if (hypre_CSRMatrixOwnsData(local_matrix)) hypre_CSRMatrixDestroy(local_matrix); else @@ -1798,6 +1863,9 @@ num_nonzeros = matrix_i[num_rows]; matrix = hypre_CSRMatrixCreate(num_rows, num_cols, num_nonzeros); + + hypre_CSRMatrixMemoryLocation(matrix) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixI(matrix) = matrix_i; hypre_CSRMatrixInitialize(matrix); matrix_j = hypre_CSRMatrixJ(matrix); @@ -1811,7 +1879,7 @@ { proc_id = used_procs[i]; start_index = matrix_i[(HYPRE_Int)new_vec_starts[i]]; - num_data = matrix_i[(HYPRE_Int)new_vec_starts[i+1]] - start_index; + num_data = matrix_i[(HYPRE_Int)new_vec_starts[i+1]] - start_index; hypre_MPI_Irecv(&matrix_data[start_index], num_data, HYPRE_MPI_COMPLEX, used_procs[i], tag1, comm, &requests[j++]); hypre_MPI_Irecv(&matrix_j[start_index], num_data, HYPRE_MPI_INT, @@ -1830,16 +1898,16 @@ hypre_MPI_Waitall(num_requests, requests, status); hypre_TFree(new_vec_starts, HYPRE_MEMORY_HOST); - + #else local_num_rows = (HYPRE_Int)(row_starts[my_id+1] - row_starts[my_id]); /* if my_id contains no data, return NULL */ - + if (!local_num_rows) return NULL; - + local_matrix = hypre_MergeDiagAndOffd(par_matrix); hypre_CSRMatrixBigJtoJ(local_matrix); /* copies big_j to j */ local_matrix_i = hypre_CSRMatrixI(local_matrix); @@ -1902,6 +1970,9 @@ num_nonzeros = matrix_i[num_rows]; matrix = hypre_CSRMatrixCreate(num_rows, num_cols, num_nonzeros); + + hypre_CSRMatrixMemoryLocation(matrix) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixI(matrix) = matrix_i; hypre_CSRMatrixInitialize(matrix); matrix_j = hypre_CSRMatrixJ(matrix); @@ -1915,7 +1986,7 @@ { proc_id = used_procs[i]; start_index = matrix_i[(HYPRE_Int)row_starts[proc_id]]; - num_data = matrix_i[(HYPRE_Int)row_starts[proc_id+1]] - start_index; + num_data = matrix_i[(HYPRE_Int)row_starts[proc_id+1]] - start_index; hypre_MPI_Irecv(&matrix_data[start_index], num_data, HYPRE_MPI_COMPLEX, used_procs[i], 0, comm, &requests[j++]); hypre_MPI_Irecv(&matrix_j[start_index], num_data, HYPRE_MPI_INT, @@ -1961,7 +2032,7 @@ return matrix; } - + /*-------------------------------------------------------------------------- * hypre_ParCSRMatrixCopy, * copies B to A, @@ -1969,9 +2040,9 @@ * the routine does not check whether the dimensions of A and B are compatible *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_ParCSRMatrixCopy( hypre_ParCSRMatrix *A, - hypre_ParCSRMatrix *B, + hypre_ParCSRMatrix *B, HYPRE_Int copy_data ) { hypre_CSRMatrix *A_diag; @@ -1980,8 +2051,8 @@ hypre_CSRMatrix *B_diag; hypre_CSRMatrix *B_offd; HYPRE_BigInt *col_map_offd_B; - HYPRE_Int num_cols_offd; - HYPRE_Int i; + HYPRE_Int num_cols_offd_A; + HYPRE_Int num_cols_offd_B; if (!A) { @@ -1993,26 +2064,36 @@ hypre_error_in_arg(1); return hypre_error_flag; } + A_diag = hypre_ParCSRMatrixDiag(A); A_offd = hypre_ParCSRMatrixOffd(A); - col_map_offd_A = hypre_ParCSRMatrixColMapOffd(A); B_diag = hypre_ParCSRMatrixDiag(B); B_offd = hypre_ParCSRMatrixOffd(B); + + num_cols_offd_A = hypre_CSRMatrixNumCols(A_offd); + num_cols_offd_B = hypre_CSRMatrixNumCols(B_offd); + + hypre_assert(num_cols_offd_A == num_cols_offd_B); + + col_map_offd_A = hypre_ParCSRMatrixColMapOffd(A); col_map_offd_B = hypre_ParCSRMatrixColMapOffd(B); - num_cols_offd = hypre_CSRMatrixNumCols(A_offd); hypre_CSRMatrixCopy(A_diag, B_diag, copy_data); hypre_CSRMatrixCopy(A_offd, B_offd, copy_data); - if (num_cols_offd && col_map_offd_B == NULL) + + /* should not happen if B has been initialized */ + if (num_cols_offd_B && col_map_offd_B == NULL) { - col_map_offd_B = hypre_CTAlloc(HYPRE_BigInt, num_cols_offd, HYPRE_MEMORY_HOST); + col_map_offd_B = hypre_TAlloc(HYPRE_BigInt, num_cols_offd_B, HYPRE_MEMORY_HOST); hypre_ParCSRMatrixColMapOffd(B) = col_map_offd_B; } - for (i = 0; i < num_cols_offd; i++) - col_map_offd_B[i] = col_map_offd_A[i]; - + + hypre_TMemcpy(col_map_offd_B, col_map_offd_A, HYPRE_BigInt, num_cols_offd_B, + HYPRE_MEMORY_HOST, HYPRE_MEMORY_HOST); + return hypre_error_flag; } + /*-------------------------------------------------------------------- * hypre_FillResponseParToCSRMatrix * Fill response function for determining the send processors @@ -2020,12 +2101,12 @@ *--------------------------------------------------------------------*/ HYPRE_Int -hypre_FillResponseParToCSRMatrix( void *p_recv_contact_buf, +hypre_FillResponseParToCSRMatrix( void *p_recv_contact_buf, HYPRE_Int contact_size, HYPRE_Int contact_proc, - void *ro, + void *ro, MPI_Comm comm, - void **p_send_response_buf, + void **p_send_response_buf, HYPRE_Int *response_message_size ) { HYPRE_Int myid; @@ -2033,9 +2114,9 @@ HYPRE_BigInt *recv_contact_buf = (HYPRE_BigInt * ) p_recv_contact_buf; - hypre_DataExchangeResponse *response_obj = (hypre_DataExchangeResponse*)ro; + hypre_DataExchangeResponse *response_obj = (hypre_DataExchangeResponse*)ro; - hypre_ProcListElements *send_proc_obj = (hypre_ProcListElements*)response_obj->data2; + hypre_ProcListElements *send_proc_obj = (hypre_ProcListElements*)response_obj->data2; hypre_MPI_Comm_rank(comm, &myid ); @@ -2043,87 +2124,41 @@ if (send_proc_obj->length == send_proc_obj->storage_length) { send_proc_obj->storage_length +=10; /*add space for 10 more processors*/ - send_proc_obj->id = hypre_TReAlloc(send_proc_obj->id, HYPRE_Int, + send_proc_obj->id = hypre_TReAlloc(send_proc_obj->id, HYPRE_Int, send_proc_obj->storage_length, HYPRE_MEMORY_HOST); send_proc_obj->vec_starts = - hypre_TReAlloc(send_proc_obj->vec_starts, HYPRE_Int, + hypre_TReAlloc(send_proc_obj->vec_starts, HYPRE_Int, send_proc_obj->storage_length + 1, HYPRE_MEMORY_HOST); } - - /*initialize*/ + + /*initialize*/ count = send_proc_obj->length; index = send_proc_obj->vec_starts[count]; /*this is the number of elements*/ - /*send proc*/ - send_proc_obj->id[count] = contact_proc; + /*send proc*/ + send_proc_obj->id[count] = contact_proc; /*do we need more storage for the elements?*/ if (send_proc_obj->element_storage_length < index + contact_size) { - elength = hypre_max(contact_size, 10); + elength = hypre_max(contact_size, 10); elength += index; - send_proc_obj->elements = hypre_TReAlloc(send_proc_obj->elements, + send_proc_obj->elements = hypre_TReAlloc(send_proc_obj->elements, HYPRE_BigInt, elength, HYPRE_MEMORY_HOST); - send_proc_obj->element_storage_length = elength; + send_proc_obj->element_storage_length = elength; } /*populate send_proc_obj*/ - for (i=0; i< contact_size; i++) - { + for (i=0; i< contact_size; i++) + { send_proc_obj->elements[index++] = recv_contact_buf[i]; } send_proc_obj->vec_starts[count+1] = index; send_proc_obj->length++; /*output - no message to return (confirmation) */ - *response_message_size = 0; - - return hypre_error_flag; -} + *response_message_size = 0; -/*-------------------------------------------------------------------------- - * hypre_ParCSRMatrixCompleteClone - * Creates and returns a new copy of the argument, A. - * Data is not copied, only structural information is reproduced. - * The following variables are not copied because they will be constructed - * later if needed: CommPkg, CommPkgT, rowindices, rowvalues - *--------------------------------------------------------------------------*/ -/* This differs from Hypre_ParCSRMatrixClone in parcsr_ls/par_gsmg.c, because - that Clone function makes a matrix with different global parameters. */ - -hypre_ParCSRMatrix * hypre_ParCSRMatrixCompleteClone( hypre_ParCSRMatrix * A ) -{ - hypre_ParCSRMatrix * B = hypre_CTAlloc(hypre_ParCSRMatrix, 1, HYPRE_MEMORY_HOST); - HYPRE_Int i, ncols_offd; - - hypre_ParCSRMatrixComm( B ) = hypre_ParCSRMatrixComm( A ); - hypre_ParCSRMatrixGlobalNumRows( B ) = hypre_ParCSRMatrixGlobalNumRows( A ); - hypre_ParCSRMatrixGlobalNumCols( B ) = hypre_ParCSRMatrixGlobalNumCols( A ); - hypre_ParCSRMatrixFirstRowIndex( B ) = hypre_ParCSRMatrixFirstRowIndex( A ); - hypre_ParCSRMatrixFirstColDiag( B ) = hypre_ParCSRMatrixFirstColDiag( A ); - hypre_ParCSRMatrixLastRowIndex( B ) = hypre_ParCSRMatrixLastRowIndex( A ); - hypre_ParCSRMatrixLastColDiag( B ) = hypre_ParCSRMatrixLastColDiag( A ); - hypre_ParCSRMatrixDiag( B ) = hypre_CSRMatrixClone( hypre_ParCSRMatrixDiag( A ) ); - hypre_ParCSRMatrixOffd( B ) = hypre_CSRMatrixClone( hypre_ParCSRMatrixOffd( A ) ); - hypre_ParCSRMatrixRowStarts( B ) = hypre_ParCSRMatrixRowStarts( A ); - hypre_ParCSRMatrixColStarts( B ) = hypre_ParCSRMatrixColStarts( A ); - /* note that B doesn't own row_starts & col_starts; this isn't a full copy */ - hypre_ParCSRMatrixCommPkg( B ) = NULL; - hypre_ParCSRMatrixCommPkgT( B ) = NULL; - hypre_ParCSRMatrixOwnsData( B ) = 1; - hypre_ParCSRMatrixOwnsRowStarts( B ) = 0; - hypre_ParCSRMatrixOwnsColStarts( B ) = 0; - hypre_ParCSRMatrixNumNonzeros( B ) = hypre_ParCSRMatrixNumNonzeros( A ); - hypre_ParCSRMatrixDNumNonzeros( B ) = hypre_ParCSRMatrixNumNonzeros( A ); - hypre_ParCSRMatrixRowindices( B ) = NULL; - hypre_ParCSRMatrixRowvalues( B ) = NULL; - hypre_ParCSRMatrixGetrowactive( B ) = 0; - ncols_offd = hypre_CSRMatrixNumCols( hypre_ParCSRMatrixOffd( B ) ); - - hypre_ParCSRMatrixColMapOffd( B ) = hypre_CTAlloc( HYPRE_BigInt, ncols_offd , HYPRE_MEMORY_HOST); - for ( i=0; i 1) { for (j = A_offd_i_i; j < A_offd_i[i+1]; j++) { HYPRE_Complex v = A_offd_a[j]; - row_2nrm += v*v; + if (type == 1) + { + row_nrm += fabs(v); + } + else if (type == 2) + { + row_nrm += v*v; + } + else + { + row_nrm = hypre_max(row_nrm, fabs(v)); + } } } - row_2nrm = sqrt(row_2nrm); + if (type == 2) + { + row_nrm = sqrt(row_nrm); + } /* drop small entries based on tol and row norm */ for (j = A_diag_i_i; j < A_diag_i[i+1]; j++) { + HYPRE_Int col = A_diag_j[j]; HYPRE_Complex val = A_diag_a[j]; - if (fabs(val) >= tol * row_2nrm) + if (i == col || fabs(val) >= tol * row_nrm) { - HYPRE_Int col = A_diag_j[j]; A_diag_j[nnz_diag] = col; A_diag_a[nnz_diag] = val; nnz_diag ++; @@ -2262,10 +2326,12 @@ { for (j = A_offd_i_i; j < A_offd_i[i+1]; j++) { + HYPRE_Int col = A_offd_j[j]; HYPRE_Complex val = A_offd_a[j]; - if (fabs(val) >= tol * row_2nrm) + /* in normal cases: diagonal entry should not + * appear in A_offd (but this can still be possible) */ + if (i + first_row == col_map_offd_A[col] || fabs(val) >= tol * row_nrm) { - HYPRE_Int col = A_offd_j[j]; if (0 == marker_offd[col]) { marker_offd[col] = 1; @@ -2281,7 +2347,7 @@ A_diag_i[i+1] = nnz_diag; A_offd_i[i+1] = nnz_offd; } - + hypre_CSRMatrixNumNonzeros(A_diag) = nnz_diag; hypre_CSRMatrixNumNonzeros(A_offd) = nnz_offd; hypre_ParCSRMatrixSetNumNonzeros(A); @@ -2313,11 +2379,13 @@ return hypre_error_flag; } +/* #ifdef HYPRE_USING_UNIFIED_MEMORY hypre_int hypre_ParCSRMatrixIsManaged(hypre_ParCSRMatrix *a){ if (hypre_CSRMatrixNumCols(hypre_ParCSRMatrixOffd(a))) return ((hypre_CSRMatrixIsManaged(hypre_ParCSRMatrixDiag(a))) && (hypre_CSRMatrixIsManaged(hypre_ParCSRMatrixOffd(a)))); else - return hypre_CSRMatrixIsManaged(hypre_ParCSRMatrixDiag(a)); + return hypre_CSRMatrixIsManaged(hypre_ParCSRMatrixDiag(a)); } #endif +*/ diff -Nru hypre-2.16.0/src/parcsr_mv/par_csr_matrix.h hypre-2.18.2/src/parcsr_mv/par_csr_matrix.h --- hypre-2.16.0/src/parcsr_mv/par_csr_matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_csr_matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -37,7 +32,7 @@ HYPRE_BigInt global_num_cols; HYPRE_BigInt first_row_index; HYPRE_BigInt first_col_diag; - /* need to know entire local range in case row_starts and col_starts + /* need to know entire local range in case row_starts and col_starts are null (i.e., bgl) AHB 6/05*/ HYPRE_BigInt last_row_index; HYPRE_BigInt last_col_diag; @@ -45,23 +40,26 @@ hypre_CSRMatrix *diag; hypre_CSRMatrix *offd; hypre_CSRMatrix *diagT, *offdT; - /* JSP: transposed matrices are created lazily and optional */ - HYPRE_BigInt *col_map_offd; - /* maps columns of offd to global columns */ - HYPRE_BigInt *row_starts; - /* array of length num_procs+1, row_starts[i] contains the - global number of the first row on proc i, - first_row_index = row_starts[my_id], - row_starts[num_procs] = global_num_rows */ + /* JSP: transposed matrices are created lazily and optional */ + HYPRE_BigInt *col_map_offd; + HYPRE_BigInt *device_col_map_offd; + /* maps columns of offd to global columns */ + HYPRE_BigInt *row_starts; + /* array of length 2 giving the glboal index of the first row + on this processor, and 1+index of the final row on this + processor. If –enable-global-partition is used, then array + is length num_procs+1, and row_starts[i] contains the + global number of the first row on proc i, first_row_index = + row_starts[my_id], row_starts[num_procs] = global_num_rows */ HYPRE_BigInt *col_starts; - /* array of length num_procs+1, col_starts[i] contains the - global number of the first column of diag on proc i, - first_col_diag = col_starts[my_id], - col_starts[num_procs] = global_num_cols */ + /* array of length num_procs+1, col_starts[i] contains the + global number of the first column of diag on proc i, + first_col_diag = col_starts[my_id], + col_starts[num_procs] = global_num_cols */ hypre_ParCSRCommPkg *comm_pkg; hypre_ParCSRCommPkg *comm_pkgT; - + /* Does the ParCSRMatrix create/destroy `diag', `offd', `col_map_offd'? */ HYPRE_Int owns_data; /* Does the ParCSRMatrix create/destroy `row_starts', `col_starts'? */ @@ -80,6 +78,10 @@ no_global_partition option is used (compile-time option)*/ + /* Array to store ordering of local diagonal block to relax. In particular, + used for triangulr matrices that are not ordered to be triangular. */ + HYPRE_Int *proc_ordering; + } hypre_ParCSRMatrix; /*-------------------------------------------------------------------------- @@ -98,6 +100,7 @@ #define hypre_ParCSRMatrixDiagT(matrix) ((matrix) -> diagT) #define hypre_ParCSRMatrixOffdT(matrix) ((matrix) -> offdT) #define hypre_ParCSRMatrixColMapOffd(matrix) ((matrix) -> col_map_offd) +#define hypre_ParCSRMatrixDeviceColMapOffd(matrix) ((matrix) -> device_col_map_offd) #define hypre_ParCSRMatrixRowStarts(matrix) ((matrix) -> row_starts) #define hypre_ParCSRMatrixColStarts(matrix) ((matrix) -> col_starts) #define hypre_ParCSRMatrixCommPkg(matrix) ((matrix) -> comm_pkg) @@ -115,6 +118,7 @@ #define hypre_ParCSRMatrixRowvalues(matrix) ((matrix) -> rowvalues) #define hypre_ParCSRMatrixGetrowactive(matrix) ((matrix) -> getrowactive) #define hypre_ParCSRMatrixAssumedPartition(matrix) ((matrix) -> assumed_partition) +#define hypre_ParCSRMatrixProcOrdering(matrix) ((matrix) -> proc_ordering) /*-------------------------------------------------------------------------- * Parallel CSR Boolean Matrix @@ -131,8 +135,8 @@ HYPRE_BigInt last_col_diag; hypre_CSRBooleanMatrix *diag; hypre_CSRBooleanMatrix *offd; - HYPRE_BigInt *col_map_offd; - HYPRE_BigInt *row_starts; + HYPRE_BigInt *col_map_offd; + HYPRE_BigInt *row_starts; HYPRE_BigInt *col_starts; hypre_ParCSRCommPkg *comm_pkg; hypre_ParCSRCommPkg *comm_pkgT; diff -Nru hypre-2.16.0/src/parcsr_mv/par_csr_matvec.c hypre-2.18.2/src/parcsr_mv/par_csr_matvec.c --- hypre-2.16.0/src/parcsr_mv/par_csr_matvec.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_csr_matvec.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -18,13 +13,6 @@ #include "_hypre_parcsr_mv.h" #include -/*#ifdef HYPRE_USING_GPU -extern "C" -{ -void PackOnDevice(HYPRE_Complex *send_data,HYPRE_Complex *x_local_data, HYPRE_Int *send_map, HYPRE_Int begin,HYPRE_Int end,cudaStream_t s); -} -#endif -*/ /*-------------------------------------------------------------------------- * hypre_ParCSRMatrixMatvec *--------------------------------------------------------------------------*/ @@ -38,29 +26,34 @@ hypre_ParVector *y ) { hypre_ParCSRCommHandle **comm_handle; - hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); - hypre_CSRMatrix *diag = hypre_ParCSRMatrixDiag(A); - hypre_CSRMatrix *offd = hypre_ParCSRMatrixOffd(A); - hypre_Vector *x_local = hypre_ParVectorLocalVector(x); - hypre_Vector *b_local = hypre_ParVectorLocalVector(b); - hypre_Vector *y_local = hypre_ParVectorLocalVector(y); - HYPRE_BigInt num_rows = hypre_ParCSRMatrixGlobalNumRows(A); - HYPRE_BigInt num_cols = hypre_ParCSRMatrixGlobalNumCols(A); + hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); - hypre_Vector *x_tmp; - HYPRE_BigInt x_size = hypre_ParVectorGlobalSize(x); - HYPRE_BigInt b_size = hypre_ParVectorGlobalSize(b); - HYPRE_BigInt y_size = hypre_ParVectorGlobalSize(y); - HYPRE_Int num_vectors = hypre_VectorNumVectors(x_local); - HYPRE_Int num_cols_offd = hypre_CSRMatrixNumCols(offd); - HYPRE_Int ierr = 0; - HYPRE_Int num_sends, i, j, jv, index, start; + hypre_CSRMatrix *diag = hypre_ParCSRMatrixDiag(A); + hypre_CSRMatrix *offd = hypre_ParCSRMatrixOffd(A); - HYPRE_Int vecstride = hypre_VectorVectorStride( x_local ); - HYPRE_Int idxstride = hypre_VectorIndexStride( x_local ); + hypre_Vector *x_local = hypre_ParVectorLocalVector(x); + hypre_Vector *b_local = hypre_ParVectorLocalVector(b); + hypre_Vector *y_local = hypre_ParVectorLocalVector(y); + hypre_Vector *x_tmp; + + HYPRE_BigInt num_rows = hypre_ParCSRMatrixGlobalNumRows(A); + HYPRE_BigInt num_cols = hypre_ParCSRMatrixGlobalNumCols(A); + HYPRE_BigInt x_size = hypre_ParVectorGlobalSize(x); + HYPRE_BigInt b_size = hypre_ParVectorGlobalSize(b); + HYPRE_BigInt y_size = hypre_ParVectorGlobalSize(y); + + HYPRE_Int num_vectors = hypre_VectorNumVectors(x_local); + HYPRE_Int num_cols_offd = hypre_CSRMatrixNumCols(offd); + HYPRE_Int ierr = 0; + HYPRE_Int num_sends, jv; - HYPRE_Complex *x_tmp_data, **x_buf_data; - HYPRE_Complex *x_local_data = hypre_VectorData(x_local); + HYPRE_Int vecstride = hypre_VectorVectorStride( x_local ); + HYPRE_Int idxstride = hypre_VectorIndexStride( x_local ); + + HYPRE_Complex *x_tmp_data, **x_buf_data; + HYPRE_Complex *x_local_data = hypre_VectorData(x_local); + + hypre_HandleCudaComputeStreamSyncPush(hypre_handle, 0); /*--------------------------------------------------------------------- * Check for size compatibility. ParMatvec returns ierr = 11 if @@ -72,26 +65,33 @@ * these conditions terminates processing, and the ierr flag * is informational only. *--------------------------------------------------------------------*/ - PUSH_RANGE_PAYLOAD("PAR_CSR_MATVEC",5,x_size); hypre_assert( idxstride>0 ); if (num_cols != x_size) + { ierr = 11; + } if (num_rows != y_size || num_rows != b_size) + { ierr = 12; + } if (num_cols != x_size && (num_rows != y_size || num_rows != b_size)) + { ierr = 13; + } - hypre_assert( hypre_VectorNumVectors(b_local)==num_vectors ); - hypre_assert( hypre_VectorNumVectors(y_local)==num_vectors ); + hypre_assert( hypre_VectorNumVectors(b_local) == num_vectors ); + hypre_assert( hypre_VectorNumVectors(y_local) == num_vectors ); - if ( num_vectors==1 ) + if ( num_vectors == 1 ) + { x_tmp = hypre_SeqVectorCreate( num_cols_offd ); + } else { - hypre_assert( num_vectors>1 ); + hypre_assert( num_vectors > 1 ); x_tmp = hypre_SeqMultiVectorCreate( num_cols_offd, num_vectors ); } @@ -105,11 +105,16 @@ comm_pkg = hypre_ParCSRMatrixCommPkg(A); } + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + hypre_assert( num_cols_offd == hypre_ParCSRCommPkgRecvVecStart(comm_pkg, hypre_ParCSRCommPkgNumRecvs(comm_pkg)) ); + hypre_assert( hypre_ParCSRCommPkgSendMapStart(comm_pkg, 0) == 0 ); + #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_PACK_UNPACK] -= hypre_MPI_Wtime(); #endif - PUSH_RANGE("MPI_PACK",3); + HYPRE_Int use_persistent_comm = 0; + #ifdef HYPRE_USING_PERSISTENT_COMM use_persistent_comm = num_vectors == 1; // JSP TODO: we can use persistent communication for multi-vectors, @@ -118,116 +123,74 @@ hypre_ParCSRPersistentCommHandle *persistent_comm_handle; #endif - if ( use_persistent_comm ) + if (use_persistent_comm) { #ifdef HYPRE_USING_PERSISTENT_COMM - PUSH_RANGE("PERCOMM1",0); persistent_comm_handle = hypre_ParCSRCommPkgGetPersistentCommHandle(1, comm_pkg); - - HYPRE_Int num_recvs = hypre_ParCSRCommPkgNumRecvs(comm_pkg); - hypre_assert(num_cols_offd == hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs)); - - hypre_VectorData(x_tmp) = (HYPRE_Complex *)persistent_comm_handle->recv_data; - hypre_SeqVectorSetDataOwner(x_tmp, 0); - POP_RANGE; #endif } else { comm_handle = hypre_CTAlloc(hypre_ParCSRCommHandle*, num_vectors, HYPRE_MEMORY_HOST); } - hypre_SeqVectorInitialize(x_tmp); - x_tmp_data = hypre_VectorData(x_tmp); - num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - if (!use_persistent_comm) + /* x_tmp */ +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + /* for GPU and single vector, alloc persistent memory for x_tmp (in comm_pkg) and reuse */ + if (num_vectors == 1) { - x_buf_data = hypre_CTAlloc( HYPRE_Complex*, num_vectors , HYPRE_MEMORY_HOST); - for ( jv=0; jvsend_data,x_local_data,hypre_ParCSRCommPkgSendMapElmts(comm_pkg),begin,end,HYPRE_STREAM(4)); - //PrintPointerAttributes(persistent_comm_handle->send_data); -#else -#if defined(DEBUG_PACK_ON_DEVICE) - hypre_CheckErrorDevice(cudaPeekAtLastError()); - hypre_CheckErrorDevice(cudaDeviceSynchronize()); - ASSERT_MANAGED(x_buf_data[0]); - ASSERT_MANAGED(x_local_data); - ASSERT_MANAGED(hypre_ParCSRCommPkgSendMapElmts(comm_pkg)); -#endif - /* - printf("%d %d %d\n", PointerAttributes(x_buf_data[0]), PointerAttributes(x_local_data), - PointerAttributes(hypre_ParCSRCommPkgSendMapElmts(comm_pkg))); - */ - PackOnDevice((HYPRE_Complex*)x_buf_data[0],x_local_data,hypre_ParCSRCommPkgSendMapElmts(comm_pkg),begin,end,HYPRE_STREAM(4)); -#if defined(DEBUG_PACK_ON_DEVICE) - hypre_CheckErrorDevice(cudaPeekAtLastError()); - hypre_CheckErrorDevice(cudaDeviceSynchronize()); -#endif -#endif - POP_RANGE; - SetAsyncMode(1); - hypre_CheckErrorDevice(cudaPeekAtLastError()); - hypre_CheckErrorDevice(cudaDeviceSynchronize()); - hypre_CSRMatrixMatvecOutOfPlace( alpha, diag, x_local, beta, b_local, y_local, 0); - //hypre_SeqVectorUpdateHost(y_local); - //hypre_SeqVectorUpdateHost(x_local); - //hypre_SeqVectorUpdateHost(b_local); - SetAsyncMode(0); -#else -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - PUSH_RANGE("MPI_PACK_OMP",4); - SyncVectorToHost(x_local); + hypre_VectorData(x_tmp) = (HYPRE_Complex *) hypre_ParCSRCommHandleRecvDataBuffer(persistent_comm_handle); + hypre_SeqVectorSetDataOwner(x_tmp, 0); +#endif + } #endif -#if defined(HYPRE_USING_OPENMP_OFFLOAD_NOT_USED) - HYPRE_Int num_threads=64; - HYPRE_Int num_teams = (end-begin+(end-begin)%num_threads)/num_threads; - HYPRE_Int *local_send_map_elmts = comm_pkg->send_map_elmts; - printf("USING OFFLOADED PACKING OF BUFER\n"); -#pragma omp target teams distribute parallel for private(i) num_teams(num_teams) thread_limit(num_threads) is_device_ptr(x_local_data,x_buf_data,comm_pkg,local_send_map_elmts) -#elif defined(HYPRE_USING_OPENMP) -#pragma omp parallel for HYPRE_SMP_SCHEDULE + hypre_SeqVectorInitialize_v2(x_tmp, HYPRE_MEMORY_DEVICE); + x_tmp_data = hypre_VectorData(x_tmp); + + /* x_buff_data */ + x_buf_data = hypre_CTAlloc(HYPRE_Complex*, num_vectors, HYPRE_MEMORY_HOST); + + for (jv = 0; jv < num_vectors; ++jv) + { +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + if (jv == 0) + { + if (!hypre_ParCSRCommPkgBufData(comm_pkg)) + { + hypre_ParCSRCommPkgBufData(comm_pkg) = hypre_TAlloc(HYPRE_Complex, + hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + HYPRE_MEMORY_DEVICE); + } + x_buf_data[0] = hypre_ParCSRCommPkgBufData(comm_pkg); + continue; + } #endif - for (i = begin; i < end; i++) + if (use_persistent_comm) { #ifdef HYPRE_USING_PERSISTENT_COMM - ((HYPRE_Complex *)persistent_comm_handle->send_data)[i - begin] -#else - x_buf_data[0][i - begin] + x_buf_data[0] = (HYPRE_Complex *) hypre_ParCSRCommHandleSendDataBuffer(persistent_comm_handle); + continue; #endif - = x_local_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,i)]; } - POP_RANGE; // "MPI_PACK_OMP" -#endif + + x_buf_data[jv] = hypre_TAlloc(HYPRE_Complex, + hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends), + HYPRE_MEMORY_DEVICE); } - else - for ( jv=0; jvlocal_vector); -} -HYPRE_Int -hypre_ParCSRMatrixMatvecOutOfPlace3( HYPRE_Complex alpha, - hypre_ParCSRMatrix *A, - hypre_ParVector *x, - HYPRE_Complex beta, - hypre_ParVector *b, - hypre_ParVector *y ) -{ - hypre_ParCSRMatrixMatvecOutOfPlace(alpha,A,x,beta,b,y); - hypre_SeqVectorUpdateHost(y->local_vector); -} -#endif /*-------------------------------------------------------------------------- * hypre_ParCSRMatrixMatvecT * @@ -365,32 +362,35 @@ hypre_ParVector *y ) { hypre_ParCSRCommHandle **comm_handle; - hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); - hypre_CSRMatrix *diag = hypre_ParCSRMatrixDiag(A); - hypre_CSRMatrix *offd = hypre_ParCSRMatrixOffd(A); - hypre_Vector *x_local = hypre_ParVectorLocalVector(x); - hypre_Vector *y_local = hypre_ParVectorLocalVector(y); - hypre_Vector *y_tmp; - HYPRE_Int vecstride = hypre_VectorVectorStride( y_local ); - HYPRE_Int idxstride = hypre_VectorIndexStride( y_local ); - HYPRE_Complex *y_tmp_data, **y_buf_data; - HYPRE_Complex *y_local_data = hypre_VectorData(y_local); - - HYPRE_BigInt num_rows = hypre_ParCSRMatrixGlobalNumRows(A); - HYPRE_BigInt num_cols = hypre_ParCSRMatrixGlobalNumCols(A); - HYPRE_Int num_cols_offd = hypre_CSRMatrixNumCols(offd); - HYPRE_BigInt x_size = hypre_ParVectorGlobalSize(x); - HYPRE_BigInt y_size = hypre_ParVectorGlobalSize(y); - HYPRE_Int num_vectors = hypre_VectorNumVectors(y_local); - - HYPRE_Int i, j, jv, index, start, num_sends; - - HYPRE_Int ierr = 0; - - if (y==NULL) { - printf("NULLY %p\b", (void*) y); - return 1; - } + hypre_ParCSRCommPkg *comm_pkg = hypre_ParCSRMatrixCommPkg(A); + + hypre_CSRMatrix *diag = hypre_ParCSRMatrixDiag(A); + hypre_CSRMatrix *offd = hypre_ParCSRMatrixOffd(A); + hypre_CSRMatrix *diagT = hypre_ParCSRMatrixDiagT(A); + hypre_CSRMatrix *offdT = hypre_ParCSRMatrixOffdT(A); + + hypre_Vector *x_local = hypre_ParVectorLocalVector(x); + hypre_Vector *y_local = hypre_ParVectorLocalVector(y); + hypre_Vector *y_tmp; + + HYPRE_BigInt num_rows = hypre_ParCSRMatrixGlobalNumRows(A); + HYPRE_BigInt num_cols = hypre_ParCSRMatrixGlobalNumCols(A); + HYPRE_BigInt x_size = hypre_ParVectorGlobalSize(x); + HYPRE_BigInt y_size = hypre_ParVectorGlobalSize(y); + + HYPRE_Int num_vectors = hypre_VectorNumVectors(y_local); + HYPRE_Int num_cols_offd = hypre_CSRMatrixNumCols(offd); + HYPRE_Int ierr = 0; + HYPRE_Int num_sends, jv; + + HYPRE_Int vecstride = hypre_VectorVectorStride(y_local); + HYPRE_Int idxstride = hypre_VectorIndexStride(y_local); + + HYPRE_Complex *y_tmp_data, **y_buf_data; + HYPRE_Complex *y_local_data = hypre_VectorData(y_local); + + hypre_HandleCudaComputeStreamSyncPush(hypre_handle, 0); + /*--------------------------------------------------------------------- * Check for size compatibility. MatvecT returns ierr = 1 if * length of X doesn't equal the number of rows of A, @@ -401,25 +401,32 @@ * these conditions terminates processing, and the ierr flag * is informational only. *--------------------------------------------------------------------*/ - if (num_rows != x_size) + { ierr = 1; + } if (num_cols != y_size) + { ierr = 2; + } if (num_rows != x_size && num_cols != y_size) + { ierr = 3; - /*----------------------------------------------------------------------- - *-----------------------------------------------------------------------*/ + } - if ( num_vectors==1 ) + hypre_assert( hypre_VectorNumVectors(x_local) == num_vectors ); + hypre_assert( hypre_VectorNumVectors(y_local) == num_vectors ); + + if ( num_vectors == 1 ) { y_tmp = hypre_SeqVectorCreate(num_cols_offd); } else { - y_tmp = hypre_SeqMultiVectorCreate(num_cols_offd,num_vectors); + hypre_assert( num_vectors > 1 ); + y_tmp = hypre_SeqMultiVectorCreate(num_cols_offd, num_vectors); } /*--------------------------------------------------------------------- @@ -432,11 +439,16 @@ comm_pkg = hypre_ParCSRMatrixCommPkg(A); } + num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); + hypre_assert( num_cols_offd == hypre_ParCSRCommPkgRecvVecStart(comm_pkg, hypre_ParCSRCommPkgNumRecvs(comm_pkg)) ); + hypre_assert( hypre_ParCSRCommPkgSendMapStart(comm_pkg, 0) == 0 ); + #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_PACK_UNPACK] -= hypre_MPI_Wtime(); #endif HYPRE_Int use_persistent_comm = 0; + #ifdef HYPRE_USING_PERSISTENT_COMM use_persistent_comm = num_vectors == 1; // JSP TODO: we can use persistent communication for multi-vectors, @@ -448,48 +460,80 @@ if (use_persistent_comm) { #ifdef HYPRE_USING_PERSISTENT_COMM - // JSP TODO: we should be also able to use persistent communication for multiple vectors persistent_comm_handle = hypre_ParCSRCommPkgGetPersistentCommHandle(2, comm_pkg); - - HYPRE_Int num_recvs = hypre_ParCSRCommPkgNumRecvs(comm_pkg); - hypre_assert(num_cols_offd == hypre_ParCSRCommPkgRecvVecStart(comm_pkg, num_recvs)); - - hypre_VectorData(y_tmp) = (HYPRE_Complex *)persistent_comm_handle->send_data; - hypre_SeqVectorSetDataOwner(y_tmp, 0); #endif } else { comm_handle = hypre_CTAlloc(hypre_ParCSRCommHandle*, num_vectors, HYPRE_MEMORY_HOST); } - hypre_SeqVectorInitialize(y_tmp); - num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg); - if (!use_persistent_comm) + /* y_tmp */ +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + /* for GPU and single vector, alloc persistent memory for y_tmp (in comm_pkg) and reuse */ + if (num_vectors == 1) { - y_buf_data = hypre_CTAlloc( HYPRE_Complex*, num_vectors , HYPRE_MEMORY_HOST); - for ( jv=0; jvoffdT) + if (offdT) { - // offdT is optional. Used only if it's present. - hypre_CSRMatrixMatvec(alpha, A->offdT, x_local, 0.0, y_tmp); -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - SyncVectorToHost(y_tmp); -#endif + // offdT is optional. Used only if it's present + hypre_CSRMatrixMatvec(alpha, offdT, x_local, 0.0, y_tmp); } else { @@ -504,16 +548,16 @@ if (use_persistent_comm) { #ifdef HYPRE_USING_PERSISTENT_COMM - hypre_ParCSRPersistentCommHandleStart(persistent_comm_handle); + hypre_ParCSRPersistentCommHandleStart(persistent_comm_handle, HYPRE_MEMORY_DEVICE, y_tmp_data); #endif } else { - for ( jv=0; jvdiagT) + /* overlapped local computation */ + if (diagT) { // diagT is optional. Used only if it's present. - hypre_CSRMatrixMatvec(alpha, A->diagT, x_local, beta, y_local); -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - SyncVectorToHost(y_local); -#endif + hypre_CSRMatrixMatvec(alpha, diagT, x_local, beta, y_local); } else { @@ -538,15 +580,16 @@ hypre_profile_times[HYPRE_TIMER_ID_HALO_EXCHANGE] -= hypre_MPI_Wtime(); #endif + /* nonblocking communication ends */ if (use_persistent_comm) { #ifdef HYPRE_USING_PERSISTENT_COMM - hypre_ParCSRPersistentCommHandleWait(persistent_comm_handle); + hypre_ParCSRPersistentCommHandleWait(persistent_comm_handle, HYPRE_MEMORY_DEVICE, y_buf_data[0]); #endif } else { - for ( jv=0; jvrecv_data)[index++]; + HYPRE_Int *device_send_map_elmts = hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg); + HYPRE_Int start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i); + HYPRE_Int end = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); +#pragma omp target teams distribute parallel for private(j) is_device_ptr(recv_data, locl_data, device_send_map_elmts) + for (j = start; j < end; j++) + { + locl_data[device_send_map_elmts[j]] += recv_data[j]; + } + } #else - += y_buf_data[0][index++]; -#endif + HYPRE_Int i; + /* unpack recv data on host, TODO OMP? */ + for (i = hypre_ParCSRCommPkgSendMapStart(comm_pkg, 0); + i < hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends); + i ++) + { + locl_data[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,i)] += recv_data[i]; } +#endif } - else - for ( jv=0; jv 1) + { + /*--------------------------------------------------------------------- + * If there exists no CommPkg for A, a CommPkg is generated using + * equally load balanced partitionings within + * hypre_ParCSRMatrixExtractBExt + *--------------------------------------------------------------------*/ + Bs_ext = hypre_ParCSRMatrixExtractBExt(B,A,1); /* contains communication + which should be explicitly included to allow for overlap */ + + + hypre_CSRMatrixSplit(Bs_ext, first_col_diag_B, last_col_diag_B, num_cols_offd_B, col_map_offd_B, + &num_cols_offd_C, &col_map_offd_C, &Bext_diag, &Bext_offd); + hypre_CSRMatrixDestroy(Bs_ext); + + /* These are local and could be overlapped with communication */ + AB_diag = hypre_CSRMatrixMultiply(A_diag, B_diag); + AB_offd = hypre_CSRMatrixMultiply(A_diag, B_offd); + + /* These require data from other processes */ + ABext_diag = hypre_CSRMatrixMultiply(A_offd, Bext_diag); + ABext_offd = hypre_CSRMatrixMultiply(A_offd, Bext_offd); + + hypre_CSRMatrixDestroy(Bext_diag); + hypre_CSRMatrixDestroy(Bext_offd); + + if (num_cols_offd_B) + { + HYPRE_Int i; + map_B_to_C = hypre_CTAlloc(HYPRE_Int, num_cols_offd_B, HYPRE_MEMORY_HOST); + + cnt = 0; + for (i=0; i < num_cols_offd_C; i++) + { + if (col_map_offd_C[i] == col_map_offd_B[cnt]) + { + map_B_to_C[cnt++] = i; + if (cnt == num_cols_offd_B) + { + break; + } + } + } + } + AB_offd_num_nonzeros = hypre_CSRMatrixNumNonzeros(AB_offd); + AB_offd_j = hypre_CSRMatrixJ(AB_offd); + for (i=0; i < AB_offd_num_nonzeros; i++) + { + AB_offd_j[i] = map_B_to_C[AB_offd_j[i]]; + } + + if (num_cols_offd_B) + { + hypre_TFree(map_B_to_C, HYPRE_MEMORY_HOST); + } + + hypre_CSRMatrixNumCols(AB_diag) = num_cols_diag_B; + hypre_CSRMatrixNumCols(ABext_diag) = num_cols_diag_B; + hypre_CSRMatrixNumCols(AB_offd) = num_cols_offd_C; + hypre_CSRMatrixNumCols(ABext_offd) = num_cols_offd_C; + C_diag = hypre_CSRMatrixAdd(AB_diag, ABext_diag); + C_offd = hypre_CSRMatrixAdd(AB_offd, ABext_offd); + + hypre_CSRMatrixDestroy(AB_diag); + hypre_CSRMatrixDestroy(ABext_diag); + hypre_CSRMatrixDestroy(AB_offd); + hypre_CSRMatrixDestroy(ABext_offd); + } + else + { + C_diag = hypre_CSRMatrixMultiply(A_diag, B_diag); + C_offd = hypre_CSRMatrixCreate(num_rows_diag_A, 0, 0); + hypre_CSRMatrixInitialize(C_offd); + } + + /*----------------------------------------------------------------------- + * Allocate C_diag_data and C_diag_j arrays. + * Allocate C_offd_data and C_offd_j arrays. + *-----------------------------------------------------------------------*/ + + + C = hypre_ParCSRMatrixCreate(comm, n_rows_A, n_cols_B, row_starts_A, + col_starts_B, num_cols_offd_C, + C_diag->num_nonzeros, C_offd->num_nonzeros); + + /* Note that C does not own the partitionings */ + hypre_ParCSRMatrixSetRowStartsOwner(C,0); + hypre_ParCSRMatrixSetColStartsOwner(C,0); + + hypre_CSRMatrixDestroy(hypre_ParCSRMatrixDiag(C)); + hypre_ParCSRMatrixDiag(C) = C_diag; + + hypre_CSRMatrixDestroy(hypre_ParCSRMatrixOffd(C)); + hypre_ParCSRMatrixOffd(C) = C_offd; + + if (num_cols_offd_C) + { + hypre_ParCSRMatrixColMapOffd(C) = col_map_offd_C; + } + + /*----------------------------------------------------------------------- + * Free various arrays + *-----------------------------------------------------------------------*/ + + return C; +} + +hypre_ParCSRMatrix* +hypre_ParCSRMatMat( hypre_ParCSRMatrix *A, + hypre_ParCSRMatrix *B ) +{ +#if defined(HYPRE_USING_CUDA) + //hypre_SetExecPolicy(HYPRE_EXEC_DEVICE); +#endif + + HYPRE_Int exec = hypre_GetExecPolicy2( hypre_CSRMatrixMemoryLocation(hypre_ParCSRMatrixDiag(A)), + hypre_CSRMatrixMemoryLocation(hypre_ParCSRMatrixDiag(B)) ); + + hypre_assert(exec != HYPRE_EXEC_UNSET); + + hypre_ParCSRMatrix *C = NULL; + + if (exec == HYPRE_EXEC_HOST) + { + C = hypre_ParCSRMatMatHost(A,B); + } +#if defined(HYPRE_USING_CUDA) + else + { + C = hypre_ParCSRMatMatDevice(A,B); + } +#endif + +#if defined(HYPRE_USING_CUDA) + //hypre_SetExecPolicy(HYPRE_EXEC_HOST); +#endif + + // TODO +#if defined(HYPRE_USING_CUDA) + if (hypre_GetActualMemLocation(hypre_CSRMatrixMemoryLocation(hypre_ParCSRMatrixDiag(C))) == HYPRE_MEMORY_DEVICE) + { + hypre_CSRMatrix *C_diag = hypre_CSRMatrixClone(hypre_ParCSRMatrixDiag(C), 1); + hypre_CSRMatrixDestroy(hypre_ParCSRMatrixDiag(C)); + hypre_ParCSRMatrixDiag(C) = C_diag; + + hypre_CSRMatrix *C_offd = hypre_CSRMatrixClone(hypre_ParCSRMatrixOffd(C), 1); + hypre_CSRMatrixDestroy(hypre_ParCSRMatrixOffd(C)); + hypre_ParCSRMatrixOffd(C) = C_offd; + } +#endif + + return C; +} + +/*-------------------------------------------------------------------------- + * hypre_ParCSRTMatMatKT : multiplies two ParCSRMatrices transpose(A) and B and returns + * the product in ParCSRMatrix C + * Note that C does not own the partitionings since its row_starts + * is owned by A and col_starts by B. + *--------------------------------------------------------------------------*/ + +hypre_ParCSRMatrix* +hypre_ParCSRTMatMatKTHost( hypre_ParCSRMatrix *A, + hypre_ParCSRMatrix *B, + HYPRE_Int keep_transpose) +{ + MPI_Comm comm = hypre_ParCSRMatrixComm(A); + hypre_ParCSRCommPkg *comm_pkg_A = hypre_ParCSRMatrixCommPkg(A); + + hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + hypre_CSRMatrix *B_diag = hypre_ParCSRMatrixDiag(B); + hypre_CSRMatrix *B_offd = hypre_ParCSRMatrixOffd(B); + hypre_CSRMatrix *AT_diag = NULL; + + HYPRE_Int num_rows_diag_A = hypre_CSRMatrixNumRows(A_diag); + HYPRE_Int num_cols_diag_A = hypre_CSRMatrixNumCols(A_diag); + HYPRE_Int num_rows_diag_B = hypre_CSRMatrixNumRows(B_diag); + HYPRE_Int num_cols_diag_B = hypre_CSRMatrixNumCols(B_diag); + HYPRE_Int num_cols_offd_B = hypre_CSRMatrixNumCols(B_offd); + HYPRE_BigInt first_col_diag_B = hypre_ParCSRMatrixFirstColDiag(B); + + HYPRE_BigInt *col_map_offd_B = hypre_ParCSRMatrixColMapOffd(B); + + HYPRE_BigInt *col_starts_A = hypre_ParCSRMatrixColStarts(A); + HYPRE_BigInt *col_starts_B = hypre_ParCSRMatrixColStarts(B); + + hypre_ParCSRMatrix *C; + hypre_CSRMatrix *C_diag = NULL; + hypre_CSRMatrix *C_offd = NULL; + + HYPRE_BigInt *col_map_offd_C = NULL; + HYPRE_Int *map_B_to_C; + HYPRE_BigInt first_col_diag_C; + HYPRE_BigInt last_col_diag_C; + HYPRE_Int num_cols_offd_C = 0; + + HYPRE_BigInt n_rows_A, n_cols_A; + HYPRE_BigInt n_rows_B, n_cols_B; + HYPRE_Int j_indx, cnt; + HYPRE_Int num_procs, my_id; + + n_rows_A = hypre_ParCSRMatrixGlobalNumRows(A); + n_cols_A = hypre_ParCSRMatrixGlobalNumCols(A); + n_rows_B = hypre_ParCSRMatrixGlobalNumRows(B); + n_cols_B = hypre_ParCSRMatrixGlobalNumCols(B); + + hypre_MPI_Comm_size(comm,&num_procs); + hypre_MPI_Comm_rank(comm, &my_id); + + if (n_rows_A != n_rows_B || num_rows_diag_A != num_rows_diag_B) + { + hypre_error_w_msg(HYPRE_ERROR_GENERIC," Error! Incompatible matrix dimensions!\n"); + return NULL; + } + + /*if (num_cols_diag_A == num_cols_diag_B) allsquare = 1;*/ + + hypre_CSRMatrixTranspose(A_diag, &AT_diag, 1); + + if (num_procs == 1) + { + C_diag = hypre_CSRMatrixMultiply(AT_diag, B_diag); + C_offd = hypre_CSRMatrixCreate(num_cols_diag_A, 0, 0); + hypre_CSRMatrixInitialize(C_offd); + if (keep_transpose) + { + A->diagT = AT_diag; + } + else + { + hypre_CSRMatrixDestroy(AT_diag); + } + } + else + { + hypre_CSRMatrix *AT_offd = NULL; + hypre_CSRMatrix *C_tmp_diag = NULL; + hypre_CSRMatrix *C_tmp_offd = NULL; + hypre_CSRMatrix *C_int = NULL; + hypre_CSRMatrix *C_ext = NULL; + hypre_CSRMatrix *C_ext_diag = NULL; + hypre_CSRMatrix *C_ext_offd = NULL; + hypre_CSRMatrix *C_int_diag = NULL; + hypre_CSRMatrix *C_int_offd = NULL; + + HYPRE_Int i; + HYPRE_Int *C_tmp_offd_i; + HYPRE_Int *C_tmp_offd_j; + HYPRE_Int *send_map_elmts_A; + void *request; + + hypre_CSRMatrixTranspose(A_offd, &AT_offd, 1); + + C_int_diag = hypre_CSRMatrixMultiply(AT_offd, B_diag); + C_int_offd = hypre_CSRMatrixMultiply(AT_offd, B_offd); + + hypre_ParCSRMatrixDiag(B) = C_int_diag; + hypre_ParCSRMatrixOffd(B) = C_int_offd; + + C_int = hypre_MergeDiagAndOffd(B); + + hypre_ParCSRMatrixDiag(B) = B_diag; + hypre_ParCSRMatrixOffd(B) = B_offd; + + /* contains communication; should be explicitly included to allow for overlap */ + hypre_ExchangeExternalRowsInit(C_int, comm_pkg_A, &request); + C_ext = hypre_ExchangeExternalRowsWait(request); + + hypre_CSRMatrixDestroy(C_int); + hypre_CSRMatrixDestroy(C_int_diag); + hypre_CSRMatrixDestroy(C_int_offd); + + C_tmp_diag = hypre_CSRMatrixMultiply(AT_diag, B_diag); + C_tmp_offd = hypre_CSRMatrixMultiply(AT_diag, B_offd); + + if (keep_transpose) + { + A->diagT = AT_diag; + } + else + { + hypre_CSRMatrixDestroy(AT_diag); + } + + if (keep_transpose) + { + A->offdT = AT_offd; + } + else + { + hypre_CSRMatrixDestroy(AT_offd); + } + + /*----------------------------------------------------------------------- + * Add contents of C_ext to C_tmp_diag and C_tmp_offd + * to obtain C_diag and C_offd + *-----------------------------------------------------------------------*/ + + /* split C_ext in local C_ext_diag and nonlocal part C_ext_offd, + also generate new col_map_offd and adjust column indices accordingly */ + first_col_diag_C = first_col_diag_B; + last_col_diag_C = first_col_diag_B + num_cols_diag_B - 1; + + if (C_ext) + { + hypre_CSRMatrixSplit(C_ext, first_col_diag_C, last_col_diag_C, + num_cols_offd_B, col_map_offd_B, &num_cols_offd_C, &col_map_offd_C, + &C_ext_diag, &C_ext_offd); + + hypre_CSRMatrixDestroy(C_ext); + C_ext = NULL; + } + + C_tmp_offd_i = hypre_CSRMatrixI(C_tmp_offd); + C_tmp_offd_j = hypre_CSRMatrixJ(C_tmp_offd); + + if (num_cols_offd_B) + { + map_B_to_C = hypre_CTAlloc(HYPRE_Int, num_cols_offd_B, HYPRE_MEMORY_HOST); + + cnt = 0; + for (i=0; i < num_cols_offd_C; i++) + { + if (col_map_offd_C[i] == col_map_offd_B[cnt]) + { + map_B_to_C[cnt++] = i; + if (cnt == num_cols_offd_B) + { + break; + } + } + } + for (i=0; i < C_tmp_offd_i[hypre_CSRMatrixNumRows(C_tmp_offd)]; i++) + { + j_indx = C_tmp_offd_j[i]; + C_tmp_offd_j[i] = map_B_to_C[j_indx]; + } + hypre_TFree(map_B_to_C, HYPRE_MEMORY_HOST); + } + + /*----------------------------------------------------------------------- + * Need to compute C_diag = C_tmp_diag + C_ext_diag + * and C_offd = C_tmp_offd + C_ext_offd !!!! + *-----------------------------------------------------------------------*/ + send_map_elmts_A = hypre_ParCSRCommPkgSendMapElmts(comm_pkg_A); + C_diag = hypre_CSRMatrixAddPartial(C_tmp_diag, C_ext_diag, send_map_elmts_A); + hypre_CSRMatrixNumCols(C_tmp_offd) = num_cols_offd_C; + C_offd = hypre_CSRMatrixAddPartial(C_tmp_offd, C_ext_offd, send_map_elmts_A); + + hypre_CSRMatrixDestroy(C_tmp_diag); + hypre_CSRMatrixDestroy(C_tmp_offd); + hypre_CSRMatrixDestroy(C_ext_diag); + hypre_CSRMatrixDestroy(C_ext_offd); + } + + C = hypre_ParCSRMatrixCreate(comm, n_cols_A, n_cols_B, col_starts_A, col_starts_B, + num_cols_offd_C, C_diag->num_nonzeros, C_offd->num_nonzeros); + + /* Note that C does not own the partitionings */ + hypre_ParCSRMatrixSetRowStartsOwner(C,0); + hypre_ParCSRMatrixSetColStartsOwner(C,0); + + hypre_CSRMatrixDestroy(hypre_ParCSRMatrixDiag(C)); + hypre_ParCSRMatrixDiag(C) = C_diag; + + hypre_CSRMatrixDestroy(hypre_ParCSRMatrixOffd(C)); + hypre_ParCSRMatrixOffd(C) = C_offd; + + hypre_ParCSRMatrixColMapOffd(C) = col_map_offd_C; + + return C; + +} + +hypre_ParCSRMatrix* +hypre_ParCSRTMatMatKT( hypre_ParCSRMatrix *A, + hypre_ParCSRMatrix *B, + HYPRE_Int keep_transpose) +{ +#if defined(HYPRE_USING_CUDA) + //hypre_SetExecPolicy(HYPRE_EXEC_DEVICE); +#endif + + HYPRE_Int exec = hypre_GetExecPolicy2( hypre_CSRMatrixMemoryLocation(hypre_ParCSRMatrixDiag(A)), + hypre_CSRMatrixMemoryLocation(hypre_ParCSRMatrixDiag(B)) ); + + hypre_assert(exec != HYPRE_EXEC_UNSET); + + hypre_ParCSRMatrix *C = NULL; + + if (exec == HYPRE_EXEC_HOST) + { + C = hypre_ParCSRTMatMatKTHost(A, B, keep_transpose); + } +#if defined(HYPRE_USING_CUDA) + else + { + C = hypre_ParCSRTMatMatKTDevice(A, B, keep_transpose); + } +#endif + +#if defined(HYPRE_USING_CUDA) + //hypre_SetExecPolicy(HYPRE_EXEC_HOST); +#endif + +#if defined(HYPRE_USING_CUDA) + if (hypre_GetActualMemLocation(hypre_CSRMatrixMemoryLocation(hypre_ParCSRMatrixDiag(C))) == HYPRE_MEMORY_DEVICE) + { + hypre_CSRMatrix *C_diag = hypre_CSRMatrixClone(hypre_ParCSRMatrixDiag(C), 1); + hypre_CSRMatrixDestroy(hypre_ParCSRMatrixDiag(C)); + hypre_ParCSRMatrixDiag(C) = C_diag; + + hypre_CSRMatrix *C_offd = hypre_CSRMatrixClone(hypre_ParCSRMatrixOffd(C), 1); + hypre_CSRMatrixDestroy(hypre_ParCSRMatrixOffd(C)); + hypre_ParCSRMatrixOffd(C) = C_offd; + } +#endif + + return C; +} + +hypre_ParCSRMatrix* +hypre_ParCSRTMatMat( hypre_ParCSRMatrix *A, + hypre_ParCSRMatrix *B) +{ + return hypre_ParCSRTMatMatKT( A, B, 0); +} + +hypre_ParCSRMatrix *hypre_ParCSRMatrixRAPKT( hypre_ParCSRMatrix *R, + hypre_ParCSRMatrix *A, + hypre_ParCSRMatrix *P, + HYPRE_Int keep_transpose ) +{ + MPI_Comm comm = hypre_ParCSRMatrixComm(A); + + hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); + + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + + HYPRE_BigInt *row_starts_A = hypre_ParCSRMatrixRowStarts(A); + HYPRE_Int num_rows_diag_A = hypre_CSRMatrixNumRows(A_diag); + HYPRE_Int num_cols_diag_A = hypre_CSRMatrixNumCols(A_diag); + HYPRE_Int num_cols_offd_A = hypre_CSRMatrixNumCols(A_offd); + + hypre_CSRMatrix *P_diag = hypre_ParCSRMatrixDiag(P); + + hypre_CSRMatrix *P_offd = hypre_ParCSRMatrixOffd(P); + HYPRE_BigInt *col_map_offd_P = hypre_ParCSRMatrixColMapOffd(P); + + HYPRE_BigInt first_col_diag_P = hypre_ParCSRMatrixFirstColDiag(P); + HYPRE_BigInt *col_starts_P = hypre_ParCSRMatrixColStarts(P); + HYPRE_Int num_rows_diag_P = hypre_CSRMatrixNumRows(P_diag); + HYPRE_Int num_cols_diag_P = hypre_CSRMatrixNumCols(P_diag); + HYPRE_Int num_cols_offd_P = hypre_CSRMatrixNumCols(P_offd); + + hypre_ParCSRMatrix *Q; + HYPRE_BigInt *col_map_offd_Q = NULL; + HYPRE_Int *map_P_to_Q=NULL; + + hypre_CSRMatrix *Q_diag = NULL; + + hypre_CSRMatrix *Q_offd = NULL; + + HYPRE_Int num_cols_offd_Q = 0; + + hypre_CSRMatrix *Ps_ext; + + hypre_CSRMatrix *Pext_diag; + + hypre_CSRMatrix *Pext_offd; + + hypre_CSRMatrix *AP_diag; + hypre_CSRMatrix *AP_offd; + HYPRE_Int AP_offd_num_nonzeros; + HYPRE_Int *AP_offd_j; + hypre_CSRMatrix *APext_diag; + hypre_CSRMatrix *APext_offd; + + hypre_ParCSRCommPkg *comm_pkg_R = hypre_ParCSRMatrixCommPkg(R); + + hypre_CSRMatrix *R_diag = hypre_ParCSRMatrixDiag(R); + hypre_CSRMatrix *RT_diag = NULL; + + hypre_CSRMatrix *R_offd = hypre_ParCSRMatrixOffd(R); + + HYPRE_Int num_rows_diag_R = hypre_CSRMatrixNumRows(R_diag); + HYPRE_Int num_cols_diag_R = hypre_CSRMatrixNumCols(R_diag); + HYPRE_Int num_cols_offd_R = hypre_CSRMatrixNumCols(R_offd); + + HYPRE_BigInt *col_starts_R = hypre_ParCSRMatrixColStarts(R); + + hypre_ParCSRMatrix *C; + HYPRE_BigInt *col_map_offd_C = NULL; + HYPRE_Int *map_Q_to_C; + + hypre_CSRMatrix *C_diag = NULL; + + HYPRE_BigInt first_col_diag_C; + HYPRE_BigInt last_col_diag_C; + + hypre_CSRMatrix *C_offd = NULL; + + HYPRE_Int num_cols_offd_C = 0; + + HYPRE_Int j_indx; + + HYPRE_BigInt n_rows_R, n_cols_R; + HYPRE_Int num_procs, my_id; + HYPRE_BigInt n_rows_A, n_cols_A; + HYPRE_BigInt n_rows_P, n_cols_P; + HYPRE_Int cnt, i; + + n_rows_R = hypre_ParCSRMatrixGlobalNumRows(R); + n_cols_R = hypre_ParCSRMatrixGlobalNumCols(R); + n_rows_A = hypre_ParCSRMatrixGlobalNumRows(A); + n_cols_A = hypre_ParCSRMatrixGlobalNumCols(A); + n_rows_P = hypre_ParCSRMatrixGlobalNumRows(P); + n_cols_P = hypre_ParCSRMatrixGlobalNumCols(P); + + hypre_MPI_Comm_size(comm,&num_procs); + hypre_MPI_Comm_rank(comm, &my_id); + + if (n_rows_R != n_rows_A || num_rows_diag_R != num_rows_diag_A + || n_cols_A != n_rows_P || num_cols_diag_A != num_rows_diag_P) + { + hypre_error_w_msg(HYPRE_ERROR_GENERIC," Error! Incompatible matrix dimensions!\n"); + return NULL; + } + + + /*hypre_CSRMatrixTranspose(R_diag, &RT_diag, 1);*/ + + if (num_procs > 1) + { + HYPRE_BigInt last_col_diag_P; + hypre_CSRMatrix *RT_offd = NULL; + hypre_CSRMatrix *C_tmp_diag = NULL; + hypre_CSRMatrix *C_tmp_offd = NULL; + hypre_CSRMatrix *C_int = NULL; + hypre_CSRMatrix *C_ext = NULL; + hypre_CSRMatrix *C_ext_diag = NULL; + hypre_CSRMatrix *C_ext_offd = NULL; + hypre_CSRMatrix *C_int_diag = NULL; + hypre_CSRMatrix *C_int_offd = NULL; + + HYPRE_Int *C_tmp_offd_i; + HYPRE_Int *C_tmp_offd_j; + + HYPRE_Int *send_map_elmts_R; + void *request; + /*--------------------------------------------------------------------- + * If there exists no CommPkg for A, a CommPkg is generated using + * equally load balanced partitionings within + * hypre_ParCSRMatrixExtractBExt + *--------------------------------------------------------------------*/ + Ps_ext = hypre_ParCSRMatrixExtractBExt(P, A, 1); /* contains communication + which should be explicitly included to allow for overlap */ + if (num_cols_offd_A) + { + last_col_diag_P = first_col_diag_P + num_cols_diag_P -1; + hypre_CSRMatrixSplit(Ps_ext, first_col_diag_P, last_col_diag_P, num_cols_offd_P, col_map_offd_P, + &num_cols_offd_Q, &col_map_offd_Q, &Pext_diag, &Pext_offd); + /* These require data from other processes */ + APext_diag = hypre_CSRMatrixMultiply(A_offd, Pext_diag); + APext_offd = hypre_CSRMatrixMultiply(A_offd, Pext_offd); + + hypre_CSRMatrixDestroy(Pext_diag); + hypre_CSRMatrixDestroy(Pext_offd); + } + else + { + num_cols_offd_Q = num_cols_offd_P; + col_map_offd_Q = hypre_CTAlloc(HYPRE_BigInt, num_cols_offd_Q, HYPRE_MEMORY_HOST); + for (i=0; i < num_cols_offd_P; i++) + { + col_map_offd_Q[i] = col_map_offd_P[i]; + } + } + hypre_CSRMatrixDestroy(Ps_ext); + /* These are local and could be overlapped with communication */ + AP_diag = hypre_CSRMatrixMultiply(A_diag, P_diag); + + if (num_cols_offd_P) + { + HYPRE_Int i; + AP_offd = hypre_CSRMatrixMultiply(A_diag, P_offd); + if (num_cols_offd_Q > num_cols_offd_P) + { + map_P_to_Q = hypre_CTAlloc(HYPRE_Int,num_cols_offd_P, HYPRE_MEMORY_HOST); + + cnt = 0; + for (i=0; i < num_cols_offd_Q; i++) + { + if (col_map_offd_Q[i] == col_map_offd_P[cnt]) + { + map_P_to_Q[cnt++] = i; + if (cnt == num_cols_offd_P) + { + break; + } + } + } + AP_offd_num_nonzeros = hypre_CSRMatrixNumNonzeros(AP_offd); + AP_offd_j = hypre_CSRMatrixJ(AP_offd); + for (i=0; i < AP_offd_num_nonzeros; i++) + { + AP_offd_j[i] = map_P_to_Q[AP_offd_j[i]]; + } + + hypre_TFree(map_P_to_Q, HYPRE_MEMORY_HOST); + hypre_CSRMatrixNumCols(AP_offd) = num_cols_offd_Q; + } + } + + if (num_cols_offd_A) /* number of rows for Pext_diag */ + { + Q_diag = hypre_CSRMatrixAdd(AP_diag, APext_diag); + hypre_CSRMatrixDestroy(AP_diag); + hypre_CSRMatrixDestroy(APext_diag); + } + else + { + Q_diag = AP_diag; + } + + if (num_cols_offd_P && num_cols_offd_A) + { + Q_offd = hypre_CSRMatrixAdd(AP_offd, APext_offd); + hypre_CSRMatrixDestroy(APext_offd); + hypre_CSRMatrixDestroy(AP_offd); + } + else if (num_cols_offd_A) + { + Q_offd = APext_offd; + } + else if (num_cols_offd_P) + { + Q_offd = AP_offd; + } + else + { + Q_offd = hypre_CSRMatrixClone(A_offd, 1); + } + + Q = hypre_ParCSRMatrixCreate(comm, n_rows_A, n_cols_P, row_starts_A, + col_starts_P, num_cols_offd_Q, + Q_diag->num_nonzeros, Q_offd->num_nonzeros); + + /* Note that C does not own the partitionings */ + hypre_ParCSRMatrixSetRowStartsOwner(Q,0); + hypre_ParCSRMatrixSetColStartsOwner(Q,0); + hypre_CSRMatrixDestroy(hypre_ParCSRMatrixDiag(Q)); + hypre_CSRMatrixDestroy(hypre_ParCSRMatrixOffd(Q)); + hypre_ParCSRMatrixDiag(Q) = Q_diag; + hypre_ParCSRMatrixOffd(Q) = Q_offd; + hypre_ParCSRMatrixColMapOffd(Q) = col_map_offd_Q; + + hypre_CSRMatrixTranspose(R_diag, &RT_diag, 1); + C_tmp_diag = hypre_CSRMatrixMultiply(RT_diag, Q_diag); + if (num_cols_offd_Q) + { + C_tmp_offd = hypre_CSRMatrixMultiply(RT_diag, Q_offd); + /* RL: WHY NEED THIS? + if (C_tmp_offd->num_nonzeros == 0) + { + C_tmp_offd->num_cols = 0; + } + */ + } + else + { + C_tmp_offd = hypre_CSRMatrixClone(Q_offd, 1); + hypre_CSRMatrixNumRows(C_tmp_offd) = num_cols_diag_R; + } + + if (keep_transpose) + { + R->diagT = RT_diag; + } + else + { + hypre_CSRMatrixDestroy(RT_diag); + } + + if (num_cols_offd_R) + { + hypre_CSRMatrixTranspose(R_offd, &RT_offd, 1); + C_int_diag = hypre_CSRMatrixMultiply(RT_offd, Q_diag); + C_int_offd = hypre_CSRMatrixMultiply(RT_offd, Q_offd); + + hypre_ParCSRMatrixDiag(Q) = C_int_diag; + hypre_ParCSRMatrixOffd(Q) = C_int_offd; + C_int = hypre_MergeDiagAndOffd(Q); + hypre_ParCSRMatrixDiag(Q) = Q_diag; + hypre_ParCSRMatrixOffd(Q) = Q_offd; + } + else + { + C_int = hypre_CSRMatrixCreate(0,0,0); + hypre_CSRMatrixInitialize(C_int); + } + + /* contains communication; should be explicitly included to allow for overlap */ + hypre_ExchangeExternalRowsInit(C_int, comm_pkg_R, &request); + C_ext = hypre_ExchangeExternalRowsWait(request); + + hypre_CSRMatrixDestroy(C_int); + if (num_cols_offd_R) + { + hypre_CSRMatrixDestroy(C_int_diag); + hypre_CSRMatrixDestroy(C_int_offd); + if (keep_transpose) + { + R->offdT = RT_offd; + } + else + { + hypre_CSRMatrixDestroy(RT_offd); + } + } + + /*----------------------------------------------------------------------- + * Add contents of C_ext to C_tmp_diag and C_tmp_offd + * to obtain C_diag and C_offd + *-----------------------------------------------------------------------*/ + + /* split C_ext in local C_ext_diag and nonlocal part C_ext_offd, + also generate new col_map_offd and adjust column indices accordingly */ + + if (C_ext) + { + first_col_diag_C = first_col_diag_P; + last_col_diag_C = first_col_diag_P + num_cols_diag_P - 1; + + hypre_CSRMatrixSplit(C_ext, first_col_diag_C, last_col_diag_C, + num_cols_offd_Q, col_map_offd_Q, &num_cols_offd_C, &col_map_offd_C, + &C_ext_diag, &C_ext_offd); + + hypre_CSRMatrixDestroy(C_ext); + C_ext = NULL; + /*if (C_ext_offd->num_nonzeros == 0) C_ext_offd->num_cols = 0;*/ + } + + if (num_cols_offd_Q && C_tmp_offd->num_cols) + { + C_tmp_offd_i = hypre_CSRMatrixI(C_tmp_offd); + C_tmp_offd_j = hypre_CSRMatrixJ(C_tmp_offd); + + map_Q_to_C = hypre_CTAlloc(HYPRE_Int,num_cols_offd_Q, HYPRE_MEMORY_HOST); + + cnt = 0; + for (i=0; i < num_cols_offd_C; i++) + { + if (col_map_offd_C[i] == col_map_offd_Q[cnt]) + { + map_Q_to_C[cnt++] = i; + if (cnt == num_cols_offd_Q) + { + break; + } + } + } + for (i=0; i < C_tmp_offd_i[hypre_CSRMatrixNumRows(C_tmp_offd)]; i++) + { + j_indx = C_tmp_offd_j[i]; + C_tmp_offd_j[i] = map_Q_to_C[j_indx]; + } + hypre_TFree(map_Q_to_C, HYPRE_MEMORY_HOST); + hypre_CSRMatrixNumCols(C_tmp_offd) = num_cols_offd_C; + } + hypre_ParCSRMatrixDestroy(Q); + + /*----------------------------------------------------------------------- + * Need to compute C_diag = C_tmp_diag + C_ext_diag + * and C_offd = C_tmp_offd + C_ext_offd !!!! + *-----------------------------------------------------------------------*/ + send_map_elmts_R = hypre_ParCSRCommPkgSendMapElmts(comm_pkg_R); + if (C_ext_diag) + { + C_diag = hypre_CSRMatrixAddPartial(C_tmp_diag, C_ext_diag, send_map_elmts_R); + hypre_CSRMatrixDestroy(C_tmp_diag); + hypre_CSRMatrixDestroy(C_ext_diag); + } + else + C_diag = C_tmp_diag; + if (C_ext_offd) + { + C_offd = hypre_CSRMatrixAddPartial(C_tmp_offd, C_ext_offd, send_map_elmts_R); + hypre_CSRMatrixDestroy(C_tmp_offd); + hypre_CSRMatrixDestroy(C_ext_offd); + } + else + { + C_offd = C_tmp_offd; + } + } + else + { + Q_diag = hypre_CSRMatrixMultiply(A_diag, P_diag); + hypre_CSRMatrixTranspose(R_diag, &RT_diag, 1); + C_diag = hypre_CSRMatrixMultiply(RT_diag, Q_diag); + C_offd = hypre_CSRMatrixCreate(num_cols_diag_R, 0, 0); + hypre_CSRMatrixInitialize(C_offd); + if (keep_transpose) + { + R->diagT = RT_diag; + } + else + { + hypre_CSRMatrixDestroy(RT_diag); + } + hypre_CSRMatrixDestroy(Q_diag); + } + + C = hypre_ParCSRMatrixCreate(comm, n_cols_R, n_cols_P, col_starts_R, + col_starts_P, num_cols_offd_C, 0, 0); + + /* Note that C does not own the partitionings */ + hypre_ParCSRMatrixSetColStartsOwner(P,0); + hypre_ParCSRMatrixSetColStartsOwner(R,0); + + hypre_CSRMatrixDestroy(hypre_ParCSRMatrixDiag(C)); + hypre_CSRMatrixDestroy(hypre_ParCSRMatrixOffd(C)); + hypre_ParCSRMatrixDiag(C) = C_diag; + + if (C_offd) + { + hypre_ParCSRMatrixOffd(C) = C_offd; + } + else + { + C_offd = hypre_CSRMatrixCreate(num_cols_diag_R, 0, 0); + hypre_CSRMatrixInitialize(C_offd); + hypre_ParCSRMatrixOffd(C) = C_offd; + } + + hypre_ParCSRMatrixColMapOffd(C) = col_map_offd_C; + + if (num_procs > 1) + { + /* hypre_GenerateRAPCommPkg(RAP, A); */ + hypre_MatvecCommPkgCreate(C); + } + + return C; +} + +hypre_ParCSRMatrix *hypre_ParCSRMatrixRAP( hypre_ParCSRMatrix *R, + hypre_ParCSRMatrix *A, + hypre_ParCSRMatrix *P ) +{ + return hypre_ParCSRMatrixRAPKT( R, A, P, 0); +} + +/*-------------------------------------------------------------------------- + * OLD NOTES: + * Sketch of John's code to build RAP + * + * Uses two integer arrays icg and ifg as marker arrays + * + * icg needs to be of size n_fine; size of ia. + * A negative value of icg(i) indicates i is a f-point, otherwise + * icg(i) is the converts from fine to coarse grid orderings. + * Note that I belive the code assumes that if i irap(ic) < irap(jc)) but I don't + * think there is a guarantee that the entries within a row will + * be ordered in any way except that the diagonal entry comes first. + * + * As structured now, the code requires that the size of rap be + * predicted up front. To avoid this, one could execute the code + * twice, the first time would only keep track of icg ,ifg and ka. + * Then you would know how much memory to allocate for rap and jrap. + * The second time would fill in these arrays. Actually you might + * be able to include the filling in of jrap into the first pass; + * just overestimate its size (its an integer array) and cut it + * back before the second time through. This would avoid some if tests + * in the second pass. + * + * Questions + * 1) parallel (PetSc) version? + * 2) what if we don't store R row-wise and don't + * even want to store a copy of it in this form + * temporarily? + *--------------------------------------------------------------------------*/ + diff -Nru hypre-2.16.0/src/parcsr_mv/par_csr_triplemat_device.c hypre-2.18.2/src/parcsr_mv/par_csr_triplemat_device.c --- hypre-2.16.0/src/parcsr_mv/par_csr_triplemat_device.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_csr_triplemat_device.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,427 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#include "_hypre_parcsr_mv.h" + +#if defined(HYPRE_USING_CUDA) + +hypre_ParCSRMatrix* +hypre_ParCSRMatMatDevice( hypre_ParCSRMatrix *A, + hypre_ParCSRMatrix *B ) +{ + MPI_Comm comm = hypre_ParCSRMatrixComm(A); + + hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + + HYPRE_BigInt *row_starts_A = hypre_ParCSRMatrixRowStarts(A); + HYPRE_Int num_cols_diag_A = hypre_CSRMatrixNumCols(A_diag); + HYPRE_Int num_rows_diag_A = hypre_CSRMatrixNumRows(A_diag); + + hypre_CSRMatrix *B_diag = hypre_ParCSRMatrixDiag(B); + hypre_CSRMatrix *B_offd = hypre_ParCSRMatrixOffd(B); + /* HYPRE_BigInt *col_map_offd_B = hypre_ParCSRMatrixColMapOffd(B); */ + + HYPRE_BigInt first_col_diag_B = hypre_ParCSRMatrixFirstColDiag(B); + HYPRE_BigInt last_col_diag_B; + HYPRE_BigInt *col_starts_B = hypre_ParCSRMatrixColStarts(B); + HYPRE_Int num_rows_diag_B = hypre_CSRMatrixNumRows(B_diag); + HYPRE_Int num_cols_diag_B = hypre_CSRMatrixNumCols(B_diag); + HYPRE_Int num_cols_offd_B = hypre_CSRMatrixNumCols(B_offd); + + hypre_ParCSRMatrix *C; + HYPRE_BigInt *col_map_offd_C = NULL; + HYPRE_Int *map_B_to_C = NULL; + + hypre_CSRMatrix *C_diag = NULL; + hypre_CSRMatrix *C_offd = NULL; + + HYPRE_Int num_cols_offd_C = 0; + + hypre_CSRMatrix *Bext; + hypre_CSRMatrix *Bext_diag; + hypre_CSRMatrix *Bext_offd; + + hypre_CSRMatrix *AB_diag; + hypre_CSRMatrix *AB_offd; + HYPRE_Int AB_offd_num_nonzeros; + HYPRE_Int *AB_offd_j; + hypre_CSRMatrix *ABext_diag; + hypre_CSRMatrix *ABext_offd; + + HYPRE_BigInt n_rows_A, n_cols_A; + HYPRE_BigInt n_rows_B, n_cols_B; + HYPRE_Int num_procs; + HYPRE_Int my_id; + + n_rows_A = hypre_ParCSRMatrixGlobalNumRows(A); + n_cols_A = hypre_ParCSRMatrixGlobalNumCols(A); + n_rows_B = hypre_ParCSRMatrixGlobalNumRows(B); + n_cols_B = hypre_ParCSRMatrixGlobalNumCols(B); + + if (n_cols_A != n_rows_B || num_cols_diag_A != num_rows_diag_B) + { + hypre_error_in_arg(1); + hypre_printf(" Error! Incompatible matrix dimensions!\n"); + return NULL; + } + + hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_rank(comm, &my_id); + + last_col_diag_B = first_col_diag_B + num_cols_diag_B - 1; + + /*----------------------------------------------------------------------- + * Extract B_ext, i.e. portion of B that is stored on neighbor procs + * and needed locally for matrix matrix product + *-----------------------------------------------------------------------*/ + if (num_procs > 1) + { + void *request; + /*--------------------------------------------------------------------- + * If there exists no CommPkg for A, a CommPkg is generated using + * equally load balanced partitionings within + * hypre_ParCSRMatrixExtractBExt + *--------------------------------------------------------------------*/ + /* contains communication which should be explicitly included to allow for overlap */ + hypre_ParCSRMatrixExtractBExtDeviceInit(B, A, 1, &request); + + //Bext = hypre_ParCSRMatrixExtractBExtDeviceWait(request); + + /* These are local and could be overlapped with communication */ + AB_diag = hypre_CSRMatrixMultiply(A_diag, B_diag); + AB_offd = hypre_CSRMatrixMultiply(A_diag, B_offd); + + Bext = hypre_ParCSRMatrixExtractBExtDeviceWait(request); + + hypre_CSRMatrixSplitDevice(Bext, first_col_diag_B, last_col_diag_B, + num_cols_offd_B, hypre_ParCSRMatrixDeviceColMapOffd(B), &map_B_to_C, + &num_cols_offd_C, &col_map_offd_C, + &Bext_diag, &Bext_offd); + hypre_CSRMatrixDestroy(Bext); + +/* +if (my_id == 3) +{ +printf("%d\n", num_cols_offd_C); +HYPRE_Int *host_col_map_offd_C = hypre_TAlloc(HYPRE_Int, num_cols_offd_C, HYPRE_MEMORY_HOST); +hypre_TMemcpy(host_col_map_offd_C, col_map_offd_C, HYPRE_Int, num_cols_offd_C, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); +for (i=0; inum_nonzeros, C_offd->num_nonzeros); + + /* Note that C does not own the partitionings */ + hypre_ParCSRMatrixSetRowStartsOwner(C, 0); + hypre_ParCSRMatrixSetColStartsOwner(C, 0); + + hypre_CSRMatrixDestroy(hypre_ParCSRMatrixDiag(C)); + hypre_ParCSRMatrixDiag(C) = C_diag; + + hypre_CSRMatrixDestroy(hypre_ParCSRMatrixOffd(C)); + hypre_ParCSRMatrixOffd(C) = C_offd; + + if (num_cols_offd_C) + { + hypre_ParCSRMatrixDeviceColMapOffd(C) = col_map_offd_C; + + hypre_ParCSRMatrixColMapOffd(C) = hypre_TAlloc(HYPRE_BigInt, num_cols_offd_C, HYPRE_MEMORY_HOST); + hypre_TMemcpy(hypre_ParCSRMatrixColMapOffd(C), col_map_offd_C, HYPRE_BigInt, num_cols_offd_C, + HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); + } + + return C; +} + +hypre_ParCSRMatrix* +hypre_ParCSRTMatMatKTDevice( hypre_ParCSRMatrix *A, + hypre_ParCSRMatrix *B, + HYPRE_Int keep_transpose) +{ + MPI_Comm comm = hypre_ParCSRMatrixComm(A); + hypre_ParCSRCommPkg *comm_pkg_A = hypre_ParCSRMatrixCommPkg(A); + + hypre_CSRMatrix *A_diag = hypre_ParCSRMatrixDiag(A); + hypre_CSRMatrix *A_offd = hypre_ParCSRMatrixOffd(A); + hypre_CSRMatrix *B_diag = hypre_ParCSRMatrixDiag(B); + hypre_CSRMatrix *B_offd = hypre_ParCSRMatrixOffd(B); + hypre_CSRMatrix *AT_diag = NULL; + + HYPRE_Int num_rows_diag_A = hypre_CSRMatrixNumRows(A_diag); + HYPRE_Int num_cols_diag_A = hypre_CSRMatrixNumCols(A_diag); + HYPRE_Int num_rows_diag_B = hypre_CSRMatrixNumRows(B_diag); + HYPRE_Int num_cols_diag_B = hypre_CSRMatrixNumCols(B_diag); + HYPRE_Int num_cols_offd_B = hypre_CSRMatrixNumCols(B_offd); + HYPRE_BigInt first_col_diag_B = hypre_ParCSRMatrixFirstColDiag(B); + HYPRE_BigInt last_col_diag_B = first_col_diag_B + num_cols_diag_B - 1; + + /* HYPRE_BigInt *col_map_offd_B = hypre_ParCSRMatrixColMapOffd(B); */ + + HYPRE_BigInt *col_starts_A = hypre_ParCSRMatrixColStarts(A); + HYPRE_BigInt *col_starts_B = hypre_ParCSRMatrixColStarts(B); + + hypre_ParCSRMatrix *C; + hypre_CSRMatrix *C_diag = NULL; + hypre_CSRMatrix *C_offd = NULL; + + HYPRE_BigInt *col_map_offd_C = NULL; + HYPRE_Int *map_B_to_C; + /* + HYPRE_Int first_col_diag_C; + HYPRE_Int last_col_diag_C; + */ + HYPRE_Int num_cols_offd_C = 0; + + HYPRE_BigInt n_rows_A, n_cols_A; + HYPRE_BigInt n_rows_B, n_cols_B; + HYPRE_Int num_procs, my_id; + + n_rows_A = hypre_ParCSRMatrixGlobalNumRows(A); + n_cols_A = hypre_ParCSRMatrixGlobalNumCols(A); + n_rows_B = hypre_ParCSRMatrixGlobalNumRows(B); + n_cols_B = hypre_ParCSRMatrixGlobalNumCols(B); + + hypre_MPI_Comm_size(comm, &num_procs); + hypre_MPI_Comm_rank(comm, &my_id); + + if (n_rows_A != n_rows_B || num_rows_diag_A != num_rows_diag_B) + { + hypre_error_w_msg(HYPRE_ERROR_GENERIC," Error! Incompatible matrix dimensions!\n"); + return NULL; + } + + /*if (num_cols_diag_A == num_cols_diag_B) allsquare = 1;*/ + + hypre_CSRMatrixTranspose(A_diag, &AT_diag, 1); + + if (num_procs == 1) + { + C_diag = hypre_CSRMatrixMultiply(AT_diag, B_diag); + C_offd = hypre_CSRMatrixCreate(num_cols_diag_A, 0, 0); + hypre_CSRMatrixInitialize_v2(C_offd, 0, HYPRE_MEMORY_DEVICE); + if (keep_transpose) + { + A->diagT = AT_diag; + } + else + { + hypre_CSRMatrixDestroy(AT_diag); + } + } + else + { + hypre_CSRMatrix *AT_offd; + hypre_CSRMatrix *C_int; + hypre_CSRMatrix *C_int_diag; + hypre_CSRMatrix *C_int_offd; + hypre_CSRMatrix *C_ext; + hypre_CSRMatrix *C_ext_diag; + hypre_CSRMatrix *C_ext_offd; + hypre_CSRMatrix *C_tmp_diag; + hypre_CSRMatrix *C_tmp_offd; + HYPRE_Int *C_tmp_offd_j; + HYPRE_Int num_sends_A; + HYPRE_Int num_elmts_send_A; + HYPRE_Int *h_send_map_elmts_A; + HYPRE_Int *d_send_map_elmts_A; + void *request; + + hypre_CSRMatrixTranspose(A_offd, &AT_offd, 1); + + /* Remark: do not do merge B first and then multiply. + * A merged B with global column range has difficulty in GPU spmm rowest */ + C_int_diag = hypre_CSRMatrixMultiply(AT_offd, B_diag); + C_int_offd = hypre_CSRMatrixMultiply(AT_offd, B_offd); + + hypre_ParCSRMatrixDiag(B) = C_int_diag; + hypre_ParCSRMatrixOffd(B) = C_int_offd; + + C_int = hypre_MergeDiagAndOffdDevice(B); + + hypre_ParCSRMatrixDiag(B) = B_diag; + hypre_ParCSRMatrixOffd(B) = B_offd; + + hypre_ExchangeExternalRowsDeviceInit(C_int, comm_pkg_A, &request); + + //C_ext = hypre_ExchangeExternalRowsDeviceWait(request); + + hypre_CSRMatrixDestroy(C_int_diag); + hypre_CSRMatrixDestroy(C_int_offd); + + C_tmp_diag = hypre_CSRMatrixMultiply(AT_diag, B_diag); + C_tmp_offd = hypre_CSRMatrixMultiply(AT_diag, B_offd); + + if (keep_transpose) + { + A->diagT = AT_diag; + } + else + { + hypre_CSRMatrixDestroy(AT_diag); + } + + if (keep_transpose) + { + A->offdT = AT_offd; + } + else + { + hypre_CSRMatrixDestroy(AT_offd); + } + + C_ext = hypre_ExchangeExternalRowsDeviceWait(request); + + hypre_CSRMatrixDestroy(C_int); + + hypre_CSRMatrixSplitDevice(C_ext, first_col_diag_B, last_col_diag_B, + num_cols_offd_B, hypre_ParCSRMatrixDeviceColMapOffd(B), &map_B_to_C, + &num_cols_offd_C, &col_map_offd_C, + &C_ext_diag, &C_ext_offd); + hypre_CSRMatrixDestroy(C_ext); + + /* adjust C_tmp_offd cols indices and number of cols of this matrix + * NOTE: cannot adjust the cols of B_offd (which needs less work) beforehand, unless want to change B */ + C_tmp_offd_j = hypre_CSRMatrixJ(C_tmp_offd); + HYPRE_THRUST_CALL(gather, C_tmp_offd_j, C_tmp_offd_j + hypre_CSRMatrixNumNonzeros(C_tmp_offd), + map_B_to_C, C_tmp_offd_j); + hypre_TFree(map_B_to_C, HYPRE_MEMORY_DEVICE); + hypre_CSRMatrixNumCols(C_tmp_offd) = num_cols_offd_C; + + /* add two parts together: a more general add, repeated rows */ + num_sends_A = hypre_ParCSRCommPkgNumSends(comm_pkg_A); + num_elmts_send_A = hypre_ParCSRCommPkgSendMapStart(comm_pkg_A, num_sends_A); + h_send_map_elmts_A = hypre_ParCSRCommPkgSendMapElmts(comm_pkg_A); + d_send_map_elmts_A = hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg_A); + if (d_send_map_elmts_A == NULL) + { + d_send_map_elmts_A = hypre_TAlloc(HYPRE_Int, num_elmts_send_A, HYPRE_MEMORY_DEVICE); + hypre_TMemcpy(d_send_map_elmts_A, h_send_map_elmts_A, HYPRE_Int, num_elmts_send_A, + HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_HOST); + hypre_ParCSRCommPkgDeviceSendMapElmts(comm_pkg_A) = d_send_map_elmts_A; + } + + hypre_assert(hypre_CSRMatrixNumRows(C_ext_diag) == num_elmts_send_A); + hypre_assert(hypre_CSRMatrixNumRows(C_ext_offd) == num_elmts_send_A); + + C_diag = hypre_CSRMatrixAddPartialDevice(C_tmp_diag, C_ext_diag, d_send_map_elmts_A); + C_offd = hypre_CSRMatrixAddPartialDevice(C_tmp_offd, C_ext_offd, d_send_map_elmts_A); + + hypre_CSRMatrixDestroy(C_tmp_diag); + hypre_CSRMatrixDestroy(C_tmp_offd); + hypre_CSRMatrixDestroy(C_ext_diag); + hypre_CSRMatrixDestroy(C_ext_offd); + } + + C = hypre_ParCSRMatrixCreate(comm, n_cols_A, n_cols_B, col_starts_A, col_starts_B, + num_cols_offd_C, C_diag->num_nonzeros, C_offd->num_nonzeros); + + /* Note that C does not own the partitionings */ + hypre_ParCSRMatrixSetRowStartsOwner(C, 0); + hypre_ParCSRMatrixSetColStartsOwner(C, 0); + + hypre_CSRMatrixDestroy(hypre_ParCSRMatrixDiag(C)); + hypre_ParCSRMatrixDiag(C) = C_diag; + + hypre_CSRMatrixDestroy(hypre_ParCSRMatrixOffd(C)); + hypre_ParCSRMatrixOffd(C) = C_offd; + + if (num_cols_offd_C) + { + hypre_ParCSRMatrixDeviceColMapOffd(C) = col_map_offd_C; + + hypre_ParCSRMatrixColMapOffd(C) = hypre_TAlloc(HYPRE_BigInt, num_cols_offd_C, HYPRE_MEMORY_HOST); + hypre_TMemcpy(hypre_ParCSRMatrixColMapOffd(C), col_map_offd_C, HYPRE_BigInt, num_cols_offd_C, + HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); + } + + /* Move the diagonal entry to the first of each row */ + hypre_CSRMatrixMoveDiagFirstDevice(C_diag); + + return C; +} + +#endif // #if defined(HYPRE_USING_CUDA) + diff -Nru hypre-2.16.0/src/parcsr_mv/par_make_system.c hypre-2.18.2/src/parcsr_mv/par_make_system.c --- hypre-2.16.0/src/parcsr_mv/par_make_system.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_make_system.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_mv.h" diff -Nru hypre-2.16.0/src/parcsr_mv/par_make_system.h hypre-2.18.2/src/parcsr_mv/par_make_system.h --- hypre-2.16.0/src/parcsr_mv/par_make_system.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_make_system.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_PAR_MAKE_SYSTEM #define hypre_PAR_MAKE_SYSTEM diff -Nru hypre-2.16.0/src/parcsr_mv/par_vector.c hypre-2.18.2/src/parcsr_mv/par_vector.c --- hypre-2.16.0/src/parcsr_mv/par_vector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_vector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -34,7 +29,7 @@ hypre_ParVector * hypre_ParVectorCreate( MPI_Comm comm, - HYPRE_BigInt global_size, + HYPRE_BigInt global_size, HYPRE_BigInt *partitioning ) { hypre_ParVector *vector; @@ -66,13 +61,13 @@ hypre_ParVectorFirstIndex(vector) = partitioning[0]; hypre_ParVectorLastIndex(vector) = partitioning[1]-1; hypre_ParVectorPartitioning(vector) = partitioning; - hypre_ParVectorLocalVector(vector) = + hypre_ParVectorLocalVector(vector) = hypre_SeqVectorCreate(partitioning[1]-partitioning[0]); #else hypre_ParVectorFirstIndex(vector) = partitioning[my_id]; hypre_ParVectorLastIndex(vector) = partitioning[my_id+1] -1; hypre_ParVectorPartitioning(vector) = partitioning; - hypre_ParVectorLocalVector(vector) = + hypre_ParVectorLocalVector(vector) = hypre_SeqVectorCreate(partitioning[my_id+1]-partitioning[my_id]); #endif @@ -90,7 +85,7 @@ hypre_ParVector * hypre_ParMultiVectorCreate( MPI_Comm comm, - HYPRE_BigInt global_size, + HYPRE_BigInt global_size, HYPRE_BigInt *partitioning, HYPRE_Int num_vectors ) { @@ -105,7 +100,7 @@ * hypre_ParVectorDestroy *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_ParVectorDestroy( hypre_ParVector *vector ) { if (vector) @@ -134,7 +129,7 @@ * hypre_ParVectorInitialize *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_ParVectorInitialize( hypre_ParVector *vector ) { if (!vector) @@ -143,8 +138,8 @@ return hypre_error_flag; } hypre_SeqVectorInitialize(hypre_ParVectorLocalVector(vector)); - hypre_ParVectorActualLocalSize(vector) - = hypre_VectorSize(hypre_ParVectorLocalVector(vector)); + hypre_ParVectorActualLocalSize(vector) + = hypre_VectorSize(hypre_ParVectorLocalVector(vector)); return hypre_error_flag; } @@ -152,7 +147,7 @@ * hypre_ParVectorSetDataOwner *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_ParVectorSetDataOwner( hypre_ParVector *vector, HYPRE_Int owns_data ) { @@ -170,7 +165,7 @@ * hypre_ParVectorSetPartitioningOwner *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_ParVectorSetPartitioningOwner( hypre_ParVector *vector, HYPRE_Int owns_partitioning ) { @@ -191,7 +186,7 @@ * probably this will do more harm than good, use hypre_ParMultiVectorCreate *--------------------------------------------------------------------------*/ #if 0 -HYPRE_Int +HYPRE_Int hypre_ParVectorSetNumVectors( hypre_ParVector *vector, HYPRE_Int num_vectors ) { @@ -220,12 +215,12 @@ HYPRE_Int i; FILE *fp; - hypre_MPI_Comm_rank(comm,&my_id); - hypre_MPI_Comm_size(comm,&num_procs); + hypre_MPI_Comm_rank(comm,&my_id); + hypre_MPI_Comm_size(comm,&num_procs); partitioning = hypre_CTAlloc(HYPRE_BigInt, num_procs+1, HYPRE_MEMORY_HOST); - hypre_sprintf(new_file_name,"%s.INFO.%d",file_name,my_id); + hypre_sprintf(new_file_name,"%s.INFO.%d",file_name,my_id); fp = fopen(new_file_name, "r"); hypre_fscanf(fp, "%b\n", &global_size); #ifdef HYPRE_NO_GLOBAL_PARTITION @@ -236,10 +231,10 @@ for (i=0; i < num_procs; i++) hypre_fscanf(fp, "%b\n", &partitioning[i]); fclose (fp); - partitioning[num_procs] = global_size; + partitioning[num_procs] = global_size; #endif par_vector = hypre_CTAlloc(hypre_ParVector, 1, HYPRE_MEMORY_HOST); - + hypre_ParVectorComm(par_vector) = comm; hypre_ParVectorGlobalSize(par_vector) = global_size; @@ -256,10 +251,10 @@ hypre_ParVectorOwnsData(par_vector) = 1; hypre_ParVectorOwnsPartitioning(par_vector) = 1; - hypre_sprintf(new_file_name,"%s.%d",file_name,my_id); + hypre_sprintf(new_file_name,"%s.%d",file_name,my_id); hypre_ParVectorLocalVector(par_vector) = hypre_SeqVectorRead(new_file_name); - /* multivector code not written yet >>> */ + /* multivector code not written yet */ hypre_assert( hypre_ParVectorNumVectors(par_vector) == 1 ); return par_vector; @@ -270,7 +265,7 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_ParVectorPrint( hypre_ParVector *vector, +hypre_ParVectorPrint( hypre_ParVector *vector, const char *file_name ) { char new_file_name[80]; @@ -285,16 +280,16 @@ hypre_error_in_arg(1); return hypre_error_flag; } - local_vector = hypre_ParVectorLocalVector(vector); + local_vector = hypre_ParVectorLocalVector(vector); comm = hypre_ParVectorComm(vector); - partitioning = hypre_ParVectorPartitioning(vector); - global_size = hypre_ParVectorGlobalSize(vector); + partitioning = hypre_ParVectorPartitioning(vector); + global_size = hypre_ParVectorGlobalSize(vector); - hypre_MPI_Comm_rank(comm,&my_id); - hypre_MPI_Comm_size(comm,&num_procs); - hypre_sprintf(new_file_name,"%s.%d",file_name,my_id); + hypre_MPI_Comm_rank(comm,&my_id); + hypre_MPI_Comm_size(comm,&num_procs); + hypre_sprintf(new_file_name,"%s.%d",file_name,my_id); hypre_SeqVectorPrint(local_vector,new_file_name); - hypre_sprintf(new_file_name,"%s.INFO.%d",file_name,my_id); + hypre_sprintf(new_file_name,"%s.INFO.%d",file_name,my_id); fp = fopen(new_file_name, "w"); hypre_fprintf(fp, "%b\n", global_size); #ifdef HYPRE_NO_GLOBAL_PARTITION @@ -318,7 +313,7 @@ HYPRE_Complex value ) { hypre_Vector *v_local = hypre_ParVectorLocalVector(v); - + return hypre_SeqVectorSetConstantValues(v_local,value); } @@ -334,10 +329,10 @@ hypre_Vector *v_local = hypre_ParVectorLocalVector(v); MPI_Comm comm = hypre_ParVectorComm(v); - hypre_MPI_Comm_rank(comm,&my_id); + hypre_MPI_Comm_rank(comm,&my_id); seed *= (my_id+1); - + return hypre_SeqVectorSetRandomValues(v_local,seed); } @@ -403,7 +398,7 @@ { hypre_Vector *x_local = hypre_ParVectorLocalVector(x); hypre_Vector *y_local = hypre_ParVectorLocalVector(y); - + return hypre_SeqVectorAxpy( alpha, x_local, y_local); } @@ -423,7 +418,7 @@ for (i=0; i < k; i++) x_local[i] = hypre_ParVectorLocalVector(x[i]); - + hypre_SeqVectorMassAxpy( alpha, x_local, y_local, k, unroll); hypre_TFree(x_local, HYPRE_MEMORY_SHARED); @@ -442,10 +437,10 @@ MPI_Comm comm = hypre_ParVectorComm(x); hypre_Vector *x_local = hypre_ParVectorLocalVector(x); hypre_Vector *y_local = hypre_ParVectorLocalVector(y); - + HYPRE_Real result = 0.0; HYPRE_Real local_result = hypre_SeqVectorInnerProd(x_local, y_local); - + #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_ALL_REDUCE] -= hypre_MPI_Wtime(); #endif @@ -454,7 +449,7 @@ #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_ALL_REDUCE] += hypre_MPI_Wtime(); #endif - + return result; } @@ -470,9 +465,9 @@ MPI_Comm comm = hypre_ParVectorComm(x); hypre_Vector *x_local = hypre_ParVectorLocalVector(x); HYPRE_Real *local_result; - HYPRE_Int i; + HYPRE_Int i; hypre_Vector **y_local; - y_local = hypre_TAlloc(hypre_Vector *, k, HYPRE_MEMORY_SHARED); + y_local = hypre_TAlloc(hypre_Vector *, k, HYPRE_MEMORY_SHARED); for (i=0; i < k; i++) y_local[i] = (hypre_Vector *) hypre_ParVectorLocalVector(y[i]); @@ -480,7 +475,7 @@ local_result = hypre_CTAlloc(HYPRE_Real, k, HYPRE_MEMORY_SHARED); hypre_SeqVectorMassInnerProd(x_local, y_local, k, unroll, local_result); - + #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_ALL_REDUCE] -= hypre_MPI_Wtime(); #endif @@ -490,9 +485,9 @@ hypre_profile_times[HYPRE_TIMER_ID_ALL_REDUCE] += hypre_MPI_Wtime(); #endif - hypre_TFree(y_local, HYPRE_MEMORY_SHARED); - hypre_TFree(local_result, HYPRE_MEMORY_SHARED); - + hypre_TFree(y_local, HYPRE_MEMORY_SHARED); + hypre_TFree(local_result, HYPRE_MEMORY_SHARED); + return hypre_error_flag; } @@ -509,9 +504,9 @@ hypre_Vector *x_local = hypre_ParVectorLocalVector(x); hypre_Vector *y_local = hypre_ParVectorLocalVector(y); HYPRE_Real *local_result, *result; - HYPRE_Int i; + HYPRE_Int i; hypre_Vector **z_local; - z_local = hypre_TAlloc(hypre_Vector *, k, HYPRE_MEMORY_SHARED); + z_local = hypre_TAlloc(hypre_Vector *, k, HYPRE_MEMORY_SHARED); for (i=0; i < k; i++) z_local[i] = (hypre_Vector *) hypre_ParVectorLocalVector(z[i]); @@ -520,7 +515,7 @@ result = hypre_CTAlloc(HYPRE_Real, 2*k, HYPRE_MEMORY_SHARED); hypre_SeqVectorMassDotpTwo(x_local, y_local, z_local, k, unroll, &local_result[0], &local_result[k]); - + #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_ALL_REDUCE] -= hypre_MPI_Wtime(); #endif @@ -535,10 +530,10 @@ result_x[i] = result[i]; result_y[i] = result[k+i]; } - hypre_TFree(z_local, HYPRE_MEMORY_SHARED); - hypre_TFree(local_result, HYPRE_MEMORY_SHARED); - hypre_TFree(result, HYPRE_MEMORY_SHARED); - + hypre_TFree(z_local, HYPRE_MEMORY_SHARED); + hypre_TFree(local_result, HYPRE_MEMORY_SHARED); + hypre_TFree(result, HYPRE_MEMORY_SHARED); + return hypre_error_flag; } @@ -597,7 +592,7 @@ local_data = hypre_VectorData(local_vector); vecstride = hypre_VectorVectorStride(local_vector); idxstride = hypre_VectorIndexStride(local_vector); - /* <<< so far the only implemented multivector StorageMethod is 0 <<< */ + /* so far the only implemented multivector StorageMethod is 0 */ hypre_assert( idxstride==1 ); if (my_id == 0) @@ -636,12 +631,12 @@ return par_vector; } - + /*-------------------------------------------------------------------------- * hypre_ParVectorToVectorAll: * generates a Vector on every proc which has a piece of the data * from a ParVector on several procs in comm, - * vec_starts needs to contain the partitioning across all procs in comm + * vec_starts needs to contain the partitioning across all procs in comm *--------------------------------------------------------------------------*/ hypre_Vector * @@ -669,7 +664,7 @@ #ifdef HYPRE_NO_GLOBAL_PARTITION HYPRE_Int *new_vec_starts; - + HYPRE_Int num_contacts; HYPRE_Int contact_proc_list[1]; HYPRE_Int contact_send_buf[1]; @@ -679,12 +674,12 @@ HYPRE_Int *response_recv_buf_starts = NULL; hypre_DataExchangeResponse response_obj; hypre_ProcListElements send_proc_obj; - + HYPRE_Int *send_info = NULL; hypre_MPI_Status status1; HYPRE_Int count, tag1 = 112, tag2 = 223; HYPRE_Int start; - + #endif hypre_MPI_Comm_size(comm, &num_procs); @@ -692,7 +687,7 @@ #ifdef HYPRE_NO_GLOBAL_PARTITION - local_size = (HYPRE_Int)(hypre_ParVectorLastIndex(par_v) - + local_size = (HYPRE_Int)(hypre_ParVectorLastIndex(par_v) - hypre_ParVectorFirstIndex(par_v) + 1); /* determine procs which hold data of par_v and store ids in used_procs */ @@ -720,7 +715,7 @@ send_proc_obj.storage_length = 10; send_proc_obj.id = hypre_CTAlloc(HYPRE_Int, send_proc_obj.storage_length, HYPRE_MEMORY_HOST); send_proc_obj.vec_starts = - hypre_CTAlloc(HYPRE_Int, send_proc_obj.storage_length + 1, HYPRE_MEMORY_HOST); + hypre_CTAlloc(HYPRE_Int, send_proc_obj.storage_length + 1, HYPRE_MEMORY_HOST); send_proc_obj.vec_starts[0] = 0; send_proc_obj.element_storage_length = 10; send_proc_obj.elements = @@ -730,15 +725,15 @@ response_obj.fill_response = hypre_FillResponseParToVectorAll; response_obj.data1 = NULL; response_obj.data2 = &send_proc_obj; /*this is where we keep info from contacts*/ - - - hypre_DataExchangeList(num_contacts, - contact_proc_list, contact_send_buf, - contact_send_buf_starts, sizeof(HYPRE_Int), - //0, &response_obj, - sizeof(HYPRE_Int), &response_obj, + + + hypre_DataExchangeList(num_contacts, + contact_proc_list, contact_send_buf, + contact_send_buf_starts, sizeof(HYPRE_Int), + //0, &response_obj, + sizeof(HYPRE_Int), &response_obj, max_response_size, 1, - comm, (void**) &response_recv_buf, + comm, (void**) &response_recv_buf, &response_recv_buf_starts); /* now processor 0 should have a list of ranges for processors that have rows - @@ -746,18 +741,18 @@ and also an array of vec starts - and send to those who own row*/ if (my_id) { - if (local_size) + if (local_size) { - /* look for a message from processor 0 */ + /* look for a message from processor 0 */ hypre_MPI_Probe(0, tag1, comm, &status1); hypre_MPI_Get_count(&status1, HYPRE_MPI_INT, &count); - + send_info = hypre_CTAlloc(HYPRE_Int, count, HYPRE_MEMORY_HOST); hypre_MPI_Recv(send_info, count, HYPRE_MPI_INT, 0, tag1, comm, &status1); - /* now unpack */ + /* now unpack */ num_types = send_info[0]; - used_procs = hypre_CTAlloc(HYPRE_Int, num_types, HYPRE_MEMORY_HOST); + used_procs = hypre_CTAlloc(HYPRE_Int, num_types, HYPRE_MEMORY_HOST); new_vec_starts = hypre_CTAlloc(HYPRE_Int, num_types+1, HYPRE_MEMORY_HOST); for (i=1; i<= num_types; i++) @@ -782,9 +777,9 @@ else /* my_id ==0 */ { num_types = send_proc_obj.length; - used_procs = hypre_CTAlloc(HYPRE_Int, num_types, HYPRE_MEMORY_HOST); + used_procs = hypre_CTAlloc(HYPRE_Int, num_types, HYPRE_MEMORY_HOST); new_vec_starts = hypre_CTAlloc(HYPRE_Int, num_types+1, HYPRE_MEMORY_HOST); - + new_vec_starts[0] = 0; for (i=0; i< num_types; i++) { @@ -814,8 +809,8 @@ { start = 1; } - - + + for (i=start; i < num_types; i++) { hypre_MPI_Isend(send_info, count, HYPRE_MPI_INT, used_procs[i], @@ -841,7 +836,7 @@ hypre_TFree(new_vec_starts, HYPRE_MEMORY_HOST); return NULL; } - + /* everyone left has rows and knows: new_vec_starts, num_types, and used_procs */ /* this vector should be rather small */ @@ -857,9 +852,9 @@ requests = hypre_CTAlloc(hypre_MPI_Request, num_requests, HYPRE_MEMORY_HOST); status = hypre_CTAlloc(hypre_MPI_Status, num_requests, HYPRE_MEMORY_HOST); - /* initialize data exchange among used_procs and generate vector - here we + /* initialize data exchange among used_procs and generate vector - here we send to ourself also*/ - + j = 0; for (i = 0; i < num_types; i++) { @@ -873,18 +868,18 @@ hypre_MPI_Isend(local_data, num_vectors*local_size, HYPRE_MPI_COMPLEX, used_procs[i], tag2, comm, &requests[j++]); } - + hypre_MPI_Waitall(num_requests, requests, status); if (num_requests) { hypre_TFree(requests, HYPRE_MEMORY_HOST); - hypre_TFree(status, HYPRE_MEMORY_HOST); + hypre_TFree(status, HYPRE_MEMORY_HOST); hypre_TFree(used_procs, HYPRE_MEMORY_HOST); } hypre_TFree(new_vec_starts, HYPRE_MEMORY_HOST); - + #else local_size = (HYPRE_Int)(vec_starts[my_id+1] - vec_starts[my_id]); @@ -893,7 +888,7 @@ if (!local_size) return NULL; - + local_data = hypre_VectorData(local_vector); vector = hypre_SeqVectorCreate(global_size); hypre_VectorNumVectors(vector) = num_vectors; @@ -907,18 +902,18 @@ if (vec_starts[i+1]-vec_starts[i]) num_types++; num_requests = 2*num_types; - + used_procs = hypre_CTAlloc(HYPRE_Int, num_types, HYPRE_MEMORY_HOST); j = 0; for (i=0; i < num_procs; i++) if (vec_starts[i+1]-vec_starts[i] && i-my_id) used_procs[j++] = i; - + requests = hypre_CTAlloc(hypre_MPI_Request, num_requests, HYPRE_MEMORY_HOST); status = hypre_CTAlloc(hypre_MPI_Status, num_requests, HYPRE_MEMORY_HOST); /* initialize data exchange among used_procs and generate vector */ - + j = 0; for (i = 0; i < num_types; i++) { @@ -932,17 +927,17 @@ hypre_MPI_Isend(local_data, num_vectors*local_size, HYPRE_MPI_COMPLEX, used_procs[i], 0, comm, &requests[j++]); } - + for (i=0; i < num_vectors*local_size; i++) vector_data[vec_starts[my_id]+i] = local_data[i]; - + hypre_MPI_Waitall(num_requests, requests, status); if (num_requests) { hypre_TFree(used_procs, HYPRE_MEMORY_HOST); hypre_TFree(requests, HYPRE_MEMORY_HOST); - hypre_TFree(status, HYPRE_MEMORY_HOST); + hypre_TFree(status, HYPRE_MEMORY_HOST); } #endif @@ -975,13 +970,13 @@ global_size = hypre_ParVectorGlobalSize(vector); partitioning = hypre_ParVectorPartitioning(vector); - /* multivector code not written yet >>> */ + /* multivector code not written yet */ hypre_assert( hypre_ParVectorNumVectors(vector) == 1 ); if ( hypre_ParVectorNumVectors(vector) != 1 ) hypre_error_in_arg(1); hypre_MPI_Comm_rank(comm, &myid); hypre_MPI_Comm_size(comm, &num_procs); - + hypre_sprintf(new_filename,"%s.%05d", filename, myid); if ((file = fopen(new_filename, "w")) == NULL) @@ -1049,7 +1044,7 @@ hypre_MPI_Comm_size(comm, &num_procs); hypre_MPI_Comm_rank(comm, &myid); - + hypre_sprintf(new_filename,"%s.%05d", filename, myid); if ((file = fopen(new_filename, "r")) == NULL) @@ -1107,7 +1102,7 @@ *base_j_ptr = base_j; *vector_ptr = vector; - /* multivector code not written yet >>> */ + /* multivector code not written yet */ hypre_assert( hypre_ParVectorNumVectors(vector) == 1 ); if ( hypre_ParVectorNumVectors(vector) != 1 ) hypre_error(HYPRE_ERROR_GENERIC); @@ -1121,20 +1116,20 @@ *--------------------------------------------------------------------*/ HYPRE_Int -hypre_FillResponseParToVectorAll( void *p_recv_contact_buf, +hypre_FillResponseParToVectorAll( void *p_recv_contact_buf, HYPRE_Int contact_size, HYPRE_Int contact_proc, - void *ro, + void *ro, MPI_Comm comm, - void **p_send_response_buf, + void **p_send_response_buf, HYPRE_Int *response_message_size ) { HYPRE_Int myid; HYPRE_Int i, index, count, elength; HYPRE_BigInt *recv_contact_buf = (HYPRE_BigInt * ) p_recv_contact_buf; - - hypre_DataExchangeResponse *response_obj = (hypre_DataExchangeResponse*)ro; + + hypre_DataExchangeResponse *response_obj = (hypre_DataExchangeResponse*)ro; hypre_ProcListElements *send_proc_obj = (hypre_ProcListElements*)response_obj->data2; hypre_MPI_Comm_rank(comm, &myid ); @@ -1143,40 +1138,40 @@ if (send_proc_obj->length == send_proc_obj->storage_length) { send_proc_obj->storage_length +=10; /*add space for 10 more processors*/ - send_proc_obj->id = hypre_TReAlloc(send_proc_obj->id, HYPRE_Int, + send_proc_obj->id = hypre_TReAlloc(send_proc_obj->id, HYPRE_Int, send_proc_obj->storage_length, HYPRE_MEMORY_HOST); send_proc_obj->vec_starts = - hypre_TReAlloc(send_proc_obj->vec_starts, HYPRE_Int, + hypre_TReAlloc(send_proc_obj->vec_starts, HYPRE_Int, send_proc_obj->storage_length + 1, HYPRE_MEMORY_HOST); } - - /*initialize*/ + + /*initialize*/ count = send_proc_obj->length; index = send_proc_obj->vec_starts[count]; /*this is the number of elements*/ - /*send proc*/ - send_proc_obj->id[count] = contact_proc; + /*send proc*/ + send_proc_obj->id[count] = contact_proc; /*do we need more storage for the elements?*/ if (send_proc_obj->element_storage_length < index + contact_size) { - elength = hypre_max(contact_size, 10); + elength = hypre_max(contact_size, 10); elength += index; - send_proc_obj->elements = hypre_TReAlloc(send_proc_obj->elements, + send_proc_obj->elements = hypre_TReAlloc(send_proc_obj->elements, HYPRE_BigInt, elength, HYPRE_MEMORY_HOST); - send_proc_obj->element_storage_length = elength; + send_proc_obj->element_storage_length = elength; } /*populate send_proc_obj*/ - for (i=0; i< contact_size; i++) - { + for (i=0; i< contact_size; i++) + { send_proc_obj->elements[index++] = recv_contact_buf[i]; } send_proc_obj->vec_starts[count+1] = index; send_proc_obj->length++; /*output - no message to return (confirmation) */ - *response_message_size = 0; - + *response_message_size = 0; + return hypre_error_flag; } @@ -1186,20 +1181,17 @@ HYPRE_Complex hypre_ParVectorLocalSumElts( hypre_ParVector * vector ) { - return hypre_VectorSumElts( hypre_ParVectorLocalVector(vector) ); + return hypre_SeqVectorSumElts( hypre_ParVectorLocalVector(vector) ); } + +/* #ifdef HYPRE_USING_UNIFIED_MEMORY hypre_int hypre_ParVectorIsManaged(hypre_ParVector *vector){ if (vector==NULL) return 1; return hypre_SeqVectorIsManaged(hypre_ParVectorLocalVector(vector)); } #endif -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD -void hypre_ParVectorUpdateHost(hypre_ParVector *p){ -#pragma omp target update from(p->local_vector->data[0:p->local_vector->size]) - SetHRC(p->local_vector); -} -#endif +*/ HYPRE_Int hypre_ParVectorGetValues(hypre_ParVector *vector, diff -Nru hypre-2.16.0/src/parcsr_mv/par_vector.h hypre-2.18.2/src/parcsr_mv/par_vector.h --- hypre-2.16.0/src/parcsr_mv/par_vector.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/parcsr_mv/par_vector.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/seq_mv/CMakeLists.txt hypre-2.18.2/src/seq_mv/CMakeLists.txt --- hypre-2.16.0/src/seq_mv/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,32 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(HDRS + HYPRE_seq_mv.h + seq_mv.h +) + +set(SRCS + csr_matop.c + csr_matrix.c + csr_matvec.c + genpart.c + HYPRE_csr_matrix.c + HYPRE_mapped_matrix.c + HYPRE_multiblock_matrix.c + HYPRE_vector.c + mapped_matrix.c + multiblock_matrix.c + vector.c + vector_batched.c +) + +convert_filenames_to_full_paths(HDRS) +convert_filenames_to_full_paths(SRCS) + +set(HYPRE_HEADERS ${HYPRE_HEADERS} ${HDRS} PARENT_SCOPE) +set(HYPRE_SOURCES ${HYPRE_SOURCES} ${SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/seq_mv/csr_matop.c hypre-2.18.2/src/seq_mv/csr_matop.c --- hypre-2.16.0/src/seq_mv/csr_matop.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/csr_matop.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -26,12 +21,12 @@ * adds two CSR Matrices A and B and returns a CSR Matrix C; * Note: The routine does not check for 0-elements which might be generated * through cancellation of elements in A and B or already contained - in A and B. To remove those, use hypre_CSRMatrixDeleteZeros + in A and B. To remove those, use hypre_CSRMatrixDeleteZeros *--------------------------------------------------------------------------*/ -hypre_CSRMatrix * -hypre_CSRMatrixAdd( hypre_CSRMatrix *A, - hypre_CSRMatrix *B ) +hypre_CSRMatrix* +hypre_CSRMatrixAddHost ( hypre_CSRMatrix *A, + hypre_CSRMatrix *B ) { HYPRE_Complex *A_data = hypre_CSRMatrixData(A); HYPRE_Int *A_i = hypre_CSRMatrixI(A); @@ -125,20 +120,46 @@ } hypre_TFree(marker, HYPRE_MEMORY_HOST); + + return C; +} + +hypre_CSRMatrix* +hypre_CSRMatrixAdd( hypre_CSRMatrix *A, + hypre_CSRMatrix *B) +{ + HYPRE_Int exec = hypre_GetExecPolicy2( hypre_CSRMatrixMemoryLocation(A), + hypre_CSRMatrixMemoryLocation(B) ); + + hypre_assert(exec != HYPRE_EXEC_UNSET); + + hypre_CSRMatrix *C = NULL; + + if (exec == HYPRE_EXEC_HOST) + { + C = hypre_CSRMatrixAddHost(A,B); + } +#if defined(HYPRE_USING_CUDA) + else + { + C = hypre_CSRMatrixAddDevice(A,B); + } +#endif + return C; -} +} /*-------------------------------------------------------------------------- * hypre_CSRMatrixBigAdd: * adds two CSR Matrices A and B and returns a CSR Matrix C; * Note: The routine does not check for 0-elements which might be generated * through cancellation of elements in A and B or already contained - in A and B. To remove those, use hypre_CSRMatrixDeleteZeros + in A and B. To remove those, use hypre_CSRMatrixDeleteZeros *--------------------------------------------------------------------------*/ hypre_CSRMatrix * hypre_CSRMatrixBigAdd( hypre_CSRMatrix *A, - hypre_CSRMatrix *B ) + hypre_CSRMatrix *B ) { HYPRE_Complex *A_data = hypre_CSRMatrixData(A); HYPRE_Int *A_i = hypre_CSRMatrixI(A); @@ -234,19 +255,19 @@ hypre_TFree(marker, HYPRE_MEMORY_HOST); return C; -} +} /*-------------------------------------------------------------------------- * hypre_CSRMatrixMultiply * multiplies two CSR Matrices A and B and returns a CSR Matrix C; * Note: The routine does not check for 0-elements which might be generated * through cancellation of elements in A and B or already contained - in A and B. To remove those, use hypre_CSRMatrixDeleteZeros + in A and B. To remove those, use hypre_CSRMatrixDeleteZeros *--------------------------------------------------------------------------*/ -hypre_CSRMatrix * -hypre_CSRMatrixMultiply( hypre_CSRMatrix *A, - hypre_CSRMatrix *B) +hypre_CSRMatrix* +hypre_CSRMatrixMultiplyHost( hypre_CSRMatrix *A, + hypre_CSRMatrix *B) { HYPRE_Complex *A_data = hypre_CSRMatrixData(A); HYPRE_Int *A_i = hypre_CSRMatrixI(A); @@ -288,125 +309,150 @@ #pragma omp parallel private(ia, ib, ic, ja, jb, num_nonzeros, row_start, counter, a_entry, b_entry) #endif { - HYPRE_Int *B_marker = NULL; - HYPRE_Int ns, ne, ii, jj; - HYPRE_Int size, rest, num_threads; - HYPRE_Int i1; - ii = hypre_GetThreadNum(); - num_threads = hypre_NumActiveThreads(); - - size = nrows_A/num_threads; - rest = nrows_A - size*num_threads; - if (ii < rest) - { - ns = ii*size+ii; - ne = (ii+1)*size+ii+1; - } - else - { - ns = ii*size+rest; - ne = (ii+1)*size+rest; - } - - B_marker = hypre_CTAlloc(HYPRE_Int, ncols_B, HYPRE_MEMORY_HOST); - - for (ib = 0; ib < ncols_B; ib++) - B_marker[ib] = -1; - - num_nonzeros = 0; - for (ic = ns; ic < ne; ic++) - { - C_i[ic] = num_nonzeros; - if (allsquare) - { - B_marker[ic] = ic; - num_nonzeros++; - } - for (ia = A_i[ic]; ia < A_i[ic+1]; ia++) - { - ja = A_j[ia]; - for (ib = B_i[ja]; ib < B_i[ja+1]; ib++) - { - jb = B_j[ib]; - if (B_marker[jb] != ic) - { - B_marker[jb] = ic; - num_nonzeros++; - } - } - } - } - jj_count[ii] = num_nonzeros; + HYPRE_Int *B_marker = NULL; + HYPRE_Int ns, ne, ii, jj; + HYPRE_Int size, rest, num_threads; + HYPRE_Int i1; + ii = hypre_GetThreadNum(); + num_threads = hypre_NumActiveThreads(); + + size = nrows_A/num_threads; + rest = nrows_A - size*num_threads; + if (ii < rest) + { + ns = ii*size+ii; + ne = (ii+1)*size+ii+1; + } + else + { + ns = ii*size+rest; + ne = (ii+1)*size+rest; + } + + B_marker = hypre_CTAlloc(HYPRE_Int, ncols_B, HYPRE_MEMORY_HOST); + + for (ib = 0; ib < ncols_B; ib++) + B_marker[ib] = -1; + + num_nonzeros = 0; + for (ic = ns; ic < ne; ic++) + { + C_i[ic] = num_nonzeros; + if (allsquare) + { + B_marker[ic] = ic; + num_nonzeros++; + } + for (ia = A_i[ic]; ia < A_i[ic+1]; ia++) + { + ja = A_j[ia]; + for (ib = B_i[ja]; ib < B_i[ja+1]; ib++) + { + jb = B_j[ib]; + if (B_marker[jb] != ic) + { + B_marker[jb] = ic; + num_nonzeros++; + } + } + } + } + jj_count[ii] = num_nonzeros; #ifdef HYPRE_USING_OPENMP #pragma omp barrier #endif - if (ii) - { - jj = jj_count[0]; - for (i1 = 1; i1 < ii; i1++) - jj += jj_count[i1]; - - for (i1 = ns; i1 < ne; i1++) - C_i[i1] += jj; - } - else - { - C_i[nrows_A] = 0; - for (i1 = 0; i1 < num_threads; i1++) - C_i[nrows_A] += jj_count[i1]; - - C = hypre_CSRMatrixCreate(nrows_A, ncols_B, C_i[nrows_A]); - hypre_CSRMatrixI(C) = C_i; - hypre_CSRMatrixInitialize(C); - C_j = hypre_CSRMatrixJ(C); - C_data = hypre_CSRMatrixData(C); - } + if (ii) + { + jj = jj_count[0]; + for (i1 = 1; i1 < ii; i1++) + jj += jj_count[i1]; + + for (i1 = ns; i1 < ne; i1++) + C_i[i1] += jj; + } + else + { + C_i[nrows_A] = 0; + for (i1 = 0; i1 < num_threads; i1++) + C_i[nrows_A] += jj_count[i1]; + + C = hypre_CSRMatrixCreate(nrows_A, ncols_B, C_i[nrows_A]); + hypre_CSRMatrixI(C) = C_i; + hypre_CSRMatrixInitialize(C); + C_j = hypre_CSRMatrixJ(C); + C_data = hypre_CSRMatrixData(C); + } #ifdef HYPRE_USING_OPENMP #pragma omp barrier #endif - for (ib = 0; ib < ncols_B; ib++) - B_marker[ib] = -1; + for (ib = 0; ib < ncols_B; ib++) + B_marker[ib] = -1; - counter = C_i[ns]; - for (ic = ns; ic < ne; ic++) - { - row_start = C_i[ic]; - if (allsquare) + counter = C_i[ns]; + for (ic = ns; ic < ne; ic++) { - B_marker[ic] = counter; - C_data[counter] = 0; - C_j[counter] = ic; - counter++; + row_start = C_i[ic]; + if (allsquare) + { + B_marker[ic] = counter; + C_data[counter] = 0; + C_j[counter] = ic; + counter++; + } + for (ia = A_i[ic]; ia < A_i[ic+1]; ia++) + { + ja = A_j[ia]; + a_entry = A_data[ia]; + for (ib = B_i[ja]; ib < B_i[ja+1]; ib++) + { + jb = B_j[ib]; + b_entry = B_data[ib]; + if (B_marker[jb] < row_start) + { + B_marker[jb] = counter; + C_j[B_marker[jb]] = jb; + C_data[B_marker[jb]] = a_entry*b_entry; + counter++; + } + else + C_data[B_marker[jb]] += a_entry*b_entry; + } + } } - for (ia = A_i[ic]; ia < A_i[ic+1]; ia++) - { - ja = A_j[ia]; - a_entry = A_data[ia]; - for (ib = B_i[ja]; ib < B_i[ja+1]; ib++) - { - jb = B_j[ib]; - b_entry = B_data[ib]; - if (B_marker[jb] < row_start) - { - B_marker[jb] = counter; - C_j[B_marker[jb]] = jb; - C_data[B_marker[jb]] = a_entry*b_entry; - counter++; - } - else - C_data[B_marker[jb]] += a_entry*b_entry; - } - } - } - hypre_TFree(B_marker, HYPRE_MEMORY_HOST); - } /*end parallel region */ - hypre_TFree(jj_count, HYPRE_MEMORY_HOST); - return C; -} + hypre_TFree(B_marker, HYPRE_MEMORY_HOST); + } /*end parallel region */ + hypre_TFree(jj_count, HYPRE_MEMORY_HOST); + return C; +} + +hypre_CSRMatrix* +hypre_CSRMatrixMultiply( hypre_CSRMatrix *A, + hypre_CSRMatrix *B) +{ + HYPRE_Int exec = hypre_GetExecPolicy2( hypre_CSRMatrixMemoryLocation(A), + hypre_CSRMatrixMemoryLocation(B) ); + + hypre_assert(exec != HYPRE_EXEC_UNSET); + + hypre_CSRMatrix *C = NULL; + + if (exec == HYPRE_EXEC_HOST) + { + C = hypre_CSRMatrixMultiplyHost(A,B); + } +#if defined(HYPRE_USING_CUDA) + else + { + C = hypre_CSRMatrixMultiplyDevice(A,B); + } +#endif + + return C; +} hypre_CSRMatrix * hypre_CSRMatrixDeleteZeros( hypre_CSRMatrix *A, HYPRE_Real tol) @@ -419,7 +465,7 @@ HYPRE_Int num_nonzeros = hypre_CSRMatrixNumNonzeros(A); hypre_CSRMatrix *B; - HYPRE_Complex *B_data; + HYPRE_Complex *B_data; HYPRE_Int *B_i; HYPRE_Int *B_j; @@ -464,7 +510,7 @@ } else return NULL; -} +} /****************************************************************************** @@ -487,9 +533,10 @@ * hypre_CSRMatrixTranspose *--------------------------------------------------------------------------*/ - -HYPRE_Int hypre_CSRMatrixTranspose(hypre_CSRMatrix *A, hypre_CSRMatrix **AT, - HYPRE_Int data) +HYPRE_Int +hypre_CSRMatrixTransposeHost(hypre_CSRMatrix *A, + hypre_CSRMatrix **AT, + HYPRE_Int data) { HYPRE_Complex *A_data = hypre_CSRMatrixData(A); @@ -509,8 +556,8 @@ HYPRE_Int max_col; HYPRE_Int i, j; - /*-------------------------------------------------------------- - * First, ascertain that num_cols and num_nonzeros has been set. + /*-------------------------------------------------------------- + * First, ascertain that num_cols and num_nonzeros has been set. * If not, set them. *--------------------------------------------------------------*/ @@ -549,7 +596,7 @@ AT_j = hypre_CTAlloc(HYPRE_Int, num_nonzerosAT, HYPRE_MEMORY_SHARED); hypre_CSRMatrixJ(*AT) = AT_j; - if (data) + if (data) { AT_data = hypre_CTAlloc(HYPRE_Complex, num_nonzerosAT, HYPRE_MEMORY_SHARED); hypre_CSRMatrixData(*AT) = AT_data; @@ -666,16 +713,277 @@ } } /*end parallel region */ - hypre_CSRMatrixI(*AT) = bucket; + hypre_CSRMatrixI(*AT) = bucket; // JSP: bucket is hypre_NumThreads() times longer than // the size needed for AT_i, but this should be OK. // If the memory size is a concern, we can allocate // a new memory for AT_i and copy from bucket. hypre_CSRMatrixI(*AT)[num_colsA] = num_nonzerosA; - return(0); + return (0); +} + + +HYPRE_Int +hypre_CSRMatrixTranspose(hypre_CSRMatrix *A, + hypre_CSRMatrix **AT, + HYPRE_Int data) +{ + HYPRE_Int exec = hypre_GetExecPolicy1( hypre_CSRMatrixMemoryLocation(A) ); + + hypre_assert(exec != HYPRE_EXEC_UNSET); + + HYPRE_Int ierr = 0; + + if (exec == HYPRE_EXEC_HOST) + { + ierr = hypre_CSRMatrixTransposeHost(A, AT, data); + } +#if defined(HYPRE_USING_CUDA) + else + { + ierr = hypre_CSRMatrixTransposeDevice(A, AT, data); + } +#endif + + return ierr; } +HYPRE_Int hypre_CSRMatrixSplit(hypre_CSRMatrix *Bs_ext, + HYPRE_BigInt first_col_diag_B, + HYPRE_BigInt last_col_diag_B, + HYPRE_Int num_cols_offd_B, + HYPRE_BigInt *col_map_offd_B, + HYPRE_Int *num_cols_offd_C_ptr, + HYPRE_BigInt **col_map_offd_C_ptr, + hypre_CSRMatrix **Bext_diag_ptr, + hypre_CSRMatrix **Bext_offd_ptr) +{ + HYPRE_Complex *Bs_ext_data = hypre_CSRMatrixData(Bs_ext); + HYPRE_Int *Bs_ext_i = hypre_CSRMatrixI(Bs_ext); + HYPRE_BigInt *Bs_ext_j = hypre_CSRMatrixBigJ(Bs_ext); + HYPRE_Int num_rows_Bext = hypre_CSRMatrixNumRows(Bs_ext); + HYPRE_Int B_ext_diag_size = 0; + HYPRE_Int B_ext_offd_size = 0; + HYPRE_Int *B_ext_diag_i = NULL; + HYPRE_Int *B_ext_diag_j = NULL; + HYPRE_Complex *B_ext_diag_data = NULL; + HYPRE_Int *B_ext_offd_i = NULL; + HYPRE_Int *B_ext_offd_j = NULL; + HYPRE_Complex *B_ext_offd_data = NULL; + HYPRE_Int *my_diag_array; + HYPRE_Int *my_offd_array; + HYPRE_BigInt *temp; + HYPRE_Int max_num_threads; + HYPRE_Int cnt = 0; + hypre_CSRMatrix *Bext_diag = NULL; + hypre_CSRMatrix *Bext_offd = NULL; + HYPRE_BigInt *col_map_offd_C = NULL; + HYPRE_Int num_cols_offd_C = 0; + + B_ext_diag_i = hypre_CTAlloc(HYPRE_Int, num_rows_Bext+1, HYPRE_MEMORY_HOST); + B_ext_offd_i = hypre_CTAlloc(HYPRE_Int, num_rows_Bext+1, HYPRE_MEMORY_HOST); + + max_num_threads = hypre_NumThreads(); + my_diag_array = hypre_CTAlloc(HYPRE_Int, max_num_threads, HYPRE_MEMORY_HOST); + my_offd_array = hypre_CTAlloc(HYPRE_Int, max_num_threads, HYPRE_MEMORY_HOST); + +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel +#endif + { + HYPRE_Int size, rest, ii; + HYPRE_Int ns, ne; + HYPRE_Int i1, i, j; + HYPRE_Int my_offd_size, my_diag_size; + HYPRE_Int cnt_offd, cnt_diag; + HYPRE_Int num_threads = hypre_NumActiveThreads(); + + size = num_rows_Bext/num_threads; + rest = num_rows_Bext - size*num_threads; + ii = hypre_GetThreadNum(); + if (ii < rest) + { + ns = ii*size+ii; + ne = (ii+1)*size+ii+1; + } + else + { + ns = ii*size+rest; + ne = (ii+1)*size+rest; + } + + my_diag_size = 0; + my_offd_size = 0; + for (i=ns; i < ne; i++) + { + B_ext_diag_i[i] = my_diag_size; + B_ext_offd_i[i] = my_offd_size; + for (j = Bs_ext_i[i]; j < Bs_ext_i[i+1]; j++) + { + if (Bs_ext_j[j] < first_col_diag_B || Bs_ext_j[j] > last_col_diag_B) + { + my_offd_size++; + } + else + { + my_diag_size++; + } + } + } + my_diag_array[ii] = my_diag_size; + my_offd_array[ii] = my_offd_size; + +#ifdef HYPRE_USING_OPENMP +#pragma omp barrier +#endif + + if (ii) + { + my_diag_size = my_diag_array[0]; + my_offd_size = my_offd_array[0]; + for (i1 = 1; i1 < ii; i1++) + { + my_diag_size += my_diag_array[i1]; + my_offd_size += my_offd_array[i1]; + } + + for (i1 = ns; i1 < ne; i1++) + { + B_ext_diag_i[i1] += my_diag_size; + B_ext_offd_i[i1] += my_offd_size; + } + } + else + { + B_ext_diag_size = 0; + B_ext_offd_size = 0; + for (i1 = 0; i1 < num_threads; i1++) + { + B_ext_diag_size += my_diag_array[i1]; + B_ext_offd_size += my_offd_array[i1]; + } + B_ext_diag_i[num_rows_Bext] = B_ext_diag_size; + B_ext_offd_i[num_rows_Bext] = B_ext_offd_size; + + if (B_ext_diag_size) + { + B_ext_diag_j = hypre_CTAlloc(HYPRE_Int, B_ext_diag_size, HYPRE_MEMORY_HOST); + B_ext_diag_data = hypre_CTAlloc(HYPRE_Complex, B_ext_diag_size, HYPRE_MEMORY_HOST); + } + if (B_ext_offd_size) + { + B_ext_offd_j = hypre_CTAlloc(HYPRE_Int, B_ext_offd_size, HYPRE_MEMORY_HOST); + B_ext_offd_data = hypre_CTAlloc(HYPRE_Complex, B_ext_offd_size, HYPRE_MEMORY_HOST); + } + if (B_ext_offd_size || num_cols_offd_B) + { + temp = hypre_CTAlloc(HYPRE_BigInt, B_ext_offd_size + num_cols_offd_B, HYPRE_MEMORY_HOST); + } + } + +#ifdef HYPRE_USING_OPENMP +#pragma omp barrier +#endif + + cnt_offd = B_ext_offd_i[ns]; + cnt_diag = B_ext_diag_i[ns]; + for (i = ns; i < ne; i++) + { + for (j = Bs_ext_i[i]; j < Bs_ext_i[i+1]; j++) + { + if (Bs_ext_j[j] < first_col_diag_B || Bs_ext_j[j] > last_col_diag_B) + { + temp[cnt_offd] = Bs_ext_j[j]; + B_ext_offd_j[cnt_offd] = Bs_ext_j[j]; + B_ext_offd_data[cnt_offd++] = Bs_ext_data[j]; + } + else + { + B_ext_diag_j[cnt_diag] = Bs_ext_j[j] - first_col_diag_B; + B_ext_diag_data[cnt_diag++] = Bs_ext_data[j]; + } + } + } + + /* This computes the mappings */ +#ifdef HYPRE_USING_OPENMP +#pragma omp barrier +#endif + + if (ii == 0) + { + cnt = 0; + if (B_ext_offd_size || num_cols_offd_B) + { + cnt = B_ext_offd_size; + for (i=0; i < num_cols_offd_B; i++) + { + temp[cnt++] = col_map_offd_B[i]; + } + if (cnt) + { + hypre_BigQsort0(temp, 0, cnt-1); + num_cols_offd_C = 1; + HYPRE_BigInt value = temp[0]; + for (i = 1; i < cnt; i++) + { + if (temp[i] > value) + { + value = temp[i]; + temp[num_cols_offd_C++] = value; + } + } + } + + if (num_cols_offd_C) + { + col_map_offd_C = hypre_CTAlloc(HYPRE_BigInt, num_cols_offd_C, HYPRE_MEMORY_HOST); + } + + for (i = 0; i < num_cols_offd_C; i++) + { + col_map_offd_C[i] = temp[i]; + } + + hypre_TFree(temp, HYPRE_MEMORY_HOST); + } + } + +#ifdef HYPRE_USING_OPENMP +#pragma omp barrier +#endif + + for (i = ns; i < ne; i++) + { + for (j = B_ext_offd_i[i]; j < B_ext_offd_i[i+1]; j++) + { + B_ext_offd_j[j] = hypre_BigBinarySearch(col_map_offd_C, B_ext_offd_j[j], num_cols_offd_C); + } + } + } /* end parallel region */ + + hypre_TFree(my_diag_array, HYPRE_MEMORY_HOST); + hypre_TFree(my_offd_array, HYPRE_MEMORY_HOST); + + Bext_diag = hypre_CSRMatrixCreate(num_rows_Bext, last_col_diag_B-first_col_diag_B+1, B_ext_diag_size); + hypre_CSRMatrixMemoryLocation(Bext_diag) = HYPRE_MEMORY_HOST; + Bext_offd = hypre_CSRMatrixCreate(num_rows_Bext, num_cols_offd_C, B_ext_offd_size); + hypre_CSRMatrixMemoryLocation(Bext_offd) = HYPRE_MEMORY_HOST; + hypre_CSRMatrixI(Bext_diag) = B_ext_diag_i; + hypre_CSRMatrixJ(Bext_diag) = B_ext_diag_j; + hypre_CSRMatrixData(Bext_diag) = B_ext_diag_data; + hypre_CSRMatrixI(Bext_offd) = B_ext_offd_i; + hypre_CSRMatrixJ(Bext_offd) = B_ext_offd_j; + hypre_CSRMatrixData(Bext_offd) = B_ext_offd_data; + + *col_map_offd_C_ptr = col_map_offd_C; + *Bext_diag_ptr = Bext_diag; + *Bext_offd_ptr = Bext_offd; + *num_cols_offd_C_ptr = num_cols_offd_C; + + return hypre_error_flag; +} /*-------------------------------------------------------------------------- * hypre_CSRMatrixReorder: @@ -732,6 +1040,153 @@ } /*-------------------------------------------------------------------------- + * hypre_CSRMatrixAddPartial: + * adds matrix rows in the CSR matrix B to the CSR Matrix A, where row_nums[i] + * defines to which row of A the i-th row of B is added, and returns a CSR Matrix C; + * Note: The routine does not check for 0-elements which might be generated + * through cancellation of elements in A and B or already contained + * in A and B. To remove those, use hypre_CSRMatrixDeleteZeros + *--------------------------------------------------------------------------*/ +hypre_CSRMatrix * +hypre_CSRMatrixAddPartial( hypre_CSRMatrix *A, + hypre_CSRMatrix *B, + HYPRE_Int *row_nums) +{ + HYPRE_Complex *A_data = hypre_CSRMatrixData(A); + HYPRE_Int *A_i = hypre_CSRMatrixI(A); + HYPRE_Int *A_j = hypre_CSRMatrixJ(A); + HYPRE_Int nrows_A = hypre_CSRMatrixNumRows(A); + HYPRE_Int ncols_A = hypre_CSRMatrixNumCols(A); + HYPRE_Complex *B_data = hypre_CSRMatrixData(B); + HYPRE_Int *B_i = hypre_CSRMatrixI(B); + HYPRE_Int *B_j = hypre_CSRMatrixJ(B); + HYPRE_Int nrows_B = hypre_CSRMatrixNumRows(B); + HYPRE_Int ncols_B = hypre_CSRMatrixNumCols(B); + hypre_CSRMatrix *C; + HYPRE_Complex *C_data; + HYPRE_Int *C_i; + HYPRE_Int *C_j; + + HYPRE_Int ia, ib, ic, jcol, num_nonzeros; + HYPRE_Int pos, i, i2, j, cnt; + HYPRE_Int *marker; + HYPRE_Int *map; + HYPRE_Int *temp; + + if (ncols_A != ncols_B) + { + hypre_error_w_msg(HYPRE_ERROR_GENERIC,"Warning! incompatible matrix dimensions!\n"); + return NULL; + } + + map = hypre_CTAlloc(HYPRE_Int, nrows_B, HYPRE_MEMORY_HOST); + temp = hypre_CTAlloc(HYPRE_Int, nrows_B, HYPRE_MEMORY_HOST); + for (i=0; i < nrows_B; i++) + { + map[i] = i; + temp[i] = row_nums[i]; + } + + hypre_qsort2i(temp,map,0,nrows_B-1); + + marker = hypre_CTAlloc(HYPRE_Int, ncols_A, HYPRE_MEMORY_HOST); + C_i = hypre_CTAlloc(HYPRE_Int, nrows_A+1, HYPRE_MEMORY_SHARED); + + for (ia = 0; ia < ncols_A; ia++) + marker[ia] = -1; + + num_nonzeros = 0; + C_i[0] = 0; + cnt = 0; + for (ic = 0; ic < nrows_A; ic++) + { + for (ia = A_i[ic]; ia < A_i[ic+1]; ia++) + { + jcol = A_j[ia]; + marker[jcol] = ic; + num_nonzeros++; + } + if (cnt < nrows_B && temp[cnt] == ic) + { + for (j = cnt; j < nrows_B; j++) + { + if (temp[j] == ic) + { + i2 = map[cnt++]; + for (ib = B_i[i2]; ib < B_i[i2+1]; ib++) + { + jcol = B_j[ib]; + if (marker[jcol] != ic) + { + marker[jcol] = ic; + num_nonzeros++; + } + } + } + else + break; + } + } + C_i[ic+1] = num_nonzeros; + } + + C = hypre_CSRMatrixCreate(nrows_A, ncols_A, num_nonzeros); + hypre_CSRMatrixI(C) = C_i; + hypre_CSRMatrixInitialize(C); + C_j = hypre_CSRMatrixJ(C); + C_data = hypre_CSRMatrixData(C); + + for (ia = 0; ia < ncols_A; ia++) + marker[ia] = -1; + + cnt = 0; + pos = 0; + for (ic = 0; ic < nrows_A; ic++) + { + for (ia = A_i[ic]; ia < A_i[ic+1]; ia++) + { + jcol = A_j[ia]; + C_j[pos] = jcol; + C_data[pos] = A_data[ia]; + marker[jcol] = pos; + pos++; + } + if (cnt < nrows_B && temp[cnt] == ic) + { + for (j = cnt; j < nrows_B; j++) + { + if (temp[j] == ic) + { + i2 = map[cnt++]; + for (ib = B_i[i2]; ib < B_i[i2+1]; ib++) + { + jcol = B_j[ib]; + if (marker[jcol] < C_i[ic]) + { + C_j[pos] = jcol; + C_data[pos] = B_data[ib]; + marker[jcol] = pos; + pos++; + } + else + { + C_data[marker[jcol]] += B_data[ib]; + } + } + } + else + break; + } + } + } + + hypre_TFree(marker, HYPRE_MEMORY_HOST); + hypre_TFree(map, HYPRE_MEMORY_HOST); + hypre_TFree(temp, HYPRE_MEMORY_HOST); + return C; +} + +/*-------------------------------------------------------------------------- * hypre_CSRMatrixSumElts: * Returns the sum of all matrix elements. *--------------------------------------------------------------------------*/ @@ -747,3 +1202,24 @@ return sum; } + +HYPRE_Real hypre_CSRMatrixFnorm( hypre_CSRMatrix *A ) +{ + HYPRE_Complex sum = 0; + HYPRE_Complex *data = hypre_CSRMatrixData( A ); + HYPRE_Int num_nonzeros = hypre_CSRMatrixNumNonzeros(A); + HYPRE_Int i, nrows, *A_i; + + nrows = hypre_CSRMatrixNumRows(A); + A_i = hypre_CSRMatrixI(A); + + hypre_assert(num_nonzeros == A_i[nrows]); + + for ( i=0; i()); + HYPRE_THRUST_CALL(lower_bound, col_map_offd_C, col_map_offd_C + num_cols_offd_C, + B_ext_offd_j, B_ext_offd_j + B_ext_offd_nnz, B_ext_offd_j); + + /* convert to row ptrs */ + B_ext_diag_i = hypreDevice_CsrRowIndicesToPtrs(num_rows, B_ext_diag_nnz, B_ext_diag_row_indices); + B_ext_offd_i = hypreDevice_CsrRowIndicesToPtrs(num_rows, B_ext_offd_nnz, B_ext_offd_row_indices); + + /* create diag and offd CSR */ + B_ext_diag = hypre_CSRMatrixCreate(num_rows, last_col_diag_B - first_col_diag_B + 1, B_ext_diag_nnz); + B_ext_offd = hypre_CSRMatrixCreate(num_rows, num_cols_offd_C, B_ext_offd_nnz); + + hypre_CSRMatrixI(B_ext_diag) = B_ext_diag_i; + hypre_CSRMatrixJ(B_ext_diag) = B_ext_diag_j; + hypre_CSRMatrixData(B_ext_diag) = B_ext_diag_a; + hypre_CSRMatrixNumNonzeros(B_ext_diag) = B_ext_diag_nnz; + hypre_CSRMatrixMemoryLocation(B_ext_diag) = HYPRE_MEMORY_DEVICE; + + hypre_CSRMatrixI(B_ext_offd) = B_ext_offd_i; + hypre_CSRMatrixJ(B_ext_offd) = B_ext_offd_j; + hypre_CSRMatrixData(B_ext_offd) = B_ext_offd_a; + hypre_CSRMatrixNumNonzeros(B_ext_offd) = B_ext_offd_nnz; + hypre_CSRMatrixMemoryLocation(B_ext_offd) = HYPRE_MEMORY_DEVICE; + + /* free */ + /* + hypre_TFree(B_ext_diag_row_indices, HYPRE_MEMORY_DEVICE); + hypre_TFree(B_ext_offd_row_indices, HYPRE_MEMORY_DEVICE); + hypre_TFree(B_ext_row_indices, HYPRE_MEMORY_DEVICE); + */ + hypre_TFree(work_mem, HYPRE_MEMORY_DEVICE); + + *map_B_to_C_ptr = map_B_to_C; + *num_cols_offd_C_ptr = num_cols_offd_C; + *col_map_offd_C_ptr = col_map_offd_C; + *B_ext_diag_ptr = B_ext_diag; + *B_ext_offd_ptr = B_ext_offd; + + return hypre_error_flag; +} + + +HYPRE_Int +hypre_CSRMatrixTransposeDevice(hypre_CSRMatrix *A, + hypre_CSRMatrix **AT_ptr, + HYPRE_Int data) +{ + HYPRE_Complex *A_data = hypre_CSRMatrixData(A); + HYPRE_Int *A_i = hypre_CSRMatrixI(A); + HYPRE_Int *A_j = hypre_CSRMatrixJ(A); + HYPRE_Int nrows_A = hypre_CSRMatrixNumRows(A); + HYPRE_Int ncols_A = hypre_CSRMatrixNumCols(A); + HYPRE_Int nnz_A = hypre_CSRMatrixNumNonzeros(A); + HYPRE_Complex *C_data; + HYPRE_Int *C_i; + HYPRE_Int *C_j; + hypre_CSRMatrix *C; + + hypreDevice_CSRSpTrans(nrows_A, ncols_A, nnz_A, A_i, A_j, A_data, &C_i, &C_j, &C_data, data); + + C = hypre_CSRMatrixCreate(ncols_A, nrows_A, nnz_A); + hypre_CSRMatrixI(C) = C_i; + hypre_CSRMatrixJ(C) = C_j; + hypre_CSRMatrixData(C) = C_data; + hypre_CSRMatrixMemoryLocation(C) = HYPRE_MEMORY_DEVICE; + + *AT_ptr = C; + + return hypre_error_flag; +} + +/*-------------------------------------------------------------------------- + * hypre_CSRMatrixAddPartial: + * adds matrix rows in the CSR matrix B to the CSR Matrix A, where row_nums[i] + * defines to which row of A the i-th row of B is added, and returns a CSR Matrix C; + * Repeated row indices are allowed in row_nums + * Note: The routine does not check for 0-elements which might be generated + * through cancellation of elements in A and B or already contained + * in A and B. To remove those, use hypre_CSRMatrixDeleteZeros + *--------------------------------------------------------------------------*/ + +hypre_CSRMatrix* +hypre_CSRMatrixAddPartialDevice( hypre_CSRMatrix *A, + hypre_CSRMatrix *B, + HYPRE_Int *row_nums) +{ + HYPRE_Complex *A_data = hypre_CSRMatrixData(A); + HYPRE_Int *A_i = hypre_CSRMatrixI(A); + HYPRE_Int *A_j = hypre_CSRMatrixJ(A); + HYPRE_Int nrows_A = hypre_CSRMatrixNumRows(A); + HYPRE_Int ncols_A = hypre_CSRMatrixNumCols(A); + HYPRE_Int nnz_A = hypre_CSRMatrixNumNonzeros(A); + HYPRE_Complex *B_data = hypre_CSRMatrixData(B); + HYPRE_Int *B_i = hypre_CSRMatrixI(B); + HYPRE_Int *B_j = hypre_CSRMatrixJ(B); + HYPRE_Int nrows_B = hypre_CSRMatrixNumRows(B); + HYPRE_Int ncols_B = hypre_CSRMatrixNumCols(B); + HYPRE_Int nnz_B = hypre_CSRMatrixNumNonzeros(B); + HYPRE_Complex *C_data; + HYPRE_Int *C_i; + HYPRE_Int *C_j; + HYPRE_Int nnzC; + hypre_CSRMatrix *C; + + if (ncols_A != ncols_B) + { + hypre_error_w_msg(HYPRE_ERROR_GENERIC,"Warning! incompatible matrix dimensions!\n"); + + return NULL; + } + + hypreDevice_CSRSpAdd(nrows_A, nrows_B, ncols_A, nnz_A, nnz_B, A_i, A_j, A_data, B_i, B_j, B_data, row_nums, + &nnzC, &C_i, &C_j, &C_data); + + C = hypre_CSRMatrixCreate(nrows_A, ncols_B, nnzC); + hypre_CSRMatrixI(C) = C_i; + hypre_CSRMatrixJ(C) = C_j; + hypre_CSRMatrixData(C) = C_data; + hypre_CSRMatrixMemoryLocation(C) = HYPRE_MEMORY_DEVICE; + + + return C; +} + +HYPRE_Int +hypre_CSRMatrixColNNzRealDevice( hypre_CSRMatrix *A, + HYPRE_Real *colnnz) +{ + HYPRE_Int *A_j = hypre_CSRMatrixJ(A); + HYPRE_Int ncols_A = hypre_CSRMatrixNumCols(A); + HYPRE_Int nnz_A = hypre_CSRMatrixNumNonzeros(A); + HYPRE_Int *A_j_sorted; + HYPRE_Int num_reduced_col_indices; + HYPRE_Int *reduced_col_indices; + HYPRE_Int *reduced_col_nnz; + + A_j_sorted = hypre_TAlloc(HYPRE_Int, nnz_A, HYPRE_MEMORY_DEVICE); + hypre_TMemcpy(A_j_sorted, A_j, HYPRE_Int, nnz_A, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_DEVICE); + HYPRE_THRUST_CALL(sort, A_j_sorted, A_j_sorted + nnz_A); + + reduced_col_indices = hypre_TAlloc(HYPRE_Int, ncols_A, HYPRE_MEMORY_DEVICE); + reduced_col_nnz = hypre_TAlloc(HYPRE_Int, ncols_A, HYPRE_MEMORY_DEVICE); + + thrust::pair new_end = + HYPRE_THRUST_CALL(reduce_by_key, A_j_sorted, A_j_sorted + nnz_A, + thrust::make_constant_iterator(1), + reduced_col_indices, + reduced_col_nnz); + + hypre_assert(new_end.first - reduced_col_indices == new_end.second - reduced_col_nnz); + + num_reduced_col_indices = new_end.first - reduced_col_indices; + + hypre_Memset(colnnz, 0, ncols_A * sizeof(HYPRE_Real), HYPRE_MEMORY_DEVICE); + HYPRE_THRUST_CALL(scatter, reduced_col_nnz, reduced_col_nnz + num_reduced_col_indices, + reduced_col_indices, colnnz); + + hypre_TFree(A_j_sorted, HYPRE_MEMORY_DEVICE); + hypre_TFree(reduced_col_indices, HYPRE_MEMORY_DEVICE); + hypre_TFree(reduced_col_nnz, HYPRE_MEMORY_DEVICE); + + return hypre_error_flag; +} + +__global__ void +hypreCUDAKernel_CSRMoveDiagFirst( HYPRE_Int nrows, + HYPRE_Int *ia, + HYPRE_Int *ja, + HYPRE_Complex *aa ) +{ + HYPRE_Int row = hypre_cuda_get_grid_warp_id<1,1>(); + + if (row >= nrows) + { + return; + } + + HYPRE_Int lane = hypre_cuda_get_lane_id<1>(); + HYPRE_Int i, p, q; + + if (lane < 2) + { + p = read_only_load(ia + row + lane); + } + q = __shfl_sync(HYPRE_WARP_FULL_MASK, p, 1); + p = __shfl_sync(HYPRE_WARP_FULL_MASK, p, 0); + + for (i = p + lane + 1; __any_sync(HYPRE_WARP_FULL_MASK, i < q); i += HYPRE_WARP_SIZE) + { + hypre_int find_diag = i < q && ja[i] == row; + + if (find_diag) + { + ja[i] = ja[p]; + ja[p] = row; + HYPRE_Complex tmp = aa[p]; + aa[p] = aa[i]; + aa[i] = tmp; + } + + if ( __any_sync(HYPRE_WARP_FULL_MASK, find_diag) ) + { + break; + } + } +} + +HYPRE_Int +hypre_CSRMatrixMoveDiagFirstDevice( hypre_CSRMatrix *A ) +{ + HYPRE_Int nrows = hypre_CSRMatrixNumRows(A); + HYPRE_Complex *A_data = hypre_CSRMatrixData(A); + HYPRE_Int *A_i = hypre_CSRMatrixI(A); + HYPRE_Int *A_j = hypre_CSRMatrixJ(A); + dim3 bDim, gDim; + + bDim = hypre_GetDefaultCUDABlockDimension(); + gDim = hypre_GetDefaultCUDAGridDimension(nrows, "warp", bDim); + + HYPRE_CUDA_LAUNCH(hypreCUDAKernel_CSRMoveDiagFirst, gDim, bDim, + nrows, A_i, A_j, A_data); + + return hypre_error_flag; +} + +#endif /* HYPRE_USING_CUDA */ + diff -Nru hypre-2.16.0/src/seq_mv/csr_matrix.c hypre-2.18.2/src/seq_mv/csr_matrix.c --- hypre-2.16.0/src/seq_mv/csr_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/csr_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -17,9 +12,7 @@ *****************************************************************************/ #include "seq_mv.h" -#ifdef HYPRE_USING_GPU -#include "gpukernels.h" -#endif + #ifdef HYPRE_PROFILE HYPRE_Real hypre_profile_times[HYPRE_TIMER_ID_COUNT] = { 0 }; #endif @@ -35,63 +28,53 @@ { hypre_CSRMatrix *matrix; - matrix = hypre_CTAlloc(hypre_CSRMatrix, 1, HYPRE_MEMORY_HOST); + matrix = hypre_CTAlloc(hypre_CSRMatrix, 1, HYPRE_MEMORY_HOST); - hypre_CSRMatrixData(matrix) = NULL; - hypre_CSRMatrixI(matrix) = NULL; - hypre_CSRMatrixJ(matrix) = NULL; - hypre_CSRMatrixBigJ(matrix) = NULL; - hypre_CSRMatrixRownnz(matrix) = NULL; - hypre_CSRMatrixNumRows(matrix) = num_rows; - hypre_CSRMatrixNumCols(matrix) = num_cols; - hypre_CSRMatrixNumNonzeros(matrix) = num_nonzeros; + hypre_CSRMatrixData(matrix) = NULL; + hypre_CSRMatrixI(matrix) = NULL; + hypre_CSRMatrixJ(matrix) = NULL; + hypre_CSRMatrixBigJ(matrix) = NULL; + hypre_CSRMatrixRownnz(matrix) = NULL; + hypre_CSRMatrixNumRows(matrix) = num_rows; + hypre_CSRMatrixNumCols(matrix) = num_cols; + hypre_CSRMatrixNumNonzeros(matrix) = num_nonzeros; + hypre_CSRMatrixMemoryLocation(matrix) = HYPRE_MEMORY_SHARED; /* HYPRE_MEMORY_UNSET; */ /* TODO !!! */ /* set defaults */ - hypre_CSRMatrixOwnsData(matrix) = 1; + hypre_CSRMatrixOwnsData(matrix) = 1; hypre_CSRMatrixNumRownnz(matrix) = num_rows; -#ifdef HYPRE_USING_UNIFIED_MEMORY - matrix->on_device=0; -#endif -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - matrix->mapped=-1; -#endif #ifdef HYPRE_BIGINT matrix->i_short=NULL; matrix->j_short=NULL; #endif return matrix; } + /*-------------------------------------------------------------------------- * hypre_CSRMatrixDestroy *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_CSRMatrixDestroy( hypre_CSRMatrix *matrix ) { - HYPRE_Int ierr=0; + HYPRE_Int ierr = 0; if (matrix) { -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - hypre_CSRMatrixUnMapFromDevice(matrix); -#endif - hypre_TFree(hypre_CSRMatrixI(matrix), HYPRE_MEMORY_SHARED); - hypre_CSRMatrixI(matrix) = NULL; - if (hypre_CSRMatrixRownnz(matrix)) - hypre_TFree(hypre_CSRMatrixRownnz(matrix), HYPRE_MEMORY_SHARED); + HYPRE_Int memory_location = hypre_CSRMatrixMemoryLocation(matrix); + + hypre_TFree(hypre_CSRMatrixI(matrix), memory_location); + hypre_TFree(hypre_CSRMatrixRownnz(matrix), memory_location); + if ( hypre_CSRMatrixOwnsData(matrix) ) { - hypre_TFree(hypre_CSRMatrixData(matrix), HYPRE_MEMORY_SHARED); - if (hypre_CSRMatrixJ(matrix)) - hypre_TFree(hypre_CSRMatrixJ(matrix), HYPRE_MEMORY_SHARED); - if (hypre_CSRMatrixBigJ(matrix)) - hypre_TFree(hypre_CSRMatrixBigJ(matrix), HYPRE_MEMORY_SHARED); - hypre_CSRMatrixData(matrix) = NULL; - hypre_CSRMatrixJ(matrix) = NULL; + hypre_TFree(hypre_CSRMatrixData(matrix), memory_location); + hypre_TFree(hypre_CSRMatrixJ(matrix), memory_location); + hypre_TFree(hypre_CSRMatrixBigJ(matrix), memory_location); } - hypre_TFree(matrix, HYPRE_MEMORY_HOST); - matrix = NULL; + + hypre_TFree(matrix, HYPRE_MEMORY_HOST); } return ierr; @@ -101,26 +84,67 @@ * hypre_CSRMatrixInitialize *--------------------------------------------------------------------------*/ -HYPRE_Int -hypre_CSRMatrixInitialize( hypre_CSRMatrix *matrix ) +HYPRE_Int +hypre_CSRMatrixInitialize_v2( hypre_CSRMatrix *matrix, HYPRE_Int bigInit, HYPRE_Int memory_location ) { HYPRE_Int num_rows = hypre_CSRMatrixNumRows(matrix); HYPRE_Int num_nonzeros = hypre_CSRMatrixNumNonzeros(matrix); -/* HYPRE_Int num_rownnz = hypre_CSRMatrixNumRownnz(matrix); */ + /* HYPRE_Int num_rownnz = hypre_CSRMatrixNumRownnz(matrix); */ - HYPRE_Int ierr=0; + HYPRE_Int ierr = 0; + + hypre_CSRMatrixMemoryLocation(matrix) = memory_location; - if ( ! hypre_CSRMatrixData(matrix) && num_nonzeros ) - hypre_CSRMatrixData(matrix) = hypre_CTAlloc(HYPRE_Complex, num_nonzeros, HYPRE_MEMORY_SHARED); - else { + /* Caveat: for pre-existing i, j, data, their memory location must be guaranteed to be consistent with `memory_location' + * Otherwise, mismatches will exist and problems will be encountered when being used, and freed */ + + if ( !hypre_CSRMatrixData(matrix) && num_nonzeros ) + { + hypre_CSRMatrixData(matrix) = hypre_CTAlloc(HYPRE_Complex, num_nonzeros, memory_location); + } + /* + else + { //if (PointerAttributes(hypre_CSRMatrixData(matrix))==HYPRE_HOST_POINTER) printf("MATREIX INITIAL WITH JHOST DATA\n"); } - if ( ! hypre_CSRMatrixI(matrix) ) - hypre_CSRMatrixI(matrix) = hypre_CTAlloc(HYPRE_Int, num_rows + 1, HYPRE_MEMORY_SHARED); -/* if ( ! hypre_CSRMatrixRownnz(matrix) ) - hypre_CSRMatrixRownnz(matrix) = hypre_CTAlloc(HYPRE_Int, num_rownnz, HYPRE_MEMORY_SHARED);*/ - if ( ! hypre_CSRMatrixJ(matrix) && num_nonzeros ) - hypre_CSRMatrixJ(matrix) = hypre_CTAlloc(HYPRE_Int, num_nonzeros, HYPRE_MEMORY_SHARED); + */ + + if ( !hypre_CSRMatrixI(matrix) ) + { + hypre_CSRMatrixI(matrix) = hypre_CTAlloc(HYPRE_Int, num_rows + 1, memory_location); + } + + /* + if (!hypre_CSRMatrixRownnz(matrix)) + { + hypre_CSRMatrixRownnz(matrix) = hypre_CTAlloc(HYPRE_Int, num_rownnz, memory_location); + } + */ + + if (bigInit) + { + if ( !hypre_CSRMatrixBigJ(matrix) && num_nonzeros ) + { + hypre_CSRMatrixBigJ(matrix) = hypre_CTAlloc(HYPRE_BigInt, num_nonzeros, memory_location); + } + } + else + { + if ( !hypre_CSRMatrixJ(matrix) && num_nonzeros ) + { + hypre_CSRMatrixJ(matrix) = hypre_CTAlloc(HYPRE_Int, num_nonzeros, memory_location); + } + } + + return ierr; +} + +HYPRE_Int +hypre_CSRMatrixInitialize( hypre_CSRMatrix *matrix ) +{ + HYPRE_Int ierr; + + ierr = hypre_CSRMatrixInitialize_v2( matrix, 0, hypre_CSRMatrixMemoryLocation(matrix) ); return ierr; } @@ -129,26 +153,12 @@ * hypre_CSRMatrixBigInitialize *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_CSRMatrixBigInitialize( hypre_CSRMatrix *matrix ) { - HYPRE_Int num_rows = hypre_CSRMatrixNumRows(matrix); - HYPRE_Int num_nonzeros = hypre_CSRMatrixNumNonzeros(matrix); -/* HYPRE_Int num_rownnz = hypre_CSRMatrixNumRownnz(matrix); */ + HYPRE_Int ierr; - HYPRE_Int ierr=0; - - if ( ! hypre_CSRMatrixData(matrix) && num_nonzeros ) - hypre_CSRMatrixData(matrix) = hypre_CTAlloc(HYPRE_Complex, num_nonzeros, HYPRE_MEMORY_SHARED); - else { - //if (PointerAttributes(hypre_CSRMatrixData(matrix))==HYPRE_HOST_POINTER) printf("MATREIX INITIAL WITH JHOST DATA\n"); - } - if ( ! hypre_CSRMatrixI(matrix) ) - hypre_CSRMatrixI(matrix) = hypre_CTAlloc(HYPRE_Int, num_rows + 1, HYPRE_MEMORY_SHARED); -/* if ( ! hypre_CSRMatrixRownnz(matrix) ) - hypre_CSRMatrixRownnz(matrix) = hypre_CTAlloc(HYPRE_Int, num_rownnz, HYPRE_MEMORY_SHARED);*/ - if ( ! hypre_CSRMatrixBigJ(matrix) && num_nonzeros ) - hypre_CSRMatrixBigJ(matrix) = hypre_CTAlloc(HYPRE_BigInt, num_nonzeros, HYPRE_MEMORY_SHARED); + ierr = hypre_CSRMatrixInitialize_v2( matrix, 1, hypre_CSRMatrixMemoryLocation(matrix) ); return ierr; } @@ -157,22 +167,24 @@ * hypre_CSRMatrixBigJtoJ *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_CSRMatrixBigJtoJ( hypre_CSRMatrix *matrix ) { - HYPRE_Int num_nonzeros = hypre_CSRMatrixNumNonzeros(matrix); - HYPRE_BigInt *matrix_big_j = hypre_CSRMatrixBigJ(matrix); - HYPRE_Int *matrix_j = NULL; - HYPRE_Int i; + HYPRE_Int num_nonzeros = hypre_CSRMatrixNumNonzeros(matrix); + HYPRE_BigInt *matrix_big_j = hypre_CSRMatrixBigJ(matrix); + HYPRE_Int *matrix_j = NULL; + HYPRE_Int i; /* HYPRE_Int num_rownnz = hypre_CSRMatrixNumRownnz(matrix); */ HYPRE_Int ierr=0; if (num_nonzeros && matrix_big_j ) { - matrix_j = hypre_CTAlloc(HYPRE_Int, num_nonzeros, HYPRE_MEMORY_SHARED); + matrix_j = hypre_CTAlloc(HYPRE_Int, num_nonzeros, HYPRE_MEMORY_SHARED); for (i=0; i < num_nonzeros; i++) - matrix_j[i] = (HYPRE_Int) matrix_big_j[i]; + { + matrix_j[i] = (HYPRE_Int) matrix_big_j[i]; + } hypre_CSRMatrixJ(matrix) = matrix_j; hypre_TFree(matrix_big_j, HYPRE_MEMORY_SHARED); hypre_CSRMatrixBigJ(matrix) = NULL; @@ -185,12 +197,12 @@ * hypre_CSRMatrixJtoBigJ *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_CSRMatrixJtoBigJ( hypre_CSRMatrix *matrix ) { - HYPRE_Int num_nonzeros = hypre_CSRMatrixNumNonzeros(matrix); - HYPRE_Int *matrix_j = hypre_CSRMatrixJ(matrix); - HYPRE_BigInt *matrix_big_j = NULL; + HYPRE_Int num_nonzeros = hypre_CSRMatrixNumNonzeros(matrix); + HYPRE_Int *matrix_j = hypre_CSRMatrixJ(matrix); + HYPRE_BigInt *matrix_big_j = NULL; HYPRE_Int i; /* HYPRE_Int num_rownnz = hypre_CSRMatrixNumRownnz(matrix); */ @@ -200,7 +212,9 @@ { matrix_big_j = hypre_CTAlloc(HYPRE_BigInt, num_nonzeros, HYPRE_MEMORY_SHARED); for (i=0; i < num_nonzeros; i++) - matrix_big_j[i] = (HYPRE_BigInt) matrix_j[i]; + { + matrix_big_j[i] = (HYPRE_BigInt) matrix_j[i]; + } hypre_CSRMatrixBigJ(matrix) = matrix_big_j; hypre_TFree(matrix_j, HYPRE_MEMORY_SHARED); hypre_CSRMatrixJ(matrix) = NULL; @@ -213,11 +227,11 @@ * hypre_CSRMatrixSetDataOwner *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_CSRMatrixSetDataOwner( hypre_CSRMatrix *matrix, - HYPRE_Int owns_data ) + HYPRE_Int owns_data ) { - HYPRE_Int ierr=0; + HYPRE_Int ierr = 0; hypre_CSRMatrixOwnsData(matrix) = owns_data; @@ -236,23 +250,26 @@ HYPRE_Int hypre_CSRMatrixSetRownnz( hypre_CSRMatrix *matrix ) { - HYPRE_Int ierr=0; + HYPRE_Int ierr = 0; HYPRE_Int num_rows = hypre_CSRMatrixNumRows(matrix); HYPRE_Int *A_i = hypre_CSRMatrixI(matrix); HYPRE_Int *Arownnz; HYPRE_Int i, adiag; - HYPRE_Int irownnz=0; + HYPRE_Int irownnz = 0; - for (i=0; i < num_rows; i++) + for (i = 0; i < num_rows; i++) { - adiag = (A_i[i+1] - A_i[i]); - if(adiag > 0) irownnz++; + adiag = A_i[i+1] - A_i[i]; + if(adiag > 0) + { + irownnz++; + } } hypre_CSRMatrixNumRownnz(matrix) = irownnz; - if ((irownnz == 0) || (irownnz == num_rows)) + if (irownnz == 0 || irownnz == num_rows) { hypre_CSRMatrixRownnz(matrix) = NULL; } @@ -260,13 +277,17 @@ { Arownnz = hypre_CTAlloc(HYPRE_Int, irownnz, HYPRE_MEMORY_SHARED); irownnz = 0; - for (i=0; i < num_rows; i++) + for (i = 0; i < num_rows; i++) { - adiag = A_i[i+1]-A_i[i]; - if(adiag > 0) Arownnz[irownnz++] = i; + adiag = A_i[i+1] - A_i[i]; + if(adiag > 0) + { + Arownnz[irownnz++] = i; + } } hypre_CSRMatrixRownnz(matrix) = Arownnz; } + return ierr; } @@ -289,7 +310,7 @@ HYPRE_Int max_col = 0; HYPRE_Int file_base = 1; - + HYPRE_Int j; /*---------------------------------------------------------- @@ -344,7 +365,7 @@ HYPRE_Int hypre_CSRMatrixPrint( hypre_CSRMatrix *matrix, - char *file_name ) + const char *file_name ) { FILE *fp; @@ -352,9 +373,9 @@ HYPRE_Int *matrix_i; HYPRE_Int *matrix_j; HYPRE_Int num_rows; - + HYPRE_Int file_base = 1; - + HYPRE_Int j; HYPRE_Int ierr = 0; @@ -404,6 +425,88 @@ return ierr; } +HYPRE_Int +hypre_CSRMatrixPrintMM( hypre_CSRMatrix *matrix, + HYPRE_Int basei, + HYPRE_Int basej, + HYPRE_Int trans, + const char *file_name ) +{ + FILE *fp; + + HYPRE_Complex *matrix_data; + HYPRE_Int *matrix_i; + HYPRE_Int *matrix_j; + HYPRE_Int num_rows, num_cols; + + /* HYPRE_Int file_base = 1; */ + + HYPRE_Int j,k; + + HYPRE_Int ierr = 0; + + /*---------------------------------------------------------- + * Print the matrix data + *----------------------------------------------------------*/ + + matrix_data = hypre_CSRMatrixData(matrix); + matrix_i = hypre_CSRMatrixI(matrix); + matrix_j = hypre_CSRMatrixJ(matrix); + num_rows = hypre_CSRMatrixNumRows(matrix); + num_cols = hypre_CSRMatrixNumCols(matrix); + + if (file_name) + { + fp = fopen(file_name, "w"); + } + else + { + fp = stdout; + } + + hypre_fprintf(fp, "%%%%MatrixMarket matrix coordinate real general\n"); + + hypre_assert(matrix_i[num_rows] == hypre_CSRMatrixNumNonzeros(matrix)); + + if (!trans) + { + hypre_fprintf(fp, "%d %d %d\n", num_rows, num_cols, hypre_CSRMatrixNumNonzeros(matrix)); + } + else + { + hypre_fprintf(fp, "%d %d %d\n", num_cols, num_rows, hypre_CSRMatrixNumNonzeros(matrix)); + } + + for (j = 0; j < num_rows; j++) + { + for (k = matrix_i[j]; k < matrix_i[j+1]; k++) + { + if (!trans) + { + hypre_fprintf(fp, "%d %d %.15e\n", j + basei, matrix_j[k] + basej, matrix_data[k]); + } + else + { + hypre_fprintf(fp, "%d %d %.15e\n", matrix_j[k] + basej, j + basei, matrix_data[k]); + } + } + } + + if (file_name) + { + fclose(fp); + } + + return ierr; +} + +HYPRE_Int +hypre_CSRMatrixPrint2( hypre_CSRMatrix *matrix, + const char *file_name ) +{ + return hypre_CSRMatrixPrintMM(matrix, 0, 0, 0, file_name); +} + /*-------------------------------------------------------------------------- * hypre_CSRMatrixPrintHB: print a CSRMatrix in Harwell-Boeing format *--------------------------------------------------------------------------*/ @@ -483,92 +586,84 @@ } /*-------------------------------------------------------------------------- - * hypre_CSRMatrixCopy: - * copys A to B, + * hypre_CSRMatrixCopy: copy A to B, * if copy_data = 0 only the structure of A is copied to B. - * the routine does not check if the dimensions of A and B match !!! + * the routine does not check if the dimensions/sparsity of A and B match !!! *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int hypre_CSRMatrixCopy( hypre_CSRMatrix *A, hypre_CSRMatrix *B, HYPRE_Int copy_data ) { - HYPRE_Int ierr=0; - HYPRE_Int num_rows = hypre_CSRMatrixNumRows(A); - HYPRE_Int *A_i = hypre_CSRMatrixI(A); - HYPRE_Int *A_j = hypre_CSRMatrixJ(A); + HYPRE_Int ierr = 0; + HYPRE_Int num_rows = hypre_CSRMatrixNumRows(A); + HYPRE_Int num_nonzeros = hypre_CSRMatrixNumNonzeros(A); + + HYPRE_Int *A_i = hypre_CSRMatrixI(A); + HYPRE_Int *A_j = hypre_CSRMatrixJ(A); + HYPRE_BigInt *A_bigj = hypre_CSRMatrixBigJ(A); HYPRE_Complex *A_data; - HYPRE_Int *B_i = hypre_CSRMatrixI(B); - HYPRE_Int *B_j = hypre_CSRMatrixJ(B); + + HYPRE_Int *B_i = hypre_CSRMatrixI(B); + HYPRE_Int *B_j = hypre_CSRMatrixJ(B); + HYPRE_BigInt *B_bigj = hypre_CSRMatrixBigJ(B); HYPRE_Complex *B_data; - HYPRE_Int num_nonzeros = hypre_CSRMatrixNumNonzeros(A); - HYPRE_Int i, j; + HYPRE_Int memlocA = hypre_CSRMatrixMemoryLocation(A); + HYPRE_Int memlocB = hypre_CSRMatrixMemoryLocation(B); -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i=0; i <= num_rows; i++) + hypre_TMemcpy(B_i, A_i, HYPRE_Int, num_rows + 1, memlocB, memlocA); + + if (A_j && B_j) { - B_i[i] = A_i[i]; + hypre_TMemcpy(B_j, A_j, HYPRE_Int, num_nonzeros, memlocB, memlocA); } -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(j) HYPRE_SMP_SCHEDULE -#endif - for (j = 0; j < num_nonzeros; ++j) + + if (A_bigj && B_bigj) { - B_j[j] = A_j[j]; + hypre_TMemcpy(B_bigj, A_bigj, HYPRE_BigInt, num_nonzeros, memlocB, memlocA); } if (copy_data) { A_data = hypre_CSRMatrixData(A); B_data = hypre_CSRMatrixData(B); -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(j) HYPRE_SMP_SCHEDULE -#endif - for (j=0; j < num_nonzeros; j++) - { - B_data[j] = A_data[j]; - } + hypre_TMemcpy(B_data, A_data, HYPRE_Complex, num_nonzeros, memlocB, memlocA); } + return ierr; } /*-------------------------------------------------------------------------- * hypre_CSRMatrixClone * Creates and returns a new copy of the argument, A. - * Data is not copied, only structural information is reproduced. * Copying is a deep copy in that no pointers are copied; new arrays are * created where necessary. *--------------------------------------------------------------------------*/ -hypre_CSRMatrix * hypre_CSRMatrixClone( hypre_CSRMatrix * A ) +hypre_CSRMatrix* +hypre_CSRMatrixClone_v2( hypre_CSRMatrix *A, HYPRE_Int copy_data, HYPRE_Int memory_location ) { - HYPRE_Int num_rows = hypre_CSRMatrixNumRows( A ); - HYPRE_Int num_cols = hypre_CSRMatrixNumCols( A ); + HYPRE_Int num_rows = hypre_CSRMatrixNumRows(A); + HYPRE_Int num_cols = hypre_CSRMatrixNumCols(A); HYPRE_Int num_nonzeros = hypre_CSRMatrixNumNonzeros( A ); - hypre_CSRMatrix * B = hypre_CSRMatrixCreate( num_rows, num_cols, num_nonzeros ); - HYPRE_Int * A_i; - HYPRE_Int * A_j; - HYPRE_Int * B_i; - HYPRE_Int * B_j; - HYPRE_Int i, j; - - hypre_CSRMatrixInitialize( B ); - - A_i = hypre_CSRMatrixI(A); - A_j = hypre_CSRMatrixJ(A); - B_i = hypre_CSRMatrixI(B); - B_j = hypre_CSRMatrixJ(B); - - for ( i=0; ion_device)&&(hypre_CSRMatrixNumNonzeros(A)>8192)){ - //printf("Pointer type %d value = %p\n",PointerAttributes((hypre_CSRMatrixI(A))),hypre_CSRMatrixI(A)); -#if defined(TRACK_MEMORY_ALLOCATIONS) - ASSERT_MANAGED(hypre_CSRMatrixData(A)); - ASSERT_MANAGED(hypre_CSRMatrixI(A)); - ASSERT_MANAGED(hypre_CSRMatrixJ(A)); + HYPRE_Complex *data = hypre_CSRMatrixData(A); + HYPRE_Int *ia = hypre_CSRMatrixI(A); + HYPRE_Int *ja = hypre_CSRMatrixJ(A); + HYPRE_Int nrow = hypre_CSRMatrixNumRows(A); + HYPRE_Int nnzA = hypre_CSRMatrixNumNonzeros(A); + + /* speical use of TMemcpy for prefetch */ + hypre_TMemcpy(data, data, HYPRE_Complex, nnzA, to_location, HYPRE_MEMORY_SHARED); + //hypre_HandleCudaPrefetchStreamNum(hypre_handle) ++; + hypre_TMemcpy(ia, ia, HYPRE_Int, nrow+1, to_location, HYPRE_MEMORY_SHARED); + //hypre_HandleCudaPrefetchStreamNum(hypre_handle) ++; + hypre_TMemcpy(ja, ja, HYPRE_Int, nnzA, to_location, HYPRE_MEMORY_SHARED); #endif - hypre_CheckErrorDevice(cudaMemPrefetchAsync(hypre_CSRMatrixData(A),hypre_CSRMatrixNumNonzeros(A)*sizeof(HYPRE_Complex),HYPRE_DEVICE,HYPRE_STREAM(4))); - hypre_CheckErrorDevice(cudaMemPrefetchAsync(hypre_CSRMatrixI(A),(hypre_CSRMatrixNumRows(A)+1)*sizeof(HYPRE_Int),HYPRE_DEVICE,HYPRE_STREAM(5))); - hypre_CheckErrorDevice(cudaMemPrefetchAsync(hypre_CSRMatrixJ(A),hypre_CSRMatrixNumNonzeros(A)*sizeof(HYPRE_Int),HYPRE_DEVICE,HYPRE_STREAM(6))); - hypre_CheckErrorDevice(cudaStreamSynchronize(HYPRE_STREAM(4))); - hypre_CheckErrorDevice(cudaStreamSynchronize(HYPRE_STREAM(5))); - hypre_CheckErrorDevice(cudaStreamSynchronize(HYPRE_STREAM(6))); -#ifdef HYPRE_USING_OPENMP_OFFLOAD - A->on_device=0; // Should be 1 for CUDA code. 0 for OMP for now -#else - A->on_device=1; -#endif - } - POP_RANGE; -} -void hypre_CSRMatrixPrefetchToDeviceBIGINT(hypre_CSRMatrix *A){ - if (hypre_CSRMatrixNumNonzeros(A)==0) return; - PUSH_RANGE_PAYLOAD("hypre_CSRMatrixPrefetchToDevice",0,hypre_CSRMatrixNumNonzeros(A)); - if ((!A->on_device)&&(hypre_CSRMatrixNumNonzeros(A)>8192)){ - //printf("Pointer type %d value = %p\n",PointerAttributes((hypre_CSRMatrixI(A))),hypre_CSRMatrixI(A)); -#if defined(TRACK_MEMORY_ALLOCATIONS) - ASSERT_MANAGED(hypre_CSRMatrixData(A)); - ASSERT_MANAGED(hypre_CSRMatrixI(A)); - ASSERT_MANAGED(hypre_CSRMatrixJ(A)); -#endif - hypre_CheckErrorDevice(cudaMemPrefetchAsync(hypre_CSRMatrixData(A),hypre_CSRMatrixNumNonzeros(A)*sizeof(HYPRE_Complex),HYPRE_DEVICE,HYPRE_STREAM(4))); - hypre_CheckErrorDevice(cudaMemPrefetchAsync(hypre_CSRMatrixI(A),(hypre_CSRMatrixNumRows(A)+1)*sizeof(HYPRE_Int),HYPRE_DEVICE,HYPRE_STREAM(5))); - hypre_CheckErrorDevice(cudaMemPrefetchAsync(hypre_CSRMatrixJ(A),hypre_CSRMatrixNumNonzeros(A)*sizeof(HYPRE_Int),HYPRE_DEVICE,HYPRE_STREAM(6))); - hypre_CheckErrorDevice(cudaStreamSynchronize(HYPRE_STREAM(4))); - hypre_CheckErrorDevice(cudaStreamSynchronize(HYPRE_STREAM(5))); - hypre_CheckErrorDevice(cudaStreamSynchronize(HYPRE_STREAM(6))); -#ifdef HYPRE_USING_OPENMP_OFFLOAD - A->on_device=0; // Should be 1 for CUDA code. 0 for OMP for now -#else - A->on_device=1; -#endif - } - POP_RANGE; -} -void hypre_CSRMatrixPrefetchToHost(hypre_CSRMatrix *A){ - PUSH_RANGE("hypre_CSRMatrixPrefetchToDevice",0); - if (A->on_device){ - A->on_device=0; - hypre_CheckErrorDevice(cudaMemPrefetchAsync(hypre_CSRMatrixData(A),hypre_CSRMatrixNumNonzeros(A)*sizeof(HYPRE_Complex),cudaCpuDeviceId,HYPRE_STREAM(4))); - hypre_CheckErrorDevice(cudaMemPrefetchAsync(hypre_CSRMatrixI(A),(hypre_CSRMatrixNumRows(A)+1)*sizeof(HYPRE_Int),cudaCpuDeviceId,HYPRE_STREAM(4))); - hypre_CheckErrorDevice(cudaMemPrefetchAsync(hypre_CSRMatrixJ(A),hypre_CSRMatrixNumNonzeros(A)*sizeof(HYPRE_Int),cudaCpuDeviceId,HYPRE_STREAM(4))); - hypre_CheckErrorDevice(cudaStreamSynchronize(HYPRE_STREAM(4))); - } - POP_RANGE; -} -hypre_int hypre_CSRMatrixIsManaged(hypre_CSRMatrix *a){ - return ((pointerIsManaged((void*)hypre_CSRMatrixData(a))) - && (pointerIsManaged((void*)hypre_CSRMatrixI(a))) - && (pointerIsManaged((void*)hypre_CSRMatrixJ(a)))); + return ierr; } -#endif -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD -void hypre_CSRMatrixMapToDevice(hypre_CSRMatrix *A){ - if (A==NULL) return; - HYPRE_Complex *A_data = hypre_CSRMatrixData(A); - HYPRE_Int *A_i = hypre_CSRMatrixI(A); - HYPRE_Int *A_j = hypre_CSRMatrixJ(A); - HYPRE_Int num_rows = hypre_CSRMatrixNumRows(A); - HYPRE_Int num_cols = hypre_CSRMatrixNumCols(A); - HYPRE_Int nnz = hypre_CSRMatrixNumNonzeros(A); - //printf("MAPPED %p sizes = %d %d \n",A,nnz,num_rows); - -#pragma omp target enter data map(to:A[0:0]) -#pragma omp target enter data map(alloc:A_data[:nnz]) if (nnz>0) -#pragma omp target enter data map(alloc:A_i[:num_rows+1]) if (num_rows>0) -#pragma omp target enter data map(alloc:A_j[:nnz]) if (nnz>0) - A->mapped=0; -} -void hypre_CSRMatrixUpdateToDevice(hypre_CSRMatrix *A){ - if (A==NULL) return; - HYPRE_Complex *A_data = hypre_CSRMatrixData(A); - HYPRE_Int *A_i = hypre_CSRMatrixI(A); - HYPRE_Int *A_j = hypre_CSRMatrixJ(A); - HYPRE_Int num_rows = hypre_CSRMatrixNumRows(A); - HYPRE_Int num_cols = hypre_CSRMatrixNumCols(A); - HYPRE_Int nnz = hypre_CSRMatrixNumNonzeros(A); - //printf("Updating MAtrix...%p \n",A); - //#pragma omp target update device(0) to(A[0:0]) - //printf("Updating MAtrix data...%p %d\n",A_data,nnz); -#pragma omp target update device(0) to(A_data[:nnz]) if (nnz>0) - //printf("Updating MAtrix I ...%p %d\n",A_i,num_rows); -#pragma omp target update device(0) to(A_i[:num_rows+1]) if (num_rows>0) - //printf("Updating MAtrix J ...%p %d\n",A_j,nnz); -#pragma omp target update device(0) to(A_j[:nnz]) if (nnz>0) - A->mapped=1; - //printf("Done \n"); -} -void hypre_CSRMatrixUnMapFromDevice(hypre_CSRMatrix *A){ - HYPRE_Complex *A_data = hypre_CSRMatrixData(A); - HYPRE_Int *A_i = hypre_CSRMatrixI(A); - HYPRE_Int *A_j = hypre_CSRMatrixJ(A); - HYPRE_Int num_rows = hypre_CSRMatrixNumRows(A); - HYPRE_Int num_cols = hypre_CSRMatrixNumCols(A); - HYPRE_Int nnz = hypre_CSRMatrixNumNonzeros(A); - //#pragma omp target exit data map(delete:A[0:0]) -#pragma omp target exit data map(delete:A_data[0:nnz]) if (nnz>0) -#pragma omp target exit data map(delete:A_i[0:num_rows+1]) if (num_rows>0) -#pragma omp target exit data map(delete:A_j[0:nnz]) if (nnz>0) + +/* +HYPRE_Int hypre_CSRMatrixIsManaged(hypre_CSRMatrix *a) +{ } -#endif +*/ + diff -Nru hypre-2.16.0/src/seq_mv/csr_matrix.h hypre-2.18.2/src/seq_mv/csr_matrix.h --- hypre-2.16.0/src/seq_mv/csr_matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/csr_matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/seq_mv/csr_matvec.c hypre-2.18.2/src/seq_mv/csr_matvec.c --- hypre-2.16.0/src/seq_mv/csr_matvec.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/csr_matvec.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -38,18 +33,14 @@ HYPRE_Real time_begin = hypre_MPI_Wtime(); #endif -#if defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) /* CUDA */ - PUSH_RANGE_PAYLOAD("MATVEC",0, hypre_CSRMatrixNumRows(A)); +#if defined(HYPRE_USING_CUDA) /* CUDA */ #ifdef HYPRE_BIGINT - HYPRE_Int ierr = hypre_CSRMatrixMatvecDeviceBIGINT( alpha,A,x,beta,b,y,offset ); + HYPRE_Int ierr = hypre_CSRMatrixMatvecDeviceBIGINT(alpha, A, x, beta, b, y, offset); #else - HYPRE_Int ierr = hypre_CSRMatrixMatvecDevice( alpha,A,x,beta,b,y,offset ); + HYPRE_Int ierr = hypre_CSRMatrixMatvecDevice(0, alpha, A, x, beta, b, y, offset); #endif - POP_RANGE; -#elif defined(HYPRE_USING_OPENMP_OFFLOAD) /* OMP 4.5 */ - PUSH_RANGE_PAYLOAD("MATVEC-OMP",0, hypre_CSRMatrixNumRows(A)); - HYPRE_Int ierr = hypre_CSRMatrixMatvecOutOfPlaceOOMP( alpha,A,x,beta,b,y,offset ); - POP_RANGE; +#elif defined(HYPRE_USING_DEVICE_OPENMP) /* OMP 4.5 */ + HYPRE_Int ierr = hypre_CSRMatrixMatvecOutOfPlaceOOMP(0, alpha, A, x, beta, b, y, offset); #else /* CPU */ HYPRE_Complex *A_data = hypre_CSRMatrixData(A); HYPRE_Int *A_i = hypre_CSRMatrixI(A) + offset; @@ -133,7 +124,7 @@ temp = beta / alpha; -/* use rownnz pointer to do the A*x multiplication when num_rownnz is smaller than num_rows */ + /* use rownnz pointer to do the A*x multiplication when num_rownnz is smaller than num_rows */ if (num_rownnz < xpar*(num_rows) || num_vectors > 1) { @@ -162,8 +153,8 @@ } else { - for (i = 0; i < num_rows*num_vectors; i++) - y_data[i] = b_data[i]; + for (i = 0; i < num_rows*num_vectors; i++) + y_data[i] = b_data[i]; } @@ -242,172 +233,175 @@ #pragma omp parallel private(i,jj,tempx) #endif { - HYPRE_Int iBegin = hypre_CSRMatrixGetLoadBalancedPartitionBegin(A); - HYPRE_Int iEnd = hypre_CSRMatrixGetLoadBalancedPartitionEnd(A); - hypre_assert(iBegin <= iEnd); - hypre_assert(iBegin >= 0 && iBegin <= num_rows); - hypre_assert(iEnd >= 0 && iEnd <= num_rows); - - if (0 == temp) - { - if (1 == alpha) // JSP: a common path - { - for (i = iBegin; i < iEnd; i++) - { - tempx = 0.0; - for (jj = A_i[i]; jj < A_i[i+1]; jj++) - { - tempx += A_data[jj] * x_data[A_j[jj]]; - } - y_data[i] = tempx; - } - } // y = A*x - else if (-1 == alpha) - { - for (i = iBegin; i < iEnd; i++) - { - tempx = 0.0; - for (jj = A_i[i]; jj < A_i[i+1]; jj++) - { - tempx -= A_data[jj] * x_data[A_j[jj]]; - } - y_data[i] = tempx; - } - } // y = -A*x - else - { - for (i = iBegin; i < iEnd; i++) - { - tempx = 0.0; - for (jj = A_i[i]; jj < A_i[i+1]; jj++) - { - tempx += A_data[jj] * x_data[A_j[jj]]; - } - y_data[i] = alpha*tempx; - } - } // y = alpha*A*x - } // temp == 0 - else if (-1 == temp) // beta == -alpha - { - if (1 == alpha) // JSP: a common path - { - for (i = iBegin; i < iEnd; i++) - { - tempx = -b_data[i]; - for (jj = A_i[i]; jj < A_i[i+1]; jj++) - { - tempx += A_data[jj] * x_data[A_j[jj]]; - } - y_data[i] = tempx; - } - } // y = A*x - y - else if (-1 == alpha) // JSP: a common path - { - for (i = iBegin; i < iEnd; i++) - { - tempx = b_data[i]; - for (jj = A_i[i]; jj < A_i[i+1]; jj++) - { - tempx -= A_data[jj] * x_data[A_j[jj]]; + HYPRE_Int iBegin = hypre_CSRMatrixGetLoadBalancedPartitionBegin(A); + HYPRE_Int iEnd = hypre_CSRMatrixGetLoadBalancedPartitionEnd(A); + hypre_assert(iBegin <= iEnd); + hypre_assert(iBegin >= 0 && iBegin <= num_rows); + hypre_assert(iEnd >= 0 && iEnd <= num_rows); + + if (0 == temp) + { + if (1 == alpha) // JSP: a common path + { + for (i = iBegin; i < iEnd; i++) + { + tempx = 0.0; + for (jj = A_i[i]; jj < A_i[i+1]; jj++) + { + tempx += A_data[jj] * x_data[A_j[jj]]; + } + y_data[i] = tempx; + } + } // y = A*x + else if (-1 == alpha) + { + for (i = iBegin; i < iEnd; i++) + { + tempx = 0.0; + for (jj = A_i[i]; jj < A_i[i+1]; jj++) + { + tempx -= A_data[jj] * x_data[A_j[jj]]; + } + y_data[i] = tempx; } - y_data[i] = tempx; - } - } // y = -A*x + y - else - { - for (i = iBegin; i < iEnd; i++) + } // y = -A*x + else { - tempx = -b_data[i]; - for (jj = A_i[i]; jj < A_i[i+1]; jj++) + for (i = iBegin; i < iEnd; i++) { - tempx += A_data[jj] * x_data[A_j[jj]]; + tempx = 0.0; + for (jj = A_i[i]; jj < A_i[i+1]; jj++) + { + tempx += A_data[jj] * x_data[A_j[jj]]; + } + y_data[i] = alpha*tempx; + } + } // y = alpha*A*x + } // temp == 0 + else if (-1 == temp) // beta == -alpha + { + if (1 == alpha) // JSP: a common path + { + for (i = iBegin; i < iEnd; i++) + { + tempx = -b_data[i]; + for (jj = A_i[i]; jj < A_i[i+1]; jj++) + { + tempx += A_data[jj] * x_data[A_j[jj]]; + } + y_data[i] = tempx; + } + } // y = A*x - y + else if (-1 == alpha) // JSP: a common path + { + for (i = iBegin; i < iEnd; i++) + { + tempx = b_data[i]; + for (jj = A_i[i]; jj < A_i[i+1]; jj++) + { + tempx -= A_data[jj] * x_data[A_j[jj]]; + } + y_data[i] = tempx; } - y_data[i] = alpha*tempx; - } - } // y = alpha*(A*x - y) - } // temp == -1 - else if (1 == temp) - { - if (1 == alpha) // JSP: a common path - { - for (i = iBegin; i < iEnd; i++) + } // y = -A*x + y + else { - tempx = b_data[i]; - for (jj = A_i[i]; jj < A_i[i+1]; jj++) + for (i = iBegin; i < iEnd; i++) { - tempx += A_data[jj] * x_data[A_j[jj]]; + tempx = -b_data[i]; + for (jj = A_i[i]; jj < A_i[i+1]; jj++) + { + tempx += A_data[jj] * x_data[A_j[jj]]; + } + y_data[i] = alpha*tempx; + } + } // y = alpha*(A*x - y) + } // temp == -1 + else if (1 == temp) + { + if (1 == alpha) // JSP: a common path + { + for (i = iBegin; i < iEnd; i++) + { + tempx = b_data[i]; + for (jj = A_i[i]; jj < A_i[i+1]; jj++) + { + tempx += A_data[jj] * x_data[A_j[jj]]; + } + y_data[i] = tempx; + } + } // y = A*x + y + else if (-1 == alpha) + { + for (i = iBegin; i < iEnd; i++) + { + tempx = -b_data[i]; + for (jj = A_i[i]; jj < A_i[i+1]; jj++) + { + tempx -= A_data[jj] * x_data[A_j[jj]]; + } + y_data[i] = tempx; } - y_data[i] = tempx; - } - } // y = A*x + y - else if (-1 == alpha) - { - for (i = iBegin; i < iEnd; i++) + } // y = -A*x - y + else { - tempx = -b_data[i]; - for (jj = A_i[i]; jj < A_i[i+1]; jj++) + for (i = iBegin; i < iEnd; i++) { - tempx -= A_data[jj] * x_data[A_j[jj]]; + tempx = b_data[i]; + for (jj = A_i[i]; jj < A_i[i+1]; jj++) + { + tempx += A_data[jj] * x_data[A_j[jj]]; + } + y_data[i] = alpha*tempx; } - y_data[i] = tempx; - } - } // y = -A*x - y + } // y = alpha*(A*x + y) + } else { - for (i = iBegin; i < iEnd; i++) + if (1 == alpha) // JSP: a common path { - tempx = b_data[i]; - for (jj = A_i[i]; jj < A_i[i+1]; jj++) + for (i = iBegin; i < iEnd; i++) { - tempx += A_data[jj] * x_data[A_j[jj]]; + tempx = b_data[i]*temp; + for (jj = A_i[i]; jj < A_i[i+1]; jj++) + { + tempx += A_data[jj] * x_data[A_j[jj]]; + } + y_data[i] = tempx; + } + } // y = A*x + temp*y + else if (-1 == alpha) + { + for (i = iBegin; i < iEnd; i++) + { + tempx = -b_data[i]*temp; + for (jj = A_i[i]; jj < A_i[i+1]; jj++) + { + tempx -= A_data[jj] * x_data[A_j[jj]]; + } + y_data[i] = tempx; } - y_data[i] = alpha*tempx; - } - } // y = alpha*(A*x + y) - } - else - { - if (1 == alpha) // JSP: a common path - { - for (i = iBegin; i < iEnd; i++) - { - tempx = b_data[i]*temp; - for (jj = A_i[i]; jj < A_i[i+1]; jj++) - { - tempx += A_data[jj] * x_data[A_j[jj]]; - } - y_data[i] = tempx; - } - } // y = A*x + temp*y - else if (-1 == alpha) - { - for (i = iBegin; i < iEnd; i++) - { - tempx = -b_data[i]*temp; - for (jj = A_i[i]; jj < A_i[i+1]; jj++) - { - tempx -= A_data[jj] * x_data[A_j[jj]]; - } - y_data[i] = tempx; - } - } // y = -A*x - temp*y - else - { - for (i = iBegin; i < iEnd; i++) + } // y = -A*x - temp*y + else { - tempx = b_data[i]*temp; - for (jj = A_i[i]; jj < A_i[i+1]; jj++) + for (i = iBegin; i < iEnd; i++) { - tempx += A_data[jj] * x_data[A_j[jj]]; + tempx = b_data[i]*temp; + for (jj = A_i[i]; jj < A_i[i+1]; jj++) + { + tempx += A_data[jj] * x_data[A_j[jj]]; + } + y_data[i] = alpha*tempx; } - y_data[i] = alpha*tempx; - } - } // y = alpha*(A*x + temp*y) - } // temp != 0 && temp != -1 && temp != 1 + } // y = alpha*(A*x + temp*y) + } // temp != 0 && temp != -1 && temp != 1 } // omp parallel } - if (x == y) hypre_SeqVectorDestroy(x_tmp); + if (x == y) + { + hypre_SeqVectorDestroy(x_tmp); + } #endif /* CPU */ @@ -428,18 +422,6 @@ return hypre_CSRMatrixMatvecOutOfPlace(alpha, A, x, beta, y, y, 0); } -#if defined (HYPRE_USING_UNIFIED_MEMORY) -HYPRE_Int -hypre_CSRMatrixMatvec3( HYPRE_Complex alpha, - hypre_CSRMatrix *A, - hypre_Vector *x, - HYPRE_Complex beta, - hypre_Vector *y ) -{ - return hypre_CSRMatrixMatvecOutOfPlaceOOMP3(alpha, A, x, beta, y, y, 0); -} -#endif - /*-------------------------------------------------------------------------- * hypre_CSRMatrixMatvecT * @@ -457,6 +439,11 @@ HYPRE_Complex beta, hypre_Vector *y ) { +#if defined(HYPRE_USING_CUDA) /* CUDA */ + HYPRE_Int ierr = hypre_CSRMatrixMatvecDevice(1, alpha, A, x, beta, y, y, 0 ); +#elif defined(HYPRE_USING_DEVICE_OPENMP) /* OMP 4.5 */ + HYPRE_Int ierr = hypre_CSRMatrixMatvecOutOfPlaceOOMP(1, alpha, A, x, beta, y, y, 0); +#else /* CPU */ HYPRE_Complex *A_data = hypre_CSRMatrixData(A); HYPRE_Int *A_i = hypre_CSRMatrixI(A); HYPRE_Int *A_j = hypre_CSRMatrixJ(A); @@ -653,18 +640,21 @@ #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif for (i = 0; i < num_cols*num_vectors; i++) + { y_data[i] *= alpha; + } } if (x == y) hypre_SeqVectorDestroy(x_tmp); +#endif + return ierr; } /*-------------------------------------------------------------------------- * hypre_CSRMatrixMatvec_FF *--------------------------------------------------------------------------*/ - HYPRE_Int hypre_CSRMatrixMatvec_FF( HYPRE_Complex alpha, hypre_CSRMatrix *A, @@ -787,9 +777,11 @@ return ierr; } -#if defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) + +#if defined(HYPRE_USING_CUDA) HYPRE_Int -hypre_CSRMatrixMatvecDevice( HYPRE_Complex alpha, +hypre_CSRMatrixMatvecDevice( HYPRE_Int trans, + HYPRE_Complex alpha, hypre_CSRMatrix *A, hypre_Vector *x, HYPRE_Complex beta, @@ -800,161 +792,86 @@ #ifdef HYPRE_BIGINT hypre_error_w_msg(HYPRE_ERROR_GENERIC,"ERROR: hypre_CSRMatvecDevice should not be called when bigint is enabled!"); #else - static cusparseHandle_t handle; - static cusparseMatDescr_t descr; - static HYPRE_Int FirstCall=1; - cusparseStatus_t status; - static cudaStream_t s[10]; - static HYPRE_Int myid; - - if (b!=y){ - - PUSH_RANGE_PAYLOAD("MEMCPY",1,y->size-offset); - VecCopy(y->data,b->data,(y->size-offset),HYPRE_STREAM(4)); - POP_RANGE - } - - if (x==y) hypre_error_w_msg(HYPRE_ERROR_GENERIC,"ERROR::x and y are the same pointer in hypre_CSRMatrixMatvecDevice\n"); - - if (FirstCall){ - PUSH_RANGE("FIRST_CALL",4); - - handle=getCusparseHandle(); - - status= cusparseCreateMatDescr(&descr); - if (status != CUSPARSE_STATUS_SUCCESS) { - hypre_error_w_msg(HYPRE_ERROR_GENERIC,"ERROR:: Matrix descriptor initialization failed\n"); - return hypre_error_flag; - } - - cusparseSetMatType(descr,CUSPARSE_MATRIX_TYPE_GENERAL); - cusparseSetMatIndexBase(descr,CUSPARSE_INDEX_BASE_ZERO); - - FirstCall=0; - hypre_int jj; - for(jj=0;jj<5;jj++) - s[jj]=HYPRE_STREAM(jj); - nvtxNameCudaStreamA(s[4], "HYPRE_COMPUTE_STREAM"); - hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); - myid++; - POP_RANGE; - } - - PUSH_RANGE("PREFETCH+SPMV",2); - - hypre_CSRMatrixPrefetchToDevice(A); - hypre_SeqVectorPrefetchToDevice(x); - hypre_SeqVectorPrefetchToDevice(y); - - //if (offset!=0) hypre_printf("WARNING:: Offset is not zero in hypre_CSRMatrixMatvecDevice :: \n"); - cusparseErrchk(cusparseDcsrmv(handle , - CUSPARSE_OPERATION_NON_TRANSPOSE, - A->num_rows-offset, A->num_cols, A->num_nonzeros, - &alpha, descr, - A->data ,A->i+offset,A->j, - x->data, &beta, y->data+offset)); - - if (!GetAsyncMode()){ - hypre_CheckErrorDevice(cudaStreamSynchronize(s[4])); - } - POP_RANGE; -#endif - return hypre_error_flag; - -} -HYPRE_Int -hypre_CSRMatrixMatvecDeviceBIGINT( HYPRE_Complex alpha, - hypre_CSRMatrix *A, - hypre_Vector *x, - HYPRE_Complex beta, - hypre_Vector *b, - hypre_Vector *y, - HYPRE_Int offset ) -{ -#ifdef HYPRE_BIGINT - static cusparseHandle_t handle; - static cusparseMatDescr_t descr; - static HYPRE_Int FirstCall=1; - cusparseStatus_t status; - static cudaStream_t s[10]; - static HYPRE_Int myid; + cusparseHandle_t handle = hypre_HandleCusparseHandle(hypre_handle); + cusparseMatDescr_t descr = hypre_HandleCusparseMatDescr(hypre_handle); - if (b!=y){ + hypre_CSRMatrixPrefetch(A, HYPRE_MEMORY_DEVICE); + hypre_SeqVectorPrefetch(x, HYPRE_MEMORY_DEVICE); + hypre_SeqVectorPrefetch(b, HYPRE_MEMORY_DEVICE); - PUSH_RANGE_PAYLOAD("MEMCPY",1,y->size-offset); - VecCopy(y->data,b->data,(y->size-offset),HYPRE_STREAM(4)); - POP_RANGE - } - - if (x==y) fprintf(stderr,"ERROR::x and y are the same pointer in hypre_CSRMatrixMatvecDevice\n"); - - if (FirstCall){ - PUSH_RANGE("FIRST_CALL",4); - - handle=getCusparseHandle(); - - status= cusparseCreateMatDescr(&descr); - if (status != CUSPARSE_STATUS_SUCCESS) { - printf("ERROR:: Matrix descriptor initialization failed\n"); - exit(2); - } - - cusparseSetMatType(descr,CUSPARSE_MATRIX_TYPE_GENERAL); - cusparseSetMatIndexBase(descr,CUSPARSE_INDEX_BASE_ZERO); - - FirstCall=0; - hypre_int jj; - for(jj=0;jj<5;jj++) - s[jj]=HYPRE_STREAM(jj); - nvtxNameCudaStreamA(s[4], "HYPRE_COMPUTE_STREAM"); - hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); - myid++; - POP_RANGE; - } - - PUSH_RANGE("PREFETCH+SPMV",2); - hypre_int num_rows = hypre_CSRMatrixNumRows(A); - hypre_int num_cols = hypre_CSRMatrixNumCols(A); - hypre_int num_nonzeros = hypre_CSRMatrixNumNonzeros(A); + if (b != y) + { + hypre_SeqVectorPrefetch(y, HYPRE_MEMORY_DEVICE); + } - if (A->i_short==NULL) { + if (b != y) + { + HYPRE_THRUST_CALL( copy_n, b->data, y->size-offset, y->data ); + } + if (x == y) + { + hypre_error_w_msg(HYPRE_ERROR_GENERIC,"ERROR::x and y are the same pointer in hypre_CSRMatrixMatvecDevice\n"); + } + // TODO + if (offset != 0) + { + hypre_printf("WARNING:: Offset is not zero in hypre_CSRMatrixMatvecDevice :: \n"); + } - A->i_short = hypre_CTAlloc(hypre_int, num_rows + 1, HYPRE_MEMORY_SHARED); - A->j_short = hypre_CTAlloc(hypre_int, num_nonzeros, HYPRE_MEMORY_SHARED); + hypre_assert(offset == 0); - hypre_CSRMatrixPrefetchToDevice(A); - hypre_CSRMatrixPrefetchToDeviceBIGINT(A); + if (trans) + { + HYPRE_Complex *csc_a = hypre_TAlloc(HYPRE_Complex, A->num_nonzeros, HYPRE_MEMORY_DEVICE); + HYPRE_Int *csc_j = hypre_TAlloc(HYPRE_Int, A->num_nonzeros, HYPRE_MEMORY_DEVICE); + HYPRE_Int *csc_i = hypre_TAlloc(HYPRE_Int, A->num_cols+1, HYPRE_MEMORY_DEVICE); - BigToSmallCopy(A->i_short,A->i,num_rows+1,0); - BigToSmallCopy(A->j_short,A->j,num_nonzeros,0); + HYPRE_CUSPARSE_CALL( cusparseDcsr2csc(handle, A->num_rows, A->num_cols, A->num_nonzeros, + A->data, A->i, A->j, csc_a, csc_j, csc_i, + CUSPARSE_ACTION_NUMERIC, CUSPARSE_INDEX_BASE_ZERO) ); - hypre_CheckErrorDevice(cudaStreamSynchronize(0)); - //hypre_printf("BIGINT MOD :: Arrays copied \n"); - } + HYPRE_CUSPARSE_CALL( cusparseDcsrmv(handle, CUSPARSE_OPERATION_NON_TRANSPOSE, + A->num_cols, A->num_rows, A->num_nonzeros, + &alpha, descr, + csc_a, csc_i, csc_j, + x->data, &beta, y->data) ); - //hypre_CSRMatrixPrefetchToDevice(A); - hypre_SeqVectorPrefetchToDevice(x); - hypre_SeqVectorPrefetchToDevice(y); + hypre_TFree(csc_a, HYPRE_MEMORY_DEVICE); + hypre_TFree(csc_i, HYPRE_MEMORY_DEVICE); + hypre_TFree(csc_j, HYPRE_MEMORY_DEVICE); + } + else + { + HYPRE_CUSPARSE_CALL( cusparseDcsrmv(handle, CUSPARSE_OPERATION_NON_TRANSPOSE, + A->num_rows-offset, A->num_cols, A->num_nonzeros, + &alpha, descr, + A->data, A->i+offset, A->j, + x->data, &beta, y->data+offset) ); + } - if (offset!=0) hypre_error_w_msg(HYPRE_ERROR_GENERIC, "WARNING:: Offset is not zero in hypre_CSRMatrixMatvecDevice \n"); + hypre_SyncCudaComputeStream(hypre_handle); +#endif - cusparseErrchk(cusparseDcsrmv(handle , - CUSPARSE_OPERATION_NON_TRANSPOSE, - num_rows-offset, num_cols, num_nonzeros, - &alpha, descr, - A->data ,A->i_short+offset,A->j_short, - x->data, &beta, y->data+offset)); + return hypre_error_flag; +} - if (!GetAsyncMode()){ - hypre_CheckErrorDevice(cudaStreamSynchronize(s[4])); - } - POP_RANGE; +HYPRE_Int +hypre_CSRMatrixMatvecDeviceBIGINT( HYPRE_Complex alpha, + hypre_CSRMatrix *A, + hypre_Vector *x, + HYPRE_Complex beta, + hypre_Vector *b, + hypre_Vector *y, + HYPRE_Int offset ) +{ +#ifdef HYPRE_BIGINT +#error "TODO BigInt" #endif return 0; - } #endif + diff -Nru hypre-2.16.0/src/seq_mv/csr_matvec_oomp.c hypre-2.18.2/src/seq_mv/csr_matvec_oomp.c --- hypre-2.16.0/src/seq_mv/csr_matvec_oomp.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/csr_matvec_oomp.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -16,13 +11,9 @@ * *****************************************************************************/ -//#if defined(HYPRE_USING_UNIFIED_MEMORY) - #include "seq_mv.h" -#include -#define NUM_TEAMS 2048 -#define NUM_THREADS 1024 +#if defined(HYPRE_USING_DEVICE_OPENMP) /*-------------------------------------------------------------------------- * hypre_CSRMatrixMatvec @@ -30,522 +21,122 @@ /* y[offset:end] = alpha*A[offset:end,:]*x + beta*b[offset:end] */ HYPRE_Int -hypre_CSRMatrixMatvecOutOfPlaceOOMP2( HYPRE_Complex alpha, - hypre_CSRMatrix *A, - hypre_Vector *x, - HYPRE_Complex beta, - hypre_Vector *b, - hypre_Vector *y, - HYPRE_Int offset ) +hypre_CSRMatrixMatvecOutOfPlaceOOMP( HYPRE_Int trans, + HYPRE_Complex alpha, + hypre_CSRMatrix *A, + hypre_Vector *x, + HYPRE_Complex beta, + hypre_Vector *b, + hypre_Vector *y, + HYPRE_Int offset ) { - /* printf("CALLING OOOMP MATVE\n"); */ -#ifdef HYPRE_PROFILE - HYPRE_Real time_begin = hypre_MPI_Wtime(); -#endif - -#if defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) - PUSH_RANGE_PAYLOAD("MATVEC_OOMP",0, hypre_CSRMatrixNumRows(A)); - HYPRE_Int ierr = hypre_CSRMatrixMatvecDevice( alpha,A,x,beta,b,y,offset ); - POP_RANGE; -#else + HYPRE_Int A_nrows = hypre_CSRMatrixNumRows(A); + HYPRE_Int A_ncols = hypre_CSRMatrixNumCols(A); + HYPRE_Int A_nnz = hypre_CSRMatrixNumNonzeros(A); HYPRE_Complex *A_data = hypre_CSRMatrixData(A); HYPRE_Int *A_i = hypre_CSRMatrixI(A) + offset; HYPRE_Int *A_j = hypre_CSRMatrixJ(A); - HYPRE_Int num_rows = hypre_CSRMatrixNumRows(A) - offset; - HYPRE_Int num_cols = hypre_CSRMatrixNumCols(A); - /*HYPRE_Int num_nnz = hypre_CSRMatrixNumNonzeros(A);*/ - - HYPRE_Int *A_rownnz = hypre_CSRMatrixRownnz(A); - HYPRE_Int num_rownnz = hypre_CSRMatrixNumRownnz(A); - + HYPRE_Int y_size = hypre_VectorSize(y) - offset; HYPRE_Complex *x_data = hypre_VectorData(x); HYPRE_Complex *b_data = hypre_VectorData(b) + offset; HYPRE_Complex *y_data = hypre_VectorData(y) + offset; - HYPRE_Int x_size = hypre_VectorSize(x); - HYPRE_Int b_size = hypre_VectorSize(b) - offset; - HYPRE_Int y_size = hypre_VectorSize(y) - offset; - HYPRE_Int num_vectors = hypre_VectorNumVectors(x); - HYPRE_Int idxstride_y = hypre_VectorIndexStride(y); - HYPRE_Int vecstride_y = hypre_VectorVectorStride(y); - /*HYPRE_Int idxstride_b = hypre_VectorIndexStride(b); - HYPRE_Int vecstride_b = hypre_VectorVectorStride(b);*/ - HYPRE_Int idxstride_x = hypre_VectorIndexStride(x); - HYPRE_Int vecstride_x = hypre_VectorVectorStride(x); - - HYPRE_Complex temp, tempx; - - HYPRE_Int i, j, jj; - - HYPRE_Int m; - - HYPRE_Real xpar=0.7; - - HYPRE_Int ierr = 0; - hypre_Vector *x_tmp = NULL; - - /*--------------------------------------------------------------------- - * Check for size compatibility. Matvec returns ierr = 1 if - * length of X doesn't equal the number of columns of A, - * ierr = 2 if the length of Y doesn't equal the number of rows - * of A, and ierr = 3 if both are true. - * - * Because temporary vectors are often used in Matvec, none of - * these conditions terminates processing, and the ierr flag - * is informational only. - *--------------------------------------------------------------------*/ - - hypre_assert( num_vectors == hypre_VectorNumVectors(y) ); - hypre_assert( num_vectors == hypre_VectorNumVectors(b) ); - - if (num_cols != x_size) - ierr = 1; - - if (num_rows != y_size || num_rows != b_size) - ierr = 2; + HYPRE_Int i; - if (num_cols != x_size && (num_rows != y_size || num_rows != b_size)) - ierr = 3; +#ifdef HYPRE_USING_CUSPARSE + cusparseHandle_t handle = hypre_HandleCusparseHandle(hypre_handle); + cusparseMatDescr_t descr = hypre_HandleCusparseMatDescr(hypre_handle); +#endif - /*----------------------------------------------------------------------- - * Do (alpha == 0.0) computation - RDF: USE MACHINE EPS - *-----------------------------------------------------------------------*/ + hypre_CSRMatrixPrefetch(A, HYPRE_MEMORY_DEVICE); + hypre_SeqVectorPrefetch(x, HYPRE_MEMORY_DEVICE); + hypre_SeqVectorPrefetch(b, HYPRE_MEMORY_DEVICE); - if (alpha == 0.0) + if (b != y) { - if (y_data!=b_data){ -#ifdef HYPRE_USING_OPENMP_OFFLOAD - //printf("Sub loop 0\n"); -#pragma omp target teams distribute parallel for num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) is_device_ptr(y_data,b_data) -#endif - for (i = 0; i < num_rows*num_vectors; i++) - y_data[i] = beta*b_data[i]; - } else { -#ifdef HYPRE_USING_OPENMP_OFFLOAD - //printf("Sub loop 1\n"); -#pragma omp target teams distribute parallel for num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) is_device_ptr(y_data) -#endif - for (i = 0; i < num_rows*num_vectors; i++) - y_data[i] *= beta; - } -#ifdef HYPRE_PROFILE - hypre_profile_times[HYPRE_TIMER_ID_MATVEC] += hypre_MPI_Wtime() - time_begin; -#endif + hypre_SeqVectorPrefetch(y, HYPRE_MEMORY_DEVICE); + } - return ierr; + if (b != y) + { +#pragma omp target teams distribute parallel for private(i) is_device_ptr(y_data, b_data) + for (i = 0; i < y_size; i++) + { + y_data[i] = b_data[i]; + } } if (x == y) { - x_tmp = hypre_SeqVectorCloneDeep(x); - x_data = hypre_VectorData(x_tmp); - } - - /*----------------------------------------------------------------------- - * y = (beta/alpha)*y - *-----------------------------------------------------------------------*/ + hypre_error_w_msg(HYPRE_ERROR_GENERIC,"ERROR::x and y are the same pointer in hypre_CSRMatrixMatvecDevice\n"); + } - temp = beta / alpha; + // TODO + if (offset != 0) + { + hypre_printf("WARNING:: Offset is not zero in hypre_CSRMatrixMatvecDevice :: \n"); + } -/* use rownnz pointer to do the A*x multiplication when num_rownnz is smaller than num_rows */ + hypre_assert(offset == 0); - if (num_rownnz < xpar*(num_rows) || num_vectors > 1) + if (trans) { - /*----------------------------------------------------------------------- - * y = (beta/alpha)*y - *-----------------------------------------------------------------------*/ + HYPRE_Complex *csc_a = hypre_TAlloc(HYPRE_Complex, A->num_nonzeros, HYPRE_MEMORY_DEVICE); + HYPRE_Int *csc_j = hypre_TAlloc(HYPRE_Int, A->num_nonzeros, HYPRE_MEMORY_DEVICE); + HYPRE_Int *csc_i = hypre_TAlloc(HYPRE_Int, A->num_cols+1, HYPRE_MEMORY_DEVICE); + + HYPRE_CUSPARSE_CALL( cusparseDcsr2csc(handle, A->num_rows, A->num_cols, A->num_nonzeros, + A->data, A->i, A->j, csc_a, csc_j, csc_i, + CUSPARSE_ACTION_NUMERIC, CUSPARSE_INDEX_BASE_ZERO) ); - if (temp != 1.0) +#ifdef HYPRE_USING_CUSPARSE + HYPRE_CUSPARSE_CALL( cusparseDcsrmv(handle, CUSPARSE_OPERATION_NON_TRANSPOSE, + A->num_cols, A->num_rows, A->num_nonzeros, + &alpha, descr, + csc_a, csc_i, csc_j, + x->data, &beta, y->data) ); +#else +#pragma omp target teams distribute parallel for private(i) is_device_ptr(csc_a, csc_i, csc_j, y_data, x_data) + for (i = 0; i < A_ncols; i++) { - if (temp == 0.0) + HYPRE_Complex tempx = 0.0; + HYPRE_Int j; + for (j = csc_i[i]; j < csc_i[i+1]; j++) { -#ifdef HYPRE_USING_OPENMP_OFFLOAD - //printf("Sub loop 2\n"); -#pragma omp target teams distribute parallel for num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) is_device_ptr(y_data) -#endif - for (i = 0; i < num_rows*num_vectors; i++) - y_data[i] = 0.0; - } - else - { - if (y_data!=b_data){ -#ifdef HYPRE_USING_OPENMP_OFFLOAD - //printf("Sub loop 3\n"); -#pragma omp target teams distribute parallel for num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) is_device_ptr(y_data,b_data) -#endif - for (i = 0; i < num_rows*num_vectors; i++) - y_data[i] = b_data[i]*temp; - - } else { -#ifdef HYPRE_USING_OPENMP_OFFLOAD - //printf("Sub loop 4\n"); -#pragma omp target teams distribute parallel for num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) is_device_ptr(y_data) -#endif - for (i = 0; i < num_rows*num_vectors; i++) - y_data[i] = y_data[i]*temp; - } - + tempx += csc_a[j] * x_data[csc_j[j]]; } + y_data[i] = alpha*tempx + beta*y_data[i]; } - else - { - if (y_data!=b_data){ -#ifdef HYPRE_USING_OPENMP_OFFLOAD - //printf("Sub loop 5\n"); -#pragma omp target teams distribute parallel for num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) is_device_ptr(y_data) -#endif - for (i = 0; i < num_rows*num_vectors; i++) - y_data[i] = b_data[i]; - } - } - - - /*----------------------------------------------------------------- - * y += A*x - *-----------------------------------------------------------------*/ - - if (num_rownnz < xpar*(num_rows)) - { -#ifdef HYPRE_USING_OPENMP_OFFLOAD - //printf("Sub loop 6\n"); -#pragma omp target teams distribute parallel for private(i,j,jj,m,tempx) num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) is_device_ptr(y_data,A_data,x_data,A_i,A_j) #endif - for (i = 0; i < num_rownnz; i++) - { - m = A_rownnz[i]; - /* - * for (jj = A_i[m]; jj < A_i[m+1]; jj++) - * { - * j = A_j[jj]; - * y_data[m] += A_data[jj] * x_data[j]; - * } */ - if ( num_vectors==1 ) - { - tempx = 0; - for (jj = A_i[m]; jj < A_i[m+1]; jj++) - tempx += A_data[jj] * x_data[A_j[jj]]; - y_data[m] += tempx; - } - else - for ( j=0; j 1 + hypre_TFree(csc_a, HYPRE_MEMORY_DEVICE); + hypre_TFree(csc_i, HYPRE_MEMORY_DEVICE); + hypre_TFree(csc_j, HYPRE_MEMORY_DEVICE); + } + else + { +#ifdef HYPRE_USING_CUSPARSE + HYPRE_CUSPARSE_CALL( cusparseDcsrmv(handle, CUSPARSE_OPERATION_NON_TRANSPOSE, + A_nrows, A_ncols, A_nnz, + &alpha, descr, + A_data, A_i, A_j, + x_data, &beta, y_data) ); +#else +#pragma omp target teams distribute parallel for private(i) is_device_ptr(A_data, A_i, A_j, y_data, x_data) + for (i = 0; i < A_num_rows; i++) { -#ifdef HYPRE_USING_OPENMP_OFFLOAD - //printf("Sub loop 7\n"); -#pragma omp target teams distribute parallel for private(i,j,jj,m,tempx) num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) is_device_ptr(y_data,A_data,x_data,A_i,A_j) -#endif - for (i = 0; i < num_rows; i++) + HYPRE_Complex tempx = 0.0; + HYPRE_Int j; + for (j = A_i[i]; j < A_i[i+1]; j++) { - for (j = 0; j < num_vectors; ++j) - { - tempx = 0; - for (jj = A_i[i]; jj < A_i[i+1]; jj++) - { - tempx += A_data[jj] * x_data[ j*vecstride_x + A_j[jj]*idxstride_x ]; - } - y_data[ j*vecstride_y + i*idxstride_y ] += tempx; - } + tempx += A_data[j] * x_data[A_j[j]]; } + y_data[i] = alpha*tempx + beta*y_data[i]; } - - /*----------------------------------------------------------------- - * y = alpha*y - *-----------------------------------------------------------------*/ - - if (alpha != 1.0) - { -#ifdef HYPRE_USING_OPENMP_OFFLOAD - //printf("Alph!=1 loop 0\n"); -#pragma omp target teams distribute parallel for private(i) num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) is_device_ptr(y_data) -#endif - for (i = 0; i < num_rows*num_vectors; i++) - y_data[i] *= alpha; // WHAT is going on here ? - } - } - else - { // JSP: this is currently the only path optimized - - if (y_data!=b_data){ - -#ifdef HYPRE_USING_OPENMP_OFFLOAD - //printf("Main work loop 1\n"); -#pragma omp target teams distribute parallel for private(i,j,jj,m,tempx) num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) is_device_ptr(y_data,A_data,x_data,A_i,A_j) -#endif - for(i=0;imapped==-1) { - //hypre_CSRMatrixSortHost(A); - hypre_CSRMatrixMapToDevice(A); - //printf("MAPPING %p \n",A); - hypre_CSRMatrixUpdateToDevice(A); - //printf("DONE MAPPING %p \n",A); - - } - //printf("Mapping X::"); - if (!x->mapped) hypre_SeqVectorMapToDevice(x); - else SyncVectorToDevice(x); - //printf("Mapping Y::"); - if (!y->mapped) hypre_SeqVectorMapToDevice(y); - else SyncVectorToDevice(y); - - if (b!=y){ - if(!b->mapped) { - //printf("Mapping B::"); - hypre_SeqVectorMapToDevice(b); - } else - SyncVectorToDevice(b); - } -#endif - - if (x == y) - { -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - hypre_error_w_msg(HYPRE_ERROR_GENERIC,"WARNING:: x_tmp is not mapped in Mapped OMP Offload version\n"); -#endif - x_tmp = hypre_SeqVectorCloneDeep(x); - x_data = hypre_VectorData(x_tmp); - } - HYPRE_Int i; - - -#ifdef HYPRE_USING_CUSPARSE - -#if defined(TRACK_MEMORY_ALLOCATIONS) - ASSERT_MANAGED(A_data); - ASSERT_MANAGED(A_i); - ASSERT_MANAGED(A_j); - ASSERT_MANAGED(x_data); - ASSERT_MANAGED(y_data); - ASSERT_MANAGED(b_data); -#endif - - if (b!=y){ -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD -#pragma omp target teams distribute parallel for private(i) -#else -#pragma omp target teams distribute parallel for private(i) is_device_ptr(y_data,b_data) -#endif - for(i=0;inum_rows>0){ -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD -#pragma omp target data use_device_ptr(A_data,x_data,y_data,A_i,A_j) -#endif - cusparseErrchk(cusparseDcsrmv(handle , - CUSPARSE_OPERATION_NON_TRANSPOSE, - num_rows, num_cols, num_nnz, - &alpha, descr, - A_data ,A_i,A_j, - x_data, &beta, y_data)); - } - - hypre_CheckErrorDevice(cudaStreamSynchronize(s[4])); -#else -#ifdef HYPRE_USING_OPENMP_OFFLOAD - HYPRE_Int num_threads=64; // >64 for 100% Theoritical occupancy - HYPRE_Int num_teams = (num_rows+num_rows%num_threads)/num_threads; -#pragma omp target teams distribute parallel for private(i) num_teams(num_teams) thread_limit(num_threads) is_device_ptr(A_data,A_i,A_j,y_data,b_data,x_data) schedule(static,1) -#endif -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - HYPRE_Int num_threads=64; // >64 for 100% Theoritical occupancy - HYPRE_Int num_teams = (num_rows+num_rows%num_threads)/num_threads; - // printf("Matvec with %d teams & %d tehreads \n",num_teams,num_threads); - // printf("Mapping map %d %d %d %d\n",omp_target_is_present(A,0),omp_target_is_present(A_data,0),omp_target_is_present(A_i,0),omp_target_is_present(A_j,0)); -#pragma omp target teams distribute parallel for private(i) num_teams(num_teams) thread_limit(num_threads) schedule(static,1) -#endif - for(i=0;imapped)) hypre_SeqVectorUnMapFromDevice(b); -#endif - //printf("DONE WITH OOMP\n"); - return ierr; -} -HYPRE_Int -hypre_CSRMatrixMatvecOutOfPlaceOOMP3( HYPRE_Complex alpha, - hypre_CSRMatrix *A, - hypre_Vector *x, - HYPRE_Complex beta, - hypre_Vector *b, - hypre_Vector *y, - HYPRE_Int offset ) -{ - return 0; - /* - hypre_CSRMatrixMatvecOutOfPlaceOOMP(alpha,A,x,beta,b,y,offset); -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - hypre_SeqVectorUpdateHost(y); -#endif - return 0; - */ -} -/* HYPRE_Int hypre_CSRMatrixSortHost(hypre_CSRMatrix *A){ */ -/* HYPRE_Int ierr=0; */ -/* HYPRE_Int num_rows = hypre_CSRMatrixNumRows(A); */ -/* HYPRE_Int *A_i = hypre_CSRMatrixI(A); */ -/* HYPRE_Int *A_j = hypre_CSRMatrixJ(A); */ -/* HYPRE_Complex *A_data=hypre_CSRMatrixData(A); */ - -/* HYPRE_Int i, j; */ -/* //printf("hypre_CSRMatrixSortHost\n"); */ -/* for (i=0; i < num_rows; i++){ */ -/* //printf("Row %d size %d \n",i,(A_i[i+1]-A_i[i])); */ -/* mysort(&A_data[A_i[i]],&A_j[A_i[i]],(A_i[i+1]-A_i[i])); */ -/* } */ -/* } */ -//#endif diff -Nru hypre-2.16.0/src/seq_mv/csr_spadd_device.c hypre-2.18.2/src/seq_mv/csr_spadd_device.c --- hypre-2.16.0/src/seq_mv/csr_spadd_device.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/csr_spadd_device.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,167 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#include "seq_mv.h" + +#if defined(HYPRE_USING_CUDA) + +/* in Matlab notation: if num_b != NULL, C = A, and + * for each num_b[i], A(num_b[i], :) += B(i,:). + * A is ma x n and B is mb x n. len(num_b) == mb. + * NOTE: all numbers in num_b must be in [0,...,ma-1] + * if num_b == NULL, C = A + B. ma == mb + * C is ma x n in both cases + */ +HYPRE_Int +hypreDevice_CSRSpAdd(HYPRE_Int ma, HYPRE_Int mb, HYPRE_Int n, + HYPRE_Int nnzA, HYPRE_Int nnzB, + HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Complex *d_aa, + HYPRE_Int *d_ib, HYPRE_Int *d_jb, HYPRE_Complex *d_ab, HYPRE_Int *d_num_b, + HYPRE_Int *nnzC_out, HYPRE_Int **d_ic_out, HYPRE_Int **d_jc_out, HYPRE_Complex **d_ac_out) +{ + /* trivial case */ + if (nnzA == 0 && nnzB == 0) + { + *d_ic_out = hypre_CTAlloc(HYPRE_Int, ma + 1, HYPRE_MEMORY_DEVICE); + *d_jc_out = hypre_CTAlloc(HYPRE_Int, 0, HYPRE_MEMORY_DEVICE); + *d_ac_out = hypre_CTAlloc(HYPRE_Complex, 0, HYPRE_MEMORY_DEVICE); + *nnzC_out = 0; + + return hypre_error_flag; + } + +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_SPADD] -= hypre_MPI_Wtime(); +#endif + + /* expand */ + HYPRE_Int nnzT = nnzA + nnzB, nnzC; + HYPRE_Int *d_it, *d_jt, *d_pm, *d_it_cp, *d_jt_cp, *d_ic, *d_jc; + HYPRE_Complex *d_at, *d_at_cp, *d_ac; + + HYPRE_Int align = 32; + HYPRE_Int nnzT2 = (nnzT + align - 1) / align * align; + char *work_mem = hypre_TAlloc(char, (5*sizeof(HYPRE_Int)+2*sizeof(HYPRE_Complex))*nnzT2, HYPRE_MEMORY_DEVICE); + char *work_mem_saved = work_mem; + + //d_it = hypre_TAlloc(HYPRE_Int, nnzT, HYPRE_MEMORY_DEVICE); + //d_jt = hypre_TAlloc(HYPRE_Int, nnzT, HYPRE_MEMORY_DEVICE); + //d_at = hypre_TAlloc(HYPRE_Complex, nnzT, HYPRE_MEMORY_DEVICE); + d_it = (HYPRE_Int *) work_mem; + work_mem += sizeof(HYPRE_Int) * nnzT2; + d_jt = (HYPRE_Int *) work_mem; + work_mem += sizeof(HYPRE_Int) * nnzT2; + d_at = (HYPRE_Complex *) work_mem; + work_mem += sizeof(HYPRE_Complex) * nnzT2; + + /* expansion */ + hypre_TMemcpy(d_jt, d_ja, HYPRE_Int, nnzA, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_DEVICE); + hypre_TMemcpy(d_jt + nnzA, d_jb, HYPRE_Int, nnzB, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_DEVICE); + hypre_TMemcpy(d_at, d_aa, HYPRE_Complex, nnzA, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_DEVICE); + hypre_TMemcpy(d_at + nnzA, d_ab, HYPRE_Complex, nnzB, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_DEVICE); + + hypreDevice_CsrRowPtrsToIndices_v2(ma, d_ia, d_it); + if (d_num_b || mb <= 0) + { + hypreDevice_CsrRowPtrsToIndicesWithRowNum(mb, d_ib, d_num_b, d_it + nnzA); + } + else + { + hypre_assert(ma == mb); + hypreDevice_CsrRowPtrsToIndices_v2(mb, d_ib, d_it + nnzA); + } + + /* permutation vector */ + //d_pm = hypre_TAlloc(HYPRE_Int, nnzT, HYPRE_MEMORY_DEVICE); + d_pm = (HYPRE_Int *) work_mem; + work_mem += sizeof(HYPRE_Int) * nnzT2; + + /* make copy of (it, jt, at), since gather cannot be done in-place */ + //d_it_cp = hypre_TAlloc(HYPRE_Int, nnzT, HYPRE_MEMORY_DEVICE); + //d_jt_cp = hypre_TAlloc(HYPRE_Int, nnzT, HYPRE_MEMORY_DEVICE); + //d_at_cp = hypre_TAlloc(HYPRE_Complex, nnzT, HYPRE_MEMORY_DEVICE); + d_it_cp = (HYPRE_Int *) work_mem; + work_mem += sizeof(HYPRE_Int) * nnzT2; + d_jt_cp = (HYPRE_Int *) work_mem; + work_mem += sizeof(HYPRE_Int) * nnzT2; + d_at_cp = (HYPRE_Complex *) work_mem; + work_mem += sizeof(HYPRE_Complex) * nnzT2; + + hypre_assert(work_mem - work_mem_saved == (5*sizeof(HYPRE_Int)+2*sizeof(HYPRE_Complex))*nnzT2); + + hypre_TMemcpy(d_it_cp, d_it, HYPRE_Int, nnzT, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_DEVICE); + hypre_TMemcpy(d_jt_cp, d_jt, HYPRE_Int, nnzT, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_DEVICE); + hypre_TMemcpy(d_at_cp, d_at, HYPRE_Complex, nnzT, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_DEVICE); + + /* sort: lexicographical order (row, col) */ + HYPRE_THRUST_CALL(sequence, d_pm, d_pm + nnzT); + HYPRE_THRUST_CALL(stable_sort_by_key, d_jt, d_jt + nnzT, d_pm); + HYPRE_THRUST_CALL(gather, d_pm, d_pm + nnzT, d_it_cp, d_it); + + HYPRE_THRUST_CALL(stable_sort_by_key, d_it, d_it + nnzT, d_pm); + HYPRE_THRUST_CALL(gather, d_pm, d_pm + nnzT, d_jt_cp, d_jt); + HYPRE_THRUST_CALL(gather, d_pm, d_pm + nnzT, d_at_cp, d_at); + + /* compress */ + typedef thrust::tuple< thrust::device_ptr, thrust::device_ptr > IteratorTuple; + typedef thrust::zip_iterator ZipIterator; + + thrust::pair< ZipIterator, thrust::device_ptr > new_end = + HYPRE_THRUST_CALL(reduce_by_key, + thrust::make_zip_iterator(thrust::make_tuple(d_it , d_jt )), + thrust::make_zip_iterator(thrust::make_tuple(d_it + nnzT, d_jt + nnzT)), + d_at, + thrust::make_zip_iterator(thrust::make_tuple(d_it_cp, d_jt_cp)), + d_at_cp, + thrust::equal_to< thrust::tuple >() + ); + + /* returns end: so nnz = end - start */ + nnzC = new_end.second - thrust::device_pointer_cast(d_at_cp); + + /* allocate final C */ + d_jc = hypre_TAlloc(HYPRE_Int, nnzC, HYPRE_MEMORY_DEVICE); + d_ac = hypre_TAlloc(HYPRE_Complex, nnzC, HYPRE_MEMORY_DEVICE); + + hypre_TMemcpy(d_jc, d_jt_cp, HYPRE_Int, nnzC, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_DEVICE); + hypre_TMemcpy(d_ac, d_at_cp, HYPRE_Complex, nnzC, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_DEVICE); + + /* convert into ic: row idx --> row ptrs */ + d_ic = hypreDevice_CsrRowIndicesToPtrs(ma, nnzC, d_it_cp); + +#if DEBUG_MODE + HYPRE_Int tmp_nnzC; + hypre_TMemcpy(&tmp_nnzC, &d_ic[ma], HYPRE_Int, 1, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); + assert(nnzC == tmp_nnzC); +#endif + + /* + hypre_TFree(d_it, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_jt, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_at, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_pm, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_it_cp, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_jt_cp, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_at_cp, HYPRE_MEMORY_DEVICE); + */ + hypre_TFree(work_mem_saved, HYPRE_MEMORY_DEVICE); + + *nnzC_out = nnzC; + *d_ic_out = d_ic; + *d_jc_out = d_jc; + *d_ac_out = d_ac; + +#ifdef HYPRE_PROFILE + cudaThreadSynchronize(); + hypre_profile_times[HYPRE_TIMER_ID_SPADD] += hypre_MPI_Wtime(); +#endif + + return hypre_error_flag; +} + +#endif + diff -Nru hypre-2.16.0/src/seq_mv/csr_spgemm_device_attempt.c hypre-2.18.2/src/seq_mv/csr_spgemm_device_attempt.c --- hypre-2.16.0/src/seq_mv/csr_spgemm_device_attempt.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/csr_spgemm_device_attempt.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,548 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +/*- - - - - - - - - - - - - - - - - - - - - - - - - - * + Perform SpMM with Row Nnz Estimation + *- - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include "seq_mv.h" +#include "csr_spgemm_device.h" + +#if defined(HYPRE_USING_CUDA) + +template +static __device__ __forceinline__ +HYPRE_Int +hash_insert_attempt( HYPRE_Int HashSize, /* capacity of the hash table */ + volatile HYPRE_Int *HashKeys, /* assumed to be initialized as all -1's */ + volatile HYPRE_Complex *HashVals, /* assumed to be initialized as all 0's */ + HYPRE_Int key, /* assumed to be nonnegative */ + HYPRE_Complex val, + HYPRE_Int &count, /* increase by 1 if is a new entry */ + char failed, + volatile char *warp_failed) +{ +#pragma unroll + for (HYPRE_Int i = 0; i < HashSize; i++) + { + HYPRE_Int j; + /* compute the hash value of key */ + if (i == 0) + { + j = key & (HashSize - 1); + } + else + { + j = HashFunc(HashSize, key, i, j); + } + + /* try to insert key+1 into slot j */ + HYPRE_Int old = atomicCAS((HYPRE_Int*)(HashKeys+j), -1, key); + + if (old == -1) + { + /* new insertion, increase counter */ + count++; + /* this slot was open, insert value */ + if (attempt == 2 || failed == 0 || *warp_failed == 0) + { + atomicAdd((HYPRE_Complex*)(HashVals+j), val); + } + return j; + } + + if (old == key) + { + /* this slot contains 'key', update value */ + if (attempt == 2 || failed == 0 || *warp_failed == 0) + { + atomicAdd((HYPRE_Complex*)(HashVals+j), val); + } + return j; + } + } + + return -1; +} + +template +static __device__ __forceinline__ +HYPRE_Int +csr_spmm_compute_row_attempt( HYPRE_Int rowi, + volatile HYPRE_Int lane_id, + HYPRE_Int *ia, + HYPRE_Int *ja, + HYPRE_Complex *aa, + HYPRE_Int *ib, + HYPRE_Int *jb, + HYPRE_Complex *ab, + HYPRE_Int s_HashSize, + volatile HYPRE_Int *s_HashKeys, + volatile HYPRE_Complex *s_HashVals, + HYPRE_Int g_HashSize, + HYPRE_Int *g_HashKeys, + HYPRE_Complex *g_HashVals, + char &failed, + volatile char *warp_s_failed) +{ + /* load the start and end position of row i of A */ + HYPRE_Int j = -1; + if (lane_id < 2) + { + j = read_only_load(ia + rowi + lane_id); + } + const HYPRE_Int istart = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 0); + const HYPRE_Int iend = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 1); + + HYPRE_Int num_new_insert = 0; + + /* load column idx and values of row i of A */ + for (HYPRE_Int i = istart; i < iend; i += blockDim.y) + { + HYPRE_Int colA = -1; + HYPRE_Complex valA = 0.0; + + if (threadIdx.x == 0 && i + threadIdx.y < iend) + { + colA = read_only_load(ja + i + threadIdx.y); + valA = read_only_load(aa + i + threadIdx.y); + } + +#if 0 + //const HYPRE_Int ymask = get_mask<4>(lane_id); + // TODO: need to confirm the behavior of __ballot_sync, leave it here for now + //const HYPRE_Int num_valid_rows = __popc(__ballot_sync(ymask, valid_i)); + //for (HYPRE_Int j = 0; j < num_valid_rows; j++) +#endif + + /* threads in the same ygroup work on one row together */ + const HYPRE_Int rowB = __shfl_sync(HYPRE_WARP_FULL_MASK, colA, 0, blockDim.x); + const HYPRE_Complex mult = __shfl_sync(HYPRE_WARP_FULL_MASK, valA, 0, blockDim.x); + /* open this row of B, collectively */ + HYPRE_Int tmp = -1; + if (rowB != -1 && threadIdx.x < 2) + { + tmp = read_only_load(ib+rowB+threadIdx.x); + } + const HYPRE_Int rowB_start = __shfl_sync(HYPRE_WARP_FULL_MASK, tmp, 0, blockDim.x); + const HYPRE_Int rowB_end = __shfl_sync(HYPRE_WARP_FULL_MASK, tmp, 1, blockDim.x); + + for (HYPRE_Int k = rowB_start; k < rowB_end; k += blockDim.x) + { + if (k + threadIdx.x < rowB_end) + { + const HYPRE_Int k_idx = read_only_load(jb + k + threadIdx.x); + const HYPRE_Complex k_val = read_only_load(ab + k + threadIdx.x) * mult; + /* first try to insert into shared memory hash table */ + HYPRE_Int pos = hash_insert_attempt + (s_HashSize, s_HashKeys, s_HashVals, k_idx, k_val, num_new_insert, + failed, warp_s_failed); + + if (-1 == pos) + { + pos = hash_insert_attempt + (g_HashSize, g_HashKeys, g_HashVals, k_idx, k_val, num_new_insert, + failed, warp_s_failed); + } + /* if failed again, both hash tables must have been full + (hash table size estimation was too small). + Increase the counter anyhow (will lead to over-counting) + */ + if (pos == -1) + { + num_new_insert ++; + failed = 1; + if (attempt == 1) + { + *warp_s_failed = 1; + } + } + } + } + } + + return num_new_insert; +} + +template +__global__ +void +csr_spmm_attempt(HYPRE_Int M, /* HYPRE_Int K, HYPRE_Int N, */ + HYPRE_Int *ia, HYPRE_Int *ja, HYPRE_Complex *aa, + HYPRE_Int *ib, HYPRE_Int *jb, HYPRE_Complex *ab, + HYPRE_Int *js, HYPRE_Complex *as, + HYPRE_Int *ig, HYPRE_Int *jg, HYPRE_Complex *ag, + HYPRE_Int *rc, HYPRE_Int *rg) +{ + volatile const HYPRE_Int num_warps = NUM_WARPS_PER_BLOCK * gridDim.x; + /* warp id inside the block */ + volatile const HYPRE_Int warp_id = get_warp_id(); + /* lane id inside the warp */ + volatile HYPRE_Int lane_id = get_lane_id(); + /* shared memory hash table */ + __shared__ volatile HYPRE_Int s_HashKeys[NUM_WARPS_PER_BLOCK * SHMEM_HASH_SIZE]; + __shared__ volatile HYPRE_Complex s_HashVals[NUM_WARPS_PER_BLOCK * SHMEM_HASH_SIZE]; + /* shared memory hash table for this warp */ + volatile HYPRE_Int *warp_s_HashKeys = s_HashKeys + warp_id * SHMEM_HASH_SIZE; + volatile HYPRE_Complex *warp_s_HashVals = s_HashVals + warp_id * SHMEM_HASH_SIZE; + /* shared memory failed flag for warps */ + __shared__ volatile char s_failed[NUM_WARPS_PER_BLOCK]; + volatile char *warp_s_failed = s_failed + warp_id; + +#if DEBUG_MODE + assert(blockDim.z == NUM_WARPS_PER_BLOCK); + assert(blockDim.x * blockDim.y == HYPRE_WARP_SIZE); + assert(NUM_WARPS_PER_BLOCK <= HYPRE_WARP_SIZE); +#endif + + for (HYPRE_Int i = blockIdx.x * NUM_WARPS_PER_BLOCK + warp_id; + i < M; + i += num_warps) + { + /* start/end position of global memory hash table */ + HYPRE_Int j = -1, istart_g, iend_g, ghash_size; + char failed = 0; + + if (lane_id < 2) + { + j = read_only_load(ig + i + lane_id); + } + istart_g = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 0); + iend_g = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 1); + + /* size of global hash table allocated for this row (must be power of 2) */ + ghash_size = iend_g - istart_g; + + if (attempt == 2) + { + if (ghash_size == 0) + { + continue; + } + } + + /* initialize warp's shared failed flag */ + if (attempt == 1 && lane_id == 0) + { + *warp_s_failed = 0; + } + /* initialize warp's shared and global memory hash table */ +#pragma unrolll + for (HYPRE_Int k = lane_id; k < SHMEM_HASH_SIZE; k += HYPRE_WARP_SIZE) + { + warp_s_HashKeys[k] = -1; + warp_s_HashVals[k] = 0.0; + } +#pragma unrolll + for (HYPRE_Int k = lane_id; k < ghash_size; k += HYPRE_WARP_SIZE) + { + jg[istart_g+k] = -1; + ag[istart_g+k] = 0.0; + } + __syncwarp(); + + /* work with two hash tables */ + j = csr_spmm_compute_row_attempt(i, lane_id, ia, ja, aa, ib, jb, ab, + SHMEM_HASH_SIZE, warp_s_HashKeys, warp_s_HashVals, + ghash_size, jg + istart_g, ag + istart_g, + failed, warp_s_failed); + +#if DEBUG_MODE + if (attempt == 2) + { + assert(failed == 0); + } +#endif + + /* num of inserts in this row (an upper bound) */ + j = warp_reduce_sum(j); + + if (attempt == 1) + { + failed = warp_allreduce_sum(failed); + } + + if (attempt == 1 && failed) + { + if (lane_id == 0) + { + rg[i] = next_power_of_2(j - SHMEM_HASH_SIZE); + } + } + else + { + if (lane_id == 0) + { + rc[i] = j; + if (attempt == 1) + { + rg[i] = 0; + } + } +#pragma unroll + for (HYPRE_Int k = lane_id; k < SHMEM_HASH_SIZE; k += HYPRE_WARP_SIZE) + { + js[i*SHMEM_HASH_SIZE + k] = warp_s_HashKeys[k]; + as[i*SHMEM_HASH_SIZE + k] = warp_s_HashVals[k]; + } + } + } // for (i=...) +} + +template +static __device__ __forceinline__ +HYPRE_Int +copy_from_hash_into_C_row( HYPRE_Int lane_id, + volatile HYPRE_Int *s_HashKeys, + volatile HYPRE_Complex *s_HashVals, + HYPRE_Int ghash_size, + HYPRE_Int *jg_start, + HYPRE_Complex *ag_start, + HYPRE_Int *jc_start, + HYPRE_Complex *ac_start) +{ + HYPRE_Int j = 0; + + /* copy shared memory hash table into C */ +#pragma unrolll + for (HYPRE_Int k = lane_id; k < SHMEM_HASH_SIZE; k += HYPRE_WARP_SIZE) + { + HYPRE_Int key, sum, pos; + key = s_HashKeys[k]; + HYPRE_Int in = key != -1; + pos = warp_prefix_sum(lane_id, in, sum); + if (key != -1) + { + jc_start[j + pos] = key; + ac_start[j + pos] = s_HashVals[k]; + } + j += sum; + } + + /* copy global memory hash table into C */ +#pragma unrolll + for (HYPRE_Int k = 0; k < ghash_size; k += HYPRE_WARP_SIZE) + { + HYPRE_Int key = -1, sum, pos; + if (k + lane_id < ghash_size) + { + key = jg_start[k + lane_id]; + } + HYPRE_Int in = key != -1; + pos = warp_prefix_sum(lane_id, in, sum); + if (key != -1) + { + jc_start[j + pos] = key; + ac_start[j + pos] = ag_start[k + lane_id]; + } + j += sum; + } + + return j; +} + +template +__global__ +void +copy_from_hash_into_C(HYPRE_Int M, HYPRE_Int *js, HYPRE_Complex *as, + HYPRE_Int *ig1, HYPRE_Int *jg1, HYPRE_Complex *ag1, + HYPRE_Int *ig2, HYPRE_Int *jg2, HYPRE_Complex *ag2, + HYPRE_Int *ic, HYPRE_Int *jc, HYPRE_Complex *ac) +{ + const HYPRE_Int num_warps = NUM_WARPS_PER_BLOCK * gridDim.x; + /* warp id inside the block */ + const HYPRE_Int warp_id = get_warp_id(); + /* lane id inside the warp */ + volatile const HYPRE_Int lane_id = get_lane_id(); + +#if DEBUG_MODE + assert(blockDim.x * blockDim.y == HYPRE_WARP_SIZE); +#endif + + for (HYPRE_Int i = blockIdx.x * NUM_WARPS_PER_BLOCK + warp_id; + i < M; + i += num_warps) + { + HYPRE_Int kc, kg1, kg2; + + /* start/end position in C */ + if (lane_id < 2) + { + kc = read_only_load(ic + i + lane_id); + kg1 = read_only_load(ig1 + i + lane_id); + kg2 = read_only_load(ig2 + i + lane_id); + } + + HYPRE_Int istart_c = __shfl_sync(HYPRE_WARP_FULL_MASK, kc, 0); +#if DEBUG_MODE + HYPRE_Int iend_c = __shfl_sync(HYPRE_WARP_FULL_MASK, kc, 1); +#endif + HYPRE_Int istart_g1 = __shfl_sync(HYPRE_WARP_FULL_MASK, kg1, 0); + HYPRE_Int iend_g1 = __shfl_sync(HYPRE_WARP_FULL_MASK, kg1, 1); + HYPRE_Int istart_g2 = __shfl_sync(HYPRE_WARP_FULL_MASK, kg2, 0); + HYPRE_Int iend_g2 = __shfl_sync(HYPRE_WARP_FULL_MASK, kg2, 1); + + HYPRE_Int g1_size = iend_g1 - istart_g1; + HYPRE_Int g2_size = iend_g2 - istart_g2; + +#if DEBUG_MODE + HYPRE_Int j; +#endif + + if (g2_size == 0) + { +#if DEBUG_MODE + j = +#endif + copy_from_hash_into_C_row + (lane_id, js + i * SHMEM_HASH_SIZE, as + i * SHMEM_HASH_SIZE, g1_size, jg1 + istart_g1, + ag1 + istart_g1, jc + istart_c, ac + istart_c); + } + else + { +#if DEBUG_MODE + j = +#endif + copy_from_hash_into_C_row + (lane_id, js + i * SHMEM_HASH_SIZE, as + i * SHMEM_HASH_SIZE, g2_size, jg2 + istart_g2, + ag2 + istart_g2, jc + istart_c, ac + istart_c); + } +#if DEBUG_MODE + assert(istart_c + j == iend_c); +#endif + } +} + +/* SpGeMM with Rownnz Estimates */ +HYPRE_Int +hypreDevice_CSRSpGemmWithRownnzEstimate(HYPRE_Int m, HYPRE_Int k, HYPRE_Int n, + HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Complex *d_a, + HYPRE_Int *d_ib, HYPRE_Int *d_jb, HYPRE_Complex *d_b, + HYPRE_Int *d_rc, + HYPRE_Int **d_ic_out, HYPRE_Int **d_jc_out, HYPRE_Complex **d_c_out, + HYPRE_Int *nnzC) +{ + const HYPRE_Int num_warps_per_block = 20; + const HYPRE_Int shmem_hash_size = 128; + const HYPRE_Int BDIMX = 2; + const HYPRE_Int BDIMY = 16; + + /* CUDA kernel configurations */ + dim3 bDim(BDIMX, BDIMY, num_warps_per_block); + + hypre_assert(bDim.x * bDim.y == HYPRE_WARP_SIZE); + + // for cases where one WARP works on a row + dim3 gDim( (m + bDim.z - 1) / bDim.z ); + + char hash_type = hypre_handle->spgemm_hash_type; + + /* --------------------------------------------------------------------------- + * build hash table + * ---------------------------------------------------------------------------*/ + HYPRE_Int *d_ghash_i, *d_ghash_j, ghash_size; + HYPRE_Complex *d_ghash_a; + csr_spmm_create_hash_table(m, d_rc, NULL, shmem_hash_size, m, + &d_ghash_i, &d_ghash_j, &d_ghash_a, &ghash_size); + + size_t m_ul = m; + + HYPRE_Int *d_ic = hypre_TAlloc(HYPRE_Int, m+1, HYPRE_MEMORY_DEVICE); + HYPRE_Int *d_ghash2_i = hypre_TAlloc(HYPRE_Int, m+1, HYPRE_MEMORY_DEVICE); + HYPRE_Int *d_js = hypre_TAlloc(HYPRE_Int, shmem_hash_size*m_ul, HYPRE_MEMORY_DEVICE); + HYPRE_Complex *d_as = hypre_TAlloc(HYPRE_Complex, shmem_hash_size*m_ul, HYPRE_MEMORY_DEVICE); + + /* --------------------------------------------------------------------------- + * 1st multiplication attempt: + * ---------------------------------------------------------------------------*/ + if (hash_type == 'L') + { + HYPRE_CUDA_LAUNCH( (csr_spmm_attempt), gDim, bDim, + m, /*k, n,*/ d_ia, d_ja, d_a, d_ib, d_jb, d_b, d_js, d_as, d_ghash_i, d_ghash_j, d_ghash_a, + d_ic + 1, d_ghash2_i + 1 ); + } + else if (hash_type == 'Q') + { + HYPRE_CUDA_LAUNCH( (csr_spmm_attempt), gDim, bDim, + m, /*k, n,*/ d_ia, d_ja, d_a, d_ib, d_jb, d_b, d_js, d_as, d_ghash_i, d_ghash_j, d_ghash_a, + d_ic + 1, d_ghash2_i + 1); + } + else if (hash_type == 'D') + { + HYPRE_CUDA_LAUNCH( (csr_spmm_attempt), gDim, bDim, + m, /*k, n,*/ d_ia, d_ja, d_a, d_ib, d_jb, d_b, d_js, d_as, d_ghash_i, d_ghash_j, d_ghash_a, + d_ic + 1, d_ghash2_i + 1 ); + } + else + { + printf("Unrecognized hash type ... [L, Q, D]\n"); + exit(0); + } + + /* --------------------------------------------------------------------------- + * build a secondary hash table for long rows + * ---------------------------------------------------------------------------*/ + HYPRE_Int ghash2_size, *d_ghash2_j; + HYPRE_Complex *d_ghash2_a; + + csr_spmm_create_ija(m, d_ghash2_i, &d_ghash2_j, &d_ghash2_a, &ghash2_size); + + /* --------------------------------------------------------------------------- + * 2nd multiplication attempt: + * ---------------------------------------------------------------------------*/ + if (ghash2_size > 0) + { + if (hash_type == 'L') + { + HYPRE_CUDA_LAUNCH( (csr_spmm_attempt), gDim, bDim, + m, /*k, n,*/ d_ia, d_ja, d_a, d_ib, d_jb, d_b, d_js, d_as, d_ghash2_i, d_ghash2_j, d_ghash2_a, + d_ic + 1, NULL ); + } + else if (hash_type == 'Q') + { + HYPRE_CUDA_LAUNCH( (csr_spmm_attempt), gDim, bDim, + m, /*k, n,*/ d_ia, d_ja, d_a, d_ib, d_jb, d_b, d_js, d_as, d_ghash2_i, d_ghash2_j, d_ghash2_a, + d_ic + 1, NULL); + } + else if (hash_type == 'D') + { + HYPRE_CUDA_LAUNCH( (csr_spmm_attempt), gDim, bDim, + m, /*k, n,*/ d_ia, d_ja, d_a, d_ib, d_jb, d_b, d_js, d_as, d_ghash2_i, d_ghash2_j, d_ghash2_a, + d_ic + 1, NULL); + } + else + { + printf("Unrecognized hash type ... [L, Q, D]\n"); + exit(0); + } + } + + HYPRE_Int nnzC_gpu, *d_jc; + HYPRE_Complex *d_c; + csr_spmm_create_ija(m, d_ic, &d_jc, &d_c, &nnzC_gpu); + + HYPRE_CUDA_LAUNCH( (copy_from_hash_into_C), gDim, bDim, + m, d_js, d_as, d_ghash_i, d_ghash_j, d_ghash_a, d_ghash2_i, d_ghash2_j, d_ghash2_a, + d_ic, d_jc, d_c); + + hypre_TFree(d_ghash_i, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_ghash_j, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_ghash_a, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_ghash2_i, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_ghash2_j, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_ghash2_a, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_js, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_as, HYPRE_MEMORY_DEVICE); + + *d_ic_out = d_ic; + *d_jc_out = d_jc; + *d_c_out = d_c; + *nnzC = nnzC_gpu; + + return hypre_error_flag; +} + +#endif /* HYPRE_USING_CUDA */ diff -Nru hypre-2.16.0/src/seq_mv/csr_spgemm_device.c hypre-2.18.2/src/seq_mv/csr_spgemm_device.c --- hypre-2.16.0/src/seq_mv/csr_spgemm_device.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/csr_spgemm_device.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,84 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#include "seq_mv.h" +#include "csr_spgemm_device.h" + +#if defined(HYPRE_USING_CUDA) + +HYPRE_Int +hypreDevice_CSRSpGemm(HYPRE_Int m, HYPRE_Int k, HYPRE_Int n, + HYPRE_Int nnza, HYPRE_Int nnzb, + HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Complex *d_a, + HYPRE_Int *d_ib, HYPRE_Int *d_jb, HYPRE_Complex *d_b, + HYPRE_Int **d_ic_out, HYPRE_Int **d_jc_out, HYPRE_Complex **d_c_out, + HYPRE_Int *nnzC) +{ + /* trivial case */ + if (nnza == 0 || nnzb == 0) + { + *d_ic_out = hypre_CTAlloc(HYPRE_Int, m + 1, HYPRE_MEMORY_DEVICE); + *d_jc_out = hypre_CTAlloc(HYPRE_Int, 0, HYPRE_MEMORY_DEVICE); + *d_c_out = hypre_CTAlloc(HYPRE_Complex, 0, HYPRE_MEMORY_DEVICE); + *nnzC = 0; + + return hypre_error_flag; + } + +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_SPMM] -= hypre_MPI_Wtime(); +#endif + + /* use CUSPARSE */ + if (hypre_handle->spgemm_use_cusparse) + { + hypreDevice_CSRSpGemmCusparse(m, k, n, nnza, d_ia, d_ja, d_a, nnzb, d_ib, d_jb, d_b, + nnzC, d_ic_out, d_jc_out, d_c_out); + } + else + { + HYPRE_Int m2 = hypre_handle->spgemm_num_passes < 3 ? m : 2*m; + HYPRE_Int *d_rc = hypre_TAlloc(HYPRE_Int, m2, HYPRE_MEMORY_DEVICE); + + hypreDevice_CSRSpGemmRownnzEstimate(m, k, n, d_ia, d_ja, d_ib, d_jb, d_rc); + + if (hypre_handle->spgemm_num_passes < 3) + { + hypreDevice_CSRSpGemmWithRownnzEstimate(m, k, n, d_ia, d_ja, d_a, d_ib, d_jb, d_b, d_rc, + d_ic_out, d_jc_out, d_c_out, nnzC); + } + else + { + HYPRE_Int rownnz_exact; + /* a binary array to indicate if row nnz counting is failed for a row */ + //HYPRE_Int *d_rf = hypre_TAlloc(HYPRE_Int, m, HYPRE_MEMORY_DEVICE); + HYPRE_Int *d_rf = d_rc + m; + + hypreDevice_CSRSpGemmRownnzUpperbound(m, k, n, d_ia, d_ja, d_ib, d_jb, d_rc, d_rf); + + /* row nnz is exact if no row failed */ + rownnz_exact = hypreDevice_IntegerReduceSum(m, d_rf) == 0; + + //hypre_TFree(d_rf, HYPRE_MEMORY_DEVICE); + + hypreDevice_CSRSpGemmWithRownnzUpperbound(m, k, n, d_ia, d_ja, d_a, d_ib, d_jb, d_b, d_rc, rownnz_exact, + d_ic_out, d_jc_out, d_c_out, nnzC); + } + + hypre_TFree(d_rc, HYPRE_MEMORY_DEVICE); + } + +#ifdef HYPRE_PROFILE + cudaThreadSynchronize(); + hypre_profile_times[HYPRE_TIMER_ID_SPMM] += hypre_MPI_Wtime(); +#endif + + return hypre_error_flag; +} + +#endif /* HYPRE_USING_CUDA */ + diff -Nru hypre-2.16.0/src/seq_mv/csr_spgemm_device_confident.c hypre-2.18.2/src/seq_mv/csr_spgemm_device_confident.c --- hypre-2.16.0/src/seq_mv/csr_spgemm_device_confident.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/csr_spgemm_device_confident.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,503 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +/*- - - - - - - - - - - - - - - - - - - - - - - - - - * + Perform SpMM with Row Nnz Upper Bound + *- - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include "seq_mv.h" +#include "csr_spgemm_device.h" + +#if defined(HYPRE_USING_CUDA) + +/*- - - - - - - - - - - - - - - - - - - - - - - - - - * + Numerical Multiplication + *- - - - - - - - - - - - - - - - - - - - - - - - - - */ + +template +static __device__ __forceinline__ +HYPRE_Int +hash_insert_numer(HYPRE_Int HashSize, /* capacity of the hash table */ + volatile HYPRE_Int *HashKeys, /* assumed to be initialized as all -1's */ + volatile HYPRE_Complex *HashVals, /* assumed to be initialized as all 0's */ + HYPRE_Int key, /* assumed to be nonnegative */ + HYPRE_Complex val, + HYPRE_Int &count) +{ +#pragma unroll + for (HYPRE_Int i = 0; i < HashSize; i++) + { + HYPRE_Int j; + /* compute the hash value of key */ + if (i == 0) + { + j = key & (HashSize - 1); + } + else + { + j = HashFunc(HashSize, key, i, j); + } + + /* try to insert key+1 into slot j */ + HYPRE_Int old = atomicCAS((HYPRE_Int *)(HashKeys+j), -1, key); + + if (old == -1 || old == key) + { + if (FAILED_SYMBL) + { + if (old == -1) + { + count++; + } + } + /* this slot was open or contained 'key', update value */ + atomicAdd((HYPRE_Complex*)(HashVals+j), val); + return j; + } + } + + return -1; +} + +template +static __device__ __forceinline__ +HYPRE_Int +csr_spmm_compute_row_numer(HYPRE_Int rowi, + HYPRE_Int lane_id, + HYPRE_Int *ia, HYPRE_Int *ja, HYPRE_Complex *aa, + HYPRE_Int *ib, HYPRE_Int *jb, HYPRE_Complex *ab, + HYPRE_Int s_HashSize, volatile HYPRE_Int *s_HashKeys, volatile HYPRE_Complex *s_HashVals, + HYPRE_Int g_HashSize, HYPRE_Int *g_HashKeys, HYPRE_Complex *g_HashVals) +{ + /* load the start and end position of row i of A */ + HYPRE_Int i; + if (lane_id < 2) + { + i = read_only_load(ia + rowi + lane_id); + } + const HYPRE_Int istart = __shfl_sync(HYPRE_WARP_FULL_MASK, i, 0); + const HYPRE_Int iend = __shfl_sync(HYPRE_WARP_FULL_MASK, i, 1); + + HYPRE_Int num_new_insert = 0; + + /* load column idx and values of row i of A */ + for (i = istart; i < iend; i += blockDim.y) + { + HYPRE_Int colA = -1; + HYPRE_Complex valA = 0.0; + + if (threadIdx.x == 0 && i + threadIdx.y < iend) + { + colA = read_only_load(ja + i + threadIdx.y); + valA = read_only_load(aa + i + threadIdx.y); + } + +#if 0 + //const HYPRE_Int ymask = get_mask<4>(lane_id); + // TODO: need to confirm the behavior of __ballot_sync, leave it here for now + //const HYPRE_Int num_valid_rows = __popc(__ballot_sync(ymask, valid_i)); + //for (HYPRE_Int j = 0; j < num_valid_rows; j++) +#endif + + /* threads in the same ygroup work on one row together */ + const HYPRE_Int rowB = __shfl_sync(HYPRE_WARP_FULL_MASK, colA, 0, blockDim.x); + const HYPRE_Complex mult = __shfl_sync(HYPRE_WARP_FULL_MASK, valA, 0, blockDim.x); + /* open this row of B, collectively */ + HYPRE_Int tmp = -1; + if (rowB != -1 && threadIdx.x < 2) + { + tmp = read_only_load(ib+rowB+threadIdx.x); + } + const HYPRE_Int rowB_start = __shfl_sync(HYPRE_WARP_FULL_MASK, tmp, 0, blockDim.x); + const HYPRE_Int rowB_end = __shfl_sync(HYPRE_WARP_FULL_MASK, tmp, 1, blockDim.x); + + for (HYPRE_Int k = rowB_start; k < rowB_end; k += blockDim.x) + { + if (k + threadIdx.x < rowB_end) + { + const HYPRE_Int k_idx = read_only_load(jb + k + threadIdx.x); + const HYPRE_Complex k_val = read_only_load(ab + k + threadIdx.x) * mult; + /* first try to insert into shared memory hash table */ + HYPRE_Int pos = hash_insert_numer + (s_HashSize, s_HashKeys, s_HashVals, k_idx, k_val, num_new_insert); + if (-1 == pos) + { + pos = hash_insert_numer + (g_HashSize, g_HashKeys, g_HashVals, k_idx, k_val, num_new_insert); + } +#if DEBUG_MODE + assert(pos != -1); +#endif + } + } + } + + return num_new_insert; +} + +template +static __device__ __forceinline__ +HYPRE_Int +copy_from_hash_into_C_row( HYPRE_Int lane_id, + volatile HYPRE_Int *s_HashKeys, + volatile HYPRE_Complex *s_HashVals, + HYPRE_Int ghash_size, + HYPRE_Int *jg_start, + HYPRE_Complex *ag_start, + HYPRE_Int *jc_start, + HYPRE_Complex *ac_start) +{ + HYPRE_Int j = 0; + + /* copy shared memory hash table into C */ +#pragma unrolll + for (HYPRE_Int k = lane_id; k < SHMEM_HASH_SIZE; k += HYPRE_WARP_SIZE) + { + HYPRE_Int key, sum, pos; + key = s_HashKeys[k]; + HYPRE_Int in = key != -1; + pos = warp_prefix_sum(lane_id, in, sum); + if (key != -1) + { + jc_start[j + pos] = key; + ac_start[j + pos] = s_HashVals[k]; + } + j += sum; + } + + /* copy global memory hash table into C */ +#pragma unrolll + for (HYPRE_Int k = 0; k < ghash_size; k += HYPRE_WARP_SIZE) + { + HYPRE_Int key = -1, sum, pos; + if (k + lane_id < ghash_size) + { + key = jg_start[k + lane_id]; + } + HYPRE_Int in = key != -1; + pos = warp_prefix_sum(lane_id, in, sum); + if (key != -1) + { + jc_start[j + pos] = key; + ac_start[j + pos] = ag_start[k + lane_id]; + } + j += sum; + } + + return j; +} + +template +__global__ +void +csr_spmm_numeric(HYPRE_Int M, /* HYPRE_Int K, HYPRE_Int N, */ + HYPRE_Int *ia, HYPRE_Int *ja, HYPRE_Complex *aa, + HYPRE_Int *ib, HYPRE_Int *jb, HYPRE_Complex *ab, + HYPRE_Int *ic, HYPRE_Int *jc, HYPRE_Complex *ac, + HYPRE_Int *rc, + HYPRE_Int *ig, HYPRE_Int *jg, HYPRE_Complex *ag) +{ + volatile const HYPRE_Int num_warps = NUM_WARPS_PER_BLOCK * gridDim.x; + /* warp id inside the block */ + volatile const HYPRE_Int warp_id = get_warp_id(); + /* warp id in the grid */ + volatile const HYPRE_Int grid_warp_id = blockIdx.x * NUM_WARPS_PER_BLOCK + warp_id; + /* lane id inside the warp */ + volatile HYPRE_Int lane_id = get_lane_id(); + /* shared memory hash table */ + __shared__ volatile HYPRE_Int s_HashKeys[NUM_WARPS_PER_BLOCK * SHMEM_HASH_SIZE]; + __shared__ volatile HYPRE_Complex s_HashVals[NUM_WARPS_PER_BLOCK * SHMEM_HASH_SIZE]; + /* shared memory hash table for this warp */ + volatile HYPRE_Int *warp_s_HashKeys = s_HashKeys + warp_id * SHMEM_HASH_SIZE; + volatile HYPRE_Complex *warp_s_HashVals = s_HashVals + warp_id * SHMEM_HASH_SIZE; + +#if DEBUG_MODE + assert(blockDim.z == NUM_WARPS_PER_BLOCK); + assert(blockDim.x * blockDim.y == HYPRE_WARP_SIZE); +#endif + + /* a warp working on the ith row */ + for (HYPRE_Int i = grid_warp_id; i < M; i += num_warps) + { + /* start/end position of global memory hash table */ + HYPRE_Int j = -1, istart_g, iend_g, ghash_size, jsum; + + if (lane_id < 2) + { + j = read_only_load(ig + grid_warp_id + lane_id); + } + istart_g = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 0); + iend_g = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 1); + + /* size of global hash table allocated for this row + (must be power of 2 and >= the actual size of the row of C) */ + ghash_size = iend_g - istart_g; + + /* initialize warp's shared and global memory hash table */ +#pragma unrolll + for (HYPRE_Int k = lane_id; k < SHMEM_HASH_SIZE; k += HYPRE_WARP_SIZE) + { + warp_s_HashKeys[k] = -1; + warp_s_HashVals[k] = 0.0; + } +#pragma unrolll + for (HYPRE_Int k = lane_id; k < ghash_size; k += HYPRE_WARP_SIZE) + { + jg[istart_g+k] = -1; + ag[istart_g+k] = 0.0; + } + __syncwarp(); + + /* work with two hash tables. jsum is the (exact) nnz for row i */ + jsum = csr_spmm_compute_row_numer(i, lane_id, ia, ja, aa, ib, jb, ab, + SHMEM_HASH_SIZE, warp_s_HashKeys, + warp_s_HashVals, + ghash_size, jg + istart_g, ag + istart_g); + + if (FAILED_SYMBL) + { + /* in the case when symb mult was failed, save row nnz into rc */ + /* num of nonzeros of this row of C (exact) */ + jsum = warp_reduce_sum(jsum); + if (lane_id == 0) + { + rc[i] = jsum; + } + } + + /* copy results into the final C */ + /* start/end position in C */ +#if DEBUG_MODE + if (lane_id < 2) + { + j = read_only_load(ic + i + lane_id); + } + HYPRE_Int istart_c = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 0); + HYPRE_Int iend_c = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 1); +#else + if (lane_id < 1) + { + j = read_only_load(ic + i); + } + HYPRE_Int istart_c = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 0); +#endif + + j = copy_from_hash_into_C_row + (lane_id, warp_s_HashKeys, warp_s_HashVals, ghash_size, jg + istart_g, + ag + istart_g, jc + istart_c, ac + istart_c); + +#if DEBUG_MODE + if (FAILED_SYMBL) + { + assert(istart_c + j <= iend_c); + } + else + { + assert(istart_c + j == iend_c); + } +#endif + } +} + +template +__global__ +void +copy_from_Cext_into_C(HYPRE_Int M, + HYPRE_Int *ix, HYPRE_Int *jx, HYPRE_Complex *ax, + HYPRE_Int *ic, HYPRE_Int *jc, HYPRE_Complex *ac) +{ + const HYPRE_Int num_warps = NUM_WARPS_PER_BLOCK * gridDim.x; + /* warp id inside the block */ + const HYPRE_Int warp_id = get_warp_id(); + /* lane id inside the warp */ + volatile const HYPRE_Int lane_id = get_lane_id(); + +#if DEBUG_MODE + assert(blockDim.x * blockDim.y == HYPRE_WARP_SIZE); +#endif + + for (HYPRE_Int i = blockIdx.x * NUM_WARPS_PER_BLOCK + warp_id; + i < M; + i += num_warps) + { + HYPRE_Int kc, kx; + + /* start/end position in C and X*/ + if (lane_id < 2) + { + kc = read_only_load(ic + i + lane_id); + kx = read_only_load(ix + i + lane_id); + } + HYPRE_Int istart_c = __shfl_sync(HYPRE_WARP_FULL_MASK, kc, 0); + HYPRE_Int iend_c = __shfl_sync(HYPRE_WARP_FULL_MASK, kc, 1); + HYPRE_Int istart_x = __shfl_sync(HYPRE_WARP_FULL_MASK, kx, 0); +#if DEBUG_MODE + HYPRE_Int iend_x = __shfl_sync(HYPRE_WARP_FULL_MASK, kx, 1); + assert(iend_c - istart_c <= iend_x - istart_x); +#endif + + HYPRE_Int p = istart_x - istart_c; + for (HYPRE_Int k = istart_c + lane_id; k < iend_c; k += HYPRE_WARP_SIZE) + { + jc[k] = jx[k+p]; + ac[k] = ax[k+p]; + } + } +} + +/* SpGeMM with Rownnz Upper bound */ +HYPRE_Int +hypreDevice_CSRSpGemmWithRownnzUpperbound(HYPRE_Int m, HYPRE_Int k, HYPRE_Int n, + HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Complex *d_a, + HYPRE_Int *d_ib, HYPRE_Int *d_jb, HYPRE_Complex *d_b, + HYPRE_Int *d_rc, HYPRE_Int exact_rownnz, + HYPRE_Int **d_ic_out, HYPRE_Int **d_jc_out, HYPRE_Complex **d_c_out, + HYPRE_Int *nnzC) +{ +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_SPMM_NUMERIC] -= hypre_MPI_Wtime(); +#endif + + const HYPRE_Int num_warps_per_block = 20; + const HYPRE_Int shmem_hash_size = 128; + const HYPRE_Int BDIMX = 2; + const HYPRE_Int BDIMY = 16; + + /* CUDA kernel configurations */ + dim3 bDim(BDIMX, BDIMY, num_warps_per_block); + + hypre_assert(bDim.x * bDim.y == HYPRE_WARP_SIZE); + + // for cases where one WARP works on a row + HYPRE_Int num_warps = min(m, HYPRE_MAX_NUM_WARPS); + dim3 gDim( (num_warps + bDim.z - 1) / bDim.z ); + // number of active warps + HYPRE_Int num_act_warps = min(bDim.z * gDim.x, m); + + char hash_type = hypre_handle->spgemm_hash_type; + + /* --------------------------------------------------------------------------- + * build hash table + * ---------------------------------------------------------------------------*/ + HYPRE_Int *d_ghash_i, *d_ghash_j, ghash_size; + HYPRE_Complex *d_ghash_a; + csr_spmm_create_hash_table(m, d_rc, NULL, shmem_hash_size, num_act_warps, + &d_ghash_i, &d_ghash_j, &d_ghash_a, &ghash_size); + + /* --------------------------------------------------------------------------- + * numerical multiplication: + * ---------------------------------------------------------------------------*/ + HYPRE_Int *d_ic, *d_jc, nnzC_nume, *d_ic_new = NULL, *d_jc_new = NULL, nnzC_nume_new = -1; + HYPRE_Complex *d_c, *d_c_new = NULL; + + /* if rc contains exact_rownnz: can allocate the final C directly; + if rc contains upper bound : it is a temporary space that is more than enough to store C */ + csr_spmm_create_ija(m, d_rc, &d_ic, &d_jc, &d_c, &nnzC_nume); + + if (!exact_rownnz) + { + d_ic_new = hypre_TAlloc(HYPRE_Int, m+1, HYPRE_MEMORY_DEVICE); + } + + if (hash_type != 'L' && hash_type != 'Q' && hash_type != 'D') + { + printf("Unrecognized hash type ... [L(inear), Q(uadratic), D(ouble)]\n"); + exit(0); + } + + if (exact_rownnz) + { + if (hash_type == 'L') + { + HYPRE_CUDA_LAUNCH( (csr_spmm_numeric), gDim, bDim, + m, /* k, n, */ d_ia, d_ja, d_a, d_ib, d_jb, d_b, d_ic, d_jc, d_c, d_ic_new + 1, + d_ghash_i, d_ghash_j, d_ghash_a ); + } + else if (hash_type == 'Q') + { + HYPRE_CUDA_LAUNCH( (csr_spmm_numeric), gDim, bDim, + m, /* k, n, */ d_ia, d_ja, d_a, d_ib, d_jb, d_b, d_ic, d_jc, d_c, d_ic_new + 1, + d_ghash_i, d_ghash_j, d_ghash_a ); + } + else if (hash_type == 'D') + { + HYPRE_CUDA_LAUNCH( (csr_spmm_numeric), gDim, bDim, + m, /* k, n, */ d_ia, d_ja, d_a, d_ib, d_jb, d_b, d_ic, d_jc, d_c, d_ic_new + 1, + d_ghash_i, d_ghash_j, d_ghash_a ); + } + } + else + { + if (hash_type == 'L') + { + HYPRE_CUDA_LAUNCH( (csr_spmm_numeric), gDim, bDim, + m, /* k, n, */ d_ia, d_ja, d_a, d_ib, d_jb, d_b, d_ic, d_jc, d_c, d_ic_new + 1, + d_ghash_i, d_ghash_j, d_ghash_a ); + } + else if (hash_type == 'Q') + { + HYPRE_CUDA_LAUNCH( (csr_spmm_numeric), gDim, bDim, + m, /* k, n, */ d_ia, d_ja, d_a, d_ib, d_jb, d_b, d_ic, d_jc, d_c, d_ic_new + 1, + d_ghash_i, d_ghash_j, d_ghash_a ); + } + else if (hash_type == 'D') + { + HYPRE_CUDA_LAUNCH( (csr_spmm_numeric), gDim, bDim, + m, /* k, n, */ d_ia, d_ja, d_a, d_ib, d_jb, d_b, d_ic, d_jc, d_c, d_ic_new + 1, + d_ghash_i, d_ghash_j, d_ghash_a ); + } + } + + if (!exact_rownnz) + { + /* alloc final C */ + csr_spmm_create_ija(m, d_ic_new, &d_jc_new, &d_c_new, &nnzC_nume_new); + + hypre_assert(nnzC_nume_new <= nnzC_nume); + + if (nnzC_nume_new < nnzC_nume) + { + /* copy to the final C */ + dim3 gDim( (m + bDim.z - 1) / bDim.z ); + HYPRE_CUDA_LAUNCH( (copy_from_Cext_into_C), gDim, bDim, + m, d_ic, d_jc, d_c, d_ic_new, d_jc_new, d_c_new ); + + hypre_TFree(d_ic, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_jc, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_c, HYPRE_MEMORY_DEVICE); + + d_ic = d_ic_new; + d_jc = d_jc_new; + d_c = d_c_new; + nnzC_nume = nnzC_nume_new; + } + else + { + hypre_TFree(d_ic_new, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_jc_new, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_c_new, HYPRE_MEMORY_DEVICE); + } + } + + hypre_TFree(d_ghash_i, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_ghash_j, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_ghash_a, HYPRE_MEMORY_DEVICE); + + *d_ic_out = d_ic; + *d_jc_out = d_jc; + *d_c_out = d_c; + *nnzC = nnzC_nume; + +#ifdef HYPRE_PROFILE + cudaThreadSynchronize(); + hypre_profile_times[HYPRE_TIMER_ID_SPMM_NUMERIC] += hypre_MPI_Wtime(); +#endif + + return hypre_error_flag; +} + +#endif /* HYPRE_USING_CUDA */ + diff -Nru hypre-2.16.0/src/seq_mv/csr_spgemm_device_cusparse.c hypre-2.18.2/src/seq_mv/csr_spgemm_device_cusparse.c --- hypre-2.16.0/src/seq_mv/csr_spgemm_device_cusparse.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/csr_spgemm_device_cusparse.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,157 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#include "seq_mv.h" +#include "csr_spgemm_device.h" + +#if defined(HYPRE_USING_CUDA) + +HYPRE_Int +hypreDevice_CSRSpGemmCusparse(HYPRE_Int m, HYPRE_Int k, HYPRE_Int n, + HYPRE_Int nnzA, + HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Complex *d_a, + HYPRE_Int nnzB, + HYPRE_Int *d_ib, HYPRE_Int *d_jb, HYPRE_Complex *d_b, + HYPRE_Int *nnzC_out, + HYPRE_Int **d_ic_out, HYPRE_Int **d_jc_out, HYPRE_Complex **d_c_out) +{ + HYPRE_Int *d_ic, *d_jc, baseC, nnzC; + HYPRE_Int *d_ja_sorted, *d_jb_sorted; + HYPRE_Complex *d_c, *d_a_sorted, *d_b_sorted; + + d_a_sorted = hypre_TAlloc(HYPRE_Complex, nnzA, HYPRE_MEMORY_DEVICE); + d_b_sorted = hypre_TAlloc(HYPRE_Complex, nnzB, HYPRE_MEMORY_DEVICE); + d_ja_sorted = hypre_TAlloc(HYPRE_Int, nnzA, HYPRE_MEMORY_DEVICE); + d_jb_sorted = hypre_TAlloc(HYPRE_Int, nnzB, HYPRE_MEMORY_DEVICE); + + cusparseHandle_t cusparsehandle=0; + cusparseMatDescr_t descrA=0, descrB=0, descrC=0; + + /* initialize cusparse library */ + HYPRE_CUSPARSE_CALL( cusparseCreate(&cusparsehandle) ); + + /* create and setup matrix descriptor */ + HYPRE_CUSPARSE_CALL( cusparseCreateMatDescr(&descrA) ); + HYPRE_CUSPARSE_CALL( cusparseSetMatType(descrA, CUSPARSE_MATRIX_TYPE_GENERAL) ); + HYPRE_CUSPARSE_CALL( cusparseSetMatIndexBase(descrA, CUSPARSE_INDEX_BASE_ZERO) ); + + HYPRE_CUSPARSE_CALL( cusparseCreateMatDescr(&descrB) ); + HYPRE_CUSPARSE_CALL( cusparseSetMatType(descrB, CUSPARSE_MATRIX_TYPE_GENERAL) ); + HYPRE_CUSPARSE_CALL( cusparseSetMatIndexBase(descrB, CUSPARSE_INDEX_BASE_ZERO) ); + + HYPRE_CUSPARSE_CALL( cusparseCreateMatDescr(&descrC) ); + HYPRE_CUSPARSE_CALL( cusparseSetMatType(descrC, CUSPARSE_MATRIX_TYPE_GENERAL) ); + HYPRE_CUSPARSE_CALL( cusparseSetMatIndexBase(descrC, CUSPARSE_INDEX_BASE_ZERO) ); + + cusparseOperation_t transA = CUSPARSE_OPERATION_NON_TRANSPOSE; + cusparseOperation_t transB = CUSPARSE_OPERATION_NON_TRANSPOSE; + + HYPRE_Int isDoublePrecision = sizeof(HYPRE_Complex) == sizeof(hypre_double); + HYPRE_Int isSinglePrecision = sizeof(HYPRE_Complex) == sizeof(hypre_double) / 2; + + hypre_assert(isDoublePrecision || isSinglePrecision); + + // Sort A + hypre_TMemcpy(d_ja_sorted, d_ja, HYPRE_Int, nnzA, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_DEVICE); + size_t pBufferSizeInBytes = 0; + void *pBuffer = NULL; + HYPRE_Int *P = NULL; + HYPRE_CUSPARSE_CALL( cusparseXcsrsort_bufferSizeExt(cusparsehandle, m, k, nnzA, d_ia, d_ja_sorted, &pBufferSizeInBytes) ); + pBuffer = hypre_TAlloc(char, pBufferSizeInBytes, HYPRE_MEMORY_DEVICE); + P = hypre_TAlloc(HYPRE_Int, nnzA, HYPRE_MEMORY_DEVICE); + HYPRE_CUSPARSE_CALL( cusparseCreateIdentityPermutation(cusparsehandle, nnzA, P) ); + HYPRE_CUSPARSE_CALL( cusparseXcsrsort(cusparsehandle, m, k, nnzA, descrA, d_ia, d_ja_sorted, P, pBuffer) ); + if (isDoublePrecision) + { + HYPRE_CUSPARSE_CALL( cusparseDgthr(cusparsehandle, nnzA, d_a, d_a_sorted, P, CUSPARSE_INDEX_BASE_ZERO) ); + } + else if (isSinglePrecision) + { + HYPRE_CUSPARSE_CALL( cusparseSgthr(cusparsehandle, nnzA, (float *) d_a, (float *) d_a_sorted, P, CUSPARSE_INDEX_BASE_ZERO) ); + } + hypre_TFree(pBuffer, HYPRE_MEMORY_DEVICE); + hypre_TFree(P, HYPRE_MEMORY_DEVICE); + + // Sort B + hypre_TMemcpy(d_jb_sorted, d_jb, HYPRE_Int, nnzB, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_DEVICE); + HYPRE_CUSPARSE_CALL( cusparseXcsrsort_bufferSizeExt(cusparsehandle, k, n, nnzB, d_ib, d_jb_sorted, &pBufferSizeInBytes) ); + pBuffer = hypre_TAlloc(char, pBufferSizeInBytes, HYPRE_MEMORY_DEVICE); + P = hypre_TAlloc(HYPRE_Int, nnzB, HYPRE_MEMORY_DEVICE); + HYPRE_CUSPARSE_CALL( cusparseCreateIdentityPermutation(cusparsehandle, nnzB, P) ); + HYPRE_CUSPARSE_CALL( cusparseXcsrsort(cusparsehandle, k, n, nnzB, descrB, d_ib, d_jb_sorted, P, pBuffer) ); + if (isDoublePrecision) + { + HYPRE_CUSPARSE_CALL( cusparseDgthr(cusparsehandle, nnzB, d_b, d_b_sorted, P, CUSPARSE_INDEX_BASE_ZERO) ); + } + else if (isSinglePrecision) + { + HYPRE_CUSPARSE_CALL( cusparseSgthr(cusparsehandle, nnzB, (float *) d_b, (float *) d_b_sorted, P, CUSPARSE_INDEX_BASE_ZERO) ); + } + + hypre_TFree(pBuffer, HYPRE_MEMORY_DEVICE); + hypre_TFree(P, HYPRE_MEMORY_DEVICE); + + // nnzTotalDevHostPtr points to host memory + HYPRE_Int *nnzTotalDevHostPtr = &nnzC; + HYPRE_CUSPARSE_CALL( cusparseSetPointerMode(cusparsehandle, CUSPARSE_POINTER_MODE_HOST) ); + + d_ic = hypre_TAlloc(HYPRE_Int, m+1, HYPRE_MEMORY_DEVICE); + + // + HYPRE_CUSPARSE_CALL( + cusparseXcsrgemmNnz(cusparsehandle, transA, transB, + m, n, k, + descrA, nnzA, d_ia, d_ja_sorted, + descrB, nnzB, d_ib, d_jb_sorted, + descrC, d_ic, nnzTotalDevHostPtr ) + ); + + if (NULL != nnzTotalDevHostPtr) + { + nnzC = *nnzTotalDevHostPtr; + } else + { + hypre_TMemcpy(&nnzC, d_ic + m, HYPRE_Int, 1, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); + hypre_TMemcpy(&baseC, d_ic, HYPRE_Int, 1, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); + nnzC -= baseC; + } + + d_jc = hypre_TAlloc(HYPRE_Int, nnzC, HYPRE_MEMORY_DEVICE); + d_c = hypre_TAlloc(HYPRE_Complex, nnzC, HYPRE_MEMORY_DEVICE); + + if (isDoublePrecision) + { + HYPRE_CUSPARSE_CALL( + cusparseDcsrgemm(cusparsehandle, transA, transB, m, n, k, + descrA, nnzA, d_a_sorted, d_ia, d_ja_sorted, + descrB, nnzB, d_b_sorted, d_ib, d_jb_sorted, + descrC, d_c, d_ic, d_jc) + ); + } else if (isSinglePrecision) + { + HYPRE_CUSPARSE_CALL( + cusparseScsrgemm(cusparsehandle, transA, transB, m, n, k, + descrA, nnzA, (float *) d_a_sorted, d_ia, d_ja_sorted, + descrB, nnzB, (float *) d_b_sorted, d_ib, d_jb_sorted, + descrC, (float *) d_c, d_ic, d_jc) + ); + } + + *d_ic_out = d_ic; + *d_jc_out = d_jc; + *d_c_out = d_c; + *nnzC_out = nnzC; + + hypre_TFree(d_a_sorted, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_b_sorted, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_ja_sorted, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_jb_sorted, HYPRE_MEMORY_DEVICE); + + return hypre_error_flag; +} + +#endif /* HYPRE_USING_CUDA */ diff -Nru hypre-2.16.0/src/seq_mv/csr_spgemm_device.h hypre-2.18.2/src/seq_mv/csr_spgemm_device.h --- hypre-2.16.0/src/seq_mv/csr_spgemm_device.h 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/csr_spgemm_device.h 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,102 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#ifndef CSR_SPGEMM_DEVICE_H +#define CSR_SPGEMM_DEVICE_H + +#if defined(HYPRE_USING_CUDA) + +#define COHEN_USE_SHMEM 0 +#define DEBUG_MODE 0 + +/* these are under the assumptions made in spgemm on block sizes: only use in spmm routines */ +static __device__ __forceinline__ +hypre_int get_block_size() +{ + //return (blockDim.x * blockDim.y * blockDim.z); // in general cases + return (HYPRE_WARP_SIZE * blockDim.z); // if blockDim.x * blockDim.y = WARP_SIZE +} + +static __device__ __forceinline__ +hypre_int get_thread_id() +{ + //return (threadIdx.z * blockDim.x * blockDim.y + threadIdx.y * blockDim.x + threadIdx.x); // in general cases + return (threadIdx.z * HYPRE_WARP_SIZE + threadIdx.y * blockDim.x + threadIdx.x); // if blockDim.x * blockDim.y = WARP_SIZE +} + +static __device__ __forceinline__ +hypre_int get_warp_id() +{ + // return get_thread_id() >> 5; // in general cases + return threadIdx.z; // if blockDim.x * blockDim.y = WARP_SIZE +} + +static __device__ __forceinline__ +hypre_int get_lane_id() +{ + // return get_thread_id() & (WARP_SIZE-1); // in general cases + return threadIdx.y * blockDim.x + threadIdx.x; // if blockDim.x * blockDim.y = WARP_SIZE +} + + +/* Hash functions */ +static __device__ __forceinline__ +HYPRE_Int Hash2Func(HYPRE_Int key) +{ + //return ( (key << 1) | 1 ); + //TODO: 6 --> should depend on hash1 size + return ( (key >> 6) | 1 ); +} + +template +static __device__ __forceinline__ +HYPRE_Int HashFunc(HYPRE_Int m, HYPRE_Int key, HYPRE_Int i, HYPRE_Int prev) +{ + HYPRE_Int hashval = 0; + + /* assume m is power of 2 */ + if (type == 'L') + { + //hashval = (key + i) % m; + hashval = ( prev + 1 ) & (m - 1); + } + else if (type == 'Q') + { + //hashval = (key + (i + i*i)/2) & (m-1); + hashval = ( prev + i ) & (m - 1); + } + else if (type == 'D') + { + //hashval = (key + i*Hash2Func(key) ) & (m - 1); + hashval = ( prev + Hash2Func(key) ) & (m - 1); + } + + return hashval; +} + + +HYPRE_Int hypreDevice_CSRSpGemmRownnzEstimate(HYPRE_Int m, HYPRE_Int k, HYPRE_Int n, HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Int *d_ib, HYPRE_Int *d_jb, HYPRE_Int *d_rc); + +HYPRE_Int hypreDevice_CSRSpGemmRownnzUpperbound(HYPRE_Int m, HYPRE_Int k, HYPRE_Int n, HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Int *d_ib, HYPRE_Int *d_jb, HYPRE_Int *d_rc, HYPRE_Int *d_rf); + +HYPRE_Int hypreDevice_CSRSpGemmRownnz(HYPRE_Int m, HYPRE_Int k, HYPRE_Int n, HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Int *d_ib, HYPRE_Int *d_jb, HYPRE_Int *d_rc); + +HYPRE_Int hypreDevice_CSRSpGemmWithRownnzUpperbound(HYPRE_Int m, HYPRE_Int k, HYPRE_Int n, HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Complex *d_a, HYPRE_Int *d_ib, HYPRE_Int *d_jb, HYPRE_Complex *d_b, HYPRE_Int *d_rc, HYPRE_Int exact_rownnz, HYPRE_Int **d_ic_out, HYPRE_Int **d_jc_out, HYPRE_Complex **d_c_out, HYPRE_Int *nnzC); + +HYPRE_Int hypreDevice_CSRSpGemmWithRownnzEstimate(HYPRE_Int m, HYPRE_Int k, HYPRE_Int n, HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Complex *d_a, HYPRE_Int *d_ib, HYPRE_Int *d_jb, HYPRE_Complex *d_b, HYPRE_Int *d_rc, HYPRE_Int **d_ic_out, HYPRE_Int **d_jc_out, HYPRE_Complex **d_c_out, HYPRE_Int *nnzC); + +HYPRE_Int hypreDevice_CSRSpGemmCusparse(HYPRE_Int m, HYPRE_Int k, HYPRE_Int n, HYPRE_Int nnzA, HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Complex *d_a, HYPRE_Int nnzB, HYPRE_Int *d_ib, HYPRE_Int *d_jb, HYPRE_Complex *d_b, HYPRE_Int *nnzC_out, HYPRE_Int **d_ic_out, HYPRE_Int **d_jc_out, HYPRE_Complex **d_c_out); + +void csr_spmm_create_ija(HYPRE_Int m, HYPRE_Int *d_i, HYPRE_Int **d_j, HYPRE_Complex **d_a, HYPRE_Int *nnz); + +void csr_spmm_create_ija(HYPRE_Int m, HYPRE_Int *d_c, HYPRE_Int **d_i, HYPRE_Int **d_j, HYPRE_Complex **d_a, HYPRE_Int *nnz); + +HYPRE_Int csr_spmm_create_hash_table(HYPRE_Int m, HYPRE_Int *d_rc, HYPRE_Int *d_rf, HYPRE_Int SHMEM_HASH_SIZE, HYPRE_Int num_ghash, HYPRE_Int **d_ghash_i, HYPRE_Int **d_ghash_j, HYPRE_Complex **d_ghash_a, HYPRE_Int *ghash_size); + +#endif /* HYPRE_USING_CUDA */ +#endif + diff -Nru hypre-2.16.0/src/seq_mv/csr_spgemm_device_rowbound.c hypre-2.18.2/src/seq_mv/csr_spgemm_device_rowbound.c --- hypre-2.16.0/src/seq_mv/csr_spgemm_device_rowbound.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/csr_spgemm_device_rowbound.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,357 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#include "seq_mv.h" +#include "csr_spgemm_device.h" + +#if defined(HYPRE_USING_CUDA) + +/*- - - - - - - - - - - - - - - - - - - - - - - - - - + *- - - - - - - - - - - - - - - - - - - - - - - - - - + Symbolic Multiplication + *- - - - - - - - - - - - - - - - - - - - - - - - - - + *- - - - - - - - - - - - - - - - - - - - - - - - - - + */ +template +static __device__ __forceinline__ +HYPRE_Int +hash_insert_symbl(HYPRE_Int HashSize, /* capacity of the hash table */ + volatile HYPRE_Int *HashKeys, /* assumed to be initialized as all -1's */ + HYPRE_Int key, /* assumed to be nonnegative */ + HYPRE_Int &count /* increase by 1 if is a new entry */) +{ +#pragma unroll + for (HYPRE_Int i = 0; i < HashSize; i++) + { + HYPRE_Int j; + /* compute the hash value of key */ + if (i == 0) + { + j = key & (HashSize - 1); + } + else + { + j = HashFunc(HashSize, key, i, j); + } + + /* try to insert key+1 into slot j */ + HYPRE_Int old = atomicCAS((HYPRE_Int*)(HashKeys+j), -1, key); + if (old == -1) + { + count++; + return j; + } + if (old == key) + { + return j; + } + } + return -1; +} + +template +static __device__ __forceinline__ +HYPRE_Int +csr_spmm_compute_row_symbl(HYPRE_Int rowi, HYPRE_Int lane_id, + HYPRE_Int *ia, HYPRE_Int *ja, + HYPRE_Int *ib, HYPRE_Int *jb, + HYPRE_Int s_HashSize, volatile HYPRE_Int *s_HashKeys, + HYPRE_Int g_HashSize, HYPRE_Int *g_HashKeys, + char &failed) +{ + /* load the start and end position of row i of A */ + HYPRE_Int j = -1; + if (lane_id < 2) + { + j = read_only_load(ia + rowi + lane_id); + } + const HYPRE_Int istart = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 0); + const HYPRE_Int iend = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 1); + + HYPRE_Int num_new_insert = 0; + + /* load column idx and values of row i of A */ + for (HYPRE_Int i = istart; i < iend; i += blockDim.y) + { + HYPRE_Int colA = -1; + + if (threadIdx.x == 0 && i + threadIdx.y < iend) + { + colA = read_only_load(ja + i + threadIdx.y); + } + +#if 0 + //const HYPRE_Int ymask = get_mask<4>(lane_id); + // TODO: need to confirm the behavior of __ballot_sync, leave it here for now + //const HYPRE_Int num_valid_rows = __popc(__ballot_sync(ymask, valid_i)); + //for (HYPRE_Int j = 0; j < num_valid_rows; j++) +#endif + + /* threads in the same ygroup work on one row together */ + const HYPRE_Int rowB = __shfl_sync(HYPRE_WARP_FULL_MASK, colA, 0, blockDim.x); + /* open this row of B, collectively */ + HYPRE_Int tmp = -1; + if (rowB != -1 && threadIdx.x < 2) + { + tmp = read_only_load(ib+rowB+threadIdx.x); + } + const HYPRE_Int rowB_start = __shfl_sync(HYPRE_WARP_FULL_MASK, tmp, 0, blockDim.x); + const HYPRE_Int rowB_end = __shfl_sync(HYPRE_WARP_FULL_MASK, tmp, 1, blockDim.x); + + for (HYPRE_Int k = rowB_start; k < rowB_end; k += blockDim.x) + { + if (k + threadIdx.x < rowB_end) + { + const HYPRE_Int k_idx = read_only_load(jb + k + threadIdx.x); + /* first try to insert into shared memory hash table */ + HYPRE_Int pos = hash_insert_symbl(s_HashSize, s_HashKeys, k_idx, num_new_insert); + if (-1 == pos) + { + pos = hash_insert_symbl(g_HashSize, g_HashKeys, k_idx, num_new_insert); + } + /* if failed again, both hash tables must have been full + (hash table size estimation was too small). + Increase the counter anyhow (will lead to over-counting) + */ + if (pos == -1) + { + num_new_insert ++; + failed = 1; + } + } + } + } + + return num_new_insert; +} + +template +__global__ +void csr_spmm_symbolic(HYPRE_Int M, /* HYPRE_Int K, HYPRE_Int N, */ + HYPRE_Int *ia, HYPRE_Int *ja, + HYPRE_Int *ib, HYPRE_Int *jb, + HYPRE_Int *ig, HYPRE_Int *jg, + HYPRE_Int *rc, HYPRE_Int *rf) +{ + volatile const HYPRE_Int num_warps = NUM_WARPS_PER_BLOCK * gridDim.x; + /* warp id inside the block */ + volatile const HYPRE_Int warp_id = get_warp_id(); + /* warp id in the grid */ + volatile const HYPRE_Int grid_warp_id = blockIdx.x * NUM_WARPS_PER_BLOCK + warp_id; + /* lane id inside the warp */ + volatile HYPRE_Int lane_id = get_lane_id(); + /* shared memory hash table */ + __shared__ volatile HYPRE_Int s_HashKeys[NUM_WARPS_PER_BLOCK * SHMEM_HASH_SIZE]; + /* shared memory hash table for this warp */ + volatile HYPRE_Int *warp_s_HashKeys = s_HashKeys + warp_id * SHMEM_HASH_SIZE; + + char failed = 0; + +#if DEBUG_MODE + assert(blockDim.z == NUM_WARPS_PER_BLOCK); + assert(blockDim.x * blockDim.y == HYPRE_WARP_SIZE); + assert(NUM_WARPS_PER_BLOCK <= HYPRE_WARP_SIZE); +#endif + + for (HYPRE_Int i = grid_warp_id; i < M; i += num_warps) + { + HYPRE_Int j; + + if (ATTEMPT == 2) + { + if (lane_id == 0) + { + j = rf[i]; + } + j = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 0); + if (j == 0) + { + continue; + } + } + + /* start/end position of global memory hash table */ + HYPRE_Int istart_g, iend_g, ghash_size; + if (lane_id < 2) + { + j = read_only_load(ig + grid_warp_id + lane_id); + } + istart_g = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 0); + iend_g = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 1); + + /* size of global hash table allocated for this row + (must be power of 2 and >= the actual size of the row of C) */ + ghash_size = iend_g - istart_g; + + /* initialize warp's shared and global memory hash table */ +#pragma unrolll + for (HYPRE_Int k = lane_id; k < SHMEM_HASH_SIZE; k += HYPRE_WARP_SIZE) + { + warp_s_HashKeys[k] = -1; + } +#pragma unrolll + for (HYPRE_Int k = lane_id; k < ghash_size; k += HYPRE_WARP_SIZE) + { + jg[istart_g+k] = -1; + } + __syncwarp(); + + /* work with two hash tables */ + j = csr_spmm_compute_row_symbl(i, lane_id, ia, ja, ib, jb, + SHMEM_HASH_SIZE, warp_s_HashKeys, + ghash_size, jg + istart_g, failed); + +#if DEBUG_MODE + if (ATTEMPT == 2) + { + assert(failed == 0); + } +#endif + + /* num of nonzeros of this row (an upper bound) */ + j = warp_reduce_sum(j); + + /* if this row failed */ + if (ATTEMPT == 1) + { + failed = warp_reduce_sum(failed); + } + + if (lane_id == 0) + { + rc[i] = j; + if (ATTEMPT == 1) + { + rf[i] = failed > 0; + } +#if DEBUG_MODE + else + { + rf[i] = failed > 0; + } +#endif + } + } +} + +template +void gpu_csr_spmm_rownnz_attempt(HYPRE_Int m, HYPRE_Int k, HYPRE_Int n, + HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Int *d_ib, HYPRE_Int *d_jb, + HYPRE_Int *d_rc, HYPRE_Int *d_rf) +{ +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_SPMM_SYMBOLIC] -= hypre_MPI_Wtime(); +#endif + + const HYPRE_Int num_warps_per_block = 20; + const HYPRE_Int shmem_hash_size = 256;//512; + const HYPRE_Int BDIMX = 2; + const HYPRE_Int BDIMY = 16; + + /* CUDA kernel configurations */ + dim3 bDim(BDIMX, BDIMY, num_warps_per_block); + assert(bDim.x * bDim.y == HYPRE_WARP_SIZE); + // for cases where one WARP works on a row + HYPRE_Int num_warps = min(m, HYPRE_MAX_NUM_WARPS); + dim3 gDim( (num_warps + bDim.z - 1) / bDim.z ); + // number of active warps + HYPRE_Int num_act_warps = min(bDim.z * gDim.x, m); + + char hash_type = hypre_handle->spgemm_hash_type; + + /* --------------------------------------------------------------------------- + * build hash table (no values) + * ---------------------------------------------------------------------------*/ + HYPRE_Int *d_ghash_i, *d_ghash_j, ghash_size, *d_act; + if (ATTEMPT == 1) + { + d_act = NULL; /* all rows are active */ + } + else + { + d_act = d_rf; + } + csr_spmm_create_hash_table(m, d_rc, d_act, shmem_hash_size, num_act_warps, + &d_ghash_i, &d_ghash_j, NULL, &ghash_size); + + /* --------------------------------------------------------------------------- + * symbolic multiplication: + * On output, it provides an upper bound of nnz in rows of C + * ---------------------------------------------------------------------------*/ + if (hash_type == 'L') + { + HYPRE_CUDA_LAUNCH( (csr_spmm_symbolic), gDim, bDim, + m, /*k, n,*/ d_ia, d_ja, d_ib, d_jb, d_ghash_i, d_ghash_j, d_rc, d_rf ); + } + else if (hash_type == 'Q') + { + HYPRE_CUDA_LAUNCH( (csr_spmm_symbolic), gDim, bDim, + m, /*k, n,*/ d_ia, d_ja, d_ib, d_jb, d_ghash_i, d_ghash_j, d_rc, d_rf ); + } + else if (hash_type == 'D') + { + HYPRE_CUDA_LAUNCH( (csr_spmm_symbolic), gDim, bDim, + m, /*k, n,*/ d_ia, d_ja, d_ib, d_jb, d_ghash_i, d_ghash_j, d_rc, d_rf ); + } + else + { + printf("Unrecognized hash type ... [L(inear), Q(uadratic), D(ouble)]\n"); + exit(0); + } + + hypre_TFree(d_ghash_i, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_ghash_j, HYPRE_MEMORY_DEVICE); + +#ifdef HYPRE_PROFILE + cudaThreadSynchronize(); + hypre_profile_times[HYPRE_TIMER_ID_SPMM_SYMBOLIC] += hypre_MPI_Wtime(); +#endif +} + +HYPRE_Int +hypreDevice_CSRSpGemmRownnzUpperbound(HYPRE_Int m, HYPRE_Int k, HYPRE_Int n, + HYPRE_Int *d_ia, HYPRE_Int *d_ja, + HYPRE_Int *d_ib, HYPRE_Int *d_jb, + HYPRE_Int *d_rc, HYPRE_Int *d_rf) +{ + gpu_csr_spmm_rownnz_attempt<1> (m, k, n, d_ia, d_ja, d_ib, d_jb, d_rc, d_rf); + + return hypre_error_flag; +} + +HYPRE_Int +hypreDevice_CSRSpGemmRownnz(HYPRE_Int m, HYPRE_Int k, HYPRE_Int n, + HYPRE_Int *d_ia, HYPRE_Int *d_ja, + HYPRE_Int *d_ib, HYPRE_Int *d_jb, + HYPRE_Int *d_rc) +{ + /* a binary array to indicate if row nnz counting is failed for a row */ + HYPRE_Int *d_rf = hypre_TAlloc(HYPRE_Int, m, HYPRE_MEMORY_DEVICE); + + gpu_csr_spmm_rownnz_attempt<1> (m, k, n, d_ia, d_ja, d_ib, d_jb, d_rc, d_rf); + + /* row nnz is exact if no row failed */ + HYPRE_Int rownnz_exact = hypreDevice_IntegerReduceSum(m, d_rf); + + printf("^^^^num of failed rows %d (%.2f)\n", rownnz_exact, rownnz_exact/(m+0.0)); + + if (rownnz_exact != 0) + { + gpu_csr_spmm_rownnz_attempt<2> (m, k, n, d_ia, d_ja, d_ib, d_jb, d_rc, d_rf); + +#if DEBUG_MODE + assert(hypreDevice_IntegerReduceSum(m, d_rf) == 0); +#endif + } + + hypre_TFree(d_rf, HYPRE_MEMORY_DEVICE); + + return hypre_error_flag; +} + +#endif /* HYPRE_USING_CUDA */ + diff -Nru hypre-2.16.0/src/seq_mv/csr_spgemm_device_rowest.c hypre-2.18.2/src/seq_mv/csr_spgemm_device_rowest.c --- hypre-2.16.0/src/seq_mv/csr_spgemm_device_rowest.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/csr_spgemm_device_rowest.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,391 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +/*- - - - - - - - - - - - - - - - - - - - - - - - - - * + Row size estimations + *- - - - - - - - - - - - - - - - - - - - - - - - - - */ + +#include "seq_mv.h" +#include "csr_spgemm_device.h" + +#if defined(HYPRE_USING_CUDA) + +/*- - - - - - - - - - - - - - - - - - - - - - - - - - * + NAIVE + *- - - - - - - - - - - - - - - - - - - - - - - - - - */ +template +static __device__ __forceinline__ +void rownnz_naive_rowi(HYPRE_Int rowi, HYPRE_Int lane_id, HYPRE_Int *ia, HYPRE_Int *ja, HYPRE_Int *ib, + HYPRE_Int &row_nnz_sum, HYPRE_Int &row_nnz_max) +{ + /* load the start and end position of row i of A */ + HYPRE_Int j = -1; + if (lane_id < 2) + { + j = read_only_load(ia + rowi + lane_id); + } + const HYPRE_Int istart = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 0); + const HYPRE_Int iend = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 1); + + row_nnz_sum = 0; + row_nnz_max = 0; + + /* load column idx and values of row i of A */ + for (HYPRE_Int i = istart; i < iend; i += HYPRE_WARP_SIZE) + { + if (i + lane_id < iend) + { + HYPRE_Int colA = read_only_load(ja + i + lane_id); + HYPRE_Int rowB_start = read_only_load(ib+colA); + HYPRE_Int rowB_end = read_only_load(ib+colA+1); + if (type == 'U' || type == 'B') + { + row_nnz_sum += rowB_end - rowB_start; + } + if (type == 'L' || type == 'B') + { + row_nnz_max = max(row_nnz_max, rowB_end - rowB_start); + } + } + } +} + +template +__global__ +void csr_spmm_rownnz_naive(HYPRE_Int M, /*HYPRE_Int K,*/ HYPRE_Int N, HYPRE_Int *ia, HYPRE_Int *ja, + HYPRE_Int *ib, HYPRE_Int *jb, HYPRE_Int *rcL, HYPRE_Int *rcU) +{ + const HYPRE_Int num_warps = NUM_WARPS_PER_BLOCK * gridDim.x; + /* warp id inside the block */ + const HYPRE_Int warp_id = get_warp_id(); + /* lane id inside the warp */ + volatile const HYPRE_Int lane_id = get_lane_id(); + +#if DEBUG_MODE + assert(blockDim.x * blockDim.y == HYPRE_WARP_SIZE); +#endif + + for (HYPRE_Int i = blockIdx.x * NUM_WARPS_PER_BLOCK + warp_id; + i < M; + i += num_warps) + { + HYPRE_Int jU, jL; + + rownnz_naive_rowi(i, lane_id, ia, ja, ib, jU, jL); + + if (type == 'U' || type == 'B') + { + jU = warp_reduce_sum(jU); + jU = min(jU, N); + } + + if (type == 'L' || type == 'B') + { + jL = warp_reduce_max(jL); + } + + if (lane_id == 0) + { + if (type == 'L' || type == 'B') + { + rcL[i] = jL; + } + + if (type == 'U' || type == 'B') + { + rcU[i] = jU; + } + } + } +} + +/*- - - - - - - - - - - - - - - - - - - - - - - - - - * + COHEN + *- - - - - - - - - - - - - - - - - - - - - - - - - - */ +__global__ +void expdistfromuniform(HYPRE_Int n, float *x) +{ + const HYPRE_Int global_thread_id = blockIdx.x * get_block_size() + get_thread_id(); + const HYPRE_Int total_num_threads = gridDim.x * get_block_size(); + +#if DEBUG_MODE + assert(blockDim.x * blockDim.y == HYPRE_WARP_SIZE); +#endif + + for (HYPRE_Int i = global_thread_id; i < n; i += total_num_threads) + { + x[i] = -logf(x[i]); + } +} + +/* T = float: single precision should be enough */ +template +__global__ +void cohen_rowest_kernel(HYPRE_Int nrow, HYPRE_Int *rowptr, HYPRE_Int *colidx, T *V_in, T *V_out, + HYPRE_Int *rc, HYPRE_Int nsamples, HYPRE_Int *low, HYPRE_Int *upp, T mult) +{ + const HYPRE_Int num_warps = NUM_WARPS_PER_BLOCK * gridDim.x; + /* warp id inside the block */ + const HYPRE_Int warp_id = get_warp_id(); + /* lane id inside the warp */ + volatile HYPRE_Int lane_id = get_lane_id(); +#if COHEN_USE_SHMEM + __shared__ volatile HYPRE_Int s_col[NUM_WARPS_PER_BLOCK * SHMEM_SIZE_PER_WARP]; + volatile HYPRE_Int *warp_s_col = s_col + warp_id * SHMEM_SIZE_PER_WARP; +#endif + +#if DEBUG_MODE + assert(blockDim.z == NUM_WARPS_PER_BLOCK); + assert(blockDim.x * blockDim.y == HYPRE_WARP_SIZE); + assert(sizeof(T) == sizeof(float)); +#endif + + for (HYPRE_Int i = blockIdx.x * NUM_WARPS_PER_BLOCK + warp_id; + i < nrow; + i += num_warps) + { + /* load the start and end position of row i */ + HYPRE_Int tmp = -1; + if (lane_id < 2) + { + tmp = read_only_load(rowptr + i + lane_id); + } + const HYPRE_Int istart = __shfl_sync(HYPRE_WARP_FULL_MASK, tmp, 0); + const HYPRE_Int iend = __shfl_sync(HYPRE_WARP_FULL_MASK, tmp, 1); + + /* works on WARP_SIZE samples at a time */ + for (HYPRE_Int r = 0; r < nsamples; r += HYPRE_WARP_SIZE) + { + T vmin = HYPRE_FLT_LARGE; + for (HYPRE_Int j = istart; j < iend; j += HYPRE_WARP_SIZE) + { + HYPRE_Int col = -1; + const HYPRE_Int j1 = j + lane_id; +#if COHEN_USE_SHMEM + const HYPRE_Int j2 = j1 - istart; + if (r == 0) + { + if (j1 < iend) + { + col = read_only_load(colidx + j1); + if (j2 < SHMEM_SIZE_PER_WARP) + { + warp_s_col[j2] = col; + } + } + + } + else + { + if (j1 < iend) + { + if (j2 < SHMEM_SIZE_PER_WARP) + { + col = warp_s_col[j2]; + } + else + { + col = read_only_load(colidx + j1); + } + } + } +#else + if (j1 < iend) + { + col = read_only_load(colidx + j1); + } +#endif + + for (HYPRE_Int k = 0; k < HYPRE_WARP_SIZE; k++) + { + HYPRE_Int colk = __shfl_sync(HYPRE_WARP_FULL_MASK, col, k); + if (colk == -1) + { +#if DEBUG_MODE + assert(j + HYPRE_WARP_SIZE >= iend); +#endif + break; + } + if (r + lane_id < nsamples) + { + T val = read_only_load(V_in + r + lane_id + colk * nsamples); + vmin = min(vmin, val); + } + } + } + + if (layer == 2) + { + if (r + lane_id < nsamples) + { + V_out[r + lane_id + i * nsamples] = vmin; + } + } + else if (layer == 1) + { + if (r + lane_id >= nsamples) + { + vmin = 0.0; + } + + /* partial sum along r */ + vmin = warp_reduce_sum(vmin); + + if (lane_id == 0) + { + if (r == 0) + { + V_out[i] = vmin; + } + else + { + V_out[i] += vmin; + } + } + } + } /* for (r = 0; ...) */ + + if (layer == 1) + { + if (lane_id == 0) + { + /* estimated length of row i*/ + HYPRE_Int len = rintf( (nsamples - 1) / V_out[i] * mult ); + + if (low) + { + len = max(low[i], len); + } + if (upp) + { + len = min(upp[i], len); + } + if (rc) + { + rc[i] = len; + } + } + } + } /* for (i = ...) */ +} + +template +void csr_spmm_rownnz_cohen(HYPRE_Int M, HYPRE_Int K, HYPRE_Int N, HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Int *d_ib, HYPRE_Int *d_jb, HYPRE_Int *d_low, HYPRE_Int *d_upp, HYPRE_Int *d_rc, HYPRE_Int nsamples, T mult_factor, T *work) +{ + dim3 bDim(BDIMX, BDIMY, NUM_WARPS_PER_BLOCK); + assert(bDim.x * bDim.y == HYPRE_WARP_SIZE); + + T *d_V1, *d_V2, *d_V3; + + d_V1 = work; + d_V2 = d_V1 + nsamples*N; + //d_V1 = hypre_TAlloc(T, nsamples*N, HYPRE_MEMORY_DEVICE); + //d_V2 = hypre_TAlloc(T, nsamples*K, HYPRE_MEMORY_DEVICE); + + curandGenerator_t gen = hypre_HandleCurandGenerator(hypre_handle); + //CURAND_CALL(curandSetGeneratorOrdering(gen, CURAND_ORDERING_PSEUDO_SEEDED)); + /* random V1: uniform --> exp */ + HYPRE_CURAND_CALL(curandGenerateUniform(gen, d_V1, nsamples * N)); + // CURAND_CALL(curandGenerateUniformDouble(gen, d_V1, nsamples * N)); + dim3 gDim( (nsamples * N + bDim.z * HYPRE_WARP_SIZE - 1) / (bDim.z * HYPRE_WARP_SIZE) ); + + HYPRE_CUDA_LAUNCH( expdistfromuniform, gDim, bDim, nsamples * N, d_V1 ); + + /* step-1: layer 3-2 */ + gDim.x = (K + bDim.z - 1) / bDim.z; + HYPRE_CUDA_LAUNCH( (cohen_rowest_kernel), gDim, bDim, + K, d_ib, d_jb, d_V1, d_V2, NULL, nsamples, NULL, NULL, -1.0); + + //hypre_TFree(d_V1, HYPRE_MEMORY_DEVICE); + + /* step-2: layer 2-1 */ + d_V3 = (T*) d_rc; + + gDim.x = (M + bDim.z - 1) / bDim.z; + HYPRE_CUDA_LAUNCH( (cohen_rowest_kernel), gDim, bDim, + M, d_ia, d_ja, d_V2, d_V3, d_rc, nsamples, d_low, d_upp, mult_factor); + + /* done */ + //hypre_TFree(d_V2, HYPRE_MEMORY_DEVICE); +} + + +HYPRE_Int +hypreDevice_CSRSpGemmRownnzEstimate(HYPRE_Int m, HYPRE_Int k, HYPRE_Int n, + HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Int *d_ib, HYPRE_Int *d_jb, HYPRE_Int *d_rc) +{ +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_SPMM_ROWNNZ] -= hypre_MPI_Wtime(); +#endif + + const HYPRE_Int num_warps_per_block = 16; + const HYPRE_Int shmem_size_per_warp = 128; + const HYPRE_Int BDIMX = 2; + const HYPRE_Int BDIMY = 16; + + /* CUDA kernel configurations */ + dim3 bDim(BDIMX, BDIMY, num_warps_per_block); + assert(bDim.x * bDim.y == HYPRE_WARP_SIZE); + // for cases where one WARP works on a row + dim3 gDim( (m + bDim.z - 1) / bDim.z ); + + HYPRE_Int row_est_mtd = hypre_handle->spgemm_rownnz_estimate_method; + HYPRE_Int cohen_nsamples = hypre_handle->spgemm_rownnz_estimate_nsamples; + float cohen_mult = hypre_handle->spgemm_rownnz_estimate_mult_factor; + + if (row_est_mtd == 1) + { + /* naive overestimate */ + HYPRE_CUDA_LAUNCH( (csr_spmm_rownnz_naive<'U', num_warps_per_block>), gDim, bDim, + m, /*k,*/ n, d_ia, d_ja, d_ib, d_jb, NULL, d_rc ); + } + else if (row_est_mtd == 2) + { + /* naive underestimate */ + HYPRE_CUDA_LAUNCH( (csr_spmm_rownnz_naive<'L', num_warps_per_block>), gDim, bDim, + m, /*k,*/ n, d_ia, d_ja, d_ib, d_jb, d_rc, NULL ); + } + else if (row_est_mtd == 3) + { + /* [optional] first run naive estimate for naive lower and upper bounds, + which will be given to Cohen's alg as corrections */ + char *work_mem = hypre_TAlloc(char, cohen_nsamples*(n+k)*sizeof(float)+2*m*sizeof(HYPRE_Int), HYPRE_MEMORY_DEVICE); + char *work_mem_saved = work_mem; + + //HYPRE_Int *d_low_upp = hypre_TAlloc(HYPRE_Int, 2 * m, HYPRE_MEMORY_DEVICE); + HYPRE_Int *d_low_upp = (HYPRE_Int *) work_mem; + work_mem += 2*m*sizeof(HYPRE_Int); + + HYPRE_Int *d_low = d_low_upp; + HYPRE_Int *d_upp = d_low_upp + m; + + HYPRE_CUDA_LAUNCH( (csr_spmm_rownnz_naive<'B', num_warps_per_block>), gDim, bDim, + m, /*k,*/ n, d_ia, d_ja, d_ib, d_jb, d_low, d_upp ); + + /* Cohen's algorithm, stochastic approach */ + csr_spmm_rownnz_cohen + (m, k, n, d_ia, d_ja, d_ib, d_jb, d_low, d_upp, d_rc, cohen_nsamples, cohen_mult, (float *)work_mem); + + //hypre_TFree(d_low_upp, HYPRE_MEMORY_DEVICE); + hypre_TFree(work_mem_saved, HYPRE_MEMORY_DEVICE); + } + else + { + printf("Unknown row nnz estimation method %d! \n", row_est_mtd); + exit(-1); + } + +#ifdef HYPRE_PROFILE + cudaThreadSynchronize(); + hypre_profile_times[HYPRE_TIMER_ID_SPMM_ROWNNZ] += hypre_MPI_Wtime(); +#endif + + return hypre_error_flag; +} + +#endif /* HYPRE_USING_CUDA */ + diff -Nru hypre-2.16.0/src/seq_mv/csr_spgemm_device_util.c hypre-2.18.2/src/seq_mv/csr_spgemm_device_util.c --- hypre-2.16.0/src/seq_mv/csr_spgemm_device_util.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/csr_spgemm_device_util.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,120 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#include "seq_mv.h" +#include "csr_spgemm_device.h" + +#if defined(HYPRE_USING_CUDA) + +/* assume d_i is of length (m+1) and contains the "sizes" in d_i[1], ..., d_i[m] + the value of d_i[0] is not assumed + */ +void csr_spmm_create_ija(HYPRE_Int m, HYPRE_Int *d_i, HYPRE_Int **d_j, HYPRE_Complex **d_a, HYPRE_Int *nnz) +{ + cudaMemset(d_i, 0, sizeof(HYPRE_Int)); + /* make ghash pointers by prefix scan */ + HYPRE_THRUST_CALL(inclusive_scan, d_i, d_i + m + 1, d_i); + /* total size */ + cudaMemcpy(nnz, d_i + m, sizeof(HYPRE_Int), cudaMemcpyDeviceToHost); + if (d_j) + { + *d_j = hypre_TAlloc(HYPRE_Int, *nnz, HYPRE_MEMORY_DEVICE); + } + if (d_a) + { + *d_a = hypre_TAlloc(HYPRE_Complex, *nnz, HYPRE_MEMORY_DEVICE); + } +} + +/* assume d_c is of length m and contains the "sizes" */ +void csr_spmm_create_ija(HYPRE_Int m, HYPRE_Int *d_c, HYPRE_Int **d_i, HYPRE_Int **d_j, HYPRE_Complex **d_a, HYPRE_Int *nnz) +{ + *d_i = hypre_TAlloc(HYPRE_Int, m+1, HYPRE_MEMORY_DEVICE); + cudaMemset(*d_i, 0, sizeof(HYPRE_Int)); + /* make ghash pointers by prefix scan */ + HYPRE_THRUST_CALL(inclusive_scan, d_c, d_c + m, *d_i + 1); + /* total size */ + cudaMemcpy(nnz, (*d_i) + m, sizeof(HYPRE_Int), cudaMemcpyDeviceToHost); + if (d_j) + { + *d_j = hypre_TAlloc(HYPRE_Int, *nnz, HYPRE_MEMORY_DEVICE); + } + if (d_a) + { + *d_a = hypre_TAlloc(HYPRE_Complex, *nnz, HYPRE_MEMORY_DEVICE); + } +} + +__global__ +void csr_spmm_get_ghash_size(HYPRE_Int n, HYPRE_Int *rc, HYPRE_Int *rf, HYPRE_Int *rg, HYPRE_Int SHMEM_HASH_SIZE) +{ +#if DEBUG_MODE + assert(blockDim.x * blockDim.y == HYPRE_WARP_SIZE); +#endif + + const HYPRE_Int global_thread_id = blockIdx.x * get_block_size() + get_thread_id(); + const HYPRE_Int total_num_threads = gridDim.x * get_block_size(); + + for (HYPRE_Int i = global_thread_id; i < n; i+= total_num_threads) + { + HYPRE_Int j = (!rf || rf[i]) ? next_power_of_2(rc[i] - SHMEM_HASH_SIZE) : 0; + rg[i] = j; + } +} + +__global__ +void csr_spmm_get_ghash_size(HYPRE_Int n, HYPRE_Int num_ghash, HYPRE_Int *rc, HYPRE_Int *rf, HYPRE_Int *rg, HYPRE_Int SHMEM_HASH_SIZE) +{ +#if DEBUG_MODE + assert(blockDim.x * blockDim.y == HYPRE_WARP_SIZE); +#endif + + const HYPRE_Int global_thread_id = blockIdx.x * get_block_size() + get_thread_id(); + const HYPRE_Int total_num_threads = gridDim.x * get_block_size(); + + for (HYPRE_Int i = global_thread_id; i < n; i+= total_num_threads) + { + HYPRE_Int j = (!rf || rf[i]) ? next_power_of_2(rc[i] - SHMEM_HASH_SIZE) : 0; + if (j) + { + atomicMax(&rg[i % num_ghash], j); + } + } +} + +HYPRE_Int +csr_spmm_create_hash_table(HYPRE_Int m, HYPRE_Int *d_rc, HYPRE_Int *d_rf, HYPRE_Int SHMEM_HASH_SIZE, HYPRE_Int num_ghash, + HYPRE_Int **d_ghash_i, HYPRE_Int **d_ghash_j, HYPRE_Complex **d_ghash_a, HYPRE_Int *ghash_size) +{ + const HYPRE_Int num_warps_per_block = 20; + const HYPRE_Int BDIMX = 4; + const HYPRE_Int BDIMY = 8; + + dim3 bDim(BDIMX, BDIMY, num_warps_per_block); + dim3 gDim( (m + bDim.z * HYPRE_WARP_SIZE - 1) / (bDim.z * HYPRE_WARP_SIZE) ); + + assert(num_ghash <= m); + + *d_ghash_i = hypre_TAlloc(HYPRE_Int, num_ghash + 1, HYPRE_MEMORY_DEVICE); + + if (num_ghash == m) + { + HYPRE_CUDA_LAUNCH( csr_spmm_get_ghash_size, gDim, bDim, m, d_rc, d_rf, (*d_ghash_i) + 1, SHMEM_HASH_SIZE ); + } + else + { + cudaMemset(*d_ghash_i, 0, (num_ghash + 1) * sizeof(HYPRE_Int)); + HYPRE_CUDA_LAUNCH( csr_spmm_get_ghash_size, gDim, bDim, m, num_ghash, d_rc, d_rf, (*d_ghash_i) + 1, SHMEM_HASH_SIZE ); + } + + csr_spmm_create_ija(num_ghash, *d_ghash_i, d_ghash_j, d_ghash_a, ghash_size); + + return hypre_error_flag; +} + +#endif /* HYPRE_USING_CUDA */ + diff -Nru hypre-2.16.0/src/seq_mv/csr_sptrans_device.c hypre-2.18.2/src/seq_mv/csr_sptrans_device.c --- hypre-2.16.0/src/seq_mv/csr_sptrans_device.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/csr_sptrans_device.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,95 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#include "seq_mv.h" + +#if defined(HYPRE_USING_CUDA) + +HYPRE_Int +hypreDevice_CSRSpTrans(HYPRE_Int m, HYPRE_Int n, HYPRE_Int nnzA, + HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Complex *d_aa, + HYPRE_Int **d_ic_out, HYPRE_Int **d_jc_out, HYPRE_Complex **d_ac_out, + HYPRE_Int want_data) +{ + /* trivial case */ + if (nnzA == 0) + { + *d_ic_out = hypre_CTAlloc(HYPRE_Int, n + 1, HYPRE_MEMORY_DEVICE); + *d_jc_out = hypre_CTAlloc(HYPRE_Int, 0, HYPRE_MEMORY_DEVICE); + *d_ac_out = hypre_CTAlloc(HYPRE_Complex, 0, HYPRE_MEMORY_DEVICE); + + return hypre_error_flag; + } + +#ifdef HYPRE_PROFILE + hypre_profile_times[HYPRE_TIMER_ID_SPTRANS] -= hypre_MPI_Wtime(); +#endif + + HYPRE_Int *d_jt, *d_it, *d_pm, *d_ic, *d_jc; + HYPRE_Complex *d_ac = NULL; + HYPRE_Int *mem_work = hypre_TAlloc(HYPRE_Int, 3*nnzA, HYPRE_MEMORY_DEVICE); + + /* allocate C */ + d_jc = hypre_TAlloc(HYPRE_Int, nnzA, HYPRE_MEMORY_DEVICE); + if (want_data) + { + d_ac = hypre_TAlloc(HYPRE_Complex, nnzA, HYPRE_MEMORY_DEVICE); + } + + /* permutation vector */ + //d_pm = hypre_TAlloc(HYPRE_Int, nnzA, HYPRE_MEMORY_DEVICE); + d_pm = mem_work; + + /* expansion: A's row idx */ + //d_it = hypre_TAlloc(HYPRE_Int, nnzA, HYPRE_MEMORY_DEVICE); + d_it = d_pm + nnzA; + hypreDevice_CsrRowPtrsToIndices_v2(m, d_ia, d_it); + + /* a copy of col idx of A */ + //d_jt = hypre_TAlloc(HYPRE_Int, nnzA, HYPRE_MEMORY_DEVICE); + d_jt = d_it + nnzA; + hypre_TMemcpy(d_jt, d_ja, HYPRE_Int, nnzA, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_DEVICE); + + /* sort: by col */ + HYPRE_THRUST_CALL(sequence, d_pm, d_pm + nnzA); + HYPRE_THRUST_CALL(stable_sort_by_key, d_jt, d_jt + nnzA, d_pm); + HYPRE_THRUST_CALL(gather, d_pm, d_pm + nnzA, d_it, d_jc); + if (want_data) + { + HYPRE_THRUST_CALL(gather, d_pm, d_pm + nnzA, d_aa, d_ac); + } + + /* convert into ic: row idx --> row ptrs */ + d_ic = hypreDevice_CsrRowIndicesToPtrs(n, nnzA, d_jt); + +#if DEBUG_MODE + HYPRE_Int nnzC; + hypre_TMemcpy(&nnzC, &d_ic[n], HYPRE_Int, 1, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); + hypre_assert(nnzC == nnzA); +#endif + + /* + hypre_TFree(d_jt, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_it, HYPRE_MEMORY_DEVICE); + hypre_TFree(d_pm, HYPRE_MEMORY_DEVICE); + */ + hypre_TFree(mem_work, HYPRE_MEMORY_DEVICE); + + *d_ic_out = d_ic; + *d_jc_out = d_jc; + *d_ac_out = d_ac; + +#ifdef HYPRE_PROFILE + cudaThreadSynchronize(); + hypre_profile_times[HYPRE_TIMER_ID_SPTRANS] += hypre_MPI_Wtime(); +#endif + + return hypre_error_flag; +} + +#endif /* HYPRE_USING_CUDA */ + diff -Nru hypre-2.16.0/src/seq_mv/genpart.c hypre-2.18.2/src/seq_mv/genpart.c --- hypre-2.16.0/src/seq_mv/genpart.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/genpart.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,10 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ - #include "seq_mv.h" /*-------------------------------------------------------------------------- diff -Nru hypre-2.16.0/src/seq_mv/gpukernels.c hypre-2.18.2/src/seq_mv/gpukernels.c --- hypre-2.16.0/src/seq_mv/gpukernels.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/gpukernels.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,280 +0,0 @@ -#include "seq_mv.h" - -//#include -//#include -//#include - -#if defined(HYPRE_USING_GPU) - -extern "C"{ - __global__ - void VecScaleKernelText(HYPRE_Complex *__restrict__ u, const HYPRE_Complex *__restrict__ v, const HYPRE_Complex *__restrict__ l1_norm, hypre_int num_rows){ - HYPRE_Int i = blockIdx.x * blockDim.x + threadIdx.x; - if (i>>(u,v,l1_norm,num_rows); -#ifdef CATCH_LAUNCH_ERRORS - hypre_CheckErrorDevice(cudaPeekAtLastError()); - hypre_CheckErrorDevice(cudaDeviceSynchronize()); -#endif - hypre_CheckErrorDevice(cudaStreamSynchronize(s)); - POP_RANGE; - } -} - - -extern "C"{ - - __global__ - void VecCopyKernel(HYPRE_Complex* __restrict__ tgt, const HYPRE_Complex* __restrict__ src, hypre_int size){ - HYPRE_Int i = blockIdx.x * blockDim.x + threadIdx.x; - if (i>>(tgt,src,size); - //hypre_CheckErrorDevice(cudaStreamSynchronize(s)); - POP_RANGE; - } -} -extern "C"{ - - __global__ - void VecSetKernel(HYPRE_Complex* __restrict__ tgt, const HYPRE_Complex value,hypre_int size){ - HYPRE_Int i = blockIdx.x * blockDim.x + threadIdx.x; - if (i>>(tgt,value,size); - cudaStreamSynchronize(s); - //cudaDeviceSynchronize(); - } -} -extern "C"{ - __global__ - void PackOnDeviceKernel(HYPRE_Complex* __restrict__ send_data,const HYPRE_Complex* __restrict__ x_local_data, const HYPRE_Int* __restrict__ send_map, HYPRE_Int begin, HYPRE_Int end){ - HYPRE_Int i = begin+blockIdx.x * blockDim.x + threadIdx.x; - if (i>>(send_data,x_local_data,send_map,begin,end); -#ifdef CATCH_LAUNCH_ERRORS - hypre_CheckErrorDevice(cudaPeekAtLastError()); - hypre_CheckErrorDevice(cudaDeviceSynchronize()); -#endif - PUSH_RANGE("PACK_PREFETCH",1); -#ifndef HYPRE_GPU_USE_PINNED - MemPrefetchSized((void*)send_data,(end-begin)*sizeof(HYPRE_Complex),cudaCpuDeviceId,s); -#endif - POP_RANGE; - //hypre_CheckErrorDevice(cudaStreamSynchronize(s)); - } -} - - // Scale vector by scalar - -extern "C"{ -__global__ -void VecScaleScalarKernel(HYPRE_Complex *__restrict__ u, const HYPRE_Complex alpha, HYPRE_Int num_rows){ - HYPRE_Int i = blockIdx.x * blockDim.x + threadIdx.x; - //if (i<5) printf("DEVICE %d %lf %lf %lf\n",i,u[i],v[i],l1_norm[i]); - if (i>>(u,alpha,num_rows); -#ifdef CATCH_LAUNCH_ERRORS - hypre_CheckErrorDevice(cudaPeekAtLastError()); - hypre_CheckErrorDevice(cudaDeviceSynchronize()); -#endif - hypre_CheckErrorDevice(cudaStreamSynchronize(s)); - POP_RANGE; - return 0; - } -} - -extern "C"{ -__global__ -void DiagScaleVectorKernel(HYPRE_Complex* __restrict__ x, HYPRE_Complex* __restrict y, HYPRE_Complex* __restrict__ A_data, const hypre_int* __restrict__ A_i, HYPRE_Int num_rows){ - HYPRE_Int i= blockIdx.x * blockDim.x + threadIdx.x; - if (i>>(x,y,A_data,A_i,num_rows); - hypre_CheckErrorDevice(cudaStreamSynchronize(s)); - } -} - -extern "C"{ -__global__ -void SpMVCudaKernel(HYPRE_Complex* __restrict__ y,HYPRE_Complex alpha, const HYPRE_Complex* __restrict__ A_data, const HYPRE_Int* __restrict__ A_i, const HYPRE_Int* __restrict__ A_j, const HYPRE_Complex* __restrict__ x, HYPRE_Complex beta, HYPRE_Int num_rows) -{ - HYPRE_Int i= blockIdx.x * blockDim.x + threadIdx.x; - if (i>>(y,alpha,A_data,A_i,A_j,x,num_rows); - else - SpMVCudaKernel<<>>(y,alpha,A_data,A_i,A_j,x,beta,num_rows); -#ifdef CATCH_LAUNCH_ERRORS - hypre_CheckErrorDevice(cudaPeekAtLastError()); - hypre_CheckErrorDevice(cudaDeviceSynchronize()); -#endif - -} -} -extern "C"{ - __global__ - void CompileFlagSafetyCheck(HYPRE_Int actual){ -#ifdef __CUDA_ARCH__ - HYPRE_Int cudarch=__CUDA_ARCH__; - if (cudarch!=actual){ - //printf("WARNING :: nvcc -arch flag does not match actual device architecture\nWARNING :: The code can fail silently and produce wrong results\n"); - //printf("Arch specified at compile = sm_%d Actual device = sm_%d\n",cudarch/10,actual/10); - } -#else - hypre_error_w_msg(HYPRE_ERROR_GENERIC,"ERROR:: CUDA_ ARCH is not defined \n This should not be happening\n"); -#endif - } -} -extern "C"{ - void CudaCompileFlagCheck(){ - HYPRE_Int devCount; - cudaGetDeviceCount(&devCount); - HYPRE_Int i; - HYPRE_Int cudarch_actual; - for(i = 0; i < devCount; ++i) - { - struct cudaDeviceProp props; - cudaGetDeviceProperties(&props, i); - cudarch_actual=props.major*100+props.minor*10; - } - hypre_CheckErrorDevice(cudaPeekAtLastError()); - hypre_CheckErrorDevice(cudaDeviceSynchronize()); - CompileFlagSafetyCheck<<<1,1,0,0>>>(cudarch_actual); - cudaError_t code=cudaPeekAtLastError(); - if (code != cudaSuccess) - { - hypre_error_w_msg(HYPRE_ERROR_GENERIC,"ERROR in CudaCompileFlagCheck \nERROR :: Check if compile arch flags match actual device arch = sm_\n"); - //fprintf(stderr,"ERROR in CudaCompileFlagCheck%s \n", cudaGetErrorString(code)); - //fprintf(stderr,"ERROR :: Check if compile arch flags match actual device arch = sm_%d\n",cudarch_actual/10); - exit(2); - } - hypre_CheckErrorDevice(cudaDeviceSynchronize()); - } -} - -extern "C" -{ - - __global__ - void BigToSmallCopyKernel (HYPRE_Int* __restrict__ tgt, const HYPRE_BigInt* __restrict__ src, HYPRE_Int size) - { - HYPRE_Int i = blockIdx.x * blockDim.x + threadIdx.x; - if (i>>(tgt,src,size); - //hypre_CheckErrorDevice(cudaStreamSynchronize(s)); - POP_RANGE; - } -} - -#endif diff -Nru hypre-2.16.0/src/seq_mv/gpukernels.h hypre-2.18.2/src/seq_mv/gpukernels.h --- hypre-2.16.0/src/seq_mv/gpukernels.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/gpukernels.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -#ifdef HYPRE_USING_GPU -#include -HYPRE_Int VecScaleScalar(HYPRE_Real *u, const HYPRE_Real alpha, HYPRE_Int num_rows,cudaStream_t s); -void DiagScaleVector(HYPRE_Real *x, HYPRE_Real *y, HYPRE_Real *A_data, HYPRE_Int *A_i, HYPRE_Int num_rows, cudaStream_t s); -void VecCopy(HYPRE_Real* tgt, const HYPRE_Real* src, HYPRE_Int size,cudaStream_t s); -void VecSet(HYPRE_Real* tgt, HYPRE_Int size, HYPRE_Real value, cudaStream_t s); -void VecScale(HYPRE_Real *u, HYPRE_Real *v, HYPRE_Real *l1_norm, HYPRE_Int num_rows,cudaStream_t s); -void VecScaleSplit(HYPRE_Real *u, HYPRE_Real *v, HYPRE_Real *l1_norm, HYPRE_Int num_rows,cudaStream_t s); -void CudaCompileFlagCheck(); -void BigToSmallCopy(HYPRE_Int *tgt, const HYPRE_BigInt* src, HYPRE_Int size, cudaStream_t s); -#endif diff -Nru hypre-2.16.0/src/seq_mv/headers hypre-2.18.2/src/seq_mv/headers --- hypre-2.16.0/src/seq_mv/headers 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/headers 2019-10-28 22:30:04.000000000 +0000 @@ -1,22 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) INTERNAL_HEADER=seq_mv.h diff -Nru hypre-2.16.0/src/seq_mv/HYPRE_csr_matrix.c hypre-2.18.2/src/seq_mv/HYPRE_csr_matrix.c --- hypre-2.16.0/src/seq_mv/HYPRE_csr_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/HYPRE_csr_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -25,7 +17,7 @@ * HYPRE_CSRMatrixCreate *--------------------------------------------------------------------------*/ -HYPRE_CSRMatrix +HYPRE_CSRMatrix HYPRE_CSRMatrixCreate( HYPRE_Int num_rows, HYPRE_Int num_cols, HYPRE_Int *row_sizes ) @@ -51,7 +43,7 @@ * HYPRE_CSRMatrixDestroy *--------------------------------------------------------------------------*/ -HYPRE_Int +HYPRE_Int HYPRE_CSRMatrixDestroy( HYPRE_CSRMatrix matrix ) { return( hypre_CSRMatrixDestroy( (hypre_CSRMatrix *) matrix ) ); @@ -71,7 +63,7 @@ * HYPRE_CSRMatrixRead *--------------------------------------------------------------------------*/ -HYPRE_CSRMatrix +HYPRE_CSRMatrix HYPRE_CSRMatrixRead( char *file_name ) { return ( (HYPRE_CSRMatrix) hypre_CSRMatrixRead( file_name ) ); @@ -81,7 +73,7 @@ * HYPRE_CSRMatrixPrint *--------------------------------------------------------------------------*/ -void +void HYPRE_CSRMatrixPrint( HYPRE_CSRMatrix matrix, char *file_name ) { @@ -103,4 +95,95 @@ return 0; } +HYPRE_Int +HYPRE_CSRMatrixDeviceSpGemmSetRownnzEstimateMethod( HYPRE_Int value ) +{ +#if defined(HYPRE_USING_CUDA) + if (hypre_handle == NULL) + { + return -1; + } + + if (value == 1 || value == 2 || value == 3) + { + hypre_handle->spgemm_rownnz_estimate_method = value; + } + else + { + return -1; + } +#endif + + return 0; +} + +HYPRE_Int +HYPRE_CSRMatrixDeviceSpGemmSetRownnzEstimateNSamples( HYPRE_Int value ) +{ +#if defined(HYPRE_USING_CUDA) + if (hypre_handle == NULL) + { + return -1; + } + + hypre_handle->spgemm_rownnz_estimate_nsamples = value; +#endif + + return 0; +} + +HYPRE_Int +HYPRE_CSRMatrixDeviceSpGemmSetRownnzEstimateMultFactor( HYPRE_Real value ) +{ +#if defined(HYPRE_USING_CUDA) + if (hypre_handle == NULL) + { + return -1; + } + + if (value > 0.0) + { + hypre_handle->spgemm_rownnz_estimate_mult_factor = value; + } + else + { + return -1; + } +#endif + + return 0; +} + +HYPRE_Int +HYPRE_CSRMatrixDeviceSpGemmSetHashType( char value ) +{ +#if defined(HYPRE_USING_CUDA) + if (hypre_handle == NULL) + { + return -1; + } + + if (value == 'L' || value == 'Q' || value == 'D') + { + hypre_handle->spgemm_hash_type = value; + } +#endif + + return 0; +} + +HYPRE_Int +HYPRE_CSRMatrixDeviceSpGemmSetUseCusparse( HYPRE_Int value ) +{ +#if defined(HYPRE_USING_CUDA) + if (hypre_handle == NULL) + { + return -1; + } + + hypre_handle->spgemm_use_cusparse = value != 0; +#endif + + return 0; +} diff -Nru hypre-2.16.0/src/seq_mv/HYPRE_mapped_matrix.c hypre-2.18.2/src/seq_mv/HYPRE_mapped_matrix.c --- hypre-2.16.0/src/seq_mv/HYPRE_mapped_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/HYPRE_mapped_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/seq_mv/HYPRE_multiblock_matrix.c hypre-2.18.2/src/seq_mv/HYPRE_multiblock_matrix.c --- hypre-2.16.0/src/seq_mv/HYPRE_multiblock_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/HYPRE_multiblock_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/seq_mv/HYPRE_seq_mv.h hypre-2.18.2/src/seq_mv/HYPRE_seq_mv.h --- hypre-2.16.0/src/seq_mv/HYPRE_seq_mv.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/HYPRE_seq_mv.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -86,6 +78,12 @@ HYPRE_Int HYPRE_VectorPrint( HYPRE_Vector vector , char *file_name ); HYPRE_Vector HYPRE_VectorRead( char *file_name ); +HYPRE_Int HYPRE_CSRMatrixDeviceSpGemmSetRownnzEstimateMethod( HYPRE_Int value ); +HYPRE_Int HYPRE_CSRMatrixDeviceSpGemmSetRownnzEstimateNSamples( HYPRE_Int value ); +HYPRE_Int HYPRE_CSRMatrixDeviceSpGemmSetRownnzEstimateMultFactor( HYPRE_Real value ); +HYPRE_Int HYPRE_CSRMatrixDeviceSpGemmSetHashType( char value ); +HYPRE_Int HYPRE_CSRMatrixDeviceSpGemmSetUseCusparse( HYPRE_Int value ); + typedef enum HYPRE_TimerID { // timers for solver phase @@ -129,6 +127,16 @@ HYPRE_TIMER_ID_RENUMBER_COLIDX_RAP, HYPRE_TIMER_ID_MERGE, + // csr matop + HYPRE_TIMER_ID_SPMM_ROWNNZ, + HYPRE_TIMER_ID_SPMM_ATTEMPT1, + HYPRE_TIMER_ID_SPMM_ATTEMPT2, + HYPRE_TIMER_ID_SPMM_SYMBOLIC, + HYPRE_TIMER_ID_SPMM_NUMERIC, + HYPRE_TIMER_ID_SPMM, + HYPRE_TIMER_ID_SPADD, + HYPRE_TIMER_ID_SPTRANS, + HYPRE_TIMER_ID_COUNT } HYPRE_TimerID; diff -Nru hypre-2.16.0/src/seq_mv/HYPRE_vector.c hypre-2.18.2/src/seq_mv/HYPRE_vector.c --- hypre-2.16.0/src/seq_mv/HYPRE_vector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/HYPRE_vector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/seq_mv/Makefile hypre-2.18.2/src/seq_mv/Makefile --- hypre-2.16.0/src/seq_mv/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,10 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config -#FILES_NVCC = gpukernels.cu -#include $(HYPRE_NVCC_MAKEFILE) - CINCLUDES = ${INCLUDES} ${MPIINCLUDE} C_COMPILE_FLAGS =\ @@ -37,8 +26,19 @@ FILES =\ csr_matop.c\ + csr_matop_device.c\ csr_matrix.c\ csr_matvec.c\ + csr_matvec_oomp.c\ + csr_spadd_device.c\ + csr_spgemm_device.c\ + csr_spgemm_device_attempt.c\ + csr_spgemm_device_confident.c\ + csr_spgemm_device_cusparse.c\ + csr_spgemm_device_rowbound.c\ + csr_spgemm_device_rowest.c\ + csr_spgemm_device_util.c\ + csr_sptrans_device.c\ genpart.c\ HYPRE_csr_matrix.c\ HYPRE_mapped_matrix.c\ @@ -47,8 +47,7 @@ mapped_matrix.c\ multiblock_matrix.c\ vector.c\ - csr_matvec_oomp.c\ - gpukernels.c + vector_batched.c OBJS = ${FILES:.c=.o} #CUOBJS = ${FILES_NVCC:.cu=.o} diff -Nru hypre-2.16.0/src/seq_mv/Makefile.empty hypre-2.18.2/src/seq_mv/Makefile.empty --- hypre-2.16.0/src/seq_mv/Makefile.empty 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/Makefile.empty 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ - diff -Nru hypre-2.16.0/src/seq_mv/Makefile.nvcc hypre-2.18.2/src/seq_mv/Makefile.nvcc --- hypre-2.16.0/src/seq_mv/Makefile.nvcc 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/Makefile.nvcc 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ - -FILES_NVCC =\ - gpukernels.cu - diff -Nru hypre-2.16.0/src/seq_mv/MakeIRIX hypre-2.18.2/src/seq_mv/MakeIRIX --- hypre-2.16.0/src/seq_mv/MakeIRIX 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/MakeIRIX 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) .SUFFIXES: .SUFFIXES: .c .f .o diff -Nru hypre-2.16.0/src/seq_mv/mapped_matrix.c hypre-2.18.2/src/seq_mv/mapped_matrix.c --- hypre-2.16.0/src/seq_mv/mapped_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/mapped_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/seq_mv/mapped_matrix.h hypre-2.18.2/src/seq_mv/mapped_matrix.h --- hypre-2.16.0/src/seq_mv/mapped_matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/mapped_matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/seq_mv/multiblock_matrix.c hypre-2.18.2/src/seq_mv/multiblock_matrix.c --- hypre-2.16.0/src/seq_mv/multiblock_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/multiblock_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/seq_mv/multiblock_matrix.h hypre-2.18.2/src/seq_mv/multiblock_matrix.h --- hypre-2.16.0/src/seq_mv/multiblock_matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/multiblock_matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/seq_mv/seq_mv.h hypre-2.18.2/src/seq_mv/seq_mv.h --- hypre-2.16.0/src/seq_mv/seq_mv.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/seq_mv.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,10 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + #ifndef hypre_MV_HEADER #define hypre_MV_HEADER @@ -56,39 +52,36 @@ /* Does the CSRMatrix create/destroy `data', `i', `j'? */ HYPRE_Int owns_data; - HYPRE_Complex *data; + HYPRE_Complex *data; /* for compressing rows in matrix multiplication */ HYPRE_Int *rownnz; HYPRE_Int num_rownnz; -#ifdef HYPRE_USING_UNIFIED_MEMORY - /* Flag to keeping track of prefetching */ - HYPRE_Int on_device; -#endif -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - HYPRE_Int mapped; -#endif + /* memory location of arrays i, j, data */ + HYPRE_Int memory_location; + //#ifdef HYPRE_BIGINT // hypre_int *i_short, *j_short; //#endif - + } hypre_CSRMatrix; /*-------------------------------------------------------------------------- * Accessor functions for the CSR Matrix structure *--------------------------------------------------------------------------*/ -#define hypre_CSRMatrixData(matrix) ((matrix) -> data) -#define hypre_CSRMatrixI(matrix) ((matrix) -> i) -#define hypre_CSRMatrixJ(matrix) ((matrix) -> j) -#define hypre_CSRMatrixBigJ(matrix) ((matrix) -> big_j) -#define hypre_CSRMatrixNumRows(matrix) ((matrix) -> num_rows) -#define hypre_CSRMatrixNumCols(matrix) ((matrix) -> num_cols) -#define hypre_CSRMatrixNumNonzeros(matrix) ((matrix) -> num_nonzeros) -#define hypre_CSRMatrixRownnz(matrix) ((matrix) -> rownnz) -#define hypre_CSRMatrixNumRownnz(matrix) ((matrix) -> num_rownnz) -#define hypre_CSRMatrixOwnsData(matrix) ((matrix) -> owns_data) +#define hypre_CSRMatrixData(matrix) ((matrix) -> data) +#define hypre_CSRMatrixI(matrix) ((matrix) -> i) +#define hypre_CSRMatrixJ(matrix) ((matrix) -> j) +#define hypre_CSRMatrixBigJ(matrix) ((matrix) -> big_j) +#define hypre_CSRMatrixNumRows(matrix) ((matrix) -> num_rows) +#define hypre_CSRMatrixNumCols(matrix) ((matrix) -> num_cols) +#define hypre_CSRMatrixNumNonzeros(matrix) ((matrix) -> num_nonzeros) +#define hypre_CSRMatrixRownnz(matrix) ((matrix) -> rownnz) +#define hypre_CSRMatrixNumRownnz(matrix) ((matrix) -> num_rownnz) +#define hypre_CSRMatrixOwnsData(matrix) ((matrix) -> owns_data) +#define hypre_CSRMatrixMemoryLocation(matrix) ((matrix) -> memory_location) HYPRE_Int hypre_CSRMatrixGetLoadBalancedPartitionBegin( hypre_CSRMatrix *A ); HYPRE_Int hypre_CSRMatrixGetLoadBalancedPartitionEnd( hypre_CSRMatrix *A ); @@ -139,7 +132,7 @@ typedef struct { void *matrix; - HYPRE_Int (*ColMap)(HYPRE_Int, void *); + HYPRE_Int (*ColMap)(HYPRE_Int, void *); void *MapData; } hypre_MappedMatrix; @@ -173,8 +166,8 @@ typedef struct { - HYPRE_Int num_submatrices; - HYPRE_Int *submatrix_types; + HYPRE_Int num_submatrices; + HYPRE_Int *submatrix_types; void **submatrices; } hypre_MultiblockMatrix; @@ -211,10 +204,13 @@ typedef struct { HYPRE_Complex *data; - HYPRE_Int size; + HYPRE_Int size; /* Does the Vector create/destroy `data'? */ - HYPRE_Int owns_data; + HYPRE_Int owns_data; + + /* memory location of array data */ + HYPRE_Int memory_location; /* For multivectors...*/ HYPRE_Int num_vectors; /* the above "size" is size of one vector */ @@ -225,59 +221,54 @@ With rowwise storage, vj[i] = data[ j + num_vectors*i] */ HYPRE_Int vecstride, idxstride; /* ... so vj[i] = data[ j*vecstride + i*idxstride ] regardless of row_storage.*/ -#ifdef HYPRE_USING_GPU - HYPRE_Int on_device; -#endif -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - HYPRE_Int mapped; - HYPRE_Int drc; /* device ref count */ - HYPRE_Int hrc; /* host ref count */ -#endif - } hypre_Vector; /*-------------------------------------------------------------------------- * Accessor functions for the Vector structure *--------------------------------------------------------------------------*/ -#define hypre_VectorData(vector) ((vector) -> data) -#define hypre_VectorSize(vector) ((vector) -> size) -#define hypre_VectorOwnsData(vector) ((vector) -> owns_data) -#define hypre_VectorNumVectors(vector) ((vector) -> num_vectors) +#define hypre_VectorData(vector) ((vector) -> data) +#define hypre_VectorSize(vector) ((vector) -> size) +#define hypre_VectorOwnsData(vector) ((vector) -> owns_data) +#define hypre_VectorMemoryLocation(vector) ((vector) -> memory_location) +#define hypre_VectorNumVectors(vector) ((vector) -> num_vectors) #define hypre_VectorMultiVecStorageMethod(vector) ((vector) -> multivec_storage_method) -#define hypre_VectorVectorStride(vector) ((vector) -> vecstride ) -#define hypre_VectorIndexStride(vector) ((vector) -> idxstride ) +#define hypre_VectorVectorStride(vector) ((vector) -> vecstride ) +#define hypre_VectorIndexStride(vector) ((vector) -> idxstride ) #endif -#ifndef hypre_GPUKERNELS_HEADER -#define hypre_GPUKERNELS_HEADER -#ifdef HYPRE_USING_GPU -#include -HYPRE_Int VecScaleScalar(HYPRE_Real *u, const HYPRE_Real alpha, HYPRE_Int num_rows,cudaStream_t s); -void DiagScaleVector(HYPRE_Real *x, HYPRE_Real *y, HYPRE_Real *A_data, HYPRE_Int *A_i, HYPRE_Int num_rows, cudaStream_t s); -void VecCopy(HYPRE_Real* tgt, const HYPRE_Real* src, HYPRE_Int size,cudaStream_t s); -void VecSet(HYPRE_Real* tgt, HYPRE_Int size, HYPRE_Real value, cudaStream_t s); -void VecScale(HYPRE_Real *u, HYPRE_Real *v, HYPRE_Real *l1_norm, HYPRE_Int num_rows,cudaStream_t s); -void VecScaleSplit(HYPRE_Real *u, HYPRE_Real *v, HYPRE_Real *l1_norm, HYPRE_Int num_rows,cudaStream_t s); -void CudaCompileFlagCheck(); -void PackOnDevice(HYPRE_Complex *send_data,HYPRE_Complex *x_local_data, HYPRE_Int *send_map, HYPRE_Int begin, HYPRE_Int end,cudaStream_t s); -#endif -#endif - /* csr_matop.c */ +hypre_CSRMatrix *hypre_CSRMatrixAddHost ( hypre_CSRMatrix *A , hypre_CSRMatrix *B ); hypre_CSRMatrix *hypre_CSRMatrixAdd ( hypre_CSRMatrix *A , hypre_CSRMatrix *B ); hypre_CSRMatrix *hypre_CSRMatrixBigAdd ( hypre_CSRMatrix *A , hypre_CSRMatrix *B ); +hypre_CSRMatrix *hypre_CSRMatrixMultiplyHost ( hypre_CSRMatrix *A , hypre_CSRMatrix *B ); hypre_CSRMatrix *hypre_CSRMatrixMultiply ( hypre_CSRMatrix *A , hypre_CSRMatrix *B ); hypre_CSRMatrix *hypre_CSRMatrixDeleteZeros ( hypre_CSRMatrix *A , HYPRE_Real tol ); +HYPRE_Int hypre_CSRMatrixTransposeHost ( hypre_CSRMatrix *A , hypre_CSRMatrix **AT , HYPRE_Int data ); HYPRE_Int hypre_CSRMatrixTranspose ( hypre_CSRMatrix *A , hypre_CSRMatrix **AT , HYPRE_Int data ); HYPRE_Int hypre_CSRMatrixReorder ( hypre_CSRMatrix *A ); HYPRE_Complex hypre_CSRMatrixSumElts ( hypre_CSRMatrix *A ); +HYPRE_Real hypre_CSRMatrixFnorm( hypre_CSRMatrix *A ); +HYPRE_Int hypre_CSRMatrixSplit(hypre_CSRMatrix *Bs_ext, HYPRE_BigInt first_col_diag_B, HYPRE_BigInt last_col_diag_B, HYPRE_Int num_cols_offd_B, HYPRE_BigInt *col_map_offd_B, HYPRE_Int *num_cols_offd_C_ptr, HYPRE_BigInt **col_map_offd_C_ptr, hypre_CSRMatrix **Bext_diag_ptr, hypre_CSRMatrix **Bext_offd_ptr); +hypre_CSRMatrix * hypre_CSRMatrixAddPartial( hypre_CSRMatrix *A, hypre_CSRMatrix *B, HYPRE_Int *row_nums); + +/* csr_matop_device.c */ +#if defined(HYPRE_USING_CUDA) +hypre_CSRMatrix *hypre_CSRMatrixAddDevice ( hypre_CSRMatrix *A , hypre_CSRMatrix *B ); +hypre_CSRMatrix *hypre_CSRMatrixMultiplyDevice ( hypre_CSRMatrix *A , hypre_CSRMatrix *B ); +HYPRE_Int hypre_CSRMatrixSplitDevice(hypre_CSRMatrix *B_ext, HYPRE_BigInt first_col_diag_B, HYPRE_BigInt last_col_diag_B, HYPRE_Int num_cols_offd_B, HYPRE_BigInt *col_map_offd_B, HYPRE_Int **map_B_to_C_ptr, HYPRE_Int *num_cols_offd_C_ptr, HYPRE_BigInt **col_map_offd_C_ptr, hypre_CSRMatrix **B_ext_diag_ptr, hypre_CSRMatrix **B_ext_offd_ptr); +HYPRE_Int hypre_CSRMatrixTransposeDevice ( hypre_CSRMatrix *A , hypre_CSRMatrix **AT , HYPRE_Int data ); +hypre_CSRMatrix* hypre_CSRMatrixAddPartialDevice( hypre_CSRMatrix *A, hypre_CSRMatrix *B, HYPRE_Int *row_nums); +HYPRE_Int hypre_CSRMatrixColNNzRealDevice( hypre_CSRMatrix *A, HYPRE_Real *colnnz); +HYPRE_Int hypre_CSRMatrixMoveDiagFirstDevice( hypre_CSRMatrix *A ); +#endif /* csr_matrix.c */ hypre_CSRMatrix *hypre_CSRMatrixCreate ( HYPRE_Int num_rows , HYPRE_Int num_cols , HYPRE_Int num_nonzeros ); HYPRE_Int hypre_CSRMatrixDestroy ( hypre_CSRMatrix *matrix ); +HYPRE_Int hypre_CSRMatrixInitialize_v2( hypre_CSRMatrix *matrix, HYPRE_Int bigInit, HYPRE_Int memory_location ); HYPRE_Int hypre_CSRMatrixInitialize ( hypre_CSRMatrix *matrix ); HYPRE_Int hypre_CSRMatrixBigInitialize ( hypre_CSRMatrix *matrix ); HYPRE_Int hypre_CSRMatrixBigJtoJ ( hypre_CSRMatrix *matrix ); @@ -285,32 +276,27 @@ HYPRE_Int hypre_CSRMatrixSetDataOwner ( hypre_CSRMatrix *matrix , HYPRE_Int owns_data ); HYPRE_Int hypre_CSRMatrixSetRownnz ( hypre_CSRMatrix *matrix ); hypre_CSRMatrix *hypre_CSRMatrixRead ( char *file_name ); -HYPRE_Int hypre_CSRMatrixPrint ( hypre_CSRMatrix *matrix , char *file_name ); +HYPRE_Int hypre_CSRMatrixPrint ( hypre_CSRMatrix *matrix, const char *file_name ); +HYPRE_Int hypre_CSRMatrixPrint2( hypre_CSRMatrix *matrix, const char *file_name ); HYPRE_Int hypre_CSRMatrixPrintHB ( hypre_CSRMatrix *matrix_input , char *file_name ); +HYPRE_Int hypre_CSRMatrixPrintMM( hypre_CSRMatrix *matrix, HYPRE_Int basei, HYPRE_Int basej, HYPRE_Int trans, const char *file_name ); HYPRE_Int hypre_CSRMatrixCopy ( hypre_CSRMatrix *A , hypre_CSRMatrix *B , HYPRE_Int copy_data ); -hypre_CSRMatrix *hypre_CSRMatrixClone ( hypre_CSRMatrix *A ); +hypre_CSRMatrix *hypre_CSRMatrixClone ( hypre_CSRMatrix *A, HYPRE_Int copy_data ); +hypre_CSRMatrix *hypre_CSRMatrixClone_v2( hypre_CSRMatrix *A, HYPRE_Int copy_data, HYPRE_Int memory_location ); hypre_CSRMatrix *hypre_CSRMatrixUnion ( hypre_CSRMatrix *A , hypre_CSRMatrix *B , HYPRE_BigInt *col_map_offd_A , HYPRE_BigInt *col_map_offd_B , HYPRE_BigInt **col_map_offd_C ); -#ifdef HYPRE_USING_UNIFIED_MEMORY -void hypre_CSRMatrixPrefetchToDevice(hypre_CSRMatrix *A); -void hypre_CSRMatrixPrefetchToDeviceBIGINT(hypre_CSRMatrix *A); -void hypre_CSRMatrixPrefetchToHost(hypre_CSRMatrix *A); -hypre_int hypre_CSRMatrixIsManaged(hypre_CSRMatrix *a); -#endif -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD -void hypre_CSRMatrixMapToDevice(hypre_CSRMatrix *A); -void hypre_CSRMatrixUpdateToDevice(hypre_CSRMatrix *A); -void hypre_CSRMatrixUnMapFromDevice(hypre_CSRMatrix *A); -#endif +HYPRE_Int hypre_CSRMatrixPrefetch( hypre_CSRMatrix *A, HYPRE_Int to_location); +//hypre_int hypre_CSRMatrixIsManaged(hypre_CSRMatrix *a); + /* csr_matvec.c */ // y[offset:end] = alpha*A[offset:end,:]*x + beta*b[offset:end] HYPRE_Int hypre_CSRMatrixMatvecOutOfPlace ( HYPRE_Complex alpha , hypre_CSRMatrix *A , hypre_Vector *x , HYPRE_Complex beta , hypre_Vector *b, hypre_Vector *y, HYPRE_Int offset ); -HYPRE_Int hypre_CSRMatrixMatvecOutOfPlaceOOMP ( HYPRE_Complex alpha , hypre_CSRMatrix *A , hypre_Vector *x , HYPRE_Complex beta , hypre_Vector *b, hypre_Vector *y, HYPRE_Int offset ); +HYPRE_Int hypre_CSRMatrixMatvecOutOfPlaceOOMP (HYPRE_Int trans, HYPRE_Complex alpha , hypre_CSRMatrix *A , hypre_Vector *x , HYPRE_Complex beta , hypre_Vector *b, hypre_Vector *y, HYPRE_Int offset ); // y = alpha*A + beta*y HYPRE_Int hypre_CSRMatrixMatvec ( HYPRE_Complex alpha , hypre_CSRMatrix *A , hypre_Vector *x , HYPRE_Complex beta , hypre_Vector *y ); HYPRE_Int hypre_CSRMatrixMatvecT ( HYPRE_Complex alpha , hypre_CSRMatrix *A , hypre_Vector *x , HYPRE_Complex beta , hypre_Vector *y ); HYPRE_Int hypre_CSRMatrixMatvec_FF ( HYPRE_Complex alpha , hypre_CSRMatrix *A , hypre_Vector *x , HYPRE_Complex beta , hypre_Vector *y , HYPRE_Int *CF_marker_x , HYPRE_Int *CF_marker_y , HYPRE_Int fpt ); -#ifdef HYPRE_USING_GPU -HYPRE_Int hypre_CSRMatrixMatvecDevice( HYPRE_Complex alpha , hypre_CSRMatrix *A , hypre_Vector *x , HYPRE_Complex beta , hypre_Vector *b, hypre_Vector *y, HYPRE_Int offset ); +#ifdef HYPRE_USING_CUDA +HYPRE_Int hypre_CSRMatrixMatvecDevice(HYPRE_Int trans, HYPRE_Complex alpha , hypre_CSRMatrix *A , hypre_Vector *x , HYPRE_Complex beta , hypre_Vector *b, hypre_Vector *y, HYPRE_Int offset ); HYPRE_Int hypre_CSRMatrixMatvecDeviceBIGINT( HYPRE_Complex alpha , hypre_CSRMatrix *A , hypre_Vector *x , HYPRE_Complex beta , hypre_Vector *b, hypre_Vector *y, HYPRE_Int offset ); #endif /* genpart.c */ @@ -383,6 +369,7 @@ hypre_Vector *hypre_SeqVectorCreate ( HYPRE_Int size ); hypre_Vector *hypre_SeqMultiVectorCreate ( HYPRE_Int size , HYPRE_Int num_vectors ); HYPRE_Int hypre_SeqVectorDestroy ( hypre_Vector *vector ); +HYPRE_Int hypre_SeqVectorInitialize_v2( hypre_Vector *vector, HYPRE_Int memory_location ); HYPRE_Int hypre_SeqVectorInitialize ( hypre_Vector *vector ); HYPRE_Int hypre_SeqVectorSetDataOwner ( hypre_Vector *vector , HYPRE_Int owns_data ); hypre_Vector *hypre_SeqVectorRead ( char *file_name ); @@ -392,7 +379,8 @@ HYPRE_Int hypre_SeqVectorCopy ( hypre_Vector *x , hypre_Vector *y ); hypre_Vector *hypre_SeqVectorCloneDeep ( hypre_Vector *x ); hypre_Vector *hypre_SeqVectorCloneShallow ( hypre_Vector *x ); -HYPRE_Int hypre_SeqVectorScale ( HYPRE_Complex alpha , hypre_Vector *y ); +HYPRE_Int hypre_SeqVectorScale( HYPRE_Complex alpha, hypre_Vector *y ); + HYPRE_Int hypre_SeqVectorAxpy ( HYPRE_Complex alpha , hypre_Vector *x , hypre_Vector *y ); HYPRE_Real hypre_SeqVectorInnerProd ( hypre_Vector *x , hypre_Vector *y ); HYPRE_Int hypre_SeqVectorMassInnerProd(hypre_Vector *x, hypre_Vector **y, HYPRE_Int k, HYPRE_Int unroll, HYPRE_Real *result); @@ -404,54 +392,25 @@ HYPRE_Int hypre_SeqVectorMassAxpy(HYPRE_Complex *alpha, hypre_Vector **x, hypre_Vector *y, HYPRE_Int k, HYPRE_Int unroll); HYPRE_Int hypre_SeqVectorMassAxpy4(HYPRE_Complex *alpha, hypre_Vector **x, hypre_Vector *y, HYPRE_Int k); HYPRE_Int hypre_SeqVectorMassAxpy8(HYPRE_Complex *alpha, hypre_Vector **x, hypre_Vector *y, HYPRE_Int k); -HYPRE_Complex hypre_VectorSumElts ( hypre_Vector *vector ); -#ifdef HYPRE_USING_UNIFIED_MEMORY -HYPRE_Complex hypre_VectorSumAbsElts ( hypre_Vector *vector ); -HYPRE_Int hypre_SeqVectorCopyDevice ( hypre_Vector *x , hypre_Vector *y ); -HYPRE_Int hypre_SeqVectorAxpyDevice( HYPRE_Complex alpha , hypre_Vector *x , hypre_Vector *y ); -HYPRE_Real hypre_SeqVectorInnerProdDevice ( hypre_Vector *x , hypre_Vector *y ); -/*void hypre_SeqVectorMassInnerProdDevice ( hypre_Vector *x , hypre_Vector **y, HYPRE_Int k, HYPRE_Real * result); -void hypre_SeqVectorMassAxpyDevice(HYPRE_Complex * alpha, hypre_Vector **x, hypre_Vector *y, HYPRE_Int k);*/ - -void hypre_SeqVectorPrefetchToDevice(hypre_Vector *x); -void hypre_SeqVectorPrefetchToHost(hypre_Vector *x); -void hypre_SeqVectorPrefetchToDeviceInStream(hypre_Vector *x, HYPRE_Int index); -hypre_int hypre_SeqVectorIsManaged(hypre_Vector *x); -#endif -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD -void hypre_SeqVectorMapToDevice(hypre_Vector *x); -void hypre_SeqVectorUnMapFromDevice(hypre_Vector *x); -void hypre_SeqVectorUpdateDevice(hypre_Vector *x); -void hypre_SeqVectorUpdateHost(hypre_Vector *x); -#endif +HYPRE_Complex hypre_SeqVectorSumElts ( hypre_Vector *vector ); +HYPRE_Int hypre_SeqVectorPrefetch(hypre_Vector *x, HYPRE_Int to_location); +//hypre_int hypre_SeqVectorIsManaged(hypre_Vector *x); -HYPRE_Int hypre_CSRMatrixMatvecOutOfPlaceOOMP3( HYPRE_Complex alpha, hypre_CSRMatrix *A, hypre_Vector *x, HYPRE_Complex beta, hypre_Vector *b, hypre_Vector *y, HYPRE_Int offset); +//HYPRE_Int hypre_CSRMatrixMatvecOutOfPlaceOOMP3( HYPRE_Complex alpha, hypre_CSRMatrix *A, hypre_Vector *x, HYPRE_Complex beta, hypre_Vector *b, hypre_Vector *y, HYPRE_Int offset); + +#if defined(HYPRE_USING_CUDA) + +HYPRE_Int hypreDevice_CSRSpAdd(HYPRE_Int ma, HYPRE_Int mb, HYPRE_Int n, HYPRE_Int nnzA, HYPRE_Int nnzB, HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Complex *d_aa, HYPRE_Int *d_ib, HYPRE_Int *d_jb, HYPRE_Complex *d_ab, HYPRE_Int *d_num_b, HYPRE_Int *nnzC_out, HYPRE_Int **d_ic_out, HYPRE_Int **d_jc_out, HYPRE_Complex **d_ac_out); + +HYPRE_Int hypreDevice_CSRSpTrans(HYPRE_Int m, HYPRE_Int n, HYPRE_Int nnzA, HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Complex *d_aa, HYPRE_Int **d_ic_out, HYPRE_Int **d_jc_out, HYPRE_Complex **d_ac_out, HYPRE_Int want_data); + +HYPRE_Int hypreDevice_CSRSpGemm(HYPRE_Int m, HYPRE_Int k, HYPRE_Int n, HYPRE_Int nnza, HYPRE_Int nnzb, HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Complex *d_a, HYPRE_Int *d_ib, HYPRE_Int *d_jb, HYPRE_Complex *d_b, HYPRE_Int **d_ic_out, HYPRE_Int **d_jc_out, HYPRE_Complex **d_c_out, HYPRE_Int *nnzC); -#ifdef __cplusplus -} #endif -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD -inline void UpdateHRC(hypre_Vector *v){ - v->hrc++; -} -inline void UpdateDRC(hypre_Vector *v){ - v->drc++; -} -inline void SetHRC(hypre_Vector *v){ - v->hrc=v->drc; -} -inline void SetDRC(hypre_Vector *v){ - v->drc=v->hrc; -} -inline void SyncVectorToDevice(hypre_Vector *v){ - if (v->hrc>v->drc) hypre_SeqVectorUpdateDevice(v); -} -inline void SyncVectorToHost(hypre_Vector *v){ - if (v->drc>v->hrc) hypre_SeqVectorUpdateHost(v); +#ifdef __cplusplus } #endif -void printRC(hypre_Vector *x,char *id); -#endif +#endif /* #ifndef hypre_MV_HEADER */ diff -Nru hypre-2.16.0/src/seq_mv/vector_batched.c hypre-2.18.2/src/seq_mv/vector_batched.c --- hypre-2.16.0/src/seq_mv/vector_batched.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/vector_batched.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,1205 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#include "seq_mv.h" + +/*-------------------------------------------------------------------------- + * hypre_SeqVectorMassAxpy8 + *--------------------------------------------------------------------------*/ + +HYPRE_Int +hypre_SeqVectorMassAxpy8( HYPRE_Complex *alpha, + hypre_Vector **x, + hypre_Vector *y, HYPRE_Int k) +{ + HYPRE_Complex *x_data = hypre_VectorData(x[0]); + HYPRE_Complex *y_data = hypre_VectorData(y); + HYPRE_Int size = hypre_VectorSize(x[0]); + + HYPRE_Int i, j, jstart, restk; + + + restk = (k-(k/8*8)); + + if (k > 7) + { + for (j = 0; j < k-7; j += 8) + { + jstart = j*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + y_data[i] += alpha[j]*x_data[jstart+i] + alpha[j+1]*x_data[jstart+i+size] + + alpha[j+2]*x_data[(j+2)*size+i] + alpha[j+3]*x_data[(j+3)*size+i] + + alpha[j+4]*x_data[(j+4)*size+i] + alpha[j+5]*x_data[(j+5)*size+i] + + alpha[j+6]*x_data[(j+6)*size+i] + alpha[j+7]*x_data[(j+7)*size+i]; + } + } + } + if (restk == 1) + { + jstart = (k-1)*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + y_data[i] += alpha[k-1] * x_data[jstart+i]; + } + } + else if (restk == 2) + { + jstart = (k-2)*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + y_data[i] += alpha[k-2] * x_data[jstart+i] + alpha[k-1] * x_data[jstart+size+i]; + } + } + else if (restk == 3) + { + jstart = (k-3)*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + y_data[i] += alpha[k-3] * x_data[jstart+i] + alpha[k-2] * x_data[jstart+size+i] + alpha[k-1] * x_data[(k-1)*size+i]; + } + } + else if (restk == 4) + { + jstart = (k-4)*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + y_data[i] += alpha[k-4]*x_data[(k-4)*size+i] + alpha[k-3]*x_data[(k-3)*size+i] + + alpha[k-2]*x_data[(k-2)*size+i] + alpha[k-1]*x_data[(k-1)*size+i]; + } + } + else if (restk == 5) + { +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + y_data[i] += + alpha[k-5]*x_data[(k-5)*size+i] + alpha[k-4]*x_data[(k-4)*size+i] + + alpha[k-3]*x_data[(k-3)*size+i] + alpha[k-2]*x_data[(k-2)*size+i] + + alpha[k-1]*x_data[(k-1)*size+i]; + } + } + else if (restk == 6) + { + jstart = (k-6)*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + y_data[i] += alpha[k-6]*x_data[jstart+i] + alpha[k-5]*x_data[jstart+i+size] + + alpha[k-4]*x_data[(k-4)*size+i] + alpha[k-3]*x_data[(k-3)*size+i] + + alpha[k-2]*x_data[(k-2)*size+i] + alpha[k-1]*x_data[(k-1)*size+i]; + } + } + else if (restk == 7) + { + jstart = (k-7)*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + y_data[i] += alpha[k-7]*x_data[jstart+i] + alpha[k-6]*x_data[jstart+i+size] + + alpha[k-5]*x_data[(k-5)*size+i] + alpha[k-4]*x_data[(k-4)*size+i] + + alpha[k-3]*x_data[(k-3)*size+i] + alpha[k-2]*x_data[(k-2)*size+i] + + alpha[k-1]*x_data[(k-1)*size+i]; + } + } + + return hypre_error_flag; +} + +/*-------------------------------------------------------------------------- + * hypre_SeqVectorMassAxpy4 + *--------------------------------------------------------------------------*/ + +HYPRE_Int +hypre_SeqVectorMassAxpy4( HYPRE_Complex *alpha, + hypre_Vector **x, + hypre_Vector *y, HYPRE_Int k) +{ + HYPRE_Complex *x_data = hypre_VectorData(x[0]); + HYPRE_Complex *y_data = hypre_VectorData(y); + HYPRE_Int size = hypre_VectorSize(x[0]); + + HYPRE_Int i, j, jstart, restk; + + + restk = (k-(k/4*4)); + + if (k > 3) + { + for (j = 0; j < k-3; j += 4) + { + jstart = j*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + y_data[i] += alpha[j]*x_data[jstart+i] + alpha[j+1]*x_data[jstart+i+size] + + alpha[j+2]*x_data[(j+2)*size+i] + alpha[j+3]*x_data[(j+3)*size+i]; + } + } + } + if (restk == 1) + { + jstart = (k-1)*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + y_data[i] += alpha[k-1] * x_data[jstart+i]; + } + } + else if (restk == 2) + { + jstart = (k-2)*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + y_data[i] += alpha[k-2] * x_data[jstart+i] + alpha[k-1] * x_data[jstart+size+i]; + } + } + else if (restk == 3) + { + jstart = (k-3)*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + y_data[i] += alpha[k-3] * x_data[jstart+i] + alpha[k-2] * x_data[jstart+size+i] + alpha[k-1] * x_data[(k-1)*size+i]; + } + } + + return hypre_error_flag; +} + +/*-------------------------------------------------------------------------- + * hypre_SeqVectorMassAxpy + *--------------------------------------------------------------------------*/ + +HYPRE_Int +hypre_SeqVectorMassAxpy( HYPRE_Complex *alpha, + hypre_Vector **x, + hypre_Vector *y, HYPRE_Int k, HYPRE_Int unroll) +{ + HYPRE_Complex *x_data = hypre_VectorData(x[0]); + HYPRE_Complex *y_data = hypre_VectorData(y); + HYPRE_Int size = hypre_VectorSize(x[0]); + + HYPRE_Int i, j, jstart; + + if (unroll == 8) + { + hypre_SeqVectorMassAxpy8(alpha, x, y, k); + return hypre_error_flag; + } + else if (unroll == 4) + { + hypre_SeqVectorMassAxpy4(alpha, x, y, k); + return hypre_error_flag; + } + else + { + for (j = 0; j < k; j++) + { + jstart = j*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + y_data[i] += alpha[j]*x_data[jstart+i]; + } + } + } + + return hypre_error_flag; +} + +/*-------------------------------------------------------------------------- + * hypre_SeqVectorMassInnerProd8 + *--------------------------------------------------------------------------*/ +HYPRE_Int hypre_SeqVectorMassInnerProd8( hypre_Vector *x, + hypre_Vector **y, HYPRE_Int k, HYPRE_Real *result) +{ + HYPRE_Complex *x_data = hypre_VectorData(x); + HYPRE_Complex *y_data = hypre_VectorData(y[0]); + HYPRE_Int size = hypre_VectorSize(x); + + HYPRE_Int i, j, restk; + HYPRE_Real res1; + HYPRE_Real res2; + HYPRE_Real res3; + HYPRE_Real res4; + HYPRE_Real res5; + HYPRE_Real res6; + HYPRE_Real res7; + HYPRE_Real res8; + HYPRE_Int jstart; + HYPRE_Int jstart1; + HYPRE_Int jstart2; + HYPRE_Int jstart3; + HYPRE_Int jstart4; + HYPRE_Int jstart5; + HYPRE_Int jstart6; + HYPRE_Int jstart7; + + restk = (k-(k/8*8)); + + if (k > 7) + { + for (j = 0; j < k-7; j += 8) + { + res1 = 0; + res2 = 0; + res3 = 0; + res4 = 0; + res5 = 0; + res6 = 0; + res7 = 0; + res8 = 0; + jstart = j*size; + jstart1 = jstart+size; + jstart2 = jstart1+size; + jstart3 = jstart2+size; + jstart4 = jstart3+size; + jstart5 = jstart4+size; + jstart6 = jstart5+size; + jstart7 = jstart6+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res1,res2,res3,res4,res5,res6,res7,res8) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; + res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; + res3 += hypre_conj(y_data[jstart2+i]) * x_data[i]; + res4 += hypre_conj(y_data[jstart3+i]) * x_data[i]; + res5 += hypre_conj(y_data[jstart4+i]) * x_data[i]; + res6 += hypre_conj(y_data[jstart5+i]) * x_data[i]; + res7 += hypre_conj(y_data[jstart6+i]) * x_data[i]; + res8 += hypre_conj(y_data[jstart7+i]) * x_data[i]; + } + result[j] = res1; + result[j+1] = res2; + result[j+2] = res3; + result[j+3] = res4; + result[j+4] = res5; + result[j+5] = res6; + result[j+6] = res7; + result[j+7] = res8; + } + } + if (restk == 1) + { + res1 = 0; + jstart = (k-1)*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res1) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; + } + result[k-1] = res1; + } + else if (restk == 2) + { + res1 = 0; + res2 = 0; + jstart = (k-2)*size; + jstart1 = jstart+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res1,res2) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; + res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; + } + result[k-2] = res1; + result[k-1] = res2; + } + else if (restk == 3) + { + res1 = 0; + res2 = 0; + res3 = 0; + jstart = (k-3)*size; + jstart1 = jstart+size; + jstart2 = jstart1+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res1,res2,res3) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; + res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; + res3 += hypre_conj(y_data[jstart2+i]) * x_data[i]; + } + result[k-3] = res1; + result[k-2] = res2; + result[k-1] = res3; + } + else if (restk == 4) + { + res1 = 0; + res2 = 0; + res3 = 0; + res4 = 0; + jstart = (k-4)*size; + jstart1 = jstart+size; + jstart2 = jstart1+size; + jstart3 = jstart2+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res1,res2,res3,res4) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; + res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; + res3 += hypre_conj(y_data[jstart2+i]) * x_data[i]; + res4 += hypre_conj(y_data[jstart3+i]) * x_data[i]; + } + result[k-4] = res1; + result[k-3] = res2; + result[k-2] = res3; + result[k-1] = res4; + } + else if (restk == 5) + { + res1 = 0; + res2 = 0; + res3 = 0; + res4 = 0; + res5 = 0; + jstart = (k-5)*size; + jstart1 = jstart+size; + jstart2 = jstart1+size; + jstart3 = jstart2+size; + jstart4 = jstart3+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res1,res2,res3,res4,res5) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; + res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; + res3 += hypre_conj(y_data[jstart2+i]) * x_data[i]; + res4 += hypre_conj(y_data[jstart3+i]) * x_data[i]; + res5 += hypre_conj(y_data[jstart4+i]) * x_data[i]; + } + result[k-5] = res1; + result[k-4] = res2; + result[k-3] = res3; + result[k-2] = res4; + result[k-1] = res5; + } + else if (restk == 6) + { + res1 = 0; + res2 = 0; + res3 = 0; + res4 = 0; + res5 = 0; + res6 = 0; + jstart = (k-6)*size; + jstart1 = jstart+size; + jstart2 = jstart1+size; + jstart3 = jstart2+size; + jstart4 = jstart3+size; + jstart5 = jstart4+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res1,res2,res3,res4,res5,res6) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; + res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; + res3 += hypre_conj(y_data[jstart2+i]) * x_data[i]; + res4 += hypre_conj(y_data[jstart3+i]) * x_data[i]; + res5 += hypre_conj(y_data[jstart4+i]) * x_data[i]; + res6 += hypre_conj(y_data[jstart5+i]) * x_data[i]; + } + result[k-6] = res1; + result[k-5] = res2; + result[k-4] = res3; + result[k-3] = res4; + result[k-2] = res5; + result[k-1] = res6; + } + else if (restk == 7) + { + res1 = 0; + res2 = 0; + res3 = 0; + res4 = 0; + res5 = 0; + res6 = 0; + res7 = 0; + jstart = (k-7)*size; + jstart1 = jstart+size; + jstart2 = jstart1+size; + jstart3 = jstart2+size; + jstart4 = jstart3+size; + jstart5 = jstart4+size; + jstart6 = jstart5+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res1,res2,res3,res4,res5,res6,res7) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; + res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; + res3 += hypre_conj(y_data[jstart2+i]) * x_data[i]; + res4 += hypre_conj(y_data[jstart3+i]) * x_data[i]; + res5 += hypre_conj(y_data[jstart4+i]) * x_data[i]; + res6 += hypre_conj(y_data[jstart5+i]) * x_data[i]; + res7 += hypre_conj(y_data[jstart6+i]) * x_data[i]; + } + result[k-7] = res1; + result[k-6] = res2; + result[k-5] = res3; + result[k-4] = res4; + result[k-3] = res5; + result[k-2] = res6; + result[k-1] = res7; + } + + + return hypre_error_flag; +} + +/*-------------------------------------------------------------------------- + * hypre_SeqVectorMassInnerProd4 + *--------------------------------------------------------------------------*/ +HYPRE_Int hypre_SeqVectorMassInnerProd4( hypre_Vector *x, + hypre_Vector **y, HYPRE_Int k, HYPRE_Real *result) +{ + HYPRE_Complex *x_data = hypre_VectorData(x); + HYPRE_Complex *y_data = hypre_VectorData(y[0]); + HYPRE_Int size = hypre_VectorSize(x); + + HYPRE_Int i, j, restk; + HYPRE_Real res1; + HYPRE_Real res2; + HYPRE_Real res3; + HYPRE_Real res4; + HYPRE_Int jstart; + HYPRE_Int jstart1; + HYPRE_Int jstart2; + HYPRE_Int jstart3; + + restk = (k-(k/4*4)); + + if (k > 3) + { + for (j = 0; j < k-3; j += 4) + { + res1 = 0; + res2 = 0; + res3 = 0; + res4 = 0; + jstart = j*size; + jstart1 = jstart+size; + jstart2 = jstart1+size; + jstart3 = jstart2+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res1,res2,res3,res4) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; + res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; + res3 += hypre_conj(y_data[jstart2+i]) * x_data[i]; + res4 += hypre_conj(y_data[jstart3+i]) * x_data[i]; + } + result[j] = res1; + result[j+1] = res2; + result[j+2] = res3; + result[j+3] = res4; + } + } + if (restk == 1) + { + res1 = 0; + jstart = (k-1)*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res1) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; + } + result[k-1] = res1; + } + else if (restk == 2) + { + res1 = 0; + res2 = 0; + jstart = (k-2)*size; + jstart1 = jstart+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res1,res2) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; + res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; + } + result[k-2] = res1; + result[k-1] = res2; + } + else if (restk == 3) + { + res1 = 0; + res2 = 0; + res3 = 0; + jstart = (k-3)*size; + jstart1 = jstart+size; + jstart2 = jstart1+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res1,res2,res3) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; + res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; + res3 += hypre_conj(y_data[jstart2+i]) * x_data[i]; + } + result[k-3] = res1; + result[k-2] = res2; + result[k-1] = res3; + } + + + return hypre_error_flag; +} + +/*-------------------------------------------------------------------------- + * hypre_SeqVectorMassDotpTwo8 + *--------------------------------------------------------------------------*/ +HYPRE_Int hypre_SeqVectorMassDotpTwo8( hypre_Vector *x, hypre_Vector *y, + hypre_Vector **z, HYPRE_Int k, HYPRE_Real *result_x, HYPRE_Real *result_y) +{ + HYPRE_Complex *x_data = hypre_VectorData(x); + HYPRE_Complex *y_data = hypre_VectorData(y); + HYPRE_Complex *z_data = hypre_VectorData(z[0]); + HYPRE_Int size = hypre_VectorSize(x); + + HYPRE_Int i, j, restk; + HYPRE_Real res_x1; + HYPRE_Real res_x2; + HYPRE_Real res_x3; + HYPRE_Real res_x4; + HYPRE_Real res_x5; + HYPRE_Real res_x6; + HYPRE_Real res_x7; + HYPRE_Real res_x8; + HYPRE_Real res_y1; + HYPRE_Real res_y2; + HYPRE_Real res_y3; + HYPRE_Real res_y4; + HYPRE_Real res_y5; + HYPRE_Real res_y6; + HYPRE_Real res_y7; + HYPRE_Real res_y8; + HYPRE_Int jstart; + HYPRE_Int jstart1; + HYPRE_Int jstart2; + HYPRE_Int jstart3; + HYPRE_Int jstart4; + HYPRE_Int jstart5; + HYPRE_Int jstart6; + HYPRE_Int jstart7; + + restk = (k-(k/8*8)); + + if (k > 7) + { + for (j = 0; j < k-7; j += 8) + { + res_x1 = 0; + res_x2 = 0; + res_x3 = 0; + res_x4 = 0; + res_x5 = 0; + res_x6 = 0; + res_x7 = 0; + res_x8 = 0; + res_y1 = 0; + res_y2 = 0; + res_y3 = 0; + res_y4 = 0; + res_y5 = 0; + res_y6 = 0; + res_y7 = 0; + res_y8 = 0; + jstart = j*size; + jstart1 = jstart+size; + jstart2 = jstart1+size; + jstart3 = jstart2+size; + jstart4 = jstart3+size; + jstart5 = jstart4+size; + jstart6 = jstart5+size; + jstart7 = jstart6+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_x3,res_x4,res_x5,res_x6,res_x7,res_x8,res_y1,res_y2,res_y3,res_y4,res_y5,res_y6,res_y7,res_y8) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; + res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; + res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; + res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; + res_x3 += hypre_conj(z_data[jstart2+i]) * x_data[i]; + res_y3 += hypre_conj(z_data[jstart2+i]) * y_data[i]; + res_x4 += hypre_conj(z_data[jstart3+i]) * x_data[i]; + res_y4 += hypre_conj(z_data[jstart3+i]) * y_data[i]; + res_x5 += hypre_conj(z_data[jstart4+i]) * x_data[i]; + res_y5 += hypre_conj(z_data[jstart4+i]) * y_data[i]; + res_x6 += hypre_conj(z_data[jstart5+i]) * x_data[i]; + res_y6 += hypre_conj(z_data[jstart5+i]) * y_data[i]; + res_x7 += hypre_conj(z_data[jstart6+i]) * x_data[i]; + res_y7 += hypre_conj(z_data[jstart6+i]) * y_data[i]; + res_x8 += hypre_conj(z_data[jstart7+i]) * x_data[i]; + res_y8 += hypre_conj(z_data[jstart7+i]) * y_data[i]; + } + result_x[j] = res_x1; + result_x[j+1] = res_x2; + result_x[j+2] = res_x3; + result_x[j+3] = res_x4; + result_x[j+4] = res_x5; + result_x[j+5] = res_x6; + result_x[j+6] = res_x7; + result_x[j+7] = res_x8; + result_y[j] = res_y1; + result_y[j+1] = res_y2; + result_y[j+2] = res_y3; + result_y[j+3] = res_y4; + result_y[j+4] = res_y5; + result_y[j+5] = res_y6; + result_y[j+6] = res_y7; + result_y[j+7] = res_y8; + } + } + if (restk == 1) + { + res_x1 = 0; + res_y1 = 0; + jstart = (k-1)*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res_x1,res_y1) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; + res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; + } + result_x[k-1] = res_x1; + result_y[k-1] = res_y1; + } + else if (restk == 2) + { + res_x1 = 0; + res_x2 = 0; + res_y1 = 0; + res_y2 = 0; + jstart = (k-2)*size; + jstart1 = jstart+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_y1,res_y2) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; + res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; + res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; + res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; + } + result_x[k-2] = res_x1; + result_x[k-1] = res_x2; + result_y[k-2] = res_y1; + result_y[k-1] = res_y2; + } + else if (restk == 3) + { + res_x1 = 0; + res_x2 = 0; + res_x3 = 0; + res_y1 = 0; + res_y2 = 0; + res_y3 = 0; + jstart = (k-3)*size; + jstart1 = jstart+size; + jstart2 = jstart1+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_x3,res_y1,res_y2,res_y3) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; + res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; + res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; + res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; + res_x3 += hypre_conj(z_data[jstart2+i]) * x_data[i]; + res_y3 += hypre_conj(z_data[jstart2+i]) * y_data[i]; + } + result_x[k-3] = res_x1; + result_x[k-2] = res_x2; + result_x[k-1] = res_x3; + result_y[k-3] = res_y1; + result_y[k-2] = res_y2; + result_y[k-1] = res_y3; + } + else if (restk == 4) + { + res_x1 = 0; + res_x2 = 0; + res_x3 = 0; + res_x4 = 0; + res_y1 = 0; + res_y2 = 0; + res_y3 = 0; + res_y4 = 0; + jstart = (k-4)*size; + jstart1 = jstart+size; + jstart2 = jstart1+size; + jstart3 = jstart2+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_x3,res_x4,res_y1,res_y2,res_y3,res_y4) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; + res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; + res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; + res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; + res_x3 += hypre_conj(z_data[jstart2+i]) * x_data[i]; + res_y3 += hypre_conj(z_data[jstart2+i]) * y_data[i]; + res_x4 += hypre_conj(z_data[jstart3+i]) * x_data[i]; + res_y4 += hypre_conj(z_data[jstart3+i]) * y_data[i]; + } + result_x[k-4] = res_x1; + result_x[k-3] = res_x2; + result_x[k-2] = res_x3; + result_x[k-1] = res_x4; + result_y[k-4] = res_y1; + result_y[k-3] = res_y2; + result_y[k-2] = res_y3; + result_y[k-1] = res_y4; + } + else if (restk == 5) + { + res_x1 = 0; + res_x2 = 0; + res_x3 = 0; + res_x4 = 0; + res_x5 = 0; + res_y1 = 0; + res_y2 = 0; + res_y3 = 0; + res_y4 = 0; + res_y5 = 0; + jstart = (k-5)*size; + jstart1 = jstart+size; + jstart2 = jstart1+size; + jstart3 = jstart2+size; + jstart4 = jstart3+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_x3,res_x4,res_x5,res_y1,res_y2,res_y3,res_y4,res_y5) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; + res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; + res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; + res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; + res_x3 += hypre_conj(z_data[jstart2+i]) * x_data[i]; + res_y3 += hypre_conj(z_data[jstart2+i]) * y_data[i]; + res_x4 += hypre_conj(z_data[jstart3+i]) * x_data[i]; + res_y4 += hypre_conj(z_data[jstart3+i]) * y_data[i]; + res_x5 += hypre_conj(z_data[jstart4+i]) * x_data[i]; + res_y5 += hypre_conj(z_data[jstart4+i]) * y_data[i]; + } + result_x[k-5] = res_x1; + result_x[k-4] = res_x2; + result_x[k-3] = res_x3; + result_x[k-2] = res_x4; + result_x[k-1] = res_x5; + result_y[k-5] = res_y1; + result_y[k-4] = res_y2; + result_y[k-3] = res_y3; + result_y[k-2] = res_y4; + result_y[k-1] = res_y5; + } + else if (restk == 6) + { + res_x1 = 0; + res_x2 = 0; + res_x3 = 0; + res_x4 = 0; + res_x5 = 0; + res_x6 = 0; + res_y1 = 0; + res_y2 = 0; + res_y3 = 0; + res_y4 = 0; + res_y5 = 0; + res_y6 = 0; + jstart = (k-6)*size; + jstart1 = jstart+size; + jstart2 = jstart1+size; + jstart3 = jstart2+size; + jstart4 = jstart3+size; + jstart5 = jstart4+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_x3,res_x4,res_x5,res_x6,res_y1,res_y2,res_y3,res_y4,res_y5,res_y6) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; + res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; + res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; + res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; + res_x3 += hypre_conj(z_data[jstart2+i]) * x_data[i]; + res_y3 += hypre_conj(z_data[jstart2+i]) * y_data[i]; + res_x4 += hypre_conj(z_data[jstart3+i]) * x_data[i]; + res_y4 += hypre_conj(z_data[jstart3+i]) * y_data[i]; + res_x5 += hypre_conj(z_data[jstart4+i]) * x_data[i]; + res_y5 += hypre_conj(z_data[jstart4+i]) * y_data[i]; + res_x6 += hypre_conj(z_data[jstart5+i]) * x_data[i]; + res_y6 += hypre_conj(z_data[jstart5+i]) * y_data[i]; + } + result_x[k-6] = res_x1; + result_x[k-5] = res_x2; + result_x[k-4] = res_x3; + result_x[k-3] = res_x4; + result_x[k-2] = res_x5; + result_x[k-1] = res_x6; + result_y[k-6] = res_y1; + result_y[k-5] = res_y2; + result_y[k-4] = res_y3; + result_y[k-3] = res_y4; + result_y[k-2] = res_y5; + result_y[k-1] = res_y6; + } + else if (restk == 7) + { + res_x1 = 0; + res_x2 = 0; + res_x3 = 0; + res_x4 = 0; + res_x5 = 0; + res_x6 = 0; + res_x7 = 0; + res_y1 = 0; + res_y2 = 0; + res_y3 = 0; + res_y4 = 0; + res_y5 = 0; + res_y6 = 0; + res_y7 = 0; + jstart = (k-7)*size; + jstart1 = jstart+size; + jstart2 = jstart1+size; + jstart3 = jstart2+size; + jstart4 = jstart3+size; + jstart5 = jstart4+size; + jstart6 = jstart5+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_x3,res_x4,res_x5,res_x6,res_x7,res_y1,res_y2,res_y3,res_y4,res_y5,res_y6,res_y7) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; + res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; + res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; + res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; + res_x3 += hypre_conj(z_data[jstart2+i]) * x_data[i]; + res_y3 += hypre_conj(z_data[jstart2+i]) * y_data[i]; + res_x4 += hypre_conj(z_data[jstart3+i]) * x_data[i]; + res_y4 += hypre_conj(z_data[jstart3+i]) * y_data[i]; + res_x5 += hypre_conj(z_data[jstart4+i]) * x_data[i]; + res_y5 += hypre_conj(z_data[jstart4+i]) * y_data[i]; + res_x6 += hypre_conj(z_data[jstart5+i]) * x_data[i]; + res_y6 += hypre_conj(z_data[jstart5+i]) * y_data[i]; + res_x7 += hypre_conj(z_data[jstart6+i]) * x_data[i]; + res_y7 += hypre_conj(z_data[jstart6+i]) * y_data[i]; + } + result_x[k-7] = res_x1; + result_x[k-6] = res_x2; + result_x[k-5] = res_x3; + result_x[k-4] = res_x4; + result_x[k-3] = res_x5; + result_x[k-2] = res_x6; + result_x[k-1] = res_x7; + result_y[k-7] = res_y1; + result_y[k-6] = res_y2; + result_y[k-5] = res_y3; + result_y[k-4] = res_y4; + result_y[k-3] = res_y5; + result_y[k-2] = res_y6; + result_y[k-1] = res_y7; + } + + + return hypre_error_flag; +} + +/*-------------------------------------------------------------------------- + * hypre_SeqVectorMassDotpTwo4 + *--------------------------------------------------------------------------*/ +HYPRE_Int hypre_SeqVectorMassDotpTwo4( hypre_Vector *x, hypre_Vector *y, + hypre_Vector **z, HYPRE_Int k, HYPRE_Real *result_x, HYPRE_Real *result_y) +{ + HYPRE_Complex *x_data = hypre_VectorData(x); + HYPRE_Complex *y_data = hypre_VectorData(y); + HYPRE_Complex *z_data = hypre_VectorData(z[0]); + HYPRE_Int size = hypre_VectorSize(x); + + HYPRE_Int i, j, restk; + HYPRE_Real res_x1; + HYPRE_Real res_x2; + HYPRE_Real res_x3; + HYPRE_Real res_x4; + HYPRE_Real res_y1; + HYPRE_Real res_y2; + HYPRE_Real res_y3; + HYPRE_Real res_y4; + HYPRE_Int jstart; + HYPRE_Int jstart1; + HYPRE_Int jstart2; + HYPRE_Int jstart3; + + restk = (k-(k/4*4)); + + if (k > 3) + { + for (j = 0; j < k-3; j += 4) + { + res_x1 = 0; + res_x2 = 0; + res_x3 = 0; + res_x4 = 0; + res_y1 = 0; + res_y2 = 0; + res_y3 = 0; + res_y4 = 0; + jstart = j*size; + jstart1 = jstart+size; + jstart2 = jstart1+size; + jstart3 = jstart2+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_x3,res_x4,res_y1,res_y2,res_y3,res_y4) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; + res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; + res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; + res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; + res_x3 += hypre_conj(z_data[jstart2+i]) * x_data[i]; + res_y3 += hypre_conj(z_data[jstart2+i]) * y_data[i]; + res_x4 += hypre_conj(z_data[jstart3+i]) * x_data[i]; + res_y4 += hypre_conj(z_data[jstart3+i]) * y_data[i]; + } + result_x[j] = res_x1; + result_x[j+1] = res_x2; + result_x[j+2] = res_x3; + result_x[j+3] = res_x4; + result_y[j] = res_y1; + result_y[j+1] = res_y2; + result_y[j+2] = res_y3; + result_y[j+3] = res_y4; + } + } + if (restk == 1) + { + res_x1 = 0; + res_y1 = 0; + jstart = (k-1)*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res_x1,res_y1) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; + res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; + } + result_x[k-1] = res_x1; + result_y[k-1] = res_y1; + } + else if (restk == 2) + { + res_x1 = 0; + res_x2 = 0; + res_y1 = 0; + res_y2 = 0; + jstart = (k-2)*size; + jstart1 = jstart+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_y1,res_y2) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; + res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; + res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; + res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; + } + result_x[k-2] = res_x1; + result_x[k-1] = res_x2; + result_y[k-2] = res_y1; + result_y[k-1] = res_y2; + } + else if (restk == 3) + { + res_x1 = 0; + res_x2 = 0; + res_x3 = 0; + res_y1 = 0; + res_y2 = 0; + res_y3 = 0; + jstart = (k-3)*size; + jstart1 = jstart+size; + jstart2 = jstart1+size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_x3,res_y1,res_y2,res_y3) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; + res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; + res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; + res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; + res_x3 += hypre_conj(z_data[jstart2+i]) * x_data[i]; + res_y3 += hypre_conj(z_data[jstart2+i]) * y_data[i]; + } + result_x[k-3] = res_x1; + result_x[k-2] = res_x2; + result_x[k-1] = res_x3; + result_y[k-3] = res_y1; + result_y[k-2] = res_y2; + result_y[k-1] = res_y3; + } + + + return hypre_error_flag; +} + +HYPRE_Int hypre_SeqVectorMassInnerProd( hypre_Vector *x, + hypre_Vector **y, HYPRE_Int k, HYPRE_Int unroll, HYPRE_Real *result) +{ + HYPRE_Complex *x_data = hypre_VectorData(x); + HYPRE_Complex *y_data = hypre_VectorData(y[0]); + HYPRE_Real res; + HYPRE_Int size = hypre_VectorSize(x); + + HYPRE_Int i, j, jstart; + + if (unroll == 8) + { + hypre_SeqVectorMassInnerProd8(x,y,k,result); + return hypre_error_flag; + } + else if (unroll == 4) + { + hypre_SeqVectorMassInnerProd4(x,y,k,result); + return hypre_error_flag; + } + else + { + for (j = 0; j < k; j++) + { + res = 0; + jstart = j*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res += hypre_conj(y_data[jstart+i]) * x_data[i]; + } + result[j] = res; + } + } + + return hypre_error_flag; +} + +/*-------------------------------------------------------------------------- + * hypre_SeqVectorMassDotpTwo + *--------------------------------------------------------------------------*/ + +HYPRE_Int hypre_SeqVectorMassDotpTwo( hypre_Vector *x, hypre_Vector *y, + hypre_Vector **z, HYPRE_Int k, HYPRE_Int unroll, + HYPRE_Real *result_x, HYPRE_Real *result_y) +{ + HYPRE_Complex *x_data = hypre_VectorData(x); + HYPRE_Complex *y_data = hypre_VectorData(y); + HYPRE_Complex *z_data = hypre_VectorData(z[0]); + HYPRE_Real res_x, res_y; + HYPRE_Int size = hypre_VectorSize(x); + + HYPRE_Int i, j, jstart; + + if (unroll == 8) + { + hypre_SeqVectorMassDotpTwo8(x,y,z,k,result_x,result_y); + return hypre_error_flag; + } + else if (unroll == 4) + { + hypre_SeqVectorMassDotpTwo4(x,y,z,k,result_x,result_y); + return hypre_error_flag; + } + else + { + for (j = 0; j < k; j++) + { + res_x = result_x[j]; + res_y = result_y[j]; + jstart = j*size; +#if defined(HYPRE_USING_OPENMP) +#pragma omp parallel for private(i) reduction(+:res_x,res_y) HYPRE_SMP_SCHEDULE +#endif + for (i = 0; i < size; i++) + { + res_x += hypre_conj(z_data[jstart+i]) * x_data[i]; + res_y += hypre_conj(z_data[jstart+i]) * y_data[i]; + } + result_x[j] = res_x; + result_y[j] = res_y; + } + } + return hypre_error_flag; +} + diff -Nru hypre-2.16.0/src/seq_mv/vector.c hypre-2.18.2/src/seq_mv/vector.c --- hypre-2.16.0/src/seq_mv/vector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/vector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -18,14 +13,7 @@ #include "seq_mv.h" #include -#ifdef HYPRE_USING_GPU -#include -#include -#include "gpukernels.h" -#endif -#define NUM_TEAMS 128 -#define NUM_THREADS 1024 /*-------------------------------------------------------------------------- * hypre_SeqVectorCreate *--------------------------------------------------------------------------*/ @@ -35,16 +23,8 @@ { hypre_Vector *vector; - vector = hypre_CTAlloc(hypre_Vector, 1, HYPRE_MEMORY_HOST); + vector = hypre_CTAlloc(hypre_Vector, 1, HYPRE_MEMORY_HOST); -#ifdef HYPRE_USING_GPU - vector->on_device=0; -#endif -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - vector->mapped=0; - vector->drc=0; - vector->hrc=0; -#endif hypre_VectorData(vector) = NULL; hypre_VectorSize(vector) = size; @@ -54,6 +34,8 @@ /* set defaults */ hypre_VectorOwnsData(vector) = 1; + hypre_VectorMemoryLocation(vector) = HYPRE_MEMORY_SHARED; + return vector; } @@ -66,6 +48,7 @@ { hypre_Vector *vector = hypre_SeqVectorCreate(size); hypre_VectorNumVectors(vector) = num_vectors; + return vector; } @@ -76,21 +59,18 @@ HYPRE_Int hypre_SeqVectorDestroy( hypre_Vector *vector ) { - HYPRE_Int ierr=0; + HYPRE_Int ierr=0; if (vector) { -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - if (vector->mapped) { - //printf("Unmap in hypre_SeqVectorDestroy\n"); - hypre_SeqVectorUnMapFromDevice(vector); - } -#endif + HYPRE_Int memory_location = hypre_VectorMemoryLocation(vector); + if ( hypre_VectorOwnsData(vector) ) { - hypre_TFree(hypre_VectorData(vector), HYPRE_MEMORY_SHARED); + hypre_TFree(hypre_VectorData(vector), memory_location); } - hypre_TFree(vector, HYPRE_MEMORY_HOST); + + hypre_TFree(vector, HYPRE_MEMORY_HOST); } return ierr; @@ -101,15 +81,24 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_SeqVectorInitialize( hypre_Vector *vector ) +hypre_SeqVectorInitialize_v2( hypre_Vector *vector, HYPRE_Int memory_location ) { HYPRE_Int size = hypre_VectorSize(vector); HYPRE_Int ierr = 0; HYPRE_Int num_vectors = hypre_VectorNumVectors(vector); HYPRE_Int multivec_storage_method = hypre_VectorMultiVecStorageMethod(vector); - if ( ! hypre_VectorData(vector) ) - hypre_VectorData(vector) = hypre_CTAlloc(HYPRE_Complex, num_vectors*size, HYPRE_MEMORY_SHARED); + hypre_VectorMemoryLocation(vector) = memory_location; + + /* Caveat: for pre-existing data, the memory location must be guaranteed + * to be consistent with `memory_location' + * Otherwise, mismatches will exist and problems will be encountered + * when being used, and freed */ + if ( !hypre_VectorData(vector) ) + { + hypre_VectorData(vector) = hypre_CTAlloc(HYPRE_Complex, num_vectors*size, + memory_location); + } if ( multivec_storage_method == 0 ) { @@ -122,10 +111,20 @@ hypre_VectorIndexStride(vector) = num_vectors; } else + { ++ierr; -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - UpdateHRC; -#endif + } + + return ierr; +} + +HYPRE_Int +hypre_SeqVectorInitialize( hypre_Vector *vector ) +{ + HYPRE_Int ierr; + + ierr = hypre_SeqVectorInitialize_v2( vector, hypre_VectorMemoryLocation(vector) ); + return ierr; } @@ -179,7 +178,7 @@ fclose(fp); - /* multivector code not written yet >>> */ + /* multivector code not written yet */ hypre_assert( hypre_VectorNumVectors(vector) == 1 ); return vector; @@ -272,46 +271,30 @@ hypre_profile_times[HYPRE_TIMER_ID_BLAS1] -= hypre_MPI_Wtime(); #endif -#if defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) /* CUDA */ - HYPRE_Int ierr = 0; - VecSet(hypre_VectorData(v),hypre_VectorSize(v),value,HYPRE_STREAM(4)); -#else /* CPU or OMP 4.5 */ - HYPRE_Complex *vector_data = hypre_VectorData(v); HYPRE_Int size = hypre_VectorSize(v); - HYPRE_Int i; HYPRE_Int ierr = 0; - size *=hypre_VectorNumVectors(v); -#if defined(HYPRE_USING_MAPPED_OPENMP_OFFLOAD) - if (!v->mapped) hypre_SeqVectorMapToDevice(v); -#endif -#ifdef HYPRE_USING_UNIFIED_MEMORY - hypre_SeqVectorPrefetchToDevice(v); -#endif -#if defined(HYPRE_USING_OPENMP_OFFLOAD) -#pragma omp target teams distribute parallel for private(i) num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) is_device_ptr(vector_data) -#elif defined(HYPRE_USING_MAPPED_OPENMP_OFFLOAD) - //printf("Vec Constant Value on Device %d %p size = %d \n",omp_target_is_present(vector_data,0),v,size); -#pragma omp target teams distribute parallel for private(i) num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) + size *= hypre_VectorNumVectors(v); + + hypre_SeqVectorPrefetch(v, HYPRE_MEMORY_DEVICE); + +#if defined(HYPRE_USING_CUDA) + HYPRE_THRUST_CALL( fill_n, vector_data, size, value ); +#else + HYPRE_Int i; +#if defined(HYPRE_USING_DEVICE_OPENMP) +#pragma omp target teams distribute parallel for private(i) is_device_ptr(vector_data) #elif defined(HYPRE_USING_OPENMP) - //printf("Vec Constant Value on Host %d \n",omp_target_is_present(vector_data,0)); - #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE +#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif for (i = 0; i < size; i++) { vector_data[i] = value; } +#endif /* defined(HYPRE_USING_CUDA) */ -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - UpdateDRC(v); - // 2 lines below required to get exact match with baseline - // Not clear why this is the case. - SyncVectorToHost(v); - UpdateHRC(v); -#endif - -#endif /* defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) */ + hypre_SyncCudaComputeStream(hypre_handle); #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_BLAS1] += hypre_MPI_Wtime(); @@ -328,21 +311,21 @@ HYPRE_Int hypre_SeqVectorSetRandomValues( hypre_Vector *v, - HYPRE_Int seed ) + HYPRE_Int seed ) { HYPRE_Complex *vector_data = hypre_VectorData(v); HYPRE_Int size = hypre_VectorSize(v); - HYPRE_Int i; - HYPRE_Int ierr = 0; hypre_SeedRand(seed); - size *=hypre_VectorNumVectors(v); + size *= hypre_VectorNumVectors(v); /* RDF: threading this loop may cause problems because of hypre_Rand() */ for (i = 0; i < size; i++) + { vector_data[i] = 2.0 * hypre_Rand() - 1.0; + } return ierr; } @@ -353,7 +336,6 @@ * if size of x is larger than y only the first size_y elements of x are * copied to y *--------------------------------------------------------------------------*/ - HYPRE_Int hypre_SeqVectorCopy( hypre_Vector *x, hypre_Vector *y ) @@ -362,30 +344,31 @@ hypre_profile_times[HYPRE_TIMER_ID_BLAS1] -= hypre_MPI_Wtime(); #endif -#if defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) - HYPRE_Int ierr = hypre_SeqVectorCopyDevice(x,y); -#else + hypre_SeqVectorPrefetch(x, HYPRE_MEMORY_DEVICE); + hypre_SeqVectorPrefetch(y, HYPRE_MEMORY_DEVICE); + HYPRE_Complex *x_data = hypre_VectorData(x); HYPRE_Complex *y_data = hypre_VectorData(y); HYPRE_Int size = hypre_VectorSize(x); HYPRE_Int size_y = hypre_VectorSize(y); - HYPRE_Int i; HYPRE_Int ierr = 0; -#if defined(HYPRE_USING_MAPPED_OPENMP_OFFLOAD) - if (!x->mapped) hypre_SeqVectorMapToDevice(x); - else SyncVectorToDevice(x); - if (!y->mapped) hypre_SeqVectorMapToDevice(y); - else SyncVectorToDevice(y); -#endif + if (size > size_y) { size = size_y; } - size *=hypre_VectorNumVectors(x); -#if defined(HYPRE_USING_OPENMP_OFFLOAD) -#pragma omp target teams distribute parallel for private(i) num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) is_device_ptr(y_data,x_data) -#elif defined(HYPRE_USING_MAPPED_OPENMP_OFFLOAD) -#pragma omp target teams distribute parallel for private(i) num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) + size *= hypre_VectorNumVectors(x); + +#if defined(HYPRE_USING_CUDA) +#if defined(HYPRE_USING_CUBLAS) + HYPRE_CUBLAS_CALL( cublasDcopy(hypre_HandleCublasHandle(hypre_handle), size, x_data, 1, y_data, 1) ); +#else + HYPRE_THRUST_CALL( copy_n, x_data, size, y_data ); +#endif +#else + HYPRE_Int i; +#if defined(HYPRE_USING_DEVICE_OPENMP) +#pragma omp target teams distribute parallel for private(i) is_device_ptr(y_data,x_data) #elif defined(HYPRE_USING_OPENMP) #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif @@ -393,10 +376,9 @@ { y_data[i] = x_data[i]; } -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - UpdateDRC(y); -#endif -#endif /* defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) */ +#endif /* defined(HYPRE_USING_CUDA) */ + + hypre_SyncCudaComputeStream(hypre_handle); #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_BLAS1] += hypre_MPI_Wtime(); @@ -410,12 +392,13 @@ * Returns a complete copy of x - a deep copy, with its own copy of the data. *--------------------------------------------------------------------------*/ -hypre_Vector * +hypre_Vector* hypre_SeqVectorCloneDeep( hypre_Vector *x ) { - HYPRE_Int size = hypre_VectorSize(x); + HYPRE_Int size = hypre_VectorSize(x); HYPRE_Int num_vectors = hypre_VectorNumVectors(x); - hypre_Vector * y = hypre_SeqMultiVectorCreate( size, num_vectors ); + + hypre_Vector *y = hypre_SeqMultiVectorCreate( size, num_vectors ); hypre_VectorMultiVecStorageMethod(y) = hypre_VectorMultiVecStorageMethod(x); hypre_VectorVectorStride(y) = hypre_VectorVectorStride(x); @@ -423,7 +406,7 @@ hypre_SeqVectorInitialize(y); hypre_SeqVectorCopy( x, y ); - // UpdateHRC(y); Done in previous statement + return y; } @@ -453,34 +436,32 @@ /*-------------------------------------------------------------------------- * hypre_SeqVectorScale *--------------------------------------------------------------------------*/ - HYPRE_Int hypre_SeqVectorScale( HYPRE_Complex alpha, - hypre_Vector *y ) + hypre_Vector *y ) { #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_BLAS1] -= hypre_MPI_Wtime(); #endif -#if defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) - HYPRE_Int ierr = VecScaleScalar(y->data,alpha, hypre_VectorSize(y), HYPRE_STREAM(4)); -#else HYPRE_Complex *y_data = hypre_VectorData(y); HYPRE_Int size = hypre_VectorSize(y); - HYPRE_Int i; HYPRE_Int ierr = 0; size *= hypre_VectorNumVectors(y); -#if defined(HYPRE_USING_MAPPED_OPENMP_OFFLOAD) - if (!y->mapped) hypre_SeqVectorMapToDevice(y); - else SyncVectorToDevice(y); -#endif + hypre_SeqVectorPrefetch(y, HYPRE_MEMORY_DEVICE); -#if defined(HYPRE_USING_OPENMP_OFFLOAD) -#pragma omp target teams distribute parallel for private(i) num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) is_device_ptr(y_data) -#elif defined(HYPRE_USING_MAPPED_OPENMP_OFFLOAD) -#pragma omp target teams distribute parallel for private(i) num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) +#if defined(HYPRE_USING_CUDA) +#if defined(HYPRE_USING_CUBLAS) + HYPRE_CUBLAS_CALL( cublasDscal(hypre_HandleCublasHandle(hypre_handle), size, &alpha, y_data, 1) ); +#else + HYPRE_THRUST_CALL( transform, y_data, y_data + size, y_data, alpha * _1 ); +#endif +#else + HYPRE_Int i; +#if defined(HYPRE_USING_DEVICE_OPENMP) +#pragma omp target teams distribute parallel for private(i) is_device_ptr(y_data) #elif defined(HYPRE_USING_OPENMP) #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif @@ -488,10 +469,10 @@ { y_data[i] *= alpha; } -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - UpdateDRC(y); -#endif -#endif /* defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) */ + +#endif /* defined(HYPRE_USING_CUDA) */ + + hypre_SyncCudaComputeStream(hypre_handle); #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_BLAS1] += hypre_MPI_Wtime(); @@ -513,45 +494,37 @@ hypre_profile_times[HYPRE_TIMER_ID_BLAS1] -= hypre_MPI_Wtime(); #endif -#if defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) - HYPRE_Int ierr = hypre_SeqVectorAxpyDevice(alpha,x,y); -#else HYPRE_Complex *x_data = hypre_VectorData(x); HYPRE_Complex *y_data = hypre_VectorData(y); HYPRE_Int size = hypre_VectorSize(x); - HYPRE_Int i; HYPRE_Int ierr = 0; size *= hypre_VectorNumVectors(x); -#if defined(HYPRE_USING_MAPPED_OPENMP_OFFLOAD) - if (!x->mapped) hypre_SeqVectorMapToDevice(x); - else SyncVectorToDevice(x); - if (!y->mapped) hypre_SeqVectorMapToDevice(y); - else SyncVectorToHost(y); -#endif + hypre_SeqVectorPrefetch(x, HYPRE_MEMORY_DEVICE); + hypre_SeqVectorPrefetch(y, HYPRE_MEMORY_DEVICE); -#ifdef HYPRE_USING_UNIFIED_MEMORY - hypre_SeqVectorPrefetchToDevice(x); - hypre_SeqVectorPrefetchToDevice(y); +#if defined(HYPRE_USING_CUDA) +#if defined(HYPRE_USING_CUBLAS) + HYPRE_CUBLAS_CALL( cublasDaxpy(hypre_HandleCublasHandle(hypre_handle), size, &alpha, x_data, 1, y_data, 1) ); +#else + HYPRE_THRUST_CALL( transform, x_data, x_data + size, y_data, y_data, alpha * _1 + _2 ); #endif - -#if defined(HYPRE_USING_OPENMP_OFFLOAD) -#pragma omp target teams distribute parallel for private(i) num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) is_device_ptr(y_data,x_data) -#elif defined(HYPRE_USING_MAPPED_OPENMP_OFFLOAD) -#pragma omp target teams distribute parallel for private(i) num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) +#else + HYPRE_Int i; +#if defined(HYPRE_USING_DEVICE_OPENMP) +#pragma omp target teams distribute parallel for private(i) is_device_ptr(y_data, x_data) #elif defined(HYPRE_USING_OPENMP) - //printf("AXPY OMP \n"); #pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE #endif for (i = 0; i < size; i++) { y_data[i] += alpha * x_data[i]; } -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - UpdateDRC(y); -#endif -#endif /* defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) */ + +#endif /* defined(HYPRE_USING_CUDA) */ + + hypre_SyncCudaComputeStream(hypre_handle); #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_BLAS1] += hypre_MPI_Wtime(); @@ -560,246 +533,10 @@ return ierr; } -/*-------------------------------------------------------------------------- - * hypre_SeqVectorMassAxpy8 - *--------------------------------------------------------------------------*/ - -HYPRE_Int -hypre_SeqVectorMassAxpy8( HYPRE_Complex *alpha, - hypre_Vector **x, - hypre_Vector *y, HYPRE_Int k) -{ - HYPRE_Complex *x_data = hypre_VectorData(x[0]); - HYPRE_Complex *y_data = hypre_VectorData(y); - HYPRE_Int size = hypre_VectorSize(x[0]); - - HYPRE_Int i, j, jstart, restk; - - - restk = (k-(k/8*8)); - - if (k > 7) - { - for (j = 0; j < k-7; j += 8) - { - jstart = j*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - y_data[i] += alpha[j]*x_data[jstart+i] + alpha[j+1]*x_data[jstart+i+size] - + alpha[j+2]*x_data[(j+2)*size+i] + alpha[j+3]*x_data[(j+3)*size+i] - + alpha[j+4]*x_data[(j+4)*size+i] + alpha[j+5]*x_data[(j+5)*size+i] - + alpha[j+6]*x_data[(j+6)*size+i] + alpha[j+7]*x_data[(j+7)*size+i]; - } - } - } - if (restk == 1) - { - jstart = (k-1)*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - y_data[i] += alpha[k-1] * x_data[jstart+i]; - } - } - else if (restk == 2) - { - jstart = (k-2)*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - y_data[i] += alpha[k-2] * x_data[jstart+i] + alpha[k-1] * x_data[jstart+size+i]; - } - } - else if (restk == 3) - { - jstart = (k-3)*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - y_data[i] += alpha[k-3] * x_data[jstart+i] + alpha[k-2] * x_data[jstart+size+i] + alpha[k-1] * x_data[(k-1)*size+i]; - } - } - else if (restk == 4) - { - jstart = (k-4)*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - y_data[i] += alpha[k-4]*x_data[(k-4)*size+i] + alpha[k-3]*x_data[(k-3)*size+i] - + alpha[k-2]*x_data[(k-2)*size+i] + alpha[k-1]*x_data[(k-1)*size+i]; - } - } - else if (restk == 5) - { -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - y_data[i] += + alpha[k-5]*x_data[(k-5)*size+i] + alpha[k-4]*x_data[(k-4)*size+i] - + alpha[k-3]*x_data[(k-3)*size+i] + alpha[k-2]*x_data[(k-2)*size+i] - + alpha[k-1]*x_data[(k-1)*size+i]; - } - } - else if (restk == 6) - { - jstart = (k-6)*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - y_data[i] += alpha[k-6]*x_data[jstart+i] + alpha[k-5]*x_data[jstart+i+size] - + alpha[k-4]*x_data[(k-4)*size+i] + alpha[k-3]*x_data[(k-3)*size+i] - + alpha[k-2]*x_data[(k-2)*size+i] + alpha[k-1]*x_data[(k-1)*size+i]; - } - } - else if (restk == 7) - { - jstart = (k-7)*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - y_data[i] += alpha[k-7]*x_data[jstart+i] + alpha[k-6]*x_data[jstart+i+size] - + alpha[k-5]*x_data[(k-5)*size+i] + alpha[k-4]*x_data[(k-4)*size+i] - + alpha[k-3]*x_data[(k-3)*size+i] + alpha[k-2]*x_data[(k-2)*size+i] - + alpha[k-1]*x_data[(k-1)*size+i]; - } - } - - return hypre_error_flag; -} - -/*-------------------------------------------------------------------------- - * hypre_SeqVectorMassAxpy4 - *--------------------------------------------------------------------------*/ - -HYPRE_Int -hypre_SeqVectorMassAxpy4( HYPRE_Complex *alpha, - hypre_Vector **x, - hypre_Vector *y, HYPRE_Int k) -{ - HYPRE_Complex *x_data = hypre_VectorData(x[0]); - HYPRE_Complex *y_data = hypre_VectorData(y); - HYPRE_Int size = hypre_VectorSize(x[0]); - - HYPRE_Int i, j, jstart, restk; - - - restk = (k-(k/4*4)); - - if (k > 3) - { - for (j = 0; j < k-3; j += 4) - { - jstart = j*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - y_data[i] += alpha[j]*x_data[jstart+i] + alpha[j+1]*x_data[jstart+i+size] - + alpha[j+2]*x_data[(j+2)*size+i] + alpha[j+3]*x_data[(j+3)*size+i]; - } - } - } - if (restk == 1) - { - jstart = (k-1)*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - y_data[i] += alpha[k-1] * x_data[jstart+i]; - } - } - else if (restk == 2) - { - jstart = (k-2)*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - y_data[i] += alpha[k-2] * x_data[jstart+i] + alpha[k-1] * x_data[jstart+size+i]; - } - } - else if (restk == 3) - { - jstart = (k-3)*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - y_data[i] += alpha[k-3] * x_data[jstart+i] + alpha[k-2] * x_data[jstart+size+i] + alpha[k-1] * x_data[(k-1)*size+i]; - } - } - - return hypre_error_flag; -} - -/*-------------------------------------------------------------------------- - * hypre_SeqVectorMassAxpy - *--------------------------------------------------------------------------*/ - -HYPRE_Int -hypre_SeqVectorMassAxpy( HYPRE_Complex *alpha, - hypre_Vector **x, - hypre_Vector *y, HYPRE_Int k, HYPRE_Int unroll) -{ - HYPRE_Complex *x_data = hypre_VectorData(x[0]); - HYPRE_Complex *y_data = hypre_VectorData(y); - HYPRE_Int size = hypre_VectorSize(x[0]); - - HYPRE_Int i, j, jstart; - - if (unroll == 8) - { - hypre_SeqVectorMassAxpy8(alpha, x, y, k); - return hypre_error_flag; - } - else if (unroll == 4) - { - hypre_SeqVectorMassAxpy4(alpha, x, y, k); - return hypre_error_flag; - } - else - { - for (j = 0; j < k; j++) - { - jstart = j*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - y_data[i] += alpha[j]*x_data[jstart+i]; - } - } - } - - return hypre_error_flag; -} /*-------------------------------------------------------------------------- * hypre_SeqVectorInnerProd *--------------------------------------------------------------------------*/ - HYPRE_Real hypre_SeqVectorInnerProd( hypre_Vector *x, hypre_Vector *y ) @@ -808,31 +545,31 @@ hypre_profile_times[HYPRE_TIMER_ID_BLAS1] -= hypre_MPI_Wtime(); #endif -#if defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) - HYPRE_Real result = hypre_SeqVectorInnerProdDevice(x,y); -#else -#if defined(HYPRE_USING_MAPPED_OPENMP_OFFLOAD) - if (!x->mapped) hypre_SeqVectorMapToDevice(x); - else SyncVectorToDevice(x); - if (!y->mapped) hypre_SeqVectorMapToDevice(y); - else SyncVectorToHost(y); -#endif - HYPRE_Complex *x_data = hypre_VectorData(x); HYPRE_Complex *y_data = hypre_VectorData(y); HYPRE_Int size = hypre_VectorSize(x); + HYPRE_Real result = 0.0; - HYPRE_Int i; + size *= hypre_VectorNumVectors(x); - HYPRE_Real result = 0.0; - //ASSERT_MANAGED(x_data); - //ASSERT_MANAGED(y_data); - PUSH_RANGE("INNER_PROD",0); - size *=hypre_VectorNumVectors(x); -#if defined(HYPRE_USING_OPENMP_OFFLOAD) -#pragma omp target teams distribute parallel for private(i) num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) reduction(+:result) is_device_ptr(y_data,x_data) map(result) -#elif defined(HYPRE_USING_MAPPED_OPENMP_OFFLOAD) -#pragma omp target teams distribute parallel for private(i) num_teams(NUM_TEAMS) thread_limit(NUM_THREADS) reduction(+:result) map(result) + hypre_SeqVectorPrefetch(x, HYPRE_MEMORY_DEVICE); + hypre_SeqVectorPrefetch(y, HYPRE_MEMORY_DEVICE); + +#if defined(HYPRE_USING_CUDA) +#ifndef HYPRE_COMPLEX +#if defined(HYPRE_USING_CUBLAS) + HYPRE_CUBLAS_CALL( cublasDdot(hypre_HandleCublasHandle(hypre_handle), size, x_data, 1, y_data, 1, &result) ); +#else + result = HYPRE_THRUST_CALL( inner_product, x_data, x_data + size, y_data, 0.0 ); +#endif +#else + /* TODO */ +#error "Complex inner product" +#endif +#else /* #if defined(HYPRE_USING_CUDA) */ + HYPRE_Int i; +#if defined(HYPRE_USING_DEVICE_OPENMP) +#pragma omp target teams distribute parallel for private(i) reduction(+:result) is_device_ptr(y_data,x_data) map(result) #elif defined(HYPRE_USING_OPENMP) #pragma omp parallel for private(i) reduction(+:result) HYPRE_SMP_SCHEDULE #endif @@ -840,8 +577,9 @@ { result += hypre_conj(y_data[i]) * x_data[i]; } - POP_RANGE; -#endif /* defined(HYPRE_USING_GPU) && defined(HYPRE_USING_UNIFIED_MEMORY) */ +#endif /* defined(HYPRE_USING_CUDA) */ + + hypre_SyncCudaComputeStream(hypre_handle); #ifdef HYPRE_PROFILE hypre_profile_times[HYPRE_TIMER_ID_BLAS1] += hypre_MPI_Wtime(); @@ -850,1173 +588,55 @@ return result; } +//TODO + /*-------------------------------------------------------------------------- - * hypre_SeqVectorMassInnerProd8 + * hypre_VectorSumElts: + * Returns the sum of all vector elements. *--------------------------------------------------------------------------*/ -HYPRE_Int hypre_SeqVectorMassInnerProd8( hypre_Vector *x, - hypre_Vector **y, HYPRE_Int k, HYPRE_Real *result) + +HYPRE_Complex hypre_SeqVectorSumElts( hypre_Vector *vector ) { - HYPRE_Complex *x_data = hypre_VectorData(x); - HYPRE_Complex *y_data = hypre_VectorData(y[0]); - HYPRE_Int size = hypre_VectorSize(x); + HYPRE_Complex sum = 0; + HYPRE_Complex *data = hypre_VectorData( vector ); + HYPRE_Int size = hypre_VectorSize( vector ); + HYPRE_Int i; + +#ifdef HYPRE_USING_OPENMP +#pragma omp parallel for private(i) reduction(+:sum) HYPRE_SMP_SCHEDULE +#endif + for ( i=0; i 7) + if (hypre_GetActualMemLocation(hypre_VectorMemoryLocation(x)) != HYPRE_MEMORY_SHARED) { - for (j = 0; j < k-7; j += 8) - { - res1 = 0; - res2 = 0; - res3 = 0; - res4 = 0; - res5 = 0; - res6 = 0; - res7 = 0; - res8 = 0; - jstart = j*size; - jstart1 = jstart+size; - jstart2 = jstart1+size; - jstart3 = jstart2+size; - jstart4 = jstart3+size; - jstart5 = jstart4+size; - jstart6 = jstart5+size; - jstart7 = jstart6+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res1,res2,res3,res4,res5,res6,res7,res8) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; - res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; - res3 += hypre_conj(y_data[jstart2+i]) * x_data[i]; - res4 += hypre_conj(y_data[jstart3+i]) * x_data[i]; - res5 += hypre_conj(y_data[jstart4+i]) * x_data[i]; - res6 += hypre_conj(y_data[jstart5+i]) * x_data[i]; - res7 += hypre_conj(y_data[jstart6+i]) * x_data[i]; - res8 += hypre_conj(y_data[jstart7+i]) * x_data[i]; - } - result[j] = res1; - result[j+1] = res2; - result[j+2] = res3; - result[j+3] = res4; - result[j+4] = res5; - result[j+5] = res6; - result[j+6] = res7; - result[j+7] = res8; - } - } - if (restk == 1) - { - res1 = 0; - jstart = (k-1)*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res1) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; - } - result[k-1] = res1; - } - else if (restk == 2) - { - res1 = 0; - res2 = 0; - jstart = (k-2)*size; - jstart1 = jstart+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res1,res2) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; - res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; - } - result[k-2] = res1; - result[k-1] = res2; - } - else if (restk == 3) - { - res1 = 0; - res2 = 0; - res3 = 0; - jstart = (k-3)*size; - jstart1 = jstart+size; - jstart2 = jstart1+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res1,res2,res3) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; - res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; - res3 += hypre_conj(y_data[jstart2+i]) * x_data[i]; - } - result[k-3] = res1; - result[k-2] = res2; - result[k-1] = res3; - } - else if (restk == 4) - { - res1 = 0; - res2 = 0; - res3 = 0; - res4 = 0; - jstart = (k-4)*size; - jstart1 = jstart+size; - jstart2 = jstart1+size; - jstart3 = jstart2+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res1,res2,res3,res4) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; - res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; - res3 += hypre_conj(y_data[jstart2+i]) * x_data[i]; - res4 += hypre_conj(y_data[jstart3+i]) * x_data[i]; - } - result[k-4] = res1; - result[k-3] = res2; - result[k-2] = res3; - result[k-1] = res4; - } - else if (restk == 5) - { - res1 = 0; - res2 = 0; - res3 = 0; - res4 = 0; - res5 = 0; - jstart = (k-5)*size; - jstart1 = jstart+size; - jstart2 = jstart1+size; - jstart3 = jstart2+size; - jstart4 = jstart3+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res1,res2,res3,res4,res5) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; - res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; - res3 += hypre_conj(y_data[jstart2+i]) * x_data[i]; - res4 += hypre_conj(y_data[jstart3+i]) * x_data[i]; - res5 += hypre_conj(y_data[jstart4+i]) * x_data[i]; - } - result[k-5] = res1; - result[k-4] = res2; - result[k-3] = res3; - result[k-2] = res4; - result[k-1] = res5; - } - else if (restk == 6) - { - res1 = 0; - res2 = 0; - res3 = 0; - res4 = 0; - res5 = 0; - res6 = 0; - jstart = (k-6)*size; - jstart1 = jstart+size; - jstart2 = jstart1+size; - jstart3 = jstart2+size; - jstart4 = jstart3+size; - jstart5 = jstart4+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res1,res2,res3,res4,res5,res6) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; - res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; - res3 += hypre_conj(y_data[jstart2+i]) * x_data[i]; - res4 += hypre_conj(y_data[jstart3+i]) * x_data[i]; - res5 += hypre_conj(y_data[jstart4+i]) * x_data[i]; - res6 += hypre_conj(y_data[jstart5+i]) * x_data[i]; - } - result[k-6] = res1; - result[k-5] = res2; - result[k-4] = res3; - result[k-3] = res4; - result[k-2] = res5; - result[k-1] = res6; + /* hypre_error_w_msg(HYPRE_ERROR_GENERIC," Error! CUDA Prefetch with non-unified momory\n");*/ + return ierr; } - else if (restk == 7) - { - res1 = 0; - res2 = 0; - res3 = 0; - res4 = 0; - res5 = 0; - res6 = 0; - res7 = 0; - jstart = (k-7)*size; - jstart1 = jstart+size; - jstart2 = jstart1+size; - jstart3 = jstart2+size; - jstart4 = jstart3+size; - jstart5 = jstart4+size; - jstart6 = jstart5+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res1,res2,res3,res4,res5,res6,res7) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; - res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; - res3 += hypre_conj(y_data[jstart2+i]) * x_data[i]; - res4 += hypre_conj(y_data[jstart3+i]) * x_data[i]; - res5 += hypre_conj(y_data[jstart4+i]) * x_data[i]; - res6 += hypre_conj(y_data[jstart5+i]) * x_data[i]; - res7 += hypre_conj(y_data[jstart6+i]) * x_data[i]; - } - result[k-7] = res1; - result[k-6] = res2; - result[k-5] = res3; - result[k-4] = res4; - result[k-3] = res5; - result[k-2] = res6; - result[k-1] = res7; - } - - return hypre_error_flag; -} - -/*-------------------------------------------------------------------------- - * hypre_SeqVectorMassInnerProd4 - *--------------------------------------------------------------------------*/ -HYPRE_Int hypre_SeqVectorMassInnerProd4( hypre_Vector *x, - hypre_Vector **y, HYPRE_Int k, HYPRE_Real *result) -{ - HYPRE_Complex *x_data = hypre_VectorData(x); - HYPRE_Complex *y_data = hypre_VectorData(y[0]); - HYPRE_Int size = hypre_VectorSize(x); - - HYPRE_Int i, j, restk; - HYPRE_Real res1; - HYPRE_Real res2; - HYPRE_Real res3; - HYPRE_Real res4; - HYPRE_Int jstart; - HYPRE_Int jstart1; - HYPRE_Int jstart2; - HYPRE_Int jstart3; - - restk = (k-(k/4*4)); - - if (k > 3) + if (size == 0) { - for (j = 0; j < k-3; j += 4) - { - res1 = 0; - res2 = 0; - res3 = 0; - res4 = 0; - jstart = j*size; - jstart1 = jstart+size; - jstart2 = jstart1+size; - jstart3 = jstart2+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res1,res2,res3,res4) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; - res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; - res3 += hypre_conj(y_data[jstart2+i]) * x_data[i]; - res4 += hypre_conj(y_data[jstart3+i]) * x_data[i]; - } - result[j] = res1; - result[j+1] = res2; - result[j+2] = res3; - result[j+3] = res4; - } - } - if (restk == 1) - { - res1 = 0; - jstart = (k-1)*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res1) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; - } - result[k-1] = res1; + return ierr; } - else if (restk == 2) - { - res1 = 0; - res2 = 0; - jstart = (k-2)*size; - jstart1 = jstart+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res1,res2) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; - res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; - } - result[k-2] = res1; - result[k-1] = res2; - } - else if (restk == 3) - { - res1 = 0; - res2 = 0; - res3 = 0; - jstart = (k-3)*size; - jstart1 = jstart+size; - jstart2 = jstart1+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res1,res2,res3) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res1 += hypre_conj(y_data[jstart+i]) * x_data[i]; - res2 += hypre_conj(y_data[jstart1+i]) * x_data[i]; - res3 += hypre_conj(y_data[jstart2+i]) * x_data[i]; - } - result[k-3] = res1; - result[k-2] = res2; - result[k-1] = res3; - } - - return hypre_error_flag; -} - -/*-------------------------------------------------------------------------- - * hypre_SeqVectorMassDotpTwo8 - *--------------------------------------------------------------------------*/ -HYPRE_Int hypre_SeqVectorMassDotpTwo8( hypre_Vector *x, hypre_Vector *y, - hypre_Vector **z, HYPRE_Int k, HYPRE_Real *result_x, HYPRE_Real *result_y) -{ - HYPRE_Complex *x_data = hypre_VectorData(x); - HYPRE_Complex *y_data = hypre_VectorData(y); - HYPRE_Complex *z_data = hypre_VectorData(z[0]); - HYPRE_Int size = hypre_VectorSize(x); - - HYPRE_Int i, j, restk; - HYPRE_Real res_x1; - HYPRE_Real res_x2; - HYPRE_Real res_x3; - HYPRE_Real res_x4; - HYPRE_Real res_x5; - HYPRE_Real res_x6; - HYPRE_Real res_x7; - HYPRE_Real res_x8; - HYPRE_Real res_y1; - HYPRE_Real res_y2; - HYPRE_Real res_y3; - HYPRE_Real res_y4; - HYPRE_Real res_y5; - HYPRE_Real res_y6; - HYPRE_Real res_y7; - HYPRE_Real res_y8; - HYPRE_Int jstart; - HYPRE_Int jstart1; - HYPRE_Int jstart2; - HYPRE_Int jstart3; - HYPRE_Int jstart4; - HYPRE_Int jstart5; - HYPRE_Int jstart6; - HYPRE_Int jstart7; - - restk = (k-(k/8*8)); - - if (k > 7) - { - for (j = 0; j < k-7; j += 8) - { - res_x1 = 0; - res_x2 = 0; - res_x3 = 0; - res_x4 = 0; - res_x5 = 0; - res_x6 = 0; - res_x7 = 0; - res_x8 = 0; - res_y1 = 0; - res_y2 = 0; - res_y3 = 0; - res_y4 = 0; - res_y5 = 0; - res_y6 = 0; - res_y7 = 0; - res_y8 = 0; - jstart = j*size; - jstart1 = jstart+size; - jstart2 = jstart1+size; - jstart3 = jstart2+size; - jstart4 = jstart3+size; - jstart5 = jstart4+size; - jstart6 = jstart5+size; - jstart7 = jstart6+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_x3,res_x4,res_x5,res_x6,res_x7,res_x8,res_y1,res_y2,res_y3,res_y4,res_y5,res_y6,res_y7,res_y8) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; - res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; - res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; - res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; - res_x3 += hypre_conj(z_data[jstart2+i]) * x_data[i]; - res_y3 += hypre_conj(z_data[jstart2+i]) * y_data[i]; - res_x4 += hypre_conj(z_data[jstart3+i]) * x_data[i]; - res_y4 += hypre_conj(z_data[jstart3+i]) * y_data[i]; - res_x5 += hypre_conj(z_data[jstart4+i]) * x_data[i]; - res_y5 += hypre_conj(z_data[jstart4+i]) * y_data[i]; - res_x6 += hypre_conj(z_data[jstart5+i]) * x_data[i]; - res_y6 += hypre_conj(z_data[jstart5+i]) * y_data[i]; - res_x7 += hypre_conj(z_data[jstart6+i]) * x_data[i]; - res_y7 += hypre_conj(z_data[jstart6+i]) * y_data[i]; - res_x8 += hypre_conj(z_data[jstart7+i]) * x_data[i]; - res_y8 += hypre_conj(z_data[jstart7+i]) * y_data[i]; - } - result_x[j] = res_x1; - result_x[j+1] = res_x2; - result_x[j+2] = res_x3; - result_x[j+3] = res_x4; - result_x[j+4] = res_x5; - result_x[j+5] = res_x6; - result_x[j+6] = res_x7; - result_x[j+7] = res_x8; - result_y[j] = res_y1; - result_y[j+1] = res_y2; - result_y[j+2] = res_y3; - result_y[j+3] = res_y4; - result_y[j+4] = res_y5; - result_y[j+5] = res_y6; - result_y[j+6] = res_y7; - result_y[j+7] = res_y8; - } - } - if (restk == 1) - { - res_x1 = 0; - res_y1 = 0; - jstart = (k-1)*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res_x1,res_y1) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; - res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; - } - result_x[k-1] = res_x1; - result_y[k-1] = res_y1; - } - else if (restk == 2) - { - res_x1 = 0; - res_x2 = 0; - res_y1 = 0; - res_y2 = 0; - jstart = (k-2)*size; - jstart1 = jstart+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_y1,res_y2) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; - res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; - res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; - res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; - } - result_x[k-2] = res_x1; - result_x[k-1] = res_x2; - result_y[k-2] = res_y1; - result_y[k-1] = res_y2; - } - else if (restk == 3) - { - res_x1 = 0; - res_x2 = 0; - res_x3 = 0; - res_y1 = 0; - res_y2 = 0; - res_y3 = 0; - jstart = (k-3)*size; - jstart1 = jstart+size; - jstart2 = jstart1+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_x3,res_y1,res_y2,res_y3) HYPRE_SMP_SCHEDULE + /* speical use of TMemcpy for prefetch */ + hypre_TMemcpy(x_data, x_data, HYPRE_Complex, size, to_location, HYPRE_MEMORY_SHARED); #endif - for (i = 0; i < size; i++) - { - res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; - res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; - res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; - res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; - res_x3 += hypre_conj(z_data[jstart2+i]) * x_data[i]; - res_y3 += hypre_conj(z_data[jstart2+i]) * y_data[i]; - } - result_x[k-3] = res_x1; - result_x[k-2] = res_x2; - result_x[k-1] = res_x3; - result_y[k-3] = res_y1; - result_y[k-2] = res_y2; - result_y[k-1] = res_y3; - } - else if (restk == 4) - { - res_x1 = 0; - res_x2 = 0; - res_x3 = 0; - res_x4 = 0; - res_y1 = 0; - res_y2 = 0; - res_y3 = 0; - res_y4 = 0; - jstart = (k-4)*size; - jstart1 = jstart+size; - jstart2 = jstart1+size; - jstart3 = jstart2+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_x3,res_x4,res_y1,res_y2,res_y3,res_y4) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; - res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; - res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; - res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; - res_x3 += hypre_conj(z_data[jstart2+i]) * x_data[i]; - res_y3 += hypre_conj(z_data[jstart2+i]) * y_data[i]; - res_x4 += hypre_conj(z_data[jstart3+i]) * x_data[i]; - res_y4 += hypre_conj(z_data[jstart3+i]) * y_data[i]; - } - result_x[k-4] = res_x1; - result_x[k-3] = res_x2; - result_x[k-2] = res_x3; - result_x[k-1] = res_x4; - result_y[k-4] = res_y1; - result_y[k-3] = res_y2; - result_y[k-2] = res_y3; - result_y[k-1] = res_y4; - } - else if (restk == 5) - { - res_x1 = 0; - res_x2 = 0; - res_x3 = 0; - res_x4 = 0; - res_x5 = 0; - res_y1 = 0; - res_y2 = 0; - res_y3 = 0; - res_y4 = 0; - res_y5 = 0; - jstart = (k-5)*size; - jstart1 = jstart+size; - jstart2 = jstart1+size; - jstart3 = jstart2+size; - jstart4 = jstart3+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_x3,res_x4,res_x5,res_y1,res_y2,res_y3,res_y4,res_y5) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; - res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; - res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; - res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; - res_x3 += hypre_conj(z_data[jstart2+i]) * x_data[i]; - res_y3 += hypre_conj(z_data[jstart2+i]) * y_data[i]; - res_x4 += hypre_conj(z_data[jstart3+i]) * x_data[i]; - res_y4 += hypre_conj(z_data[jstart3+i]) * y_data[i]; - res_x5 += hypre_conj(z_data[jstart4+i]) * x_data[i]; - res_y5 += hypre_conj(z_data[jstart4+i]) * y_data[i]; - } - result_x[k-5] = res_x1; - result_x[k-4] = res_x2; - result_x[k-3] = res_x3; - result_x[k-2] = res_x4; - result_x[k-1] = res_x5; - result_y[k-5] = res_y1; - result_y[k-4] = res_y2; - result_y[k-3] = res_y3; - result_y[k-2] = res_y4; - result_y[k-1] = res_y5; - } - else if (restk == 6) - { - res_x1 = 0; - res_x2 = 0; - res_x3 = 0; - res_x4 = 0; - res_x5 = 0; - res_x6 = 0; - res_y1 = 0; - res_y2 = 0; - res_y3 = 0; - res_y4 = 0; - res_y5 = 0; - res_y6 = 0; - jstart = (k-6)*size; - jstart1 = jstart+size; - jstart2 = jstart1+size; - jstart3 = jstart2+size; - jstart4 = jstart3+size; - jstart5 = jstart4+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_x3,res_x4,res_x5,res_x6,res_y1,res_y2,res_y3,res_y4,res_y5,res_y6) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; - res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; - res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; - res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; - res_x3 += hypre_conj(z_data[jstart2+i]) * x_data[i]; - res_y3 += hypre_conj(z_data[jstart2+i]) * y_data[i]; - res_x4 += hypre_conj(z_data[jstart3+i]) * x_data[i]; - res_y4 += hypre_conj(z_data[jstart3+i]) * y_data[i]; - res_x5 += hypre_conj(z_data[jstart4+i]) * x_data[i]; - res_y5 += hypre_conj(z_data[jstart4+i]) * y_data[i]; - res_x6 += hypre_conj(z_data[jstart5+i]) * x_data[i]; - res_y6 += hypre_conj(z_data[jstart5+i]) * y_data[i]; - } - result_x[k-6] = res_x1; - result_x[k-5] = res_x2; - result_x[k-4] = res_x3; - result_x[k-3] = res_x4; - result_x[k-2] = res_x5; - result_x[k-1] = res_x6; - result_y[k-6] = res_y1; - result_y[k-5] = res_y2; - result_y[k-4] = res_y3; - result_y[k-3] = res_y4; - result_y[k-2] = res_y5; - result_y[k-1] = res_y6; - } - else if (restk == 7) - { - res_x1 = 0; - res_x2 = 0; - res_x3 = 0; - res_x4 = 0; - res_x5 = 0; - res_x6 = 0; - res_x7 = 0; - res_y1 = 0; - res_y2 = 0; - res_y3 = 0; - res_y4 = 0; - res_y5 = 0; - res_y6 = 0; - res_y7 = 0; - jstart = (k-7)*size; - jstart1 = jstart+size; - jstart2 = jstart1+size; - jstart3 = jstart2+size; - jstart4 = jstart3+size; - jstart5 = jstart4+size; - jstart6 = jstart5+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_x3,res_x4,res_x5,res_x6,res_x7,res_y1,res_y2,res_y3,res_y4,res_y5,res_y6,res_y7) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; - res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; - res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; - res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; - res_x3 += hypre_conj(z_data[jstart2+i]) * x_data[i]; - res_y3 += hypre_conj(z_data[jstart2+i]) * y_data[i]; - res_x4 += hypre_conj(z_data[jstart3+i]) * x_data[i]; - res_y4 += hypre_conj(z_data[jstart3+i]) * y_data[i]; - res_x5 += hypre_conj(z_data[jstart4+i]) * x_data[i]; - res_y5 += hypre_conj(z_data[jstart4+i]) * y_data[i]; - res_x6 += hypre_conj(z_data[jstart5+i]) * x_data[i]; - res_y6 += hypre_conj(z_data[jstart5+i]) * y_data[i]; - res_x7 += hypre_conj(z_data[jstart6+i]) * x_data[i]; - res_y7 += hypre_conj(z_data[jstart6+i]) * y_data[i]; - } - result_x[k-7] = res_x1; - result_x[k-6] = res_x2; - result_x[k-5] = res_x3; - result_x[k-4] = res_x4; - result_x[k-3] = res_x5; - result_x[k-2] = res_x6; - result_x[k-1] = res_x7; - result_y[k-7] = res_y1; - result_y[k-6] = res_y2; - result_y[k-5] = res_y3; - result_y[k-4] = res_y4; - result_y[k-3] = res_y5; - result_y[k-2] = res_y6; - result_y[k-1] = res_y7; - } - - return hypre_error_flag; -} - -/*-------------------------------------------------------------------------- - * hypre_SeqVectorMassDotpTwo4 - *--------------------------------------------------------------------------*/ -HYPRE_Int hypre_SeqVectorMassDotpTwo4( hypre_Vector *x, hypre_Vector *y, - hypre_Vector **z, HYPRE_Int k, HYPRE_Real *result_x, HYPRE_Real *result_y) -{ - HYPRE_Complex *x_data = hypre_VectorData(x); - HYPRE_Complex *y_data = hypre_VectorData(y); - HYPRE_Complex *z_data = hypre_VectorData(z[0]); - HYPRE_Int size = hypre_VectorSize(x); - - HYPRE_Int i, j, restk; - HYPRE_Real res_x1; - HYPRE_Real res_x2; - HYPRE_Real res_x3; - HYPRE_Real res_x4; - HYPRE_Real res_y1; - HYPRE_Real res_y2; - HYPRE_Real res_y3; - HYPRE_Real res_y4; - HYPRE_Int jstart; - HYPRE_Int jstart1; - HYPRE_Int jstart2; - HYPRE_Int jstart3; - - restk = (k-(k/4*4)); - - if (k > 3) - { - for (j = 0; j < k-3; j += 4) - { - res_x1 = 0; - res_x2 = 0; - res_x3 = 0; - res_x4 = 0; - res_y1 = 0; - res_y2 = 0; - res_y3 = 0; - res_y4 = 0; - jstart = j*size; - jstart1 = jstart+size; - jstart2 = jstart1+size; - jstart3 = jstart2+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_x3,res_x4,res_y1,res_y2,res_y3,res_y4) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; - res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; - res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; - res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; - res_x3 += hypre_conj(z_data[jstart2+i]) * x_data[i]; - res_y3 += hypre_conj(z_data[jstart2+i]) * y_data[i]; - res_x4 += hypre_conj(z_data[jstart3+i]) * x_data[i]; - res_y4 += hypre_conj(z_data[jstart3+i]) * y_data[i]; - } - result_x[j] = res_x1; - result_x[j+1] = res_x2; - result_x[j+2] = res_x3; - result_x[j+3] = res_x4; - result_y[j] = res_y1; - result_y[j+1] = res_y2; - result_y[j+2] = res_y3; - result_y[j+3] = res_y4; - } - } - if (restk == 1) - { - res_x1 = 0; - res_y1 = 0; - jstart = (k-1)*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res_x1,res_y1) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; - res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; - } - result_x[k-1] = res_x1; - result_y[k-1] = res_y1; - } - else if (restk == 2) - { - res_x1 = 0; - res_x2 = 0; - res_y1 = 0; - res_y2 = 0; - jstart = (k-2)*size; - jstart1 = jstart+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_y1,res_y2) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; - res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; - res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; - res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; - } - result_x[k-2] = res_x1; - result_x[k-1] = res_x2; - result_y[k-2] = res_y1; - result_y[k-1] = res_y2; - } - else if (restk == 3) - { - res_x1 = 0; - res_x2 = 0; - res_x3 = 0; - res_y1 = 0; - res_y2 = 0; - res_y3 = 0; - jstart = (k-3)*size; - jstart1 = jstart+size; - jstart2 = jstart1+size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res_x1,res_x2,res_x3,res_y1,res_y2,res_y3) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res_x1 += hypre_conj(z_data[jstart+i]) * x_data[i]; - res_y1 += hypre_conj(z_data[jstart+i]) * y_data[i]; - res_x2 += hypre_conj(z_data[jstart1+i]) * x_data[i]; - res_y2 += hypre_conj(z_data[jstart1+i]) * y_data[i]; - res_x3 += hypre_conj(z_data[jstart2+i]) * x_data[i]; - res_y3 += hypre_conj(z_data[jstart2+i]) * y_data[i]; - } - result_x[k-3] = res_x1; - result_x[k-2] = res_x2; - result_x[k-1] = res_x3; - result_y[k-3] = res_y1; - result_y[k-2] = res_y2; - result_y[k-1] = res_y3; - } - - - return hypre_error_flag; -} - -HYPRE_Int hypre_SeqVectorMassInnerProd( hypre_Vector *x, - hypre_Vector **y, HYPRE_Int k, HYPRE_Int unroll, HYPRE_Real *result) -{ - HYPRE_Complex *x_data = hypre_VectorData(x); - HYPRE_Complex *y_data = hypre_VectorData(y[0]); - HYPRE_Real res; - HYPRE_Int size = hypre_VectorSize(x); - - HYPRE_Int i, j, jstart; - - if (unroll == 8) - { - hypre_SeqVectorMassInnerProd8(x,y,k,result); - return hypre_error_flag; - } - else if (unroll == 4) - { - hypre_SeqVectorMassInnerProd4(x,y,k,result); - return hypre_error_flag; - } - else - { - for (j = 0; j < k; j++) - { - res = 0; - jstart = j*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res += hypre_conj(y_data[jstart+i]) * x_data[i]; - } - result[j] = res; - } - } - - return hypre_error_flag; -} - -/*-------------------------------------------------------------------------- - * hypre_SeqVectorMassDotpTwo - *--------------------------------------------------------------------------*/ - -HYPRE_Int hypre_SeqVectorMassDotpTwo( hypre_Vector *x, hypre_Vector *y, - hypre_Vector **z, HYPRE_Int k, HYPRE_Int unroll, - HYPRE_Real *result_x, HYPRE_Real *result_y) -{ - HYPRE_Complex *x_data = hypre_VectorData(x); - HYPRE_Complex *y_data = hypre_VectorData(y); - HYPRE_Complex *z_data = hypre_VectorData(z[0]); - HYPRE_Real res_x, res_y; - HYPRE_Int size = hypre_VectorSize(x); - - HYPRE_Int i, j, jstart; - - if (unroll == 8) - { - hypre_SeqVectorMassDotpTwo8(x,y,z,k,result_x,result_y); - return hypre_error_flag; - } - else if (unroll == 4) - { - hypre_SeqVectorMassDotpTwo4(x,y,z,k,result_x,result_y); - return hypre_error_flag; - } - else - { - for (j = 0; j < k; j++) - { - res_x = result_x[j]; - res_y = result_y[j]; - jstart = j*size; -#if defined(HYPRE_USING_OPENMP) -#pragma omp parallel for private(i) reduction(+:res_x,res_y) HYPRE_SMP_SCHEDULE -#endif - for (i = 0; i < size; i++) - { - res_x += hypre_conj(z_data[jstart+i]) * x_data[i]; - res_y += hypre_conj(z_data[jstart+i]) * y_data[i]; - } - result_x[j] = res_x; - result_y[j] = res_y; - } - } - return hypre_error_flag; -} - -/*-------------------------------------------------------------------------- - * hypre_VectorSumElts: - * Returns the sum of all vector elements. - *--------------------------------------------------------------------------*/ - -HYPRE_Complex hypre_VectorSumElts( hypre_Vector *vector ) -{ - HYPRE_Complex sum = 0; - HYPRE_Complex *data = hypre_VectorData( vector ); - HYPRE_Int size = hypre_VectorSize( vector ); - HYPRE_Int i; - -#ifdef HYPRE_USING_OPENMP -#pragma omp parallel for private(i) reduction(+:sum) HYPRE_SMP_SCHEDULE -#endif - for ( i=0; i size_y) size = size_y; - size *=hypre_VectorNumVectors(x); - PUSH_RANGE_PAYLOAD("VECCOPYDEVICE",2,size); - hypre_SeqVectorPrefetchToDevice(x); - hypre_SeqVectorPrefetchToDevice(y); -#ifdef HYPRE_USING_GPU - VecCopy(y_data,x_data,size,HYPRE_STREAM(4)); -#endif - cudaStreamSynchronize(HYPRE_STREAM(4)); - POP_RANGE; - return ierr; -} - -HYPRE_Int -hypre_SeqVectorAxpyDevice( HYPRE_Complex alpha, - hypre_Vector *x, - hypre_Vector *y ) -{ - - HYPRE_Complex *x_data = hypre_VectorData(x); - HYPRE_Complex *y_data = hypre_VectorData(y); - HYPRE_Int size = hypre_VectorSize(x); - /* HYPRE_Int i; */ - HYPRE_Int ierr = 0; - /* cublasStatus_t stat; */ - size *=hypre_VectorNumVectors(x); - - PUSH_RANGE_PAYLOAD("DEVAXPY",0,hypre_VectorSize(x)); - hypre_SeqVectorPrefetchToDevice(x); - hypre_SeqVectorPrefetchToDevice(y); - static cublasHandle_t handle; - static HYPRE_Int firstcall=1; - if (firstcall){ - handle=getCublasHandle(); - firstcall=0; - } - cublasErrchk(cublasDaxpy(handle,(HYPRE_Int)size,&alpha,x_data,1,y_data,1)); - hypre_CheckErrorDevice(cudaStreamSynchronize(HYPRE_STREAM(4))); - POP_RANGE; - return ierr; -} - -HYPRE_Real hypre_SeqVectorInnerProdDevice( hypre_Vector *x, - hypre_Vector *y ) -{ - PUSH_RANGE_PAYLOAD("DEVDOT",4,hypre_VectorSize(x)); - static cublasHandle_t handle; - static HYPRE_Int firstcall=1; - - HYPRE_Complex *x_data = hypre_VectorData(x); - HYPRE_Complex *y_data = hypre_VectorData(y); - HYPRE_Int size = hypre_VectorSize(x); - /* HYPRE_Int i; */ - HYPRE_Real result = 0.0; - /* cublasStatus_t stat; */ - if (firstcall){ - handle = getCublasHandle(); - firstcall=0; - } - PUSH_RANGE_PAYLOAD("DEVDOT-PRFETCH",5,hypre_VectorSize(x)); - //hypre_SeqVectorPrefetchToDevice(x); - //hypre_SeqVectorPrefetchToDevice(y); - POP_RANGE; - PUSH_RANGE_PAYLOAD("DEVDOT-ACTUAL",0,hypre_VectorSize(x)); - /*stat=*/cublasDdot(handle, (HYPRE_Int)size, - x_data, 1, - y_data, 1, - &result); - hypre_CheckErrorDevice(cudaStreamSynchronize(HYPRE_STREAM(4))); - POP_RANGE; - POP_RANGE; - return result; - -} -void hypre_SeqVectorPrefetchToDevice(hypre_Vector *x){ - if (hypre_VectorSize(x)==0) return; -#if defined(TRACK_MEMORY_ALLOCATIONS) - ASSERT_MANAGED(hypre_VectorData(x)); -#endif - //PrintPointerAttributes(hypre_VectorData(x)); - PUSH_RANGE("hypre_SeqVectorPrefetchToDevice",0); - hypre_CheckErrorDevice(cudaMemPrefetchAsync(hypre_VectorData(x),hypre_VectorSize(x)*sizeof(HYPRE_Complex),HYPRE_DEVICE,HYPRE_STREAM(4))); - hypre_CheckErrorDevice(cudaStreamSynchronize(HYPRE_STREAM(4))); - POP_RANGE; -} -void hypre_SeqVectorPrefetchToHost(hypre_Vector *x){ - if (hypre_VectorSize(x)==0) return; - PUSH_RANGE("hypre_SeqVectorPrefetchToHost",0); - hypre_CheckErrorDevice(cudaMemPrefetchAsync(hypre_VectorData(x),hypre_VectorSize(x)*sizeof(HYPRE_Complex),cudaCpuDeviceId,HYPRE_STREAM(4))); - hypre_CheckErrorDevice(cudaStreamSynchronize(HYPRE_STREAM(4))); - POP_RANGE; -} -void hypre_SeqVectorPrefetchToDeviceInStream(hypre_Vector *x, HYPRE_Int index){ - if (hypre_VectorSize(x)==0) return; -#if defined(TRACK_MEMORY_ALLOCATIONS) - ASSERT_MANAGED(hypre_VectorData(x)); -#endif - PUSH_RANGE("hypre_SeqVectorPrefetchToDevice",0); - hypre_CheckErrorDevice(cudaMemPrefetchAsync(hypre_VectorData(x),hypre_VectorSize(x)*sizeof(HYPRE_Complex),HYPRE_DEVICE,HYPRE_STREAM(index))); - hypre_CheckErrorDevice(cudaStreamSynchronize(HYPRE_STREAM(index))); - POP_RANGE; -} -hypre_int hypre_SeqVectorIsManaged(hypre_Vector *x){ - return pointerIsManaged((void*)hypre_VectorData(x)); -} -#endif - - - - -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - -void hypre_SeqVectorMapToDevice(hypre_Vector *x){ - if (x==NULL) return; - if (x->size>0){ - //#pragma omp target enter data map(to:x[0:0]) -#pragma omp target enter data map(to:x->data[0:x->size]) - x->mapped=1; -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - SetDRC(x); -#endif - } -} -void hypre_SeqVectorMapToDevicePrint(hypre_Vector *x){ - printf("SVmap %p [%p,%p] %d Size = %d ",x,x->data,x->data+x->size,x->mapped,x->size); - if (x->size>0){ - //#pragma omp target enter data map(to:x[0:0]) -#pragma omp target enter data map(to:x->data[0:x->size]) - x->mapped=1; -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - SetDRC(x); -#endif - } - printf("...Done\n"); + return ierr; } -void hypre_SeqVectorUnMapFromDevice(hypre_Vector *x){ - //printf("map %p [%p,%p] %d Size = %d\n",x,x->data,x->data+x->size,x->mapped,x->size); - //#pragma omp target exit data map(from:x[0:0]) -#pragma omp target exit data map(from:x->data[0:x->size]) - x->mapped=0; -} -void hypre_SeqVectorUpdateDevice(hypre_Vector *x){ - if (x==NULL) return; -#pragma omp target update to(x->data[0:x->size]) -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - SetDRC(x); -#endif -} +//hypre_int hypre_SeqVectorIsManaged(hypre_Vector *x) +//{ +//} -void hypre_SeqVectorUpdateHost(hypre_Vector *x){ - if (x==NULL) return; -#pragma omp target update from(x->data[0:x->size]) -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - SetHRC(x); -#endif -} -void printRC(hypre_Vector *x,char *id){ - printf("%p At %s HRC = %d , DRC = %d \n",x,id,x->hrc,x->drc); -} -#endif diff -Nru hypre-2.16.0/src/seq_mv/vector.h hypre-2.18.2/src/seq_mv/vector.h --- hypre-2.16.0/src/seq_mv/vector.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/seq_mv/vector.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -40,14 +35,6 @@ With rowwise storage, vj[i] = data[ j + num_vectors*i] */ HYPRE_Int vecstride, idxstride; /* ... so vj[i] = data[ j*vecstride + i*idxstride ] regardless of row_storage.*/ -#ifdef HYPRE_USING_GPU - HYPRE_Int on_device; -#endif -#ifdef HYPRE_USING_MAPPED_OPENMP_OFFLOAD - HYPRE_Int mapped; - HYPRE_Int drc; /* device ref count */ - HYPRE_Int hrc; /* host ref count */ -#endif } hypre_Vector; /*-------------------------------------------------------------------------- diff -Nru hypre-2.16.0/src/sstruct_ls/CMakeLists.txt hypre-2.18.2/src/sstruct_ls/CMakeLists.txt --- hypre-2.16.0/src/sstruct_ls/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,83 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(HDRS + HYPRE_sstruct_ls.h + _hypre_sstruct_ls.h +) + +set(SRCS + F90_HYPRE_sstruct_bicgstab.c + F90_HYPRE_sstruct_gmres.c + F90_HYPRE_sstruct_flexgmres.c + F90_HYPRE_sstruct_lgmres.c + F90_HYPRE_sstruct_InterFAC.c + F90_HYPRE_sstruct_int.c + F90_HYPRE_sstruct_maxwell.c + F90_HYPRE_sstruct_pcg.c + F90_HYPRE_sstruct_split.c + F90_HYPRE_sstruct_sys_pfmg.c + HYPRE_sstruct_bicgstab.c + HYPRE_sstruct_gmres.c + HYPRE_sstruct_flexgmres.c + HYPRE_sstruct_lgmres.c + HYPRE_sstruct_InterFAC.c + HYPRE_sstruct_int.c + HYPRE_sstruct_maxwell.c + HYPRE_sstruct_pcg.c + HYPRE_sstruct_split.c + HYPRE_sstruct_sys_pfmg.c + fac.c + fac_amr_rap.c + fac_amr_fcoarsen.c + fac_amr_zero_data.c + fac_cf_coarsen.c + fac_cfstencil_box.c + fac_CFInterfaceExtents.c + fac_interp2.c + fac_relax.c + fac_restrict2.c + fac_setup2.c + fac_solve3.c + fac_zero_cdata.c + fac_zero_stencilcoef.c + hypre_bsearch.c + krylov.c + krylov_sstruct.c + eliminate_rowscols.c + maxwell_grad.c + maxwell_physbdy.c + maxwell_PNedelec.c + maxwell_PNedelec_bdy.c + maxwell_semi_interp.c + maxwell_TV.c + maxwell_TV_setup.c + maxwell_zeroBC.c + hypre_MaxwellSolve.c + hypre_MaxwellSolve2.c + nd1_amge_interpolation.c + node_relax.c + sstruct_amr_intercommunication.c + sstruct_owninfo.c + sstruct_recvinfo.c + sstruct_sendinfo.c + sstruct_sharedDOFComm.c + sys_pfmg.c + sys_pfmg_relax.c + sys_pfmg_setup.c + sys_pfmg_setup_interp.c + sys_pfmg_setup_rap.c + sys_pfmg_solve.c + sys_semi_interp.c + sys_semi_restrict.c +) + +convert_filenames_to_full_paths(HDRS) +convert_filenames_to_full_paths(SRCS) + +set(HYPRE_HEADERS ${HYPRE_HEADERS} ${HDRS} PARENT_SCOPE) +set(HYPRE_SOURCES ${HYPRE_SOURCES} ${SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/sstruct_ls/eliminate_rowscols.c hypre-2.18.2/src/sstruct_ls/eliminate_rowscols.c --- hypre-2.16.0/src/sstruct_ls/eliminate_rowscols.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/eliminate_rowscols.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_parcsr_mv.h" #include "eliminate_rowscols.h" diff -Nru hypre-2.16.0/src/sstruct_ls/eliminate_rowscols.h hypre-2.18.2/src/sstruct_ls/eliminate_rowscols.h --- hypre-2.16.0/src/sstruct_ls/eliminate_rowscols.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/eliminate_rowscols.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_PARCSR_ELIMINATE_ROWSCOLS #define hypre_PARCSR_ELIMINATE_ROWSCOLS diff -Nru hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_bicgstab.c hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_bicgstab.c --- hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_bicgstab.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_bicgstab.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_flexgmres.c hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_flexgmres.c --- hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_flexgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_flexgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_gmres.c hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_gmres.c --- hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_gmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_gmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_int.c hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_int.c --- hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_int.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_int.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_InterFAC.c hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_InterFAC.c --- hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_InterFAC.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_InterFAC.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_lgmres.c hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_lgmres.c --- hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_lgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_lgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_maxwell.c hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_maxwell.c --- hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_maxwell.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_maxwell.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_pcg.c hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_pcg.c --- hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_pcg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_pcg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_split.c hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_split.c --- hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_split.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_split.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_sys_pfmg.c hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_sys_pfmg.c --- hypre-2.16.0/src/sstruct_ls/F90_HYPRE_sstruct_sys_pfmg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/F90_HYPRE_sstruct_sys_pfmg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_ls/fac_amr_fcoarsen.c hypre-2.18.2/src/sstruct_ls/fac_amr_fcoarsen.c --- hypre-2.16.0/src/sstruct_ls/fac_amr_fcoarsen.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/fac_amr_fcoarsen.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * OpenMP Problems diff -Nru hypre-2.16.0/src/sstruct_ls/fac_amr_rap.c hypre-2.18.2/src/sstruct_ls/fac_amr_rap.c --- hypre-2.16.0/src/sstruct_ls/fac_amr_rap.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/fac_amr_rap.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" #include "fac.h" diff -Nru hypre-2.16.0/src/sstruct_ls/fac_amr_zero_data.c hypre-2.18.2/src/sstruct_ls/fac_amr_zero_data.c --- hypre-2.16.0/src/sstruct_ls/fac_amr_zero_data.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/fac_amr_zero_data.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" #include "fac.h" diff -Nru hypre-2.16.0/src/sstruct_ls/fac.c hypre-2.18.2/src/sstruct_ls/fac.c --- hypre-2.16.0/src/sstruct_ls/fac.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/fac.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" #include "fac.h" diff -Nru hypre-2.16.0/src/sstruct_ls/fac_cf_coarsen.c hypre-2.18.2/src/sstruct_ls/fac_cf_coarsen.c --- hypre-2.16.0/src/sstruct_ls/fac_cf_coarsen.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/fac_cf_coarsen.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * OpenMP Problems diff -Nru hypre-2.16.0/src/sstruct_ls/fac_CFInterfaceExtents.c hypre-2.18.2/src/sstruct_ls/fac_CFInterfaceExtents.c --- hypre-2.16.0/src/sstruct_ls/fac_CFInterfaceExtents.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/fac_CFInterfaceExtents.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" #include "fac.h" diff -Nru hypre-2.16.0/src/sstruct_ls/fac_cfstencil_box.c hypre-2.18.2/src/sstruct_ls/fac_cfstencil_box.c --- hypre-2.16.0/src/sstruct_ls/fac_cfstencil_box.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/fac_cfstencil_box.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" #include "fac.h" diff -Nru hypre-2.16.0/src/sstruct_ls/fac.h hypre-2.18.2/src/sstruct_ls/fac.h --- hypre-2.16.0/src/sstruct_ls/fac.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/fac.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_ls/fac_interp2.c hypre-2.18.2/src/sstruct_ls/fac_interp2.c --- hypre-2.16.0/src/sstruct_ls/fac_interp2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/fac_interp2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * OpenMP Problems diff -Nru hypre-2.16.0/src/sstruct_ls/fac_relax.c hypre-2.18.2/src/sstruct_ls/fac_relax.c --- hypre-2.16.0/src/sstruct_ls/fac_relax.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/fac_relax.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * FAC relaxation. Refinement patches are solved using system pfmg diff -Nru hypre-2.16.0/src/sstruct_ls/fac_restrict2.c hypre-2.18.2/src/sstruct_ls/fac_restrict2.c --- hypre-2.16.0/src/sstruct_ls/fac_restrict2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/fac_restrict2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * OpenMP Problems diff -Nru hypre-2.16.0/src/sstruct_ls/fac_setup2.c hypre-2.18.2/src/sstruct_ls/fac_setup2.c --- hypre-2.16.0/src/sstruct_ls/fac_setup2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/fac_setup2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" #include "fac.h" diff -Nru hypre-2.16.0/src/sstruct_ls/fac_solve3.c hypre-2.18.2/src/sstruct_ls/fac_solve3.c --- hypre-2.16.0/src/sstruct_ls/fac_solve3.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/fac_solve3.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * FAC cycle. Refinement patches are solved using relaxation. diff -Nru hypre-2.16.0/src/sstruct_ls/fac_zero_cdata.c hypre-2.18.2/src/sstruct_ls/fac_zero_cdata.c --- hypre-2.16.0/src/sstruct_ls/fac_zero_cdata.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/fac_zero_cdata.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" #include "fac.h" diff -Nru hypre-2.16.0/src/sstruct_ls/fac_zero_stencilcoef.c hypre-2.18.2/src/sstruct_ls/fac_zero_stencilcoef.c --- hypre-2.16.0/src/sstruct_ls/fac_zero_stencilcoef.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/fac_zero_stencilcoef.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" #include "fac.h" diff -Nru hypre-2.16.0/src/sstruct_ls/gselim.h hypre-2.18.2/src/sstruct_ls/gselim.h --- hypre-2.16.0/src/sstruct_ls/gselim.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/gselim.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + #ifndef GSELIM_H #define GSELIM_H diff -Nru hypre-2.16.0/src/sstruct_ls/headers hypre-2.18.2/src/sstruct_ls/headers --- hypre-2.16.0/src/sstruct_ls/headers 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/headers 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) INTERNAL_HEADER=_hypre_sstruct_ls.h diff -Nru hypre-2.16.0/src/sstruct_ls/hypre_bsearch.c hypre-2.18.2/src/sstruct_ls/hypre_bsearch.c --- hypre-2.16.0/src/sstruct_ls/hypre_bsearch.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/hypre_bsearch.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_utilities.h" #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/hypre_MaxwellSolve2.c hypre-2.18.2/src/sstruct_ls/hypre_MaxwellSolve2.c --- hypre-2.16.0/src/sstruct_ls/hypre_MaxwellSolve2.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/hypre_MaxwellSolve2.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/hypre_MaxwellSolve.c hypre-2.18.2/src/sstruct_ls/hypre_MaxwellSolve.c --- hypre-2.16.0/src/sstruct_ls/hypre_MaxwellSolve.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/hypre_MaxwellSolve.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_bicgstab.c hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_bicgstab.c --- hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_bicgstab.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_bicgstab.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_flexgmres.c hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_flexgmres.c --- hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_flexgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_flexgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_gmres.c hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_gmres.c --- hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_gmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_gmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_int.c hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_int.c --- hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_int.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_int.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" #include "interpreter.h" diff -Nru hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_InterFAC.c hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_InterFAC.c --- hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_InterFAC.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_InterFAC.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_lgmres.c hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_lgmres.c --- hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_lgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_lgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/_hypre_sstruct_ls.h hypre-2.18.2/src/sstruct_ls/_hypre_sstruct_ls.h --- hypre-2.16.0/src/sstruct_ls/_hypre_sstruct_ls.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/_hypre_sstruct_ls.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_SSTRUCT_LS_HEADER #define hypre_SSTRUCT_LS_HEADER @@ -32,21 +27,6 @@ extern "C" { #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - /*-------------------------------------------------------------------------- * hypre_SStructOwnInfo data structure * This structure is for the coarsen fboxes that are on this processor, @@ -84,21 +64,6 @@ ((own_data) -> own_composite_size) #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - /*-------------------------------------------------------------------------- * hypre_SStructRecvInfo data structure *--------------------------------------------------------------------------*/ @@ -116,21 +81,6 @@ } hypre_SStructRecvInfoData; #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - /*-------------------------------------------------------------------------- * hypre_SStructSendInfo data structure *--------------------------------------------------------------------------*/ @@ -149,21 +99,6 @@ } hypre_SStructSendInfoData; #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - typedef struct { hypre_IJMatrix *Face_iedge; @@ -175,21 +110,6 @@ } hypre_PTopology; -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - /****************************************************************************** * * Header info for the Maxwell solver @@ -289,21 +209,6 @@ } hypre_MaxwellData; #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - typedef struct { HYPRE_Int row; diff -Nru hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_ls.h hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_ls.h --- hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_ls.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_ls.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef HYPRE_SSTRUCT_LS_HEADER #define HYPRE_SSTRUCT_LS_HEADER diff -Nru hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_maxwell.c hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_maxwell.c --- hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_maxwell.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_maxwell.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_pcg.c hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_pcg.c --- hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_pcg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_pcg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_split.c hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_split.c --- hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_split.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_split.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_sys_pfmg.c hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_sys_pfmg.c --- hypre-2.16.0/src/sstruct_ls/HYPRE_sstruct_sys_pfmg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/HYPRE_sstruct_sys_pfmg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/krylov.c hypre-2.18.2/src/sstruct_ls/krylov.c --- hypre-2.16.0/src/sstruct_ls/krylov.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/krylov.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_utilities.h" #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/krylov_sstruct.c hypre-2.18.2/src/sstruct_ls/krylov_sstruct.c --- hypre-2.16.0/src/sstruct_ls/krylov_sstruct.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/krylov_sstruct.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_ls/Makefile hypre-2.18.2/src/sstruct_ls/Makefile --- hypre-2.16.0/src/sstruct_ls/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config diff -Nru hypre-2.16.0/src/sstruct_ls/maxwell_grad.c hypre-2.18.2/src/sstruct_ls/maxwell_grad.c --- hypre-2.16.0/src/sstruct_ls/maxwell_grad.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/maxwell_grad.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * OpenMP Problems diff -Nru hypre-2.16.0/src/sstruct_ls/maxwell_physbdy.c hypre-2.18.2/src/sstruct_ls/maxwell_physbdy.c --- hypre-2.16.0/src/sstruct_ls/maxwell_physbdy.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/maxwell_physbdy.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * OpenMP Problems diff -Nru hypre-2.16.0/src/sstruct_ls/maxwell_PNedelec_bdy.c hypre-2.18.2/src/sstruct_ls/maxwell_PNedelec_bdy.c --- hypre-2.16.0/src/sstruct_ls/maxwell_PNedelec_bdy.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/maxwell_PNedelec_bdy.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/maxwell_PNedelec.c hypre-2.18.2/src/sstruct_ls/maxwell_PNedelec.c --- hypre-2.16.0/src/sstruct_ls/maxwell_PNedelec.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/maxwell_PNedelec.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * OpenMP Problems diff -Nru hypre-2.16.0/src/sstruct_ls/maxwell_PTopology.h hypre-2.18.2/src/sstruct_ls/maxwell_PTopology.h --- hypre-2.16.0/src/sstruct_ls/maxwell_PTopology.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/maxwell_PTopology.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ typedef struct { diff -Nru hypre-2.16.0/src/sstruct_ls/maxwell_semi_interp.c hypre-2.18.2/src/sstruct_ls/maxwell_semi_interp.c --- hypre-2.16.0/src/sstruct_ls/maxwell_semi_interp.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/maxwell_semi_interp.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * OpenMP Problems diff -Nru hypre-2.16.0/src/sstruct_ls/maxwell_TV.c hypre-2.18.2/src/sstruct_ls/maxwell_TV.c --- hypre-2.16.0/src/sstruct_ls/maxwell_TV.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/maxwell_TV.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" #include "maxwell_TV.h" diff -Nru hypre-2.16.0/src/sstruct_ls/maxwell_TV.h hypre-2.18.2/src/sstruct_ls/maxwell_TV.h --- hypre-2.16.0/src/sstruct_ls/maxwell_TV.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/maxwell_TV.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_ls/maxwell_TV_setup.c hypre-2.18.2/src/sstruct_ls/maxwell_TV_setup.c --- hypre-2.16.0/src/sstruct_ls/maxwell_TV_setup.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/maxwell_TV_setup.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * OpenMP Problems diff -Nru hypre-2.16.0/src/sstruct_ls/maxwell_zeroBC.c hypre-2.18.2/src/sstruct_ls/maxwell_zeroBC.c --- hypre-2.16.0/src/sstruct_ls/maxwell_zeroBC.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/maxwell_zeroBC.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/nd1_amge_interpolation.c hypre-2.18.2/src/sstruct_ls/nd1_amge_interpolation.c --- hypre-2.16.0/src/sstruct_ls/nd1_amge_interpolation.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/nd1_amge_interpolation.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_IJ_mv.h" #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/nd1_amge_interpolation.h hypre-2.18.2/src/sstruct_ls/nd1_amge_interpolation.h --- hypre-2.16.0/src/sstruct_ls/nd1_amge_interpolation.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/nd1_amge_interpolation.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_ND1_AMGE_INTERPOLATION #define hypre_ND1_AMGE_INTERPOLATION diff -Nru hypre-2.16.0/src/sstruct_ls/node_relax.c hypre-2.18.2/src/sstruct_ls/node_relax.c --- hypre-2.16.0/src/sstruct_ls/node_relax.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/node_relax.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" #include "_hypre_parcsr_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/sstruct_amr_intercommunication.c hypre-2.18.2/src/sstruct_ls/sstruct_amr_intercommunication.c --- hypre-2.16.0/src/sstruct_ls/sstruct_amr_intercommunication.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sstruct_amr_intercommunication.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/sstruct_owninfo.c hypre-2.18.2/src/sstruct_ls/sstruct_owninfo.c --- hypre-2.16.0/src/sstruct_ls/sstruct_owninfo.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sstruct_owninfo.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/sstruct_owninfo.h hypre-2.18.2/src/sstruct_ls/sstruct_owninfo.h --- hypre-2.16.0/src/sstruct_ls/sstruct_owninfo.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sstruct_owninfo.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*-------------------------------------------------------------------------- * hypre_SStructOwnInfo data structure diff -Nru hypre-2.16.0/src/sstruct_ls/sstruct_recvinfo.c hypre-2.18.2/src/sstruct_ls/sstruct_recvinfo.c --- hypre-2.16.0/src/sstruct_ls/sstruct_recvinfo.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sstruct_recvinfo.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/sstruct_recvinfo.h hypre-2.18.2/src/sstruct_ls/sstruct_recvinfo.h --- hypre-2.16.0/src/sstruct_ls/sstruct_recvinfo.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sstruct_recvinfo.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*-------------------------------------------------------------------------- * hypre_SStructRecvInfo data structure diff -Nru hypre-2.16.0/src/sstruct_ls/sstruct_sendinfo.c hypre-2.18.2/src/sstruct_ls/sstruct_sendinfo.c --- hypre-2.16.0/src/sstruct_ls/sstruct_sendinfo.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sstruct_sendinfo.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/sstruct_sendinfo.h hypre-2.18.2/src/sstruct_ls/sstruct_sendinfo.h --- hypre-2.16.0/src/sstruct_ls/sstruct_sendinfo.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sstruct_sendinfo.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*-------------------------------------------------------------------------- * hypre_SStructSendInfo data structure diff -Nru hypre-2.16.0/src/sstruct_ls/sstruct_sharedDOFComm.c hypre-2.18.2/src/sstruct_ls/sstruct_sharedDOFComm.c --- hypre-2.16.0/src/sstruct_ls/sstruct_sharedDOFComm.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sstruct_sharedDOFComm.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * OpenMP Problems diff -Nru hypre-2.16.0/src/sstruct_ls/sstruct_sharedDOFComm.h hypre-2.18.2/src/sstruct_ls/sstruct_sharedDOFComm.h --- hypre-2.16.0/src/sstruct_ls/sstruct_sharedDOFComm.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sstruct_sharedDOFComm.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ typedef struct { diff -Nru hypre-2.16.0/src/sstruct_ls/sys_pfmg.c hypre-2.18.2/src/sstruct_ls/sys_pfmg.c --- hypre-2.16.0/src/sstruct_ls/sys_pfmg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sys_pfmg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" #include "sys_pfmg.h" diff -Nru hypre-2.16.0/src/sstruct_ls/sys_pfmg.h hypre-2.18.2/src/sstruct_ls/sys_pfmg.h --- hypre-2.16.0/src/sstruct_ls/sys_pfmg.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sys_pfmg.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_ls/sys_pfmg_relax.c hypre-2.18.2/src/sstruct_ls/sys_pfmg_relax.c --- hypre-2.16.0/src/sstruct_ls/sys_pfmg_relax.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sys_pfmg_relax.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/sys_pfmg_setup.c hypre-2.18.2/src/sstruct_ls/sys_pfmg_setup.c --- hypre-2.16.0/src/sstruct_ls/sys_pfmg_setup.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sys_pfmg_setup.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" #include "sys_pfmg.h" diff -Nru hypre-2.16.0/src/sstruct_ls/sys_pfmg_setup_interp.c hypre-2.18.2/src/sstruct_ls/sys_pfmg_setup_interp.c --- hypre-2.16.0/src/sstruct_ls/sys_pfmg_setup_interp.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sys_pfmg_setup_interp.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/sys_pfmg_setup_rap.c hypre-2.18.2/src/sstruct_ls/sys_pfmg_setup_rap.c --- hypre-2.16.0/src/sstruct_ls/sys_pfmg_setup_rap.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sys_pfmg_setup_rap.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/sys_pfmg_solve.c hypre-2.18.2/src/sstruct_ls/sys_pfmg_solve.c --- hypre-2.16.0/src/sstruct_ls/sys_pfmg_solve.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sys_pfmg_solve.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" #include "sys_pfmg.h" diff -Nru hypre-2.16.0/src/sstruct_ls/sys_semi_interp.c hypre-2.18.2/src/sstruct_ls/sys_semi_interp.c --- hypre-2.16.0/src/sstruct_ls/sys_semi_interp.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sys_semi_interp.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_ls/sys_semi_restrict.c hypre-2.18.2/src/sstruct_ls/sys_semi_restrict.c --- hypre-2.16.0/src/sstruct_ls/sys_semi_restrict.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_ls/sys_semi_restrict.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_ls.h" diff -Nru hypre-2.16.0/src/sstruct_mv/CMakeLists.txt hypre-2.18.2/src/sstruct_mv/CMakeLists.txt --- hypre-2.16.0/src/sstruct_mv/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,40 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(HDRS + HYPRE_sstruct_mv.h + _hypre_sstruct_mv.h +) + +set(SRCS + F90_HYPRE_sstruct_graph.c + F90_HYPRE_sstruct_grid.c + F90_HYPRE_sstruct_matrix.c + F90_HYPRE_sstruct_stencil.c + F90_HYPRE_sstruct_vector.c + HYPRE_sstruct_graph.c + HYPRE_sstruct_grid.c + HYPRE_sstruct_matrix.c + HYPRE_sstruct_stencil.c + HYPRE_sstruct_vector.c + sstruct_axpy.c + sstruct_copy.c + sstruct_graph.c + sstruct_grid.c + sstruct_innerprod.c + sstruct_matrix.c + sstruct_matvec.c + sstruct_scale.c + sstruct_stencil.c + sstruct_vector.c +) + +convert_filenames_to_full_paths(HDRS) +convert_filenames_to_full_paths(SRCS) + +set(HYPRE_HEADERS ${HYPRE_HEADERS} ${HDRS} PARENT_SCOPE) +set(HYPRE_SOURCES ${HYPRE_SOURCES} ${SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/sstruct_mv/F90_HYPRE_sstruct_graph.c hypre-2.18.2/src/sstruct_mv/F90_HYPRE_sstruct_graph.c --- hypre-2.16.0/src/sstruct_mv/F90_HYPRE_sstruct_graph.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/F90_HYPRE_sstruct_graph.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/F90_HYPRE_sstruct_grid.c hypre-2.18.2/src/sstruct_mv/F90_HYPRE_sstruct_grid.c --- hypre-2.16.0/src/sstruct_mv/F90_HYPRE_sstruct_grid.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/F90_HYPRE_sstruct_grid.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/F90_HYPRE_sstruct_matrix.c hypre-2.18.2/src/sstruct_mv/F90_HYPRE_sstruct_matrix.c --- hypre-2.16.0/src/sstruct_mv/F90_HYPRE_sstruct_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/F90_HYPRE_sstruct_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/F90_HYPRE_sstruct_stencil.c hypre-2.18.2/src/sstruct_mv/F90_HYPRE_sstruct_stencil.c --- hypre-2.16.0/src/sstruct_mv/F90_HYPRE_sstruct_stencil.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/F90_HYPRE_sstruct_stencil.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/F90_HYPRE_sstruct_vector.c hypre-2.18.2/src/sstruct_mv/F90_HYPRE_sstruct_vector.c --- hypre-2.16.0/src/sstruct_mv/F90_HYPRE_sstruct_vector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/F90_HYPRE_sstruct_vector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/headers hypre-2.18.2/src/sstruct_mv/headers --- hypre-2.16.0/src/sstruct_mv/headers 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/headers 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) INTERNAL_HEADER=_hypre_sstruct_mv.h diff -Nru hypre-2.16.0/src/sstruct_mv/HYPRE_sstruct_graph.c hypre-2.18.2/src/sstruct_mv/HYPRE_sstruct_graph.c --- hypre-2.16.0/src/sstruct_mv/HYPRE_sstruct_graph.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/HYPRE_sstruct_graph.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/HYPRE_sstruct_grid.c hypre-2.18.2/src/sstruct_mv/HYPRE_sstruct_grid.c --- hypre-2.16.0/src/sstruct_mv/HYPRE_sstruct_grid.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/HYPRE_sstruct_grid.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* 9/09 AB - modified all functions to use the box manager */ diff -Nru hypre-2.16.0/src/sstruct_mv/HYPRE_sstruct_matrix.c hypre-2.18.2/src/sstruct_mv/HYPRE_sstruct_matrix.c --- hypre-2.16.0/src/sstruct_mv/HYPRE_sstruct_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/HYPRE_sstruct_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/_hypre_sstruct_mv.h hypre-2.18.2/src/sstruct_mv/_hypre_sstruct_mv.h --- hypre-2.16.0/src/sstruct_mv/_hypre_sstruct_mv.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/_hypre_sstruct_mv.h 2019-10-28 22:30:04.000000000 +0000 @@ -18,17 +18,12 @@ extern "C" { #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -109,8 +104,8 @@ typedef struct { HYPRE_Int type; - HYPRE_BigInt offset; - HYPRE_BigInt ghoffset; + HYPRE_BigInt offset; + HYPRE_BigInt ghoffset; } hypre_SStructBoxManInfo; @@ -318,17 +313,12 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -371,17 +361,12 @@ hypre_StructStencilElement( hypre_SStructStencilSStencil(stencil), i ) #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -547,17 +532,12 @@ #define hypre_SStructGraphEntryToVar(g) ((g) -> to_var) #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -680,17 +660,12 @@ #define hypre_SStructPMatrixRefCount(pmat) ((pmat) -> ref_count) #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -794,17 +769,12 @@ #define hypre_SStructPVectorDataSize(pvec) ((pvec) -> datasize ) #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* HYPRE_sstruct_graph.c */ HYPRE_Int HYPRE_SStructGraphCreate ( MPI_Comm comm , HYPRE_SStructGrid grid , HYPRE_SStructGraph *graph_ptr ); diff -Nru hypre-2.16.0/src/sstruct_mv/HYPRE_sstruct_mv.h hypre-2.18.2/src/sstruct_mv/HYPRE_sstruct_mv.h --- hypre-2.16.0/src/sstruct_mv/HYPRE_sstruct_mv.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/HYPRE_sstruct_mv.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef HYPRE_SSTRUCT_MV_HEADER #define HYPRE_SSTRUCT_MV_HEADER diff -Nru hypre-2.16.0/src/sstruct_mv/HYPRE_sstruct_stencil.c hypre-2.18.2/src/sstruct_mv/HYPRE_sstruct_stencil.c --- hypre-2.16.0/src/sstruct_mv/HYPRE_sstruct_stencil.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/HYPRE_sstruct_stencil.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/HYPRE_sstruct_vector.c hypre-2.18.2/src/sstruct_mv/HYPRE_sstruct_vector.c --- hypre-2.16.0/src/sstruct_mv/HYPRE_sstruct_vector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/HYPRE_sstruct_vector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/Makefile hypre-2.18.2/src/sstruct_mv/Makefile --- hypre-2.16.0/src/sstruct_mv/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config diff -Nru hypre-2.16.0/src/sstruct_mv/protos.h hypre-2.18.2/src/sstruct_mv/protos.h --- hypre-2.16.0/src/sstruct_mv/protos.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/protos.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* HYPRE_sstruct_graph.c */ HYPRE_Int HYPRE_SStructGraphCreate ( MPI_Comm comm , HYPRE_SStructGrid grid , HYPRE_SStructGraph *graph_ptr ); @@ -94,7 +89,7 @@ /* sstruct_graph.c */ HYPRE_Int hypre_SStructGraphRef ( hypre_SStructGraph *graph , hypre_SStructGraph **graph_ref ); -HYPRE_Int hypre_SStructGraphGetUVEntryRank( hypre_SStructGraph *graph , HYPRE_Int part , HYPRE_Int var , hypre_Index index, HYPRE_Int *rank ); +HYPRE_Int hypre_SStructGraphGetUVEntryRank( hypre_SStructGraph *graph , HYPRE_Int part , HYPRE_Int var , hypre_Index index, HYPRE_BigInt *rank ); HYPRE_Int hypre_SStructGraphFindBoxEndpt ( hypre_SStructGraph *graph , HYPRE_Int part , HYPRE_Int var , HYPRE_Int proc , HYPRE_Int endpt , HYPRE_Int boxi ); HYPRE_Int hypre_SStructGraphFindSGridEndpts ( hypre_SStructGraph *graph , HYPRE_Int part , HYPRE_Int var , HYPRE_Int proc , HYPRE_Int endpt , HYPRE_Int *endpts ); @@ -116,8 +111,8 @@ HYPRE_Int hypre_SStructGridBoxProcFindBoxManEntry ( hypre_SStructGrid *grid , HYPRE_Int part , HYPRE_Int var , HYPRE_Int box , HYPRE_Int proc , hypre_BoxManEntry **entry_ptr ); HYPRE_Int hypre_SStructBoxManEntryGetCSRstrides ( hypre_BoxManEntry *entry , hypre_Index strides ); HYPRE_Int hypre_SStructBoxManEntryGetGhstrides ( hypre_BoxManEntry *entry , hypre_Index strides ); -HYPRE_Int hypre_SStructBoxManEntryGetGlobalCSRank ( hypre_BoxManEntry *entry , hypre_Index index , HYPRE_Int *rank_ptr ); -HYPRE_Int hypre_SStructBoxManEntryGetGlobalGhrank ( hypre_BoxManEntry *entry , hypre_Index index , HYPRE_Int *rank_ptr ); +HYPRE_Int hypre_SStructBoxManEntryGetGlobalCSRank ( hypre_BoxManEntry *entry , hypre_Index index , HYPRE_BigInt *rank_ptr ); +HYPRE_Int hypre_SStructBoxManEntryGetGlobalGhrank ( hypre_BoxManEntry *entry , hypre_Index index , HYPRE_BigInt *rank_ptr ); HYPRE_Int hypre_SStructBoxManEntryGetProcess ( hypre_BoxManEntry *entry , HYPRE_Int *proc_ptr ); HYPRE_Int hypre_SStructBoxManEntryGetBoxnum ( hypre_BoxManEntry *entry , HYPRE_Int *id_ptr ); HYPRE_Int hypre_SStructBoxManEntryGetPart ( hypre_BoxManEntry *entry , HYPRE_Int part , HYPRE_Int *part_ptr ); @@ -127,7 +122,7 @@ HYPRE_Int hypre_SStructNborBoxToBox ( hypre_Box *nbor_box , hypre_Index root , hypre_Index nbor_root , hypre_Index coord , hypre_Index dir ); HYPRE_Int hypre_SStructVarToNborVar ( hypre_SStructGrid *grid , HYPRE_Int part , HYPRE_Int var , HYPRE_Int *coord , HYPRE_Int *nbor_var_ptr ); HYPRE_Int hypre_SStructGridSetNumGhost ( hypre_SStructGrid *grid , HYPRE_Int *num_ghost ); -HYPRE_Int hypre_SStructBoxManEntryGetGlobalRank ( hypre_BoxManEntry *entry , hypre_Index index , HYPRE_Int *rank_ptr , HYPRE_Int type ); +HYPRE_Int hypre_SStructBoxManEntryGetGlobalRank ( hypre_BoxManEntry *entry , hypre_Index index , HYPRE_BigInt *rank_ptr , HYPRE_Int type ); HYPRE_Int hypre_SStructBoxManEntryGetStrides ( hypre_BoxManEntry *entry , hypre_Index strides , HYPRE_Int type ); HYPRE_Int hypre_SStructBoxNumMap ( hypre_SStructGrid *grid , HYPRE_Int part , HYPRE_Int boxnum , HYPRE_Int **num_varboxes_ptr , HYPRE_Int ***map_ptr ); HYPRE_Int hypre_SStructCellGridBoxNumMap ( hypre_SStructGrid *grid , HYPRE_Int part , HYPRE_Int ***num_varboxes_ptr , HYPRE_Int ****map_ptr ); diff -Nru hypre-2.16.0/src/sstruct_mv/sstruct_axpy.c hypre-2.18.2/src/sstruct_mv/sstruct_axpy.c --- hypre-2.16.0/src/sstruct_mv/sstruct_axpy.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/sstruct_axpy.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/sstruct_copy.c hypre-2.18.2/src/sstruct_mv/sstruct_copy.c --- hypre-2.16.0/src/sstruct_mv/sstruct_copy.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/sstruct_copy.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/sstruct_graph.c hypre-2.18.2/src/sstruct_mv/sstruct_graph.c --- hypre-2.16.0/src/sstruct_mv/sstruct_graph.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/sstruct_graph.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/sstruct_graph.h hypre-2.18.2/src/sstruct_mv/sstruct_graph.h --- hypre-2.16.0/src/sstruct_mv/sstruct_graph.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/sstruct_graph.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -41,7 +36,7 @@ HYPRE_Int to_var; HYPRE_Int to_boxnum; /* local box number */ HYPRE_Int to_proc; - HYPRE_BigInt to_rank; + HYPRE_Int to_rank; } hypre_SStructUEntry; @@ -50,7 +45,7 @@ HYPRE_Int part; hypre_Index index; HYPRE_Int var; - HYPRE_BigInt rank; + HYPRE_Int rank; HYPRE_Int nUentries; hypre_SStructUEntry *Uentries; diff -Nru hypre-2.16.0/src/sstruct_mv/sstruct_grid.c hypre-2.18.2/src/sstruct_mv/sstruct_grid.c --- hypre-2.16.0/src/sstruct_mv/sstruct_grid.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/sstruct_grid.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/sstruct_grid.h hypre-2.18.2/src/sstruct_mv/sstruct_grid.h --- hypre-2.16.0/src/sstruct_mv/sstruct_grid.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/sstruct_grid.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/sstruct_innerprod.c hypre-2.18.2/src/sstruct_mv/sstruct_innerprod.c --- hypre-2.16.0/src/sstruct_mv/sstruct_innerprod.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/sstruct_innerprod.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/sstruct_matrix.c hypre-2.18.2/src/sstruct_mv/sstruct_matrix.c --- hypre-2.16.0/src/sstruct_mv/sstruct_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/sstruct_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -396,7 +391,7 @@ values, action, -1, 0); /* TODO: Why need DeviceSync? */ #if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) - hypre_CheckErrorDevice(cudaDeviceSynchronize()); + HYPRE_CUDA_CALL(cudaDeviceSynchronize()); #endif /* set (AddTo/Get) or clear (Set) values outside the grid in ghost zones */ if (action != 0) diff -Nru hypre-2.16.0/src/sstruct_mv/sstruct_matrix.h hypre-2.18.2/src/sstruct_mv/sstruct_matrix.h --- hypre-2.16.0/src/sstruct_mv/sstruct_matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/sstruct_matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -71,7 +66,7 @@ HYPRE_Complex *tmp_coeffs; HYPRE_Int ns_symmetric; /* Non-stencil entries symmetric? */ - HYPRE_BigInt global_size; /* Total number of nonzero coeffs */ + HYPRE_Int global_size; /* Total number of nonzero coeffs */ HYPRE_Int ref_count; diff -Nru hypre-2.16.0/src/sstruct_mv/sstruct_matvec.c hypre-2.18.2/src/sstruct_mv/sstruct_matvec.c --- hypre-2.16.0/src/sstruct_mv/sstruct_matvec.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/sstruct_matvec.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/sstruct_scale.c hypre-2.18.2/src/sstruct_mv/sstruct_scale.c --- hypre-2.16.0/src/sstruct_mv/sstruct_scale.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/sstruct_scale.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/sstruct_stencil.c hypre-2.18.2/src/sstruct_mv/sstruct_stencil.c --- hypre-2.16.0/src/sstruct_mv/sstruct_stencil.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/sstruct_stencil.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_sstruct_mv.h" diff -Nru hypre-2.16.0/src/sstruct_mv/sstruct_stencil.h hypre-2.18.2/src/sstruct_mv/sstruct_stencil.h --- hypre-2.16.0/src/sstruct_mv/sstruct_stencil.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/sstruct_stencil.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/sstruct_mv/sstruct_vector.c hypre-2.18.2/src/sstruct_mv/sstruct_vector.c --- hypre-2.16.0/src/sstruct_mv/sstruct_vector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/sstruct_vector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -251,7 +246,7 @@ /* TODO: Why need DeviceSync? */ #if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) - hypre_CheckErrorDevice(cudaDeviceSynchronize()); + HYPRE_CUDA_CALL(cudaDeviceSynchronize()); #endif /* set (AddTo/Get) or clear (Set) values outside the grid in ghost zones */ if (action != 0) diff -Nru hypre-2.16.0/src/sstruct_mv/sstruct_vector.h hypre-2.18.2/src/sstruct_mv/sstruct_vector.h --- hypre-2.16.0/src/sstruct_mv/sstruct_vector.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/sstruct_mv/sstruct_vector.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -68,7 +63,7 @@ of vector data for the part=partx */ HYPRE_Int datasize ; /* GEC1002 size of all data = ghlocalsize */ - HYPRE_BigInt global_size; /* Total number coefficients */ + HYPRE_Int global_size; /* Total number coefficients */ HYPRE_Int ref_count; diff -Nru hypre-2.16.0/src/struct_ls/CMakeLists.txt hypre-2.18.2/src/struct_ls/CMakeLists.txt --- hypre-2.16.0/src/struct_ls/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,85 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(HDRS + HYPRE_struct_ls.h + _hypre_struct_ls.h +) + +set(SRCS + coarsen.c + cyclic_reduction.c + F90_HYPRE_struct_bicgstab.c + F90_HYPRE_struct_cycred.c + F90_HYPRE_struct_gmres.c + F90_HYPRE_struct_hybrid.c + F90_HYPRE_struct_int.c + F90_HYPRE_struct_jacobi.c + F90_HYPRE_struct_pcg.c + F90_HYPRE_struct_pfmg.c + F90_HYPRE_struct_smg.c + F90_HYPRE_struct_sparse_msg.c + general.c + hybrid.c + HYPRE_struct_bicgstab.c + HYPRE_struct_cycred.c + HYPRE_struct_hybrid.c + HYPRE_struct_int.c + HYPRE_struct_jacobi.c + HYPRE_struct_pfmg.c + HYPRE_struct_smg.c + HYPRE_struct_sparse_msg.c + HYPRE_struct_pcg.c + HYPRE_struct_gmres.c + HYPRE_struct_flexgmres.c + HYPRE_struct_lgmres.c + jacobi.c + pcg_struct.c + pfmg2_setup_rap.c + pfmg3_setup_rap.c + pfmg.c + pfmg_relax.c + pfmg_setup.c + pfmg_setup_interp.c + pfmg_setup_rap5.c + pfmg_setup_rap7.c + pfmg_setup_rap.c + pfmg_solve.c + point_relax.c + red_black_constantcoef_gs.c + red_black_gs.c + semi.c + semi_interp.c + semi_restrict.c + semi_setup_rap.c + smg2_setup_rap.c + smg3_setup_rap.c + smg_axpy.c + smg.c + smg_relax.c + smg_residual.c + smg_setup.c + smg_setup_interp.c + smg_setup_rap.c + smg_setup_restrict.c + smg_solve.c + sparse_msg2_setup_rap.c + sparse_msg3_setup_rap.c + sparse_msg.c + sparse_msg_filter.c + sparse_msg_interp.c + sparse_msg_restrict.c + sparse_msg_setup.c + sparse_msg_setup_rap.c + sparse_msg_solve.c +) + +convert_filenames_to_full_paths(HDRS) +convert_filenames_to_full_paths(SRCS) + +set(HYPRE_HEADERS ${HYPRE_HEADERS} ${HDRS} PARENT_SCOPE) +set(HYPRE_SOURCES ${HYPRE_SOURCES} ${SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/struct_ls/coarsen.c hypre-2.18.2/src/struct_ls/coarsen.c --- hypre-2.16.0/src/struct_ls/coarsen.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/coarsen.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #define TIME_DEBUG 0 diff -Nru hypre-2.16.0/src/struct_ls/cyclic_reduction.c hypre-2.18.2/src/struct_ls/cyclic_reduction.c --- hypre-2.16.0/src/struct_ls/cyclic_reduction.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/cyclic_reduction.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * Cyclic reduction algorithm (coded as if it were a 1D MG method) diff -Nru hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_bicgstab.c hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_bicgstab.c --- hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_bicgstab.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_bicgstab.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "fortran.h" diff -Nru hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_cycred.c hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_cycred.c --- hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_cycred.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_cycred.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "fortran.h" diff -Nru hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_flexgmres.c hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_flexgmres.c --- hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_flexgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_flexgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "fortran.h" diff -Nru hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_gmres.c hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_gmres.c --- hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_gmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_gmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "fortran.h" diff -Nru hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_hybrid.c hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_hybrid.c --- hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_hybrid.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_hybrid.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "fortran.h" diff -Nru hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_int.c hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_int.c --- hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_int.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_int.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "fortran.h" diff -Nru hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_jacobi.c hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_jacobi.c --- hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_jacobi.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_jacobi.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "fortran.h" diff -Nru hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_lgmres.c hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_lgmres.c --- hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_lgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_lgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "fortran.h" diff -Nru hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_pcg.c hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_pcg.c --- hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_pcg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_pcg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "fortran.h" diff -Nru hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_pfmg.c hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_pfmg.c --- hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_pfmg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_pfmg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "fortran.h" diff -Nru hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_smg.c hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_smg.c --- hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_smg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_smg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_sparse_msg.c hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_sparse_msg.c --- hypre-2.16.0/src/struct_ls/F90_HYPRE_struct_sparse_msg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/F90_HYPRE_struct_sparse_msg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "fortran.h" diff -Nru hypre-2.16.0/src/struct_ls/general.c hypre-2.18.2/src/struct_ls/general.c --- hypre-2.16.0/src/struct_ls/general.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/general.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/headers hypre-2.18.2/src/struct_ls/headers --- hypre-2.16.0/src/struct_ls/headers 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/headers 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) INTERNAL_HEADER=_hypre_struct_ls.h diff -Nru hypre-2.16.0/src/struct_ls/hybrid.c hypre-2.18.2/src/struct_ls/hybrid.c --- hypre-2.16.0/src/struct_ls/hybrid.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/hybrid.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" @@ -24,25 +19,27 @@ HYPRE_Real cf_tol; HYPRE_Real pcg_atolf; HYPRE_Int dscg_max_its; - HYPRE_Int pcg_max_its; + HYPRE_Int krylov_max_its; HYPRE_Int two_norm; HYPRE_Int stop_crit; HYPRE_Int rel_change; + HYPRE_Int recompute_residual; + HYPRE_Int recompute_residual_p; HYPRE_Int k_dim; - HYPRE_Int solver_type; + HYPRE_Int solver_type; - HYPRE_Int pcg_default; /* boolean */ - HYPRE_Int (*pcg_precond_solve)(void*, void*, void*, void*); - HYPRE_Int (*pcg_precond_setup)(void*, void*, void*, void*); - void *pcg_precond; + HYPRE_Int krylov_default; /* boolean */ + HYPRE_Int (*krylov_precond_solve)(void*, void*, void*, void*); + HYPRE_Int (*krylov_precond_setup)(void*, void*, void*, void*); + void *krylov_precond; /* log info (always logged) */ HYPRE_Int dscg_num_its; - HYPRE_Int pcg_num_its; + HYPRE_Int krylov_num_its; HYPRE_Real final_rel_res_norm; HYPRE_Int time_index; - HYPRE_Int print_level; + HYPRE_Int print_level; /* additional information (place-holder currently used to print norms) */ HYPRE_Int logging; @@ -67,20 +64,20 @@ (hybrid_data -> cf_tol) = 0.90; (hybrid_data -> pcg_atolf) = 0.0; (hybrid_data -> dscg_max_its) = 1000; - (hybrid_data -> pcg_max_its) = 200; + (hybrid_data -> krylov_max_its) = 200; (hybrid_data -> two_norm) = 0; (hybrid_data -> stop_crit) = 0; (hybrid_data -> rel_change) = 0; (hybrid_data -> solver_type) = 1; (hybrid_data -> k_dim) = 5; - (hybrid_data -> pcg_default) = 1; - (hybrid_data -> pcg_precond_solve) = NULL; - (hybrid_data -> pcg_precond_setup) = NULL; - (hybrid_data -> pcg_precond) = NULL; + (hybrid_data -> krylov_default) = 1; + (hybrid_data -> krylov_precond_solve) = NULL; + (hybrid_data -> krylov_precond_setup) = NULL; + (hybrid_data -> krylov_precond) = NULL; /* initialize */ (hybrid_data -> dscg_num_its) = 0; - (hybrid_data -> pcg_num_its) = 0; + (hybrid_data -> krylov_num_its) = 0; (hybrid_data -> logging) = 0; (hybrid_data -> print_level) = 0; @@ -94,7 +91,7 @@ HYPRE_Int hypre_HybridDestroy( void *hybrid_vdata ) { - hypre_HybridData *hybrid_data = (hypre_HybridData *) hybrid_vdata; + hypre_HybridData *hybrid_data = (hypre_HybridData *) hybrid_vdata; if (hybrid_data) { @@ -109,10 +106,10 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_HybridSetTol( void *hybrid_vdata, +hypre_HybridSetTol( void *hybrid_vdata, HYPRE_Real tol ) { - hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; + hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; (hybrid_data -> tol) = tol; @@ -124,10 +121,10 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_HybridSetConvergenceTol( void *hybrid_vdata, +hypre_HybridSetConvergenceTol( void *hybrid_vdata, HYPRE_Real cf_tol ) { - hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; + hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; (hybrid_data -> cf_tol) = cf_tol; @@ -139,10 +136,10 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_HybridSetDSCGMaxIter( void *hybrid_vdata, - HYPRE_Int dscg_max_its ) +hypre_HybridSetDSCGMaxIter( void *hybrid_vdata, + HYPRE_Int dscg_max_its ) { - hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; + hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; (hybrid_data -> dscg_max_its) = dscg_max_its; @@ -154,12 +151,12 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_HybridSetPCGMaxIter( void *hybrid_vdata, - HYPRE_Int pcg_max_its ) +hypre_HybridSetPCGMaxIter( void *hybrid_vdata, + HYPRE_Int krylov_max_its ) { - hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; + hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; - (hybrid_data -> pcg_max_its) = pcg_max_its; + (hybrid_data -> krylov_max_its) = krylov_max_its; return hypre_error_flag; } @@ -169,10 +166,10 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_HybridSetPCGAbsoluteTolFactor( void *hybrid_vdata, +hypre_HybridSetPCGAbsoluteTolFactor( void *hybrid_vdata, HYPRE_Real pcg_atolf ) { - hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; + hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; (hybrid_data -> pcg_atolf) = pcg_atolf; @@ -184,10 +181,10 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_HybridSetTwoNorm( void *hybrid_vdata, - HYPRE_Int two_norm ) +hypre_HybridSetTwoNorm( void *hybrid_vdata, + HYPRE_Int two_norm ) { - hypre_HybridData *hybrid_data = ( hypre_HybridData *)hybrid_vdata; + hypre_HybridData *hybrid_data = ( hypre_HybridData *)hybrid_vdata; (hybrid_data -> two_norm) = two_norm; @@ -199,10 +196,10 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_HybridSetStopCrit( void *hybrid_vdata, - HYPRE_Int stop_crit ) +hypre_HybridSetStopCrit( void *hybrid_vdata, + HYPRE_Int stop_crit ) { - hypre_HybridData *hybrid_data = ( hypre_HybridData *)hybrid_vdata; + hypre_HybridData *hybrid_data = ( hypre_HybridData *)hybrid_vdata; (hybrid_data -> stop_crit) = stop_crit; @@ -214,10 +211,10 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_HybridSetRelChange( void *hybrid_vdata, - HYPRE_Int rel_change ) +hypre_HybridSetRelChange( void *hybrid_vdata, + HYPRE_Int rel_change ) { - hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; + hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; (hybrid_data -> rel_change) = rel_change; @@ -229,8 +226,8 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_HybridSetSolverType( void *hybrid_vdata, - HYPRE_Int solver_type ) +hypre_HybridSetSolverType( void *hybrid_vdata, + HYPRE_Int solver_type ) { hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; @@ -240,12 +237,64 @@ } /*-------------------------------------------------------------------------- + * hypre_HybridSetRecomputeResidual + *--------------------------------------------------------------------------*/ + +HYPRE_Int +hypre_HybridSetRecomputeResidual( void *hybrid_vdata, + HYPRE_Int recompute_residual ) +{ + hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; + + (hybrid_data -> recompute_residual) = recompute_residual; + + return hypre_error_flag; +} + +HYPRE_Int +hypre_HybridGetRecomputeResidual( void *hybrid_vdata, + HYPRE_Int *recompute_residual ) +{ + hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; + + *recompute_residual = (hybrid_data -> recompute_residual); + + return hypre_error_flag; +} + +/*-------------------------------------------------------------------------- + * hypre_HybridSetRecomputeResidualP + *--------------------------------------------------------------------------*/ + +HYPRE_Int +hypre_HybridSetRecomputeResidualP( void *hybrid_vdata, + HYPRE_Int recompute_residual_p ) +{ + hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; + + (hybrid_data -> recompute_residual_p) = recompute_residual_p; + + return hypre_error_flag; +} + +HYPRE_Int +hypre_HybridGetRecomputeResidualP( void *hybrid_vdata, + HYPRE_Int *recompute_residual_p ) +{ + hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; + + *recompute_residual_p = (hybrid_data -> recompute_residual_p); + + return hypre_error_flag; +} + +/*-------------------------------------------------------------------------- * hypre_HybridSetKDim *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_HybridSetKDim( void *hybrid_vdata, - HYPRE_Int k_dim ) +hypre_HybridSetKDim( void *hybrid_vdata, + HYPRE_Int k_dim ) { hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; @@ -259,17 +308,17 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_HybridSetPrecond( void *pcg_vdata, - HYPRE_Int (*pcg_precond_solve)(void*, void*, void*, void*), - HYPRE_Int (*pcg_precond_setup)(void*, void*, void*, void*), - void *pcg_precond ) +hypre_HybridSetPrecond( void *krylov_vdata, + HYPRE_Int (*krylov_precond_solve)(void*, void*, void*, void*), + HYPRE_Int (*krylov_precond_setup)(void*, void*, void*, void*), + void *krylov_precond ) { - hypre_HybridData *pcg_data = (hypre_HybridData *)pcg_vdata; + hypre_HybridData *krylov_data = (hypre_HybridData *)krylov_vdata; - (pcg_data -> pcg_default) = 0; - (pcg_data -> pcg_precond_solve) = pcg_precond_solve; - (pcg_data -> pcg_precond_setup) = pcg_precond_setup; - (pcg_data -> pcg_precond) = pcg_precond; + (krylov_data -> krylov_default) = 0; + (krylov_data -> krylov_precond_solve) = krylov_precond_solve; + (krylov_data -> krylov_precond_setup) = krylov_precond_setup; + (krylov_data -> krylov_precond) = krylov_precond; return hypre_error_flag; } @@ -279,7 +328,7 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_HybridSetLogging( void *hybrid_vdata, +hypre_HybridSetLogging( void *hybrid_vdata, HYPRE_Int logging ) { hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; @@ -294,8 +343,8 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_HybridSetPrintLevel( void *hybrid_vdata, - HYPRE_Int print_level ) +hypre_HybridSetPrintLevel( void *hybrid_vdata, + HYPRE_Int print_level ) { hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; @@ -309,12 +358,12 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_HybridGetNumIterations( void *hybrid_vdata, - HYPRE_Int *num_its ) +hypre_HybridGetNumIterations( void *hybrid_vdata, + HYPRE_Int *num_its ) { hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; - *num_its = (hybrid_data -> dscg_num_its) + (hybrid_data -> pcg_num_its); + *num_its = (hybrid_data -> dscg_num_its) + (hybrid_data -> krylov_num_its); return hypre_error_flag; } @@ -324,8 +373,8 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_HybridGetDSCGNumIterations( void *hybrid_vdata, - HYPRE_Int *dscg_num_its ) +hypre_HybridGetDSCGNumIterations( void *hybrid_vdata, + HYPRE_Int *dscg_num_its ) { hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; @@ -339,12 +388,12 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_HybridGetPCGNumIterations( void *hybrid_vdata, - HYPRE_Int *pcg_num_its ) +hypre_HybridGetPCGNumIterations( void *hybrid_vdata, + HYPRE_Int *krylov_num_its ) { hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; - *pcg_num_its = (hybrid_data -> pcg_num_its); + *krylov_num_its = (hybrid_data -> krylov_num_its); return hypre_error_flag; } @@ -354,8 +403,8 @@ *--------------------------------------------------------------------------*/ HYPRE_Int -hypre_HybridGetFinalRelativeResidualNorm( void *hybrid_vdata, - HYPRE_Real *final_rel_res_norm ) +hypre_HybridGetFinalRelativeResidualNorm( void *hybrid_vdata, + HYPRE_Real *final_rel_res_norm ) { hypre_HybridData *hybrid_data = (hypre_HybridData *)hybrid_vdata; @@ -388,6 +437,113 @@ * *--------------------------------------------------------------------------*/ +/* Local helper function for creating default PCG solver */ +void * +hypre_HybridSolveUsePCG( hypre_HybridData *hybrid_data ) +{ + void *krylov_solver; + HYPRE_Real tol = (hybrid_data -> tol); + HYPRE_Real pcg_atolf = (hybrid_data -> pcg_atolf); + HYPRE_Int two_norm = (hybrid_data -> two_norm); + HYPRE_Int stop_crit = (hybrid_data -> stop_crit); + HYPRE_Int rel_change = (hybrid_data -> rel_change); + HYPRE_Int recompute_residual = (hybrid_data -> recompute_residual); + HYPRE_Int recompute_residual_p = (hybrid_data -> recompute_residual_p); + HYPRE_Int logging = (hybrid_data -> logging); + HYPRE_Int print_level = (hybrid_data -> print_level); + + hypre_PCGFunctions *pcg_functions = + hypre_PCGFunctionsCreate( + hypre_CAlloc, hypre_StructKrylovFree, + hypre_StructKrylovCommInfo, + hypre_StructKrylovCreateVector, + hypre_StructKrylovDestroyVector, hypre_StructKrylovMatvecCreate, + hypre_StructKrylovMatvec, hypre_StructKrylovMatvecDestroy, + hypre_StructKrylovInnerProd, hypre_StructKrylovCopyVector, + hypre_StructKrylovClearVector, + hypre_StructKrylovScaleVector, hypre_StructKrylovAxpy, + hypre_StructKrylovIdentitySetup, hypre_StructKrylovIdentity ); + krylov_solver = hypre_PCGCreate( pcg_functions ); + + hypre_PCGSetTol(krylov_solver, tol); + hypre_PCGSetAbsoluteTolFactor(krylov_solver, pcg_atolf); + hypre_PCGSetTwoNorm(krylov_solver, two_norm); + hypre_PCGSetStopCrit(krylov_solver, stop_crit); + hypre_PCGSetRelChange(krylov_solver, rel_change); + hypre_PCGSetRecomputeResidual(krylov_solver, recompute_residual); + hypre_PCGSetRecomputeResidualP(krylov_solver, recompute_residual_p); + hypre_PCGSetPrintLevel(krylov_solver, print_level); + hypre_PCGSetLogging(krylov_solver, logging); + + return krylov_solver; +} + +/* Local helper function for setting up GMRES */ +void * +hypre_HybridSolveUseGMRES( hypre_HybridData *hybrid_data ) +{ + void *krylov_solver; + HYPRE_Real tol = (hybrid_data -> tol); + HYPRE_Int stop_crit = (hybrid_data -> stop_crit); + HYPRE_Int rel_change = (hybrid_data -> rel_change); + HYPRE_Int logging = (hybrid_data -> logging); + HYPRE_Int print_level = (hybrid_data -> print_level); + HYPRE_Int k_dim = (hybrid_data -> k_dim); + + hypre_GMRESFunctions *gmres_functions = + hypre_GMRESFunctionsCreate( + hypre_CAlloc, hypre_StructKrylovFree, + hypre_StructKrylovCommInfo, + hypre_StructKrylovCreateVector, + hypre_StructKrylovCreateVectorArray, + hypre_StructKrylovDestroyVector, hypre_StructKrylovMatvecCreate, + hypre_StructKrylovMatvec, hypre_StructKrylovMatvecDestroy, + hypre_StructKrylovInnerProd, hypre_StructKrylovCopyVector, + hypre_StructKrylovClearVector, + hypre_StructKrylovScaleVector, hypre_StructKrylovAxpy, + hypre_StructKrylovIdentitySetup, hypre_StructKrylovIdentity ); + krylov_solver = hypre_GMRESCreate( gmres_functions ); + + hypre_GMRESSetTol(krylov_solver, tol); + hypre_GMRESSetKDim(krylov_solver, k_dim); + hypre_GMRESSetStopCrit(krylov_solver, stop_crit); + hypre_GMRESSetRelChange(krylov_solver, rel_change); + hypre_GMRESSetPrintLevel(krylov_solver, print_level); + hypre_GMRESSetLogging(krylov_solver, logging); + + return krylov_solver; +} + +/* Local helper function for setting up BiCGSTAB */ +void * +hypre_HybridSolveUseBiCGSTAB( hypre_HybridData *hybrid_data ) +{ + void *krylov_solver; + HYPRE_Real tol = (hybrid_data -> tol); + HYPRE_Int stop_crit = (hybrid_data -> stop_crit); + HYPRE_Int logging = (hybrid_data -> logging); + HYPRE_Int print_level = (hybrid_data -> print_level); + + hypre_BiCGSTABFunctions *bicgstab_functions = + hypre_BiCGSTABFunctionsCreate( + hypre_StructKrylovCreateVector, + hypre_StructKrylovDestroyVector, hypre_StructKrylovMatvecCreate, + hypre_StructKrylovMatvec, hypre_StructKrylovMatvecDestroy, + hypre_StructKrylovInnerProd, hypre_StructKrylovCopyVector, + hypre_StructKrylovClearVector, + hypre_StructKrylovScaleVector, hypre_StructKrylovAxpy, + hypre_StructKrylovCommInfo, + hypre_StructKrylovIdentitySetup, hypre_StructKrylovIdentity ); + krylov_solver = hypre_BiCGSTABCreate( bicgstab_functions ); + + hypre_BiCGSTABSetTol(krylov_solver, tol); + hypre_BiCGSTABSetStopCrit(krylov_solver, stop_crit); + hypre_BiCGSTABSetPrintLevel(krylov_solver, print_level); + hypre_BiCGSTABSetLogging(krylov_solver, logging); + + return krylov_solver; +} + HYPRE_Int hypre_HybridSolve( void *hybrid_vdata, hypre_StructMatrix *A, @@ -398,31 +554,20 @@ MPI_Comm comm = (hybrid_data -> comm); - HYPRE_Real tol = (hybrid_data -> tol); HYPRE_Real cf_tol = (hybrid_data -> cf_tol); - HYPRE_Real pcg_atolf = (hybrid_data -> pcg_atolf); HYPRE_Int dscg_max_its = (hybrid_data -> dscg_max_its); - HYPRE_Int pcg_max_its = (hybrid_data -> pcg_max_its); - HYPRE_Int two_norm = (hybrid_data -> two_norm); - HYPRE_Int stop_crit = (hybrid_data -> stop_crit); - HYPRE_Int rel_change = (hybrid_data -> rel_change); + HYPRE_Int krylov_max_its = (hybrid_data -> krylov_max_its); HYPRE_Int logging = (hybrid_data -> logging); - HYPRE_Int print_level = (hybrid_data -> print_level); HYPRE_Int solver_type = (hybrid_data -> solver_type); - HYPRE_Int k_dim = (hybrid_data -> k_dim); - HYPRE_Int pcg_default = (hybrid_data -> pcg_default); - HYPRE_Int (*pcg_precond_solve)(void*, void*, void*, void*); - HYPRE_Int (*pcg_precond_setup)(void*, void*, void*, void*); - void *pcg_precond; - - void *pcg_solver; - hypre_PCGFunctions * pcg_functions; - hypre_GMRESFunctions * gmres_functions; - hypre_BiCGSTABFunctions * bicgstab_functions; + HYPRE_Int krylov_default = (hybrid_data -> krylov_default); + HYPRE_Int (*krylov_precond_solve)(void*, void*, void*, void*); + HYPRE_Int (*krylov_precond_setup)(void*, void*, void*, void*); + void *krylov_precond; + void *krylov_solver; HYPRE_Int dscg_num_its; - HYPRE_Int pcg_num_its; + HYPRE_Int krylov_num_its; HYPRE_Int converged; HYPRE_Real res_norm; @@ -433,49 +578,29 @@ /*-------------------------------------------------------------------- * Setup DSCG. *--------------------------------------------------------------------*/ - pcg_functions = - hypre_PCGFunctionsCreate( - hypre_CAlloc, hypre_StructKrylovFree, - hypre_StructKrylovCommInfo, - hypre_StructKrylovCreateVector, - hypre_StructKrylovDestroyVector, hypre_StructKrylovMatvecCreate, - hypre_StructKrylovMatvec, hypre_StructKrylovMatvecDestroy, - hypre_StructKrylovInnerProd, hypre_StructKrylovCopyVector, - hypre_StructKrylovClearVector, - hypre_StructKrylovScaleVector, hypre_StructKrylovAxpy, - hypre_StructKrylovIdentitySetup, hypre_StructKrylovIdentity ); - pcg_solver = hypre_PCGCreate( pcg_functions ); - - hypre_PCGSetMaxIter(pcg_solver, dscg_max_its); - hypre_PCGSetTol(pcg_solver, tol); - hypre_PCGSetAbsoluteTolFactor(pcg_solver, pcg_atolf); - hypre_PCGSetConvergenceFactorTol(pcg_solver, cf_tol); - hypre_PCGSetTwoNorm(pcg_solver, two_norm); - hypre_PCGSetStopCrit(pcg_solver, stop_crit); - hypre_PCGSetRelChange(pcg_solver, rel_change); - hypre_PCGSetPrintLevel(pcg_solver, print_level); - hypre_PCGSetLogging(pcg_solver, logging); + krylov_solver = hypre_HybridSolveUsePCG(hybrid_data); + hypre_PCGSetMaxIter(krylov_solver, dscg_max_its); + hypre_PCGSetConvergenceFactorTol(krylov_solver, cf_tol); - pcg_precond = NULL; + krylov_precond = NULL; - hypre_PCGSetPrecond((void*) pcg_solver, + hypre_PCGSetPrecond((void*) krylov_solver, (HYPRE_Int (*)(void*, void*, void*, void*)) HYPRE_StructDiagScale, (HYPRE_Int (*)(void*, void*, void*, void*)) HYPRE_StructDiagScaleSetup, - (void*) pcg_precond); - hypre_PCGSetup(pcg_solver, (void*) A, (void*) b, (void*) x); - + (void*) krylov_precond); + hypre_PCGSetup(krylov_solver, (void*) A, (void*) b, (void*) x); /*-------------------------------------------------------------------- * Solve with DSCG. *--------------------------------------------------------------------*/ - hypre_PCGSolve(pcg_solver, (void*) A, (void*) b, (void*) x); + hypre_PCGSolve(krylov_solver, (void*) A, (void*) b, (void*) x); /*-------------------------------------------------------------------- * Get information for DSCG. *--------------------------------------------------------------------*/ - hypre_PCGGetNumIterations(pcg_solver, &dscg_num_its); + hypre_PCGGetNumIterations(krylov_solver, &dscg_num_its); (hybrid_data -> dscg_num_its) = dscg_num_its; - hypre_PCGGetFinalRelativeResidualNorm(pcg_solver, &res_norm); + hypre_PCGGetFinalRelativeResidualNorm(krylov_solver, &res_norm); /*-------------------------------------------------------------------- * Get additional information from PCG if logging on for hybrid solver. @@ -484,68 +609,47 @@ if( logging > 1 ) { hypre_MPI_Comm_rank(comm, &myid ); - hypre_PCGPrintLogging(pcg_solver, myid); + hypre_PCGPrintLogging(krylov_solver, myid); } /*-------------------------------------------------------------------- * check if converged. *--------------------------------------------------------------------*/ - hypre_PCGGetConverged(pcg_solver, &converged); + hypre_PCGGetConverged(krylov_solver, &converged); } else if (solver_type == 2) { /*-------------------------------------------------------------------- * Setup GMRES *--------------------------------------------------------------------*/ - gmres_functions = - hypre_GMRESFunctionsCreate( - hypre_CAlloc, hypre_StructKrylovFree, - hypre_StructKrylovCommInfo, - hypre_StructKrylovCreateVector, - hypre_StructKrylovCreateVectorArray, - hypre_StructKrylovDestroyVector, hypre_StructKrylovMatvecCreate, - hypre_StructKrylovMatvec, hypre_StructKrylovMatvecDestroy, - hypre_StructKrylovInnerProd, hypre_StructKrylovCopyVector, - hypre_StructKrylovClearVector, - hypre_StructKrylovScaleVector, hypre_StructKrylovAxpy, - hypre_StructKrylovIdentitySetup, hypre_StructKrylovIdentity ); - pcg_solver = hypre_GMRESCreate( gmres_functions ); - - hypre_GMRESSetMaxIter(pcg_solver, dscg_max_its); - hypre_GMRESSetTol(pcg_solver, tol); - hypre_GMRESSetKDim(pcg_solver, k_dim); - hypre_GMRESSetConvergenceFactorTol(pcg_solver, cf_tol); - hypre_GMRESSetStopCrit(pcg_solver, stop_crit); - hypre_GMRESSetRelChange(pcg_solver, rel_change); - hypre_GMRESSetPrintLevel(pcg_solver, print_level); - hypre_GMRESSetPrintLevel(pcg_solver, print_level); - hypre_GMRESSetLogging(pcg_solver, logging); + krylov_solver = hypre_HybridSolveUseGMRES(hybrid_data); + hypre_GMRESSetMaxIter(krylov_solver, dscg_max_its); + hypre_GMRESSetConvergenceFactorTol(krylov_solver, cf_tol); - pcg_precond = NULL; + krylov_precond = NULL; - hypre_GMRESSetPrecond((void*) pcg_solver, + hypre_GMRESSetPrecond((void*) krylov_solver, (HYPRE_Int (*)(void*, void*, void*, void*))HYPRE_StructDiagScale, (HYPRE_Int (*)(void*, void*, void*, void*))HYPRE_StructDiagScaleSetup, - (void*) pcg_precond); - hypre_GMRESSetup(pcg_solver, (void*) A, (void*) b, (void*) x); - + (void*) krylov_precond); + hypre_GMRESSetup(krylov_solver, (void*) A, (void*) b, (void*) x); /*-------------------------------------------------------------------- * Solve with GMRES *--------------------------------------------------------------------*/ - hypre_GMRESSolve(pcg_solver, (void*) A, (void*) b, (void*) x); + hypre_GMRESSolve(krylov_solver, (void*) A, (void*) b, (void*) x); /*-------------------------------------------------------------------- * Get information for GMRES *--------------------------------------------------------------------*/ - hypre_GMRESGetNumIterations(pcg_solver, &dscg_num_its); + hypre_GMRESGetNumIterations(krylov_solver, &dscg_num_its); (hybrid_data -> dscg_num_its) = dscg_num_its; - hypre_GMRESGetFinalRelativeResidualNorm(pcg_solver, &res_norm); + hypre_GMRESGetFinalRelativeResidualNorm(krylov_solver, &res_norm); /*-------------------------------------------------------------------- * check if converged. *--------------------------------------------------------------------*/ - hypre_GMRESGetConverged(pcg_solver, &converged); + hypre_GMRESGetConverged(krylov_solver, &converged); } else @@ -553,53 +657,36 @@ /*-------------------------------------------------------------------- * Setup BiCGSTAB *--------------------------------------------------------------------*/ - bicgstab_functions = - hypre_BiCGSTABFunctionsCreate( - hypre_StructKrylovCreateVector, - hypre_StructKrylovDestroyVector, hypre_StructKrylovMatvecCreate, - hypre_StructKrylovMatvec, hypre_StructKrylovMatvecDestroy, - hypre_StructKrylovInnerProd, hypre_StructKrylovCopyVector, - hypre_StructKrylovClearVector, - hypre_StructKrylovScaleVector, hypre_StructKrylovAxpy, - hypre_StructKrylovCommInfo, - hypre_StructKrylovIdentitySetup, hypre_StructKrylovIdentity ); - pcg_solver = hypre_BiCGSTABCreate( bicgstab_functions ); - - hypre_BiCGSTABSetMaxIter(pcg_solver, dscg_max_its); - hypre_BiCGSTABSetTol(pcg_solver, tol); - hypre_BiCGSTABSetConvergenceFactorTol(pcg_solver, cf_tol); - hypre_BiCGSTABSetStopCrit(pcg_solver, stop_crit); - hypre_BiCGSTABSetPrintLevel(pcg_solver, print_level); - hypre_BiCGSTABSetLogging(pcg_solver, logging); + krylov_solver = hypre_HybridSolveUseBiCGSTAB(hybrid_data); + hypre_BiCGSTABSetMaxIter(krylov_solver, dscg_max_its); + hypre_BiCGSTABSetConvergenceFactorTol(krylov_solver, cf_tol); - pcg_precond = NULL; + krylov_precond = NULL; - hypre_BiCGSTABSetPrecond((void*) pcg_solver, + hypre_BiCGSTABSetPrecond((void*) krylov_solver, (HYPRE_Int (*)(void*, void*, void*, void*)) HYPRE_StructDiagScale, (HYPRE_Int (*)(void*, void*, void*, void*)) HYPRE_StructDiagScaleSetup, - (void*) pcg_precond); - hypre_BiCGSTABSetup(pcg_solver, (void*) A, (void*) b, (void*) x); - + (void*) krylov_precond); + hypre_BiCGSTABSetup(krylov_solver, (void*) A, (void*) b, (void*) x); /*-------------------------------------------------------------------- * Solve with BiCGSTAB *--------------------------------------------------------------------*/ - hypre_BiCGSTABSolve(pcg_solver, (void*) A, (void*) b, (void*) x); + hypre_BiCGSTABSolve(krylov_solver, (void*) A, (void*) b, (void*) x); /*-------------------------------------------------------------------- * Get information for BiCGSTAB *--------------------------------------------------------------------*/ - hypre_BiCGSTABGetNumIterations(pcg_solver, &dscg_num_its); + hypre_BiCGSTABGetNumIterations(krylov_solver, &dscg_num_its); (hybrid_data -> dscg_num_its) = dscg_num_its; - hypre_BiCGSTABGetFinalRelativeResidualNorm(pcg_solver, &res_norm); + hypre_BiCGSTABGetFinalRelativeResidualNorm(krylov_solver, &res_norm); /*-------------------------------------------------------------------- * check if converged. *--------------------------------------------------------------------*/ - hypre_BiCGSTABGetConverged(pcg_solver, &converged); + hypre_BiCGSTABGetConverged(krylov_solver, &converged); } - /*----------------------------------------------------------------------- * if converged, done... *-----------------------------------------------------------------------*/ @@ -607,15 +694,15 @@ { (hybrid_data -> final_rel_res_norm) = res_norm; if (solver_type == 1) - hypre_PCGDestroy(pcg_solver); + hypre_PCGDestroy(krylov_solver); else if (solver_type == 2) - hypre_GMRESDestroy(pcg_solver); + hypre_GMRESDestroy(krylov_solver); else - hypre_BiCGSTABDestroy(pcg_solver); + hypre_BiCGSTABDestroy(krylov_solver); } /*----------------------------------------------------------------------- - * ... otherwise, use SMG+solver + * ... otherwise, use solver+precond *-----------------------------------------------------------------------*/ else { @@ -624,116 +711,64 @@ *--------------------------------------------------------------------*/ if (solver_type == 1) { - hypre_PCGDestroy(pcg_solver); + hypre_PCGDestroy(krylov_solver); - pcg_functions = - hypre_PCGFunctionsCreate( - hypre_CAlloc, hypre_StructKrylovFree, - hypre_StructKrylovCommInfo, - hypre_StructKrylovCreateVector, - hypre_StructKrylovDestroyVector, hypre_StructKrylovMatvecCreate, - hypre_StructKrylovMatvec, hypre_StructKrylovMatvecDestroy, - hypre_StructKrylovInnerProd, hypre_StructKrylovCopyVector, - hypre_StructKrylovClearVector, - hypre_StructKrylovScaleVector, hypre_StructKrylovAxpy, - hypre_StructKrylovIdentitySetup, hypre_StructKrylovIdentity ); - pcg_solver = hypre_PCGCreate( pcg_functions ); - - hypre_PCGSetMaxIter(pcg_solver, pcg_max_its); - hypre_PCGSetTol(pcg_solver, tol); - hypre_PCGSetAbsoluteTolFactor(pcg_solver, pcg_atolf); - hypre_PCGSetTwoNorm(pcg_solver, two_norm); - hypre_PCGSetStopCrit(pcg_solver, stop_crit); - hypre_PCGSetRelChange(pcg_solver, rel_change); - hypre_PCGSetPrintLevel(pcg_solver, print_level); - hypre_PCGSetLogging(pcg_solver, logging); + krylov_solver = hypre_HybridSolveUsePCG(hybrid_data); + hypre_PCGSetMaxIter(krylov_solver, krylov_max_its); + hypre_PCGSetConvergenceFactorTol(krylov_solver, 0.0); } else if (solver_type == 2) { - hypre_GMRESDestroy(pcg_solver); + hypre_GMRESDestroy(krylov_solver); - gmres_functions = - hypre_GMRESFunctionsCreate( - hypre_CAlloc, hypre_StructKrylovFree, - hypre_StructKrylovCommInfo, - hypre_StructKrylovCreateVector, - hypre_StructKrylovCreateVectorArray, - hypre_StructKrylovDestroyVector, hypre_StructKrylovMatvecCreate, - hypre_StructKrylovMatvec, hypre_StructKrylovMatvecDestroy, - hypre_StructKrylovInnerProd, hypre_StructKrylovCopyVector, - hypre_StructKrylovClearVector, - hypre_StructKrylovScaleVector, hypre_StructKrylovAxpy, - hypre_StructKrylovIdentitySetup, hypre_StructKrylovIdentity ); - pcg_solver = hypre_GMRESCreate( gmres_functions ); - - hypre_GMRESSetMaxIter(pcg_solver, pcg_max_its); - hypre_GMRESSetTol(pcg_solver, tol); - hypre_GMRESSetKDim(pcg_solver, k_dim); - hypre_GMRESSetStopCrit(pcg_solver, stop_crit); - hypre_GMRESSetRelChange(pcg_solver, rel_change); - hypre_GMRESSetPrintLevel(pcg_solver, print_level); - hypre_GMRESSetLogging(pcg_solver, logging); - hypre_GMRESSetConvergenceFactorTol(pcg_solver, 0.0); + krylov_solver = hypre_HybridSolveUseGMRES(hybrid_data); + hypre_GMRESSetMaxIter(krylov_solver, krylov_max_its); + hypre_GMRESSetConvergenceFactorTol(krylov_solver, 0.0); } else { - hypre_BiCGSTABDestroy(pcg_solver); + hypre_BiCGSTABDestroy(krylov_solver); - bicgstab_functions = - hypre_BiCGSTABFunctionsCreate( - hypre_StructKrylovCreateVector, - hypre_StructKrylovDestroyVector, hypre_StructKrylovMatvecCreate, - hypre_StructKrylovMatvec, hypre_StructKrylovMatvecDestroy, - hypre_StructKrylovInnerProd, hypre_StructKrylovCopyVector, - hypre_StructKrylovClearVector, - hypre_StructKrylovScaleVector, hypre_StructKrylovAxpy, - hypre_StructKrylovCommInfo, - hypre_StructKrylovIdentitySetup, hypre_StructKrylovIdentity ); - pcg_solver = hypre_BiCGSTABCreate( bicgstab_functions ); - - hypre_BiCGSTABSetMaxIter(pcg_solver, pcg_max_its); - hypre_BiCGSTABSetTol(pcg_solver, tol); - hypre_BiCGSTABSetStopCrit(pcg_solver, stop_crit); - hypre_BiCGSTABSetPrintLevel(pcg_solver, print_level); - hypre_BiCGSTABSetLogging(pcg_solver, logging); - hypre_BiCGSTABSetConvergenceFactorTol(pcg_solver, 0.0); + krylov_solver = hypre_HybridSolveUseBiCGSTAB(hybrid_data); + hypre_BiCGSTABSetMaxIter(krylov_solver, krylov_max_its); + hypre_BiCGSTABSetConvergenceFactorTol(krylov_solver, 0.0); } /* Setup preconditioner */ - if (pcg_default) + if (krylov_default) { - pcg_precond = hypre_SMGCreate(comm); - hypre_SMGSetMaxIter(pcg_precond, 1); - hypre_SMGSetTol(pcg_precond, 0.0); - hypre_SMGSetNumPreRelax(pcg_precond, 1); - hypre_SMGSetNumPostRelax(pcg_precond, 1); - hypre_SMGSetLogging(pcg_precond, 0); - pcg_precond_solve = (HYPRE_Int (*)(void*, void*, void*, void*))hypre_SMGSolve; - pcg_precond_setup = (HYPRE_Int (*)(void*, void*, void*, void*))hypre_SMGSetup; + krylov_precond = hypre_SMGCreate(comm); + hypre_SMGSetMaxIter(krylov_precond, 1); + hypre_SMGSetTol(krylov_precond, 0.0); + hypre_SMGSetNumPreRelax(krylov_precond, 1); + hypre_SMGSetNumPostRelax(krylov_precond, 1); + hypre_SMGSetLogging(krylov_precond, 0); + krylov_precond_solve = (HYPRE_Int (*)(void*, void*, void*, void*))hypre_SMGSolve; + krylov_precond_setup = (HYPRE_Int (*)(void*, void*, void*, void*))hypre_SMGSetup; } else { - pcg_precond = (hybrid_data -> pcg_precond); - pcg_precond_solve = (hybrid_data -> pcg_precond_solve); - pcg_precond_setup = (hybrid_data -> pcg_precond_setup); + krylov_precond = (hybrid_data -> krylov_precond); + krylov_precond_solve = (hybrid_data -> krylov_precond_solve); + krylov_precond_setup = (hybrid_data -> krylov_precond_setup); } - /* Complete setup of solver+SMG */ + /* Complete setup of solver+precond */ if (solver_type == 1) { - hypre_PCGSetPrecond((void*) pcg_solver, - (HYPRE_Int (*)(void*, void*, void*, void*)) pcg_precond_solve, - (HYPRE_Int (*)(void*, void*, void*, void*)) pcg_precond_setup, - (void*) pcg_precond); - hypre_PCGSetup(pcg_solver, (void*) A, (void*) b, (void*) x); + hypre_PCGSetPrecond((void*) krylov_solver, + (HYPRE_Int (*)(void*, void*, void*, void*)) krylov_precond_solve, + (HYPRE_Int (*)(void*, void*, void*, void*)) krylov_precond_setup, + (void*) krylov_precond); + hypre_PCGSetup(krylov_solver, (void*) A, (void*) b, (void*) x); /* Solve */ - hypre_PCGSolve(pcg_solver, (void*) A, (void*) b, (void*) x); + hypre_PCGSolve(krylov_solver, (void*) A, (void*) b, (void*) x); /* Get information from PCG that is always logged in hybrid solver*/ - hypre_PCGGetNumIterations(pcg_solver, &pcg_num_its); - (hybrid_data -> pcg_num_its) = pcg_num_its; - hypre_PCGGetFinalRelativeResidualNorm(pcg_solver, &res_norm); + hypre_PCGGetNumIterations(krylov_solver, &krylov_num_its); + (hybrid_data -> krylov_num_its) = krylov_num_its; + hypre_PCGGetFinalRelativeResidualNorm(krylov_solver, &res_norm); (hybrid_data -> final_rel_res_norm) = res_norm; /*----------------------------------------------------------------- @@ -743,52 +778,52 @@ if( logging > 1 ) { hypre_MPI_Comm_rank(comm, &myid ); - hypre_PCGPrintLogging(pcg_solver, myid); + hypre_PCGPrintLogging(krylov_solver, myid); } /* Free PCG and preconditioner */ - hypre_PCGDestroy(pcg_solver); + hypre_PCGDestroy(krylov_solver); } else if (solver_type == 2) { - hypre_GMRESSetPrecond(pcg_solver, - pcg_precond_solve, pcg_precond_setup, pcg_precond); - hypre_GMRESSetup(pcg_solver, (void*) A, (void*) b, (void*) x); + hypre_GMRESSetPrecond(krylov_solver, + krylov_precond_solve, krylov_precond_setup, krylov_precond); + hypre_GMRESSetup(krylov_solver, (void*) A, (void*) b, (void*) x); /* Solve */ - hypre_GMRESSolve(pcg_solver, (void*) A, (void*) b, (void*) x); + hypre_GMRESSolve(krylov_solver, (void*) A, (void*) b, (void*) x); /* Get information from GMRES that is always logged in hybrid solver*/ - hypre_GMRESGetNumIterations(pcg_solver, &pcg_num_its); - (hybrid_data -> pcg_num_its) = pcg_num_its; - hypre_GMRESGetFinalRelativeResidualNorm(pcg_solver, &res_norm); + hypre_GMRESGetNumIterations(krylov_solver, &krylov_num_its); + (hybrid_data -> krylov_num_its) = krylov_num_its; + hypre_GMRESGetFinalRelativeResidualNorm(krylov_solver, &res_norm); (hybrid_data -> final_rel_res_norm) = res_norm; /* Free GMRES and preconditioner */ - hypre_GMRESDestroy(pcg_solver); + hypre_GMRESDestroy(krylov_solver); } else { - hypre_BiCGSTABSetPrecond(pcg_solver, pcg_precond_solve, - pcg_precond_setup, pcg_precond); - hypre_BiCGSTABSetup(pcg_solver, (void*) A, (void*) b, (void*) x); + hypre_BiCGSTABSetPrecond(krylov_solver, krylov_precond_solve, + krylov_precond_setup, krylov_precond); + hypre_BiCGSTABSetup(krylov_solver, (void*) A, (void*) b, (void*) x); /* Solve */ - hypre_BiCGSTABSolve(pcg_solver, (void*) A, (void*) b, (void*) x); + hypre_BiCGSTABSolve(krylov_solver, (void*) A, (void*) b, (void*) x); /* Get information from BiCGSTAB that is always logged in hybrid solver*/ - hypre_BiCGSTABGetNumIterations(pcg_solver, &pcg_num_its); - (hybrid_data -> pcg_num_its) = pcg_num_its; - hypre_BiCGSTABGetFinalRelativeResidualNorm(pcg_solver, &res_norm); + hypre_BiCGSTABGetNumIterations(krylov_solver, &krylov_num_its); + (hybrid_data -> krylov_num_its) = krylov_num_its; + hypre_BiCGSTABGetFinalRelativeResidualNorm(krylov_solver, &res_norm); (hybrid_data -> final_rel_res_norm) = res_norm; /* Free BiCGSTAB and preconditioner */ - hypre_BiCGSTABDestroy(pcg_solver); + hypre_BiCGSTABDestroy(krylov_solver); } - if (pcg_default) + if (krylov_default) { - hypre_SMGDestroy(pcg_precond); + hypre_SMGDestroy(krylov_precond); } } diff -Nru hypre-2.16.0/src/struct_ls/HYPRE_struct_bicgstab.c hypre-2.18.2/src/struct_ls/HYPRE_struct_bicgstab.c --- hypre-2.16.0/src/struct_ls/HYPRE_struct_bicgstab.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/HYPRE_struct_bicgstab.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/HYPRE_struct_cycred.c hypre-2.18.2/src/struct_ls/HYPRE_struct_cycred.c --- hypre-2.16.0/src/struct_ls/HYPRE_struct_cycred.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/HYPRE_struct_cycred.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2015, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/HYPRE_struct_flexgmres.c hypre-2.18.2/src/struct_ls/HYPRE_struct_flexgmres.c --- hypre-2.16.0/src/struct_ls/HYPRE_struct_flexgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/HYPRE_struct_flexgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/HYPRE_struct_gmres.c hypre-2.18.2/src/struct_ls/HYPRE_struct_gmres.c --- hypre-2.16.0/src/struct_ls/HYPRE_struct_gmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/HYPRE_struct_gmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/HYPRE_struct_hybrid.c hypre-2.18.2/src/struct_ls/HYPRE_struct_hybrid.c --- hypre-2.16.0/src/struct_ls/HYPRE_struct_hybrid.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/HYPRE_struct_hybrid.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" @@ -153,6 +148,40 @@ } /*-------------------------------------------------------------------------- + *--------------------------------------------------------------------------*/ + +HYPRE_Int +HYPRE_StructHybridSetRecomputeResidual( HYPRE_StructSolver solver, + HYPRE_Int recompute_residual ) +{ + return( hypre_HybridSetRecomputeResidual( (void *) solver, recompute_residual ) ); +} + +HYPRE_Int +HYPRE_StructHybridGetRecomputeResidual( HYPRE_StructSolver solver, + HYPRE_Int *recompute_residual ) +{ + return( hypre_HybridGetRecomputeResidual( (void *) solver, recompute_residual ) ); +} + +/*-------------------------------------------------------------------------- + *--------------------------------------------------------------------------*/ + +HYPRE_Int +HYPRE_StructHybridSetRecomputeResidualP( HYPRE_StructSolver solver, + HYPRE_Int recompute_residual_p ) +{ + return( hypre_HybridSetRecomputeResidualP( (void *) solver, recompute_residual_p ) ); +} + +HYPRE_Int +HYPRE_StructHybridGetRecomputeResidualP( HYPRE_StructSolver solver, + HYPRE_Int *recompute_residual_p ) +{ + return( hypre_HybridGetRecomputeResidualP( (void *) solver, recompute_residual_p ) ); +} + +/*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ HYPRE_Int diff -Nru hypre-2.16.0/src/struct_ls/HYPRE_struct_int.c hypre-2.18.2/src/struct_ls/HYPRE_struct_int.c --- hypre-2.16.0/src/struct_ls/HYPRE_struct_int.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/HYPRE_struct_int.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "temp_multivector.h" diff -Nru hypre-2.16.0/src/struct_ls/HYPRE_struct_jacobi.c hypre-2.18.2/src/struct_ls/HYPRE_struct_jacobi.c --- hypre-2.16.0/src/struct_ls/HYPRE_struct_jacobi.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/HYPRE_struct_jacobi.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/HYPRE_struct_lgmres.c hypre-2.18.2/src/struct_ls/HYPRE_struct_lgmres.c --- hypre-2.16.0/src/struct_ls/HYPRE_struct_lgmres.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/HYPRE_struct_lgmres.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/_hypre_struct_ls.h hypre-2.18.2/src/struct_ls/_hypre_struct_ls.h --- hypre-2.16.0/src/struct_ls/_hypre_struct_ls.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/_hypre_struct_ls.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_STRUCT_LS_HEADER #define hypre_STRUCT_LS_HEADER @@ -63,6 +58,10 @@ HYPRE_Int hypre_HybridSetStopCrit ( void *hybrid_vdata , HYPRE_Int stop_crit ); HYPRE_Int hypre_HybridSetRelChange ( void *hybrid_vdata , HYPRE_Int rel_change ); HYPRE_Int hypre_HybridSetSolverType ( void *hybrid_vdata , HYPRE_Int solver_type ); +HYPRE_Int hypre_HybridSetRecomputeResidual( void *hybrid_vdata , HYPRE_Int recompute_residual ); +HYPRE_Int hypre_HybridGetRecomputeResidual( void *hybrid_vdata , HYPRE_Int *recompute_residual ); +HYPRE_Int hypre_HybridSetRecomputeResidualP( void *hybrid_vdata , HYPRE_Int recompute_residual_p ); +HYPRE_Int hypre_HybridGetRecomputeResidualP( void *hybrid_vdata , HYPRE_Int *recompute_residual_p ); HYPRE_Int hypre_HybridSetKDim ( void *hybrid_vdata , HYPRE_Int k_dim ); HYPRE_Int hypre_HybridSetPrecond ( void *pcg_vdata , HYPRE_Int (*pcg_precond_solve )(void*, void*, void*, void*), HYPRE_Int (*pcg_precond_setup )(void*, void*, void*, void*), void *pcg_precond ); HYPRE_Int hypre_HybridSetLogging ( void *hybrid_vdata , HYPRE_Int logging ); diff -Nru hypre-2.16.0/src/struct_ls/HYPRE_struct_ls.h hypre-2.18.2/src/struct_ls/HYPRE_struct_ls.h --- hypre-2.16.0/src/struct_ls/HYPRE_struct_ls.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/HYPRE_struct_ls.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef HYPRE_STRUCT_LS_HEADER #define HYPRE_STRUCT_LS_HEADER @@ -954,7 +948,37 @@ * \end{tabular} **/ HYPRE_Int HYPRE_StructHybridSetSolverType(HYPRE_StructSolver solver, - HYPRE_Int solver_type); + HYPRE_Int solver_type); + +/** + * (Optional) Set recompute residual (don't rely on 3-term recurrence). + **/ +HYPRE_Int +HYPRE_StructHybridSetRecomputeResidual( HYPRE_StructSolver solver, + HYPRE_Int recompute_residual ); + +/** + * (Optional) Get recompute residual option. + **/ +HYPRE_Int +HYPRE_StructHybridGetRecomputeResidual( HYPRE_StructSolver solver, + HYPRE_Int *recompute_residual ); + +/** + * (Optional) Set recompute residual period (don't rely on 3-term recurrence). + * + * Recomputes residual after every specified number of iterations. + **/ +HYPRE_Int +HYPRE_StructHybridSetRecomputeResidualP( HYPRE_StructSolver solver, + HYPRE_Int recompute_residual_p ); + +/** + * (Optional) Get recompute residual period option. + **/ +HYPRE_Int +HYPRE_StructHybridGetRecomputeResidualP( HYPRE_StructSolver solver, + HYPRE_Int *recompute_residual_p ); /** * (Optional) Set the maximum size of the Krylov space when using GMRES. diff -Nru hypre-2.16.0/src/struct_ls/HYPRE_struct_pcg.c hypre-2.18.2/src/struct_ls/HYPRE_struct_pcg.c --- hypre-2.16.0/src/struct_ls/HYPRE_struct_pcg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/HYPRE_struct_pcg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/HYPRE_struct_pfmg.c hypre-2.18.2/src/struct_ls/HYPRE_struct_pfmg.c --- hypre-2.16.0/src/struct_ls/HYPRE_struct_pfmg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/HYPRE_struct_pfmg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/HYPRE_struct_smg.c hypre-2.18.2/src/struct_ls/HYPRE_struct_smg.c --- hypre-2.16.0/src/struct_ls/HYPRE_struct_smg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/HYPRE_struct_smg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/HYPRE_struct_sparse_msg.c hypre-2.18.2/src/struct_ls/HYPRE_struct_sparse_msg.c --- hypre-2.16.0/src/struct_ls/HYPRE_struct_sparse_msg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/HYPRE_struct_sparse_msg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_ls/jacobi.c hypre-2.18.2/src/struct_ls/jacobi.c --- hypre-2.16.0/src/struct_ls/jacobi.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/jacobi.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/Makefile hypre-2.18.2/src/struct_ls/Makefile --- hypre-2.16.0/src/struct_ls/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config diff -Nru hypre-2.16.0/src/struct_ls/pcg_struct.c hypre-2.18.2/src/struct_ls/pcg_struct.c --- hypre-2.16.0/src/struct_ls/pcg_struct.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/pcg_struct.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/pfmg2_setup_rap.c hypre-2.18.2/src/struct_ls/pfmg2_setup_rap.c --- hypre-2.16.0/src/struct_ls/pfmg2_setup_rap.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/pfmg2_setup_rap.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "pfmg.h" diff -Nru hypre-2.16.0/src/struct_ls/pfmg3_setup_rap.c hypre-2.18.2/src/struct_ls/pfmg3_setup_rap.c --- hypre-2.16.0/src/struct_ls/pfmg3_setup_rap.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/pfmg3_setup_rap.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "pfmg.h" diff -Nru hypre-2.16.0/src/struct_ls/pfmg.c hypre-2.18.2/src/struct_ls/pfmg.c --- hypre-2.16.0/src/struct_ls/pfmg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/pfmg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "pfmg.h" diff -Nru hypre-2.16.0/src/struct_ls/pfmg.h hypre-2.18.2/src/struct_ls/pfmg.h --- hypre-2.16.0/src/struct_ls/pfmg.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/pfmg.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_ls/pfmg_relax.c hypre-2.18.2/src/struct_ls/pfmg_relax.c --- hypre-2.16.0/src/struct_ls/pfmg_relax.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/pfmg_relax.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/pfmg_setup.c hypre-2.18.2/src/struct_ls/pfmg_setup.c --- hypre-2.16.0/src/struct_ls/pfmg_setup.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/pfmg_setup.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "pfmg.h" diff -Nru hypre-2.16.0/src/struct_ls/pfmg_setup_interp.c hypre-2.18.2/src/struct_ls/pfmg_setup_interp.c --- hypre-2.16.0/src/struct_ls/pfmg_setup_interp.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/pfmg_setup_interp.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "pfmg.h" diff -Nru hypre-2.16.0/src/struct_ls/pfmg_setup_rap5.c hypre-2.18.2/src/struct_ls/pfmg_setup_rap5.c --- hypre-2.16.0/src/struct_ls/pfmg_setup_rap5.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/pfmg_setup_rap5.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "pfmg.h" diff -Nru hypre-2.16.0/src/struct_ls/pfmg_setup_rap7.c hypre-2.18.2/src/struct_ls/pfmg_setup_rap7.c --- hypre-2.16.0/src/struct_ls/pfmg_setup_rap7.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/pfmg_setup_rap7.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "pfmg.h" diff -Nru hypre-2.16.0/src/struct_ls/pfmg_setup_rap.c hypre-2.18.2/src/struct_ls/pfmg_setup_rap.c --- hypre-2.16.0/src/struct_ls/pfmg_setup_rap.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/pfmg_setup_rap.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "pfmg.h" diff -Nru hypre-2.16.0/src/struct_ls/pfmg_solve.c hypre-2.18.2/src/struct_ls/pfmg_solve.c --- hypre-2.16.0/src/struct_ls/pfmg_solve.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/pfmg_solve.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "pfmg.h" diff -Nru hypre-2.16.0/src/struct_ls/point_relax.c hypre-2.18.2/src/struct_ls/point_relax.c --- hypre-2.16.0/src/struct_ls/point_relax.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/point_relax.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/red_black_constantcoef_gs.c hypre-2.18.2/src/struct_ls/red_black_constantcoef_gs.c --- hypre-2.16.0/src/struct_ls/red_black_constantcoef_gs.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/red_black_constantcoef_gs.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "red_black_gs.h" diff -Nru hypre-2.16.0/src/struct_ls/red_black_gs.c hypre-2.18.2/src/struct_ls/red_black_gs.c --- hypre-2.16.0/src/struct_ls/red_black_gs.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/red_black_gs.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_ls/red_black_gs.h hypre-2.18.2/src/struct_ls/red_black_gs.h --- hypre-2.16.0/src/struct_ls/red_black_gs.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/red_black_gs.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*-------------------------------------------------------------------------- * hypre_RedBlackGSData data structure @@ -307,9 +299,9 @@ #ifdef HYPRE_USING_OPENMP #define HYPRE_BOX_REDUCTION #ifdef WIN32 -#define Pragma(x) __pragma(#x) +#define Pragma(x) __pragma(HYPRE_XSTR(x)) #else -#define Pragma(x) _Pragma(#x) +#define Pragma(x) _Pragma(HYPRE_XSTR(x)) #endif #define OMPRB1 Pragma(omp parallel for private(HYPRE_REDBLACK_PRIVATE) HYPRE_BOX_REDUCTION HYPRE_SMP_SCHEDULE) #else diff -Nru hypre-2.16.0/src/struct_ls/semi.c hypre-2.18.2/src/struct_ls/semi.c --- hypre-2.16.0/src/struct_ls/semi.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/semi.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/semi_interp.c hypre-2.18.2/src/struct_ls/semi_interp.c --- hypre-2.16.0/src/struct_ls/semi_interp.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/semi_interp.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/semi_restrict.c hypre-2.18.2/src/struct_ls/semi_restrict.c --- hypre-2.16.0/src/struct_ls/semi_restrict.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/semi_restrict.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/semi_setup_rap.c hypre-2.18.2/src/struct_ls/semi_setup_rap.c --- hypre-2.16.0/src/struct_ls/semi_setup_rap.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/semi_setup_rap.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "pfmg.h" diff -Nru hypre-2.16.0/src/struct_ls/smg2_setup_rap.c hypre-2.18.2/src/struct_ls/smg2_setup_rap.c --- hypre-2.16.0/src/struct_ls/smg2_setup_rap.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/smg2_setup_rap.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "smg.h" diff -Nru hypre-2.16.0/src/struct_ls/smg3_setup_rap.c hypre-2.18.2/src/struct_ls/smg3_setup_rap.c --- hypre-2.16.0/src/struct_ls/smg3_setup_rap.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/smg3_setup_rap.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "smg.h" diff -Nru hypre-2.16.0/src/struct_ls/smg_axpy.c hypre-2.18.2/src/struct_ls/smg_axpy.c --- hypre-2.16.0/src/struct_ls/smg_axpy.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/smg_axpy.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/smg.c hypre-2.18.2/src/struct_ls/smg.c --- hypre-2.16.0/src/struct_ls/smg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/smg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "smg.h" diff -Nru hypre-2.16.0/src/struct_ls/smg.h hypre-2.18.2/src/struct_ls/smg.h --- hypre-2.16.0/src/struct_ls/smg.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/smg.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_ls/smg_relax.c hypre-2.18.2/src/struct_ls/smg_relax.c --- hypre-2.16.0/src/struct_ls/smg_relax.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/smg_relax.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/smg_residual.c hypre-2.18.2/src/struct_ls/smg_residual.c --- hypre-2.16.0/src/struct_ls/smg_residual.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/smg_residual.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/smg_residual_unrolled.c hypre-2.18.2/src/struct_ls/smg_residual_unrolled.c --- hypre-2.16.0/src/struct_ls/smg_residual_unrolled.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/smg_residual_unrolled.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/smg_setup.c hypre-2.18.2/src/struct_ls/smg_setup.c --- hypre-2.16.0/src/struct_ls/smg_setup.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/smg_setup.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "smg.h" diff -Nru hypre-2.16.0/src/struct_ls/smg_setup_interp.c hypre-2.18.2/src/struct_ls/smg_setup_interp.c --- hypre-2.16.0/src/struct_ls/smg_setup_interp.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/smg_setup_interp.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "smg.h" diff -Nru hypre-2.16.0/src/struct_ls/smg_setup_rap.c hypre-2.18.2/src/struct_ls/smg_setup_rap.c --- hypre-2.16.0/src/struct_ls/smg_setup_rap.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/smg_setup_rap.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "smg.h" diff -Nru hypre-2.16.0/src/struct_ls/smg_setup_restrict.c hypre-2.18.2/src/struct_ls/smg_setup_restrict.c --- hypre-2.16.0/src/struct_ls/smg_setup_restrict.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/smg_setup_restrict.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "smg.h" diff -Nru hypre-2.16.0/src/struct_ls/smg_solve.c hypre-2.18.2/src/struct_ls/smg_solve.c --- hypre-2.16.0/src/struct_ls/smg_solve.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/smg_solve.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" #include "smg.h" diff -Nru hypre-2.16.0/src/struct_ls/sparse_msg2_setup_rap.c hypre-2.18.2/src/struct_ls/sparse_msg2_setup_rap.c --- hypre-2.16.0/src/struct_ls/sparse_msg2_setup_rap.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/sparse_msg2_setup_rap.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/sparse_msg3_setup_rap.c hypre-2.18.2/src/struct_ls/sparse_msg3_setup_rap.c --- hypre-2.16.0/src/struct_ls/sparse_msg3_setup_rap.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/sparse_msg3_setup_rap.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/sparse_msg.c hypre-2.18.2/src/struct_ls/sparse_msg.c --- hypre-2.16.0/src/struct_ls/sparse_msg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/sparse_msg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_ls/sparse_msg_filter.c hypre-2.18.2/src/struct_ls/sparse_msg_filter.c --- hypre-2.16.0/src/struct_ls/sparse_msg_filter.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/sparse_msg_filter.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/sparse_msg.h hypre-2.18.2/src/struct_ls/sparse_msg.h --- hypre-2.16.0/src/struct_ls/sparse_msg.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/sparse_msg.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_ls/sparse_msg_interp.c hypre-2.18.2/src/struct_ls/sparse_msg_interp.c --- hypre-2.16.0/src/struct_ls/sparse_msg_interp.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/sparse_msg_interp.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/sparse_msg_restrict.c hypre-2.18.2/src/struct_ls/sparse_msg_restrict.c --- hypre-2.16.0/src/struct_ls/sparse_msg_restrict.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/sparse_msg_restrict.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_ls.h" diff -Nru hypre-2.16.0/src/struct_ls/sparse_msg_setup.c hypre-2.18.2/src/struct_ls/sparse_msg_setup.c --- hypre-2.16.0/src/struct_ls/sparse_msg_setup.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/sparse_msg_setup.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_ls/sparse_msg_setup_rap.c hypre-2.18.2/src/struct_ls/sparse_msg_setup_rap.c --- hypre-2.16.0/src/struct_ls/sparse_msg_setup_rap.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/sparse_msg_setup_rap.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_ls/sparse_msg_solve.c hypre-2.18.2/src/struct_ls/sparse_msg_solve.c --- hypre-2.16.0/src/struct_ls/sparse_msg_solve.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_ls/sparse_msg_solve.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/assumed_part.c hypre-2.18.2/src/struct_mv/assumed_part.c --- hypre-2.16.0/src/struct_mv/assumed_part.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/assumed_part.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* This is code for the struct assumed partition - AHB 6/05 */ diff -Nru hypre-2.16.0/src/struct_mv/assumed_part.h hypre-2.18.2/src/struct_mv/assumed_part.h --- hypre-2.16.0/src/struct_mv/assumed_part.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/assumed_part.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/box_algebra.c hypre-2.18.2/src/struct_mv/box_algebra.c --- hypre-2.16.0/src/struct_mv/box_algebra.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/box_algebra.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/box_boundary.c hypre-2.18.2/src/struct_mv/box_boundary.c --- hypre-2.16.0/src/struct_mv/box_boundary.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/box_boundary.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/box.c hypre-2.18.2/src/struct_mv/box.c --- hypre-2.16.0/src/struct_mv/box.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/box.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/box.h hypre-2.18.2/src/struct_mv/box.h --- hypre-2.16.0/src/struct_mv/box.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/box.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/boxloop_cuda.h hypre-2.18.2/src/struct_mv/boxloop_cuda.h --- hypre-2.16.0/src/struct_mv/boxloop_cuda.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/boxloop_cuda.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -86,11 +81,8 @@ else if (policy == HYPRE_MEMORY_DEVICE) { HYPRE_Int gridSize = (length + BLOCKSIZE - 1) / BLOCKSIZE; - if (gridSize == 0) - { - gridSize = 1; - } - forall_kernel<<>>(loop_body, length); + const dim3 gDim(gridSize), bDim(BLOCKSIZE); + HYPRE_CUDA_LAUNCH( forall_kernel, gDim, bDim, loop_body, length ); } else if (policy == 2) { @@ -125,7 +117,8 @@ hypre_printf("length= %d, blocksize = %d, gridsize = %d\n", length, BLOCKSIZE, gridSize); */ - reductionforall_kernel<<>>(ReductionLoop, length); + const dim3 gDim(gridSize), bDim(BLOCKSIZE); + HYPRE_CUDA_LAUNCH( reductionforall_kernel, gDim, bDim, ReductionLoop, length ); } } diff -Nru hypre-2.16.0/src/struct_mv/boxloop.h hypre-2.18.2/src/struct_mv/boxloop.h --- hypre-2.16.0/src/struct_mv/boxloop.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/boxloop.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -26,9 +21,9 @@ #ifdef HYPRE_USING_OPENMP #define HYPRE_BOX_REDUCTION #ifdef WIN32 -#define Pragma(x) __pragma(#x) +#define Pragma(x) __pragma(HYPRE_XSTR(x)) #else -#define Pragma(x) _Pragma(#x) +#define Pragma(x) _Pragma(HYPRE_XSTR(x)) #endif #define OMP1 Pragma(omp parallel for private(HYPRE_BOX_PRIVATE) HYPRE_BOX_REDUCTION HYPRE_SMP_SCHEDULE) #else diff -Nru hypre-2.16.0/src/struct_mv/boxloop_kokkos.h hypre-2.18.2/src/struct_mv/boxloop_kokkos.h --- hypre-2.16.0/src/struct_mv/boxloop_kokkos.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/boxloop_kokkos.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/boxloop_omp45.h hypre-2.18.2/src/struct_mv/boxloop_omp45.h --- hypre-2.16.0/src/struct_mv/boxloop_omp45.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/boxloop_omp45.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -25,13 +20,6 @@ #include "omp.h" -/* stringification: - * _Pragma(string-literal), so we need to cast argument to a string - * The three dots as last argument of the macro tells compiler that this is a variadic macro. - * I.e. this is a macro that receives variable number of arguments. - */ -#define HYPRE_STR(s...) #s -#define HYPRE_XSTR(s...) HYPRE_STR(s) /* concatenation: */ #define HYPRE_CONCAT2(x, y) x ## _ ## y @@ -41,7 +29,7 @@ #define HYPRE_XCONCAT3(x, y, z) HYPRE_CONCAT3(x, y, z) /* if use OMP 4.5 default team size and number of teams */ -#define AUTO_OMP_TEAM +#define AUTO_OMP_TEAM #ifndef AUTO_OMP_TEAM /* omp team size (aka. gpu block size) */ @@ -51,21 +39,21 @@ #endif //#define HYPRE_BOXLOOP_ENTRY_PRINT hypre_printf("%s %s %d\n", __FILE__, __func__, __LINE__); -#define HYPRE_BOXLOOP_ENTRY_PRINT +#define HYPRE_BOXLOOP_ENTRY_PRINT /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - BOX LOOPS [TEAM DISTRIBUTE VERSION] !!! NOTE: THIS CODE ONLY WORKS FOR DIM <= 3 !!! * - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ /* -#define hypre_BoxLoop0For() -#define hypre_BoxLoop1For(i1) -#define hypre_BoxLoop2For(i1, i2) -#define hypre_BoxLoop3For(i1, i2, i3) -#define hypre_BoxLoop4For(i1, i2, i3, i4) +#define hypre_BoxLoop0For() +#define hypre_BoxLoop1For(i1) +#define hypre_BoxLoop2For(i1, i2) +#define hypre_BoxLoop3For(i1, i2, i3) +#define hypre_BoxLoop4For(i1, i2, i3, i4) */ -#define hypre_BoxLoopGetIndex zypre_BoxLoopGetIndex -#define hypre_BoxLoopSetOneBlock() ; +#define hypre_BoxLoopGetIndex zypre_BoxLoopGetIndex +#define hypre_BoxLoopSetOneBlock() ; #define hypre_BoxLoopBlock() 0 #define hypre_BoxLoop0Begin zypre_omp4_dist_BoxLoop0Begin @@ -143,16 +131,16 @@ * map clause * - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ #define MAP_CLAUSE0 -#define MAP_CLAUSE1 -#define MAP_CLAUSE2 -#define MAP_CLAUSE3 -#define MAP_CLAUSE4 +#define MAP_CLAUSE1 +#define MAP_CLAUSE2 +#define MAP_CLAUSE3 +#define MAP_CLAUSE4 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - * if clause * - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ #define IF_CLAUSE if (hypre__global_offload && hypre__tot > 0) -//#define IF_CLAUSE +//#define IF_CLAUSE /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - * is_device_ptr clause @@ -160,7 +148,7 @@ #if defined(HYPRE_DEVICE_OPENMP_ALLOC) #define IS_DEVICE_CLAUSE DEVICE_VAR #else -#define IS_DEVICE_CLAUSE +#define IS_DEVICE_CLAUSE #endif /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -374,7 +362,7 @@ for (HYPRE_Int hypre__thread = 0; hypre__thread < hypre__tot; hypre__thread++) \ {\ zypre_omp4_BoxLoopSet3(i1, i2, i3) - + #if 0 #define zypre_omp4_dist_BoxLoop3_SAME_STRIDE_Begin(ndim, loop_size, \ dbox1, start1, stride1, i1, \ @@ -392,7 +380,7 @@ {\ zypre_omp4_BoxLoopSet3_SAME_STRIDE(i1, i2, o2, i3) #endif - + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - * BoxLoop 4 * - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ diff -Nru hypre-2.16.0/src/struct_mv/boxloop_raja.h hypre-2.18.2/src/struct_mv/boxloop_raja.h --- hypre-2.16.0/src/struct_mv/boxloop_raja.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/boxloop_raja.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/box_manager.c hypre-2.18.2/src/struct_mv/box_manager.c --- hypre-2.16.0/src/struct_mv/box_manager.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/box_manager.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /******************************************************************************* diff -Nru hypre-2.16.0/src/struct_mv/box_manager.h hypre-2.18.2/src/struct_mv/box_manager.h --- hypre-2.16.0/src/struct_mv/box_manager.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/box_manager.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_BOX_MANAGER_HEADER #define hypre_BOX_MANAGER_HEADER diff -Nru hypre-2.16.0/src/struct_mv/CMakeLists.txt hypre-2.18.2/src/struct_mv/CMakeLists.txt --- hypre-2.16.0/src/struct_mv/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,48 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(HDRS + HYPRE_struct_mv.h + _hypre_struct_mv.h +) + +set(SRCS + assumed_part.c + box_algebra.c + box_boundary.c + box.c + box_manager.c + communication_info.c + computation.c + F90_HYPRE_struct_grid.c + F90_HYPRE_struct_matrix.c + F90_HYPRE_struct_stencil.c + F90_HYPRE_struct_vector.c + HYPRE_struct_grid.c + HYPRE_struct_matrix.c + HYPRE_struct_stencil.c + HYPRE_struct_vector.c + project.c + struct_axpy.c + struct_communication.c + struct_copy.c + struct_grid.c + struct_innerprod.c + struct_io.c + struct_matrix.c + struct_matrix_mask.c + struct_matvec.c + struct_scale.c + struct_stencil.c + struct_vector.c +) + +convert_filenames_to_full_paths(HDRS) +convert_filenames_to_full_paths(SRCS) + +set(HYPRE_HEADERS ${HYPRE_HEADERS} ${HDRS} PARENT_SCOPE) +set(HYPRE_SOURCES ${HYPRE_SOURCES} ${SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/struct_mv/communication_info.c hypre-2.18.2/src/struct_mv/communication_info.c --- hypre-2.16.0/src/struct_mv/communication_info.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/communication_info.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_mv.h" diff -Nru hypre-2.16.0/src/struct_mv/computation.c hypre-2.18.2/src/struct_mv/computation.c --- hypre-2.16.0/src/struct_mv/computation.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/computation.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/computation.h hypre-2.18.2/src/struct_mv/computation.h --- hypre-2.16.0/src/struct_mv/computation.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/computation.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/F90_HYPRE_struct_grid.c hypre-2.18.2/src/struct_mv/F90_HYPRE_struct_grid.c --- hypre-2.16.0/src/struct_mv/F90_HYPRE_struct_grid.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/F90_HYPRE_struct_grid.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/F90_HYPRE_struct_matrix.c hypre-2.18.2/src/struct_mv/F90_HYPRE_struct_matrix.c --- hypre-2.16.0/src/struct_mv/F90_HYPRE_struct_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/F90_HYPRE_struct_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/F90_HYPRE_struct_stencil.c hypre-2.18.2/src/struct_mv/F90_HYPRE_struct_stencil.c --- hypre-2.16.0/src/struct_mv/F90_HYPRE_struct_stencil.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/F90_HYPRE_struct_stencil.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/F90_HYPRE_struct_vector.c hypre-2.18.2/src/struct_mv/F90_HYPRE_struct_vector.c --- hypre-2.16.0/src/struct_mv/F90_HYPRE_struct_vector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/F90_HYPRE_struct_vector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/headers hypre-2.18.2/src/struct_mv/headers --- hypre-2.16.0/src/struct_mv/headers 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/headers 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) INTERNAL_HEADER=_hypre_struct_mv.h diff -Nru hypre-2.16.0/src/struct_mv/HYPRE_struct_grid.c hypre-2.18.2/src/struct_mv/HYPRE_struct_grid.c --- hypre-2.16.0/src/struct_mv/HYPRE_struct_grid.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/HYPRE_struct_grid.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/HYPRE_struct_matrix.c hypre-2.18.2/src/struct_mv/HYPRE_struct_matrix.c --- hypre-2.16.0/src/struct_mv/HYPRE_struct_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/HYPRE_struct_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/_hypre_struct_mv.h hypre-2.18.2/src/struct_mv/_hypre_struct_mv.h --- hypre-2.16.0/src/struct_mv/_hypre_struct_mv.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/_hypre_struct_mv.h 2019-10-28 22:30:04.000000000 +0000 @@ -13,17 +13,12 @@ #include "_hypre_utilities.h" #if defined(HYPRE_USING_RAJA) -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -349,17 +344,12 @@ #endif #elif defined(HYPRE_USING_KOKKOS) -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -725,17 +715,12 @@ #define hypre_BasicBoxLoop2Begin hypre_newBasicBoxLoop2Begin #endif #elif defined(HYPRE_USING_CUDA) -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -813,11 +798,8 @@ else if (policy == HYPRE_MEMORY_DEVICE) { HYPRE_Int gridSize = (length + BLOCKSIZE - 1) / BLOCKSIZE; - if (gridSize == 0) - { - gridSize = 1; - } - forall_kernel<<>>(loop_body, length); + const dim3 gDim(gridSize), bDim(BLOCKSIZE); + HYPRE_CUDA_LAUNCH( forall_kernel, gDim, bDim, loop_body, length ); } else if (policy == 2) { @@ -852,7 +834,8 @@ hypre_printf("length= %d, blocksize = %d, gridsize = %d\n", length, BLOCKSIZE, gridSize); */ - reductionforall_kernel<<>>(ReductionLoop, length); + const dim3 gDim(gridSize), bDim(BLOCKSIZE); + HYPRE_CUDA_LAUNCH( reductionforall_kernel, gDim, bDim, ReductionLoop, length ); } } @@ -1167,17 +1150,12 @@ #endif #elif defined(HYPRE_USING_DEVICE_OPENMP) -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -1194,13 +1172,6 @@ #include "omp.h" -/* stringification: - * _Pragma(string-literal), so we need to cast argument to a string - * The three dots as last argument of the macro tells compiler that this is a variadic macro. - * I.e. this is a macro that receives variable number of arguments. - */ -#define HYPRE_STR(s...) #s -#define HYPRE_XSTR(s...) HYPRE_STR(s) /* concatenation: */ #define HYPRE_CONCAT2(x, y) x ## _ ## y @@ -1210,7 +1181,7 @@ #define HYPRE_XCONCAT3(x, y, z) HYPRE_CONCAT3(x, y, z) /* if use OMP 4.5 default team size and number of teams */ -#define AUTO_OMP_TEAM +#define AUTO_OMP_TEAM #ifndef AUTO_OMP_TEAM /* omp team size (aka. gpu block size) */ @@ -1220,21 +1191,21 @@ #endif //#define HYPRE_BOXLOOP_ENTRY_PRINT hypre_printf("%s %s %d\n", __FILE__, __func__, __LINE__); -#define HYPRE_BOXLOOP_ENTRY_PRINT +#define HYPRE_BOXLOOP_ENTRY_PRINT /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - BOX LOOPS [TEAM DISTRIBUTE VERSION] !!! NOTE: THIS CODE ONLY WORKS FOR DIM <= 3 !!! * - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ /* -#define hypre_BoxLoop0For() -#define hypre_BoxLoop1For(i1) -#define hypre_BoxLoop2For(i1, i2) -#define hypre_BoxLoop3For(i1, i2, i3) -#define hypre_BoxLoop4For(i1, i2, i3, i4) +#define hypre_BoxLoop0For() +#define hypre_BoxLoop1For(i1) +#define hypre_BoxLoop2For(i1, i2) +#define hypre_BoxLoop3For(i1, i2, i3) +#define hypre_BoxLoop4For(i1, i2, i3, i4) */ -#define hypre_BoxLoopGetIndex zypre_BoxLoopGetIndex -#define hypre_BoxLoopSetOneBlock() ; +#define hypre_BoxLoopGetIndex zypre_BoxLoopGetIndex +#define hypre_BoxLoopSetOneBlock() ; #define hypre_BoxLoopBlock() 0 #define hypre_BoxLoop0Begin zypre_omp4_dist_BoxLoop0Begin @@ -1312,16 +1283,16 @@ * map clause * - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ #define MAP_CLAUSE0 -#define MAP_CLAUSE1 -#define MAP_CLAUSE2 -#define MAP_CLAUSE3 -#define MAP_CLAUSE4 +#define MAP_CLAUSE1 +#define MAP_CLAUSE2 +#define MAP_CLAUSE3 +#define MAP_CLAUSE4 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - * if clause * - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ #define IF_CLAUSE if (hypre__global_offload && hypre__tot > 0) -//#define IF_CLAUSE +//#define IF_CLAUSE /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - * is_device_ptr clause @@ -1329,7 +1300,7 @@ #if defined(HYPRE_DEVICE_OPENMP_ALLOC) #define IS_DEVICE_CLAUSE DEVICE_VAR #else -#define IS_DEVICE_CLAUSE +#define IS_DEVICE_CLAUSE #endif /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1543,7 +1514,7 @@ for (HYPRE_Int hypre__thread = 0; hypre__thread < hypre__tot; hypre__thread++) \ {\ zypre_omp4_BoxLoopSet3(i1, i2, i3) - + #if 0 #define zypre_omp4_dist_BoxLoop3_SAME_STRIDE_Begin(ndim, loop_size, \ dbox1, start1, stride1, i1, \ @@ -1561,7 +1532,7 @@ {\ zypre_omp4_BoxLoopSet3_SAME_STRIDE(i1, i2, o2, i3) #endif - + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - * BoxLoop 4 * - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ @@ -1747,17 +1718,12 @@ #endif #else -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -1775,9 +1741,9 @@ #ifdef HYPRE_USING_OPENMP #define HYPRE_BOX_REDUCTION #ifdef WIN32 -#define Pragma(x) __pragma(#x) +#define Pragma(x) __pragma(HYPRE_XSTR(x)) #else -#define Pragma(x) _Pragma(#x) +#define Pragma(x) _Pragma(HYPRE_XSTR(x)) #endif #define OMP1 Pragma(omp parallel for private(HYPRE_BOX_PRIVATE) HYPRE_BOX_REDUCTION HYPRE_SMP_SCHEDULE) #else @@ -2036,17 +2002,12 @@ #ifdef __cplusplus extern "C" { #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -2731,17 +2692,12 @@ } #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -2794,17 +2750,12 @@ #define hypre_StructAssumedPartMyPartitionProcId(apart, i) ((apart)->my_partition_proc_ids[i]) #define hypre_StructAssumedPartMyPartitionBoxnum(apart, i) ((apart)->my_partition_boxnums[i]) #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_BOX_MANAGER_HEADER #define hypre_BOX_MANAGER_HEADER @@ -2991,19 +2942,12 @@ #define hypre_BoxManEntryBoxMan(entry) ((entry) -> boxman) #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -3091,19 +3035,12 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -3139,17 +3076,12 @@ #define hypre_StructStencilElement(stencil, i) hypre_StructStencilShape(stencil)[i] #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_COMMUNICATION_HEADER #define hypre_COMMUNICATION_HEADER @@ -3396,19 +3328,12 @@ #define hypre_CommHandleRecvBuffersDevice(comm_handle) (comm_handle -> recv_buffers_data) #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -3476,17 +3401,12 @@ #define hypre_ComputePkgNumValues(compute_pkg) (compute_pkg -> num_values) #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -3585,17 +3505,12 @@ hypre_CCBoxIndexRank(hypre_StructMatrixBox(matrix, b), index)) #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -3666,17 +3581,12 @@ hypre_BoxIndexRank(hypre_StructVectorBox(vector, b), index)) #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* assumed_part.c */ HYPRE_Int hypre_APSubdivideRegion ( hypre_Box *region , HYPRE_Int dim , HYPRE_Int level , hypre_BoxArray *box_array , HYPRE_Int *num_new_boxes ); diff -Nru hypre-2.16.0/src/struct_mv/HYPRE_struct_mv.h hypre-2.18.2/src/struct_mv/HYPRE_struct_mv.h --- hypre-2.16.0/src/struct_mv/HYPRE_struct_mv.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/HYPRE_struct_mv.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef HYPRE_STRUCT_MV_HEADER #define HYPRE_STRUCT_MV_HEADER diff -Nru hypre-2.16.0/src/struct_mv/HYPRE_struct_stencil.c hypre-2.18.2/src/struct_mv/HYPRE_struct_stencil.c --- hypre-2.16.0/src/struct_mv/HYPRE_struct_stencil.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/HYPRE_struct_stencil.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/HYPRE_struct_vector.c hypre-2.18.2/src/struct_mv/HYPRE_struct_vector.c --- hypre-2.16.0/src/struct_mv/HYPRE_struct_vector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/HYPRE_struct_vector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/Makefile hypre-2.18.2/src/struct_mv/Makefile --- hypre-2.16.0/src/struct_mv/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config diff -Nru hypre-2.16.0/src/struct_mv/project.c hypre-2.18.2/src/struct_mv/project.c --- hypre-2.16.0/src/struct_mv/project.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/project.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/protos.h hypre-2.18.2/src/struct_mv/protos.h --- hypre-2.16.0/src/struct_mv/protos.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/protos.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* assumed_part.c */ HYPRE_Int hypre_APSubdivideRegion ( hypre_Box *region , HYPRE_Int dim , HYPRE_Int level , hypre_BoxArray *box_array , HYPRE_Int *num_new_boxes ); diff -Nru hypre-2.16.0/src/struct_mv/struct_axpy.c hypre-2.18.2/src/struct_mv/struct_axpy.c --- hypre-2.16.0/src/struct_mv/struct_axpy.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/struct_axpy.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/struct_communication.c hypre-2.18.2/src/struct_mv/struct_communication.c --- hypre-2.16.0/src/struct_mv/struct_communication.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/struct_communication.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_struct_mv.h" diff -Nru hypre-2.16.0/src/struct_mv/struct_communication.h hypre-2.18.2/src/struct_mv/struct_communication.h --- hypre-2.16.0/src/struct_mv/struct_communication.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/struct_communication.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_COMMUNICATION_HEADER #define hypre_COMMUNICATION_HEADER diff -Nru hypre-2.16.0/src/struct_mv/struct_copy.c hypre-2.18.2/src/struct_mv/struct_copy.c --- hypre-2.16.0/src/struct_mv/struct_copy.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/struct_copy.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/struct_grid.c hypre-2.18.2/src/struct_mv/struct_grid.c --- hypre-2.16.0/src/struct_mv/struct_grid.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/struct_grid.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/struct_grid.h hypre-2.18.2/src/struct_mv/struct_grid.h --- hypre-2.16.0/src/struct_mv/struct_grid.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/struct_grid.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/struct_innerprod.c hypre-2.18.2/src/struct_mv/struct_innerprod.c --- hypre-2.16.0/src/struct_mv/struct_innerprod.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/struct_innerprod.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/struct_io.c hypre-2.18.2/src/struct_mv/struct_io.c --- hypre-2.16.0/src/struct_mv/struct_io.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/struct_io.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/struct_matrix.c hypre-2.18.2/src/struct_mv/struct_matrix.c --- hypre-2.16.0/src/struct_mv/struct_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/struct_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/struct_matrix.h hypre-2.18.2/src/struct_mv/struct_matrix.h --- hypre-2.16.0/src/struct_mv/struct_matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/struct_matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/struct_matrix_mask.c hypre-2.18.2/src/struct_mv/struct_matrix_mask.c --- hypre-2.16.0/src/struct_mv/struct_matrix_mask.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/struct_matrix_mask.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/struct_matvec.c hypre-2.18.2/src/struct_mv/struct_matvec.c --- hypre-2.16.0/src/struct_mv/struct_matvec.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/struct_matvec.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/struct_scale.c hypre-2.18.2/src/struct_mv/struct_scale.c --- hypre-2.16.0/src/struct_mv/struct_scale.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/struct_scale.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/struct_stencil.c hypre-2.18.2/src/struct_mv/struct_stencil.c --- hypre-2.16.0/src/struct_mv/struct_stencil.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/struct_stencil.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/struct_stencil.h hypre-2.18.2/src/struct_mv/struct_stencil.h --- hypre-2.16.0/src/struct_mv/struct_stencil.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/struct_stencil.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/struct_vector.c hypre-2.18.2/src/struct_mv/struct_vector.c --- hypre-2.16.0/src/struct_mv/struct_vector.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/struct_vector.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/struct_mv/struct_vector.h hypre-2.18.2/src/struct_mv/struct_vector.h --- hypre-2.16.0/src/struct_mv/struct_vector.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/struct_mv/struct_vector.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/test/ams_driver.c hypre-2.18.2/src/test/ams_driver.c --- hypre-2.16.0/src/test/ams_driver.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/ams_driver.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* This test driver performs the following operations: diff -Nru hypre-2.16.0/src/test/checktest.sh hypre-2.18.2/src/test/checktest.sh --- hypre-2.16.0/src/test/checktest.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/checktest.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) # Echo usage information case $1 in diff -Nru hypre-2.16.0/src/test/cleantest.sh hypre-2.18.2/src/test/cleantest.sh --- hypre-2.16.0/src/test/cleantest.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/cleantest.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) # Echo usage information case $1 in diff -Nru hypre-2.16.0/src/test/CMakeLists.txt hypre-2.18.2/src/test/CMakeLists.txt --- hypre-2.16.0/src/test/CMakeLists.txt 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -1,78 +1,24 @@ -cmake_minimum_required (VERSION 2.8.8) -project (hypre-test) +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) -if (${hypre-test_SOURCE_DIR} STREQUAL ${hypre-test_BINARY_DIR}) - message(FATAL_ERROR "In-place build not allowed! Please use a separate build directory. See the Users Manual or INSTALL file for details.") -endif () - -# Set the installation directory for hypre -set (HYPRE_INSTALL_DIR "${PROJECT_SOURCE_DIR}/../hypre" CACHE PATH - "Installation directory for HYPRE") - -# Set default compile optimization flag -set (CMAKE_BUILD_TYPE "RELEASE" CACHE INTERNAL "" FORCE) - -# Include directories -set (HYPRE_INCLUDE_DIRS "${HYPRE_INSTALL_DIR}/include") - -# Library directories -set (HYPRE_LIB_DIRS "${HYPRE_INSTALL_DIR}/lib") - -# Link libraries -set (HYPRE_LIBS HYPRE) - -# Link libraries for Unix systems -if (UNIX) - list (APPEND HYPRE_LIBS m) -endif (UNIX) - -# Configuration options -option(HYPRE_BIGINT "Use long long int for HYPRE_Int" OFF) -option(HYPRE_SEQUENTIAL "Compile without MPI" OFF) - -# CDEFS = -DHYPRE_TIMING -DHYPRE_FORTRAN -# CXXDEFS = -DNOFEI -DHYPRE_TIMING -DMPICH_SKIP_MPICXX -# -lstdc++ -lm - -# Set MPI compile flags -if (NOT HYPRE_SEQUENTIAL) - find_package (MPI) - if ((MPI_C_FOUND) AND (NOT CMAKE_C_COMPILER STREQUAL MPI_C_COMPILER)) - include_directories (${MPI_C_INCLUDE_PATH}) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_C_COMPILE_FLAGS}") - list (APPEND HYPRE_LIBS ${MPI_C_LIBRARIES}) - endif () -endif (NOT HYPRE_SEQUENTIAL) - -include_directories (${HYPRE_INCLUDE_DIRS}) -link_directories (${HYPRE_LIB_DIRS}) add_definitions (-DHYPRE_TIMING) if (MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif () -add_executable (ij ij.c) -target_link_libraries (ij ${HYPRE_LIBS}) - -add_executable (sstruct sstruct.c) -target_link_libraries (sstruct ${HYPRE_LIBS}) - -add_executable (struct struct.c) -target_link_libraries (struct ${HYPRE_LIBS}) - -add_executable (ams_driver ams_driver.c) -target_link_libraries (ams_driver ${HYPRE_LIBS}) - -add_executable (maxwell_unscaled maxwell_unscaled.c) -target_link_libraries (maxwell_unscaled ${HYPRE_LIBS}) - -add_executable (struct_migrate struct_migrate.c) -target_link_libraries (struct_migrate ${HYPRE_LIBS}) - -add_executable (sstruct_fac sstruct_fac.c) -target_link_libraries (sstruct_fac ${HYPRE_LIBS}) - -add_executable (ij_mv ij_mv.c) -target_link_libraries (ij_mv ${HYPRE_LIBS}) +set(TEST_SRCS + ij.c + sstruct.c + struct.c + ams_driver.c + maxwell_unscaled.c + struct_migrate.c + sstruct_fac.c + ij_mv.c +) + +add_hypre_executables(TEST_SRCS) diff -Nru hypre-2.16.0/src/test/cmbuild/README.txt hypre-2.18.2/src/test/cmbuild/README.txt --- hypre-2.16.0/src/test/cmbuild/README.txt 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/cmbuild/README.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -This directory is provided for convenience to do CMake builds... diff -Nru hypre-2.16.0/src/test/driver_commpkg.c hypre-2.18.2/src/test/driver_commpkg.c --- hypre-2.16.0/src/test/driver_commpkg.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/driver_commpkg.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* driver_commpkg.c*/ /* AHB 06/04 */ diff -Nru hypre-2.16.0/src/test/ex1_for.c hypre-2.18.2/src/test/ex1_for.c --- hypre-2.16.0/src/test/ex1_for.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/ex1_for.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* Example 1 diff -Nru hypre-2.16.0/src/test/ex3_for.c hypre-2.18.2/src/test/ex3_for.c --- hypre-2.16.0/src/test/ex3_for.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/ex3_for.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* Example 3 diff -Nru hypre-2.16.0/src/test/ex5_for.c hypre-2.18.2/src/test/ex5_for.c --- hypre-2.16.0/src/test/ex5_for.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/ex5_for.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* Example 5 diff -Nru hypre-2.16.0/src/test/ex6_for.c hypre-2.18.2/src/test/ex6_for.c --- hypre-2.16.0/src/test/ex6_for.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/ex6_for.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* Example 6 diff -Nru hypre-2.16.0/src/test/ex7_for.c hypre-2.18.2/src/test/ex7_for.c --- hypre-2.16.0/src/test/ex7_for.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/ex7_for.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* Example 7 -- FORTRAN Test Version diff -Nru hypre-2.16.0/src/test/f77_ij.f hypre-2.18.2/src/test/f77_ij.f --- hypre-2.16.0/src/test/f77_ij.f 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/f77_ij.f 2019-10-28 22:30:04.000000000 +0000 @@ -1,22 +1,16 @@ -cBHEADER********************************************************************** -c Copyright (c) 2008, Lawrence Livermore National Security, LLC. -c Produced at the Lawrence Livermore National Laboratory. -c This file is part of HYPRE. See file COPYRIGHT for details. -c -c HYPRE is free software; you can redistribute it and/or modify it under the -c terms of the GNU Lesser General Public License (as published by the Free -c Software Foundation) version 2.1 dated February 1999. -c -c $Revision$ -cEHEADER********************************************************************** -c----------------------------------------------------------------------- -c Test driver for unstructured matrix interface (structured storage) -c----------------------------------------------------------------------- +! Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +! HYPRE Project Developers. See the top-level COPYRIGHT file for details. +! +! SPDX-License-Identifier: (Apache-2.0 OR MIT) + +!----------------------------------------------------------------------- +! Test driver for unstructured matrix interface (structured storage) +!----------------------------------------------------------------------- -c----------------------------------------------------------------------- -c Standard 7-point laplacian in 3D with grid and anisotropy determined -c as user settings. -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Standard 7-point laplacian in 3D with grid and anisotropy determined +! as user settings. +!----------------------------------------------------------------------- program test @@ -59,7 +53,7 @@ parameter (pc_tol = 0.0) double precision final_res_norm -c parameters for BoomerAMG +! parameters for BoomerAMG integer hybrid, coarsen_type, measure_type integer cycle_type integer smooth_num_sweep @@ -72,7 +66,7 @@ double precision max_row_sum data max_row_sum /1.0/ -c parameters for ParaSails +! parameters for ParaSails double precision sai_threshold double precision sai_filter @@ -99,18 +93,18 @@ integer dof_func(1000), j -c----------------------------------------------------------------------- -c Initialize MPI -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Initialize MPI +!----------------------------------------------------------------------- call MPI_INIT(ierr) call MPI_COMM_RANK(MPI_COMM_WORLD, myid, ierr) call MPI_COMM_SIZE(MPI_COMM_WORLD, num_procs, ierr) -c----------------------------------------------------------------------- -c Set defaults -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Set defaults +!----------------------------------------------------------------------- dim = 3 @@ -135,38 +129,38 @@ solver_id = 3 -c----------------------------------------------------------------------- -c Read options -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Read options +!----------------------------------------------------------------------- -c open( 5, file='parcsr_linear_solver.in', status='old') -c -c read( 5, *) dim -c -c read( 5, *) nx -c read( 5, *) ny -c read( 5, *) nz -c -c read( 5, *) Px -c read( 5, *) Py -c read( 5, *) Pz -c -c read( 5, *) bx -c read( 5, *) by -c read( 5, *) bz -c -c read( 5, *) cx -c read( 5, *) cy -c read( 5, *) cz -c -c read( 5, *) n_pre -c read( 5, *) n_post -c -c write(6,*) 'Generate matrix? !0 yes, 0 no (from file)' +! open( 5, file='parcsr_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 +! +! write(6,*) 'Generate matrix? !0 yes, 0 no (from file)' read(5,*) generate_matrix if (generate_matrix .eq. 0) then -c write(6,*) 'What file to use for matrix (<= 31 chars)?' +! write(6,*) 'What file to use for matrix (<= 31 chars)?' read(5,*) matfile_str i = 1 100 if (matfile_str(i:i) .ne. ' ') then @@ -179,12 +173,12 @@ 200 matfile(i) = char(0) endif -c write(6,*) 'Generate right-hand side? !0 yes, 0 no (from file)' +! write(6,*) 'Generate right-hand side? !0 yes, 0 no (from file)' read(5,*) generate_rhs if (generate_rhs .eq. 0) then -c write(6,*) -c & 'What file to use for right-hand side (<= 31 chars)?' +! write(6,*) +! & 'What file to use for right-hand side (<= 31 chars)?' read(5,*) vecfile_str i = 1 300 if (vecfile_str(i:i) .ne. ' ') then @@ -197,25 +191,25 @@ 400 vecfile(i) = char(0) endif -c write(6,*) 'What solver_id?' -c write(6,*) '0 AMG, 1 AMG-PCG, 2 DS-PCG, 3 AMG-GMRES, 4 DS-GMRES,' -c write(6,*) '5 AMG-CGNR, 6 DS-CGNR, 7 PILUT-GMRES, 8 ParaSails-GMRES,' -c write(6,*) '9 AMG-BiCGSTAB, 10 DS-BiCGSTAB' +! write(6,*) 'What solver_id?' +! write(6,*) '0 AMG, 1 AMG-PCG, 2 DS-PCG, 3 AMG-GMRES, 4 DS-GMRES,' +! write(6,*) '5 AMG-CGNR, 6 DS-CGNR, 7 PILUT-GMRES, 8 ParaSails-GMRES,' +! write(6,*) '9 AMG-BiCGSTAB, 10 DS-BiCGSTAB' read(5,*) solver_id if (solver_id .eq. 7) then -c write(6,*) 'What drop tolerance? <0 do not drop' +! write(6,*) 'What drop tolerance? <0 do not drop' read(5,*) drop_tol endif -c write(6,*) 'What relative residual norm tolerance?' +! write(6,*) 'What relative residual norm tolerance?' read(5,*) tol -c close( 5 ) +! close( 5 ) -c----------------------------------------------------------------------- -c Check a few things -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Check a few things +!----------------------------------------------------------------------- if ((Px*Py*Pz) .ne. num_procs) then print *, 'Error: Invalid number of processors or topology' @@ -237,9 +231,9 @@ stop endif -c----------------------------------------------------------------------- -c Print driver parameters -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Print driver parameters +!----------------------------------------------------------------------- if (myid .eq. 0) then print *, 'Running with these driver parameters:' @@ -251,33 +245,33 @@ print *, ' dim = ', dim endif -c----------------------------------------------------------------------- -c Compute some grid and processor information -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Compute some grid and processor information +!----------------------------------------------------------------------- if (dim .eq. 1) then -c compute p from Px and myid +! compute p from Px and myid p = mod(myid,Px) elseif (dim .eq. 2) then -c compute p,q from Px, Py and myid +! compute p,q from Px, Py and myid p = mod(myid,Px) q = mod(((myid - p)/Px),Py) elseif (dim .eq. 3) then -c compute p,q,r from Px,Py,Pz and myid +! compute p,q,r from Px,Py,Pz and myid p = mod(myid,Px) q = mod((( myid - p)/Px),Py) r = (myid - (p + Px*q))/(Px*Py) endif -c---------------------------------------------------------------------- -c Set up the matrix -c----------------------------------------------------------------------- +!---------------------------------------------------------------------- +! Set up the matrix +!----------------------------------------------------------------------- values(2) = -cx values(3) = -cy @@ -288,7 +282,7 @@ if (ny .gt. 1) values(1) = values(1) + 2d0*cy if (nz .gt. 1) values(1) = values(1) + 2d0*cz -c Generate a Dirichlet Laplacian +! Generate a Dirichlet Laplacian if (generate_matrix .eq. 0) then call HYPRE_IJMatrixRead(matfile, MPI_COMM_WORLD, @@ -338,9 +332,9 @@ call hypre_ParCSRMatrixRowStarts(A_storage, row_starts, ierr) -c----------------------------------------------------------------------- -c Set up the rhs and initial guess -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Set up the rhs and initial guess +!----------------------------------------------------------------------- if (generate_rhs .eq. 0) then @@ -356,7 +350,7 @@ call HYPRE_IJVectorSetObjectType(b, HYPRE_PARCSR, ierr) call HYPRE_IJVectorInitialize(b, ierr) -c Set up a Dirichlet 0 problem +! Set up a Dirichlet 0 problem do i = 1, last_local_col - first_local_col + 1 indices(i) = first_local_col - 1 + i vals(i) = 1. @@ -396,7 +390,7 @@ call HYPRE_IJVectorSetValues(x, & last_local_col - first_local_col + 1, indices, vals, ierr) -c Choose a nonzero initial guess +! Choose a nonzero initial guess call HYPRE_IJVectorGetObject(x, x_storage, ierr) vecfile(1) = 'd' @@ -416,12 +410,12 @@ call HYPRE_IJVectorPrint(x, vecfile, ierr) -c----------------------------------------------------------------------- -c Solve the linear system -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Solve the linear system +!----------------------------------------------------------------------- -c General solver parameters, passing hard coded constants -c will break the interface. +! General solver parameters, passing hard coded constants +! will break the interface. maxiter = 100 convtol = 0.9 @@ -430,7 +424,7 @@ if (solver_id .eq. 0) then -c Set defaults for BoomerAMG +! Set defaults for BoomerAMG maxiter = 500 coarsen_type = 6 hybrid = 1 @@ -455,39 +449,39 @@ call HYPRE_BoomerAMGSetMaxIter(solver, maxiter, ierr) call HYPRE_BoomerAMGSetCycleType(solver, cycle_type, ierr) -c RDF: Used this to test the fortran interface for SetDofFunc -c do i = 1, 1000/2 -c j = 2*i-1 -c dof_func(j) = 0 -c j = j + 1 -c dof_func(j) = 1 -c enddo -c call HYPRE_BoomerAMGSetNumFunctions(solver, 2, ierr) -c call HYPRE_BoomerAMGSetDofFunc(solver, dof_func, ierr) - -c call HYPRE_BoomerAMGInitGridRelaxatn(num_grid_sweeps, -c & grid_relax_type, -c & grid_relax_points, -c & coarsen_type, -c & relax_weights, -c & MAXLEVELS,ierr) -c num_grid_sweeps2(1) = 1 -c num_grid_sweeps2(2) = 1 -c num_grid_sweeps2(3) = 1 -c num_grid_sweeps2(4) = 1 -c call HYPRE_BoomerAMGSetNumGridSweeps(solver, -c & num_grid_sweeps2, ierr) -c call HYPRE_BoomerAMGSetGridRelaxType(solver, -c & grid_relax_type, ierr) -c call HYPRE_BoomerAMGSetRelaxWeight(solver, -c & relax_weights, ierr) -c call HYPRE_BoomerAMGSetSmoothOption(solver, smooth_option, -c & ierr) -c call HYPRE_BoomerAMGSetSmoothNumSwp(solver, smooth_num_sweep, -c & ierr) -c call HYPRE_BoomerAMGSetGridRelaxPnts(solver, -c & grid_relax_points, -c & ierr) +! RDF: Used this to test the fortran interface for SetDofFunc +! do i = 1, 1000/2 +! j = 2*i-1 +! dof_func(j) = 0 +! j = j + 1 +! dof_func(j) = 1 +! enddo +! call HYPRE_BoomerAMGSetNumFunctions(solver, 2, ierr) +! call HYPRE_BoomerAMGSetDofFunc(solver, dof_func, ierr) + +! call HYPRE_BoomerAMGInitGridRelaxatn(num_grid_sweeps, +! & grid_relax_type, +! & grid_relax_points, +! & coarsen_type, +! & relax_weights, +! & MAXLEVELS,ierr) +! num_grid_sweeps2(1) = 1 +! num_grid_sweeps2(2) = 1 +! num_grid_sweeps2(3) = 1 +! num_grid_sweeps2(4) = 1 +! call HYPRE_BoomerAMGSetNumGridSweeps(solver, +! & num_grid_sweeps2, ierr) +! call HYPRE_BoomerAMGSetGridRelaxType(solver, +! & grid_relax_type, ierr) +! call HYPRE_BoomerAMGSetRelaxWeight(solver, +! & relax_weights, ierr) +! call HYPRE_BoomerAMGSetSmoothOption(solver, smooth_option, +! & ierr) +! call HYPRE_BoomerAMGSetSmoothNumSwp(solver, smooth_num_sweep, +! & ierr) +! call HYPRE_BoomerAMGSetGridRelaxPnts(solver, +! & grid_relax_points, +! & ierr) call HYPRE_BoomerAMGSetMaxLevels(solver, MAXLEVELS, ierr) call HYPRE_BoomerAMGSetMaxRowSum(solver, max_row_sum, & ierr) @@ -510,7 +504,7 @@ maxiter = 100 k_dim = 5 -c Solve the system using preconditioned GMRES +! Solve the system using preconditioned GMRES call HYPRE_ParCSRGMRESCreate(MPI_COMM_WORLD, solver, ierr) call HYPRE_ParCSRGMRESSetKDim(solver, k_dim, ierr) @@ -534,7 +528,7 @@ precond_id = 2 -c Set defaults for BoomerAMG +! Set defaults for BoomerAMG maxiter = 1 coarsen_type = 6 hybrid = 1 @@ -572,10 +566,10 @@ & grid_relax_type, ierr) call HYPRE_BoomerAMGSetRelaxWeight(precond, & relax_weights, ierr) -c call HYPRE_BoomerAMGSetSmoothOption(precond, smooth_option, -c & ierr) -c call HYPRE_BoomerAMGSetSmoothNumSwp(precond, smooth_num_sweep, -c & ierr) +! call HYPRE_BoomerAMGSetSmoothOption(precond, smooth_option, +! & ierr) +! call HYPRE_BoomerAMGSetSmoothNumSwp(precond, smooth_num_sweep, +! & ierr) call HYPRE_BoomerAMGSetGridRelaxPnts(precond, & grid_relax_points, ierr) call HYPRE_BoomerAMGSetMaxLevels(precond, @@ -685,7 +679,7 @@ precond_id = 2 -c Set defaults for BoomerAMG +! Set defaults for BoomerAMG maxiter = 1 coarsen_type = 6 hybrid = 1 @@ -725,11 +719,11 @@ & grid_relax_type, ierr) call HYPRE_BoomerAMGSetRelaxWeight(precond, & relax_weights, ierr) -c call HYPRE_BoomerAMGSetSmoothOption(precond, smooth_option, -c & ierr) -c call HYPRE_BoomerAMGSetSmoothNumSwp(precond, -c & smooth_num_sweep, -c & ierr) +! call HYPRE_BoomerAMGSetSmoothOption(precond, smooth_option, +! & ierr) +! call HYPRE_BoomerAMGSetSmoothNumSwp(precond, +! & smooth_num_sweep, +! & ierr) call HYPRE_BoomerAMGSetGridRelaxPnts(precond, & grid_relax_points, ierr) call HYPRE_BoomerAMGSetMaxLevels(precond, MAXLEVELS, ierr) @@ -792,7 +786,7 @@ precond_id = 2 -c Set defaults for BoomerAMG +! Set defaults for BoomerAMG maxiter = 1 coarsen_type = 6 hybrid = 1 @@ -831,10 +825,10 @@ & grid_relax_type, ierr) call HYPRE_BoomerAMGSetRelaxWeight(precond, & relax_weights, ierr) -c call HYPRE_BoomerAMGSetSmoothOption(precond, smooth_option, -c & ierr) -c call HYPRE_BoomerAMGSetSmoothNumSwp(precond, smooth_num_sweep, -c & ierr) +! call HYPRE_BoomerAMGSetSmoothOption(precond, smooth_option, +! & ierr) +! call HYPRE_BoomerAMGSetSmoothNumSwp(precond, smooth_num_sweep, +! & ierr) call HYPRE_BoomerAMGSetGridRelaxPnts(precond, & grid_relax_points, & ierr) @@ -897,7 +891,7 @@ precond_id = 2 -c Set defaults for BoomerAMG +! Set defaults for BoomerAMG maxiter = 1 coarsen_type = 6 hybrid = 1 @@ -937,10 +931,10 @@ & grid_relax_type, ierr) call HYPRE_BoomerAMGSetRelaxWeight(precond, & relax_weights, ierr) -c call HYPRE_BoomerAMGSetSmoothOption(precond, smooth_option, -c & ierr) -c call HYPRE_BoomerAMGSetSmoothNumSwp(precond, smooth_num_sweep, -c & ierr) +! call HYPRE_BoomerAMGSetSmoothOption(precond, smooth_option, +! & ierr) +! call HYPRE_BoomerAMGSetSmoothNumSwp(precond, smooth_num_sweep, +! & ierr) call HYPRE_BoomerAMGSetGridRelaxPnts(precond, & grid_relax_points, ierr) call HYPRE_BoomerAMGSetMaxLevels(precond, MAXLEVELS, ierr) @@ -981,9 +975,9 @@ endif -c----------------------------------------------------------------------- -c Print the solution and other info -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Print the solution and other info +!----------------------------------------------------------------------- vecfile(1) = 'd' vecfile(2) = 'r' @@ -1006,15 +1000,15 @@ print *, 'Final Residual Norm = ', final_res_norm endif -c----------------------------------------------------------------------- -c Finalize things -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Finalize things +!----------------------------------------------------------------------- call HYPRE_ParCSRMatrixDestroy(A_storage, ierr) call HYPRE_IJVectorDestroy(b, ierr) call HYPRE_IJVectorDestroy(x, ierr) -c Finalize MPI +! Finalize MPI call MPI_FINALIZE(ierr) diff -Nru hypre-2.16.0/src/test/f77_ij_mv.f hypre-2.18.2/src/test/f77_ij_mv.f --- hypre-2.16.0/src/test/f77_ij_mv.f 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/f77_ij_mv.f 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,11 @@ -cBHEADER********************************************************************** -c Copyright (c) 2008, Lawrence Livermore National Security, LLC. -c Produced at the Lawrence Livermore National Laboratory. -c This file is part of HYPRE. See file COPYRIGHT for details. -c -c HYPRE is free software; you can redistribute it and/or modify it under the -c terms of the GNU Lesser General Public License (as published by the Free -c Software Foundation) version 2.1 dated February 1999. -c -c $Revision$ -cEHEADER********************************************************************** -c----------------------------------------------------------------------- -c Test driver for unstructured matrix-vector interface -c----------------------------------------------------------------------- +! Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +! HYPRE Project Developers. See the top-level COPYRIGHT file for details. +! +! SPDX-License-Identifier: (Apache-2.0 OR MIT) + +!----------------------------------------------------------------------- +! Test driver for unstructured matrix-vector interface +!----------------------------------------------------------------------- program test @@ -58,18 +52,18 @@ double precision xvals(MAXZONS) double precision sum -c----------------------------------------------------------------------- -c Initialize MPI -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Initialize MPI +!----------------------------------------------------------------------- call MPI_INIT(ierr) call MPI_COMM_RANK(MPI_COMM_WORLD, myid, ierr) call MPI_COMM_SIZE(MPI_COMM_WORLD, num_procs, ierr) -c----------------------------------------------------------------------- -c Set defaults -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Set defaults +!----------------------------------------------------------------------- dim = 3 @@ -85,31 +79,31 @@ cy = 1.0 cz = 1.0 -c----------------------------------------------------------------------- -c Read options -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Read options +!----------------------------------------------------------------------- -c open( 5, file='parcsr_matrix_vector.in', status='old') -c -c read( 5, *) dim -c -c read( 5, *) nx -c read( 5, *) ny -c read( 5, *) nz -c -c read( 5, *) Px -c read( 5, *) Py -c read( 5, *) Pz -c -c read( 5, *) cx -c read( 5, *) cy -c read( 5, *) cz -c -c write(6,*) 'Generate matrix? !0 yes, 0 no (from file)' +! open( 5, file='parcsr_matrix_vector.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, *) cx +! read( 5, *) cy +! read( 5, *) cz +! +! write(6,*) 'Generate matrix? !0 yes, 0 no (from file)' read(5,*) generate_matrix if (generate_matrix .eq. 0) then -c write(6,*) 'What file to use for matrix (<= 32 chars)?' +! write(6,*) 'What file to use for matrix (<= 32 chars)?' read(5,*) matfile_str i = 1 100 if (matfile_str(i:i) .ne. ' ') then @@ -122,12 +116,12 @@ 200 matfile(i) = char(0) endif -c write(6,*) 'Generate vector? !0 yes, 0 no (from file)' +! write(6,*) 'Generate vector? !0 yes, 0 no (from file)' read(5,*) generate_vec if (generate_vec .eq. 0) then -c write(6,*) -c & 'What file to use for vector (<= 32 chars)?' +! write(6,*) +! & 'What file to use for vector (<= 32 chars)?' read(5,*) vecfile_str i = 1 300 if (vecfile_str(i:i) .ne. ' ') then @@ -140,11 +134,11 @@ 400 vecfile(i) = char(0) endif -c close( 5 ) +! close( 5 ) -c----------------------------------------------------------------------- -c Check a few things -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Check a few things +!----------------------------------------------------------------------- if ((Px*Py*Pz) .ne. num_procs) then print *, 'Error: Invalid number of processors or topology' @@ -161,9 +155,9 @@ stop endif -c----------------------------------------------------------------------- -c Print driver parameters -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Print driver parameters +!----------------------------------------------------------------------- if (myid .eq. 0) then print *, 'Matrix built with these parameters:' @@ -173,33 +167,33 @@ print *, ' dim = ', dim endif -c----------------------------------------------------------------------- -c Compute some grid and processor information -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Compute some grid and processor information +!----------------------------------------------------------------------- if (dim .eq. 1) then -c compute p from Px and myid +! compute p from Px and myid p = mod(myid,Px) elseif (dim .eq. 2) then -c compute p,q from Px, Py and myid +! compute p,q from Px, Py and myid p = mod(myid,Px) q = mod(((myid - p)/Px),Py) elseif (dim .eq. 3) then -c compute p,q,r from Px,Py,Pz and myid +! compute p,q,r from Px,Py,Pz and myid p = mod(myid,Px) q = mod((( myid - p)/Px),Py) r = (myid - (p + Px*q))/(Px*Py) endif -c---------------------------------------------------------------------- -c Set up the matrix -c----------------------------------------------------------------------- +!---------------------------------------------------------------------- +! Set up the matrix +!----------------------------------------------------------------------- values(2) = -cx values(3) = -cy @@ -210,11 +204,11 @@ if (ny .gt. 1) values(1) = values(1) + 2d0*cy if (nz .gt. 1) values(1) = values(1) + 2d0*cz -c Generate a Dirichlet Laplacian +! Generate a Dirichlet Laplacian if (generate_matrix .gt. 0) then -c Standard 7-point laplacian in 3D with grid and anisotropy -c determined as user settings. +! Standard 7-point laplacian in 3D with grid and anisotropy +! determined as user settings. call HYPRE_GenerateLaplacian(MPI_COMM_WORLD, nx, ny, nz, & Px, Py, Pz, p, q, r, values, @@ -269,9 +263,9 @@ if (ierr .ne. 0) write(6,*) 'Matrix print failed' -c----------------------------------------------------------------------- -c "RHS vector" test -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! "RHS vector" test +!----------------------------------------------------------------------- if (generate_vec .gt. 0) then call HYPRE_IJVectorCreate(MPI_COMM_WORLD, first_local_row, & last_local_row, b, ierr) @@ -286,7 +280,7 @@ if (ierr .ne. 0) write(6,*) 'RHS vector initialization failed' -c Set up a Dirichlet 0 problem +! Set up a Dirichlet 0 problem do i = 1, last_local_row - first_local_row + 1 indices(i) = first_local_row - 1 + i vals(i) = 0. @@ -326,8 +320,8 @@ if (ierr .ne. 0) write(6,*) 'RHS vector value retrieval failed' -c Set about to modify every other component of b, by adding the -c negative of the component +! Set about to modify every other component of b, by adding the +! negative of the component do i = 1, last_local_row - first_local_row + 1, 2 indices(i) = first_local_row - 1 + i @@ -355,9 +349,9 @@ if (sum .ne. 0.) write(6,*) 'RHS vector value addition error' -c----------------------------------------------------------------------- -c "Solution vector" test -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! "Solution vector" test +!----------------------------------------------------------------------- call HYPRE_IJVectorCreate(MPI_COMM_WORLD, first_local_col, & last_local_col, x, ierr) @@ -424,15 +418,15 @@ & write(6,*) 'Solution vector value addition error,', & ' last_local_col' -c----------------------------------------------------------------------- -c Finalize things -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Finalize things +!----------------------------------------------------------------------- call HYPRE_ParCSRMatrixDestroy(A_storage, ierr) call HYPRE_IJVectorDestroy(b, ierr) call HYPRE_IJVectorDestroy(x, ierr) -c Finalize MPI +! Finalize MPI call MPI_FINALIZE(ierr) diff -Nru hypre-2.16.0/src/test/f77_struct.f hypre-2.18.2/src/test/f77_struct.f --- hypre-2.16.0/src/test/f77_struct.f 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/f77_struct.f 2019-10-28 22:30:04.000000000 +0000 @@ -1,23 +1,16 @@ -cBHEADER********************************************************************** -c Copyright (c) 2008, Lawrence Livermore National Security, LLC. -c Produced at the Lawrence Livermore National Laboratory. -c This file is part of HYPRE. See file COPYRIGHT for details. -c -c HYPRE is free software; you can redistribute it and/or modify it under the -c terms of the GNU Lesser General Public License (as published by the Free -c Software Foundation) version 2.1 dated February 1999. -c -c $Revision$ -cEHEADER********************************************************************** - -c----------------------------------------------------------------------- -c Test driver for structured matrix interface (structured storage) -c----------------------------------------------------------------------- +! Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +! HYPRE Project Developers. See the top-level COPYRIGHT file for details. +! +! SPDX-License-Identifier: (Apache-2.0 OR MIT) + +!----------------------------------------------------------------------- +! Test driver for structured matrix interface (structured storage) +!----------------------------------------------------------------------- -c----------------------------------------------------------------------- -c Standard 7-point laplacian in 3D with grid and anisotropy determined -c as user settings. -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Standard 7-point laplacian in 3D with grid and anisotropy determined +! as user settings. +!----------------------------------------------------------------------- program test @@ -45,22 +38,22 @@ integer num_iterations double precision final_res_norm -c HYPRE_StructMatrix A -c HYPRE_StructVector b -c HYPRE_StructVector x +! HYPRE_StructMatrix A +! HYPRE_StructVector b +! HYPRE_StructVector x integer*8 A integer*8 b integer*8 x -c HYPRE_StructSolver solver -c HYPRE_StructSolver precond +! HYPRE_StructSolver solver +! HYPRE_StructSolver precond integer*8 solver integer*8 precond -c HYPRE_StructGrid grid -c HYPRE_StructStencil stencil +! HYPRE_StructGrid grid +! HYPRE_StructStencil stencil integer*8 grid integer*8 stencil @@ -89,9 +82,9 @@ data zero / 0 / data one / 1 / -c----------------------------------------------------------------------- -c Initialize MPI -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Initialize MPI +!----------------------------------------------------------------------- call MPI_INIT(ierr) @@ -99,9 +92,9 @@ call MPI_COMM_SIZE(MPI_COMM_WORLD, num_procs, ierr) -c----------------------------------------------------------------------- -c Set defaults -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Set defaults +!----------------------------------------------------------------------- dim = 3 @@ -130,40 +123,40 @@ istart(2) = -3 istart(3) = -3 -c----------------------------------------------------------------------- -c Read options -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Read options +!----------------------------------------------------------------------- -c open( 5, file='struct_linear_solver.in', status='old') -c -c read( 5, *) dim -c -c read( 5, *) nx -c read( 5, *) ny -c read( 5, *) nz -c -c read( 5, *) Px -c read( 5, *) Py -c read( 5, *) Pz -c -c read( 5, *) bx -c read( 5, *) by -c read( 5, *) bz -c -c read( 5, *) cx -c read( 5, *) cy -c read( 5, *) cz -c -c read( 5, *) n_pre -c read( 5, *) n_post -c -c read( 5, *) solver_id -c -c close( 5 ) - -c----------------------------------------------------------------------- -c Check a few things -c----------------------------------------------------------------------- +! 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 ) + +!----------------------------------------------------------------------- +! Check a few things +!----------------------------------------------------------------------- if ((Px*Py*Pz) .ne. num_procs) then print *, 'Error: Invalid number of processors or topology' @@ -185,9 +178,9 @@ stop endif -c----------------------------------------------------------------------- -c Print driver parameters -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Print driver parameters +!----------------------------------------------------------------------- if (myid .eq. 0) then print *, 'Running with these driver parameters:' @@ -200,45 +193,45 @@ print *, ' solver ID = ', solver_id endif -c----------------------------------------------------------------------- -c Set up dxyz for PFMG solver -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Set up dxyz for PFMG solver +!----------------------------------------------------------------------- dxyz(1) = dsqrt(1.d0 / cx) dxyz(2) = dsqrt(1.d0 / cy) dxyz(3) = dsqrt(1.d0 / cz) -c----------------------------------------------------------------------- -c Compute some grid and processor information -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Compute some grid and processor information +!----------------------------------------------------------------------- if (dim .eq. 1) then volume = nx nblocks = bx -c compute p from Px and myid +! compute p from Px and myid p = mod(myid,Px) elseif (dim .eq. 2) then volume = nx*ny nblocks = bx*by -c compute p,q from Px, Py and myid +! compute p,q from Px, Py and myid p = mod(myid,Px) q = mod(((myid - p)/Px),Py) elseif (dim .eq. 3) then volume = nx*ny*nz nblocks = bx*by*bz -c compute p,q,r from Px,Py,Pz and myid +! compute p,q,r from Px,Py,Pz and myid p = mod(myid,Px) q = mod((( myid - p)/Px),Py) r = (myid - (p + Px*q))/(Px*Py) endif -c---------------------------------------------------------------------- -c Compute ilower and iupper from (p,q,r), (bx,by,bz), and (nx,ny,nz) -c and set up the grid structure. -c---------------------------------------------------------------------- +!---------------------------------------------------------------------- +! Compute ilower and iupper from (p,q,r), (bx,by,bz), and (nx,ny,nz) +! and set up the grid structure. +!---------------------------------------------------------------------- ib = 1 if (dim .eq. 1) then @@ -280,9 +273,9 @@ enddo call HYPRE_StructGridAssemble(grid, ierr) -c---------------------------------------------------------------------- -c Compute the offsets and set up the stencil structure. -c---------------------------------------------------------------------- +!---------------------------------------------------------------------- +! Compute the offsets and set up the stencil structure. +!---------------------------------------------------------------------- if (dim .eq. 1) then offsets(1,1) = -1 @@ -315,9 +308,9 @@ & offsets(1,s), ierr) enddo -c----------------------------------------------------------------------- -c Set up the matrix structure -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Set up the matrix structure +!----------------------------------------------------------------------- do i=1,dim A_num_ghost(2*i - 1) = 1 @@ -330,9 +323,9 @@ call HYPRE_StructMatrixSetNumGhost(A, A_num_ghost, ierr) call HYPRE_StructMatrixInitialize(A, ierr) -c----------------------------------------------------------------------- -c Set the coefficients for the grid -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Set the coefficients for the grid +!----------------------------------------------------------------------- do s=1,(dim + 1) stencil_indices(s) = s - 1 @@ -359,9 +352,9 @@ & iupper(1,ib), (dim+1), stencil_indices, values, ierr) enddo -c----------------------------------------------------------------------- -c Zero out stencils reaching to real boundary -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Zero out stencils reaching to real boundary +!----------------------------------------------------------------------- do i=1,volume values(i) = 0.0 @@ -380,12 +373,12 @@ enddo call HYPRE_StructMatrixAssemble(A, ierr) -c call HYPRE_StructMatrixPrint(A, zero, ierr) -c call HYPRE_StructMatrixPrint("driver.out.A", A, zero, ierr) +! call HYPRE_StructMatrixPrint(A, zero, ierr) +! call HYPRE_StructMatrixPrint("driver.out.A", A, zero, ierr) -c----------------------------------------------------------------------- -c Set up the rhs and initial guess -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Set up the rhs and initial guess +!----------------------------------------------------------------------- call HYPRE_StructVectorCreate(MPI_COMM_WORLD, grid, b, ierr) call HYPRE_StructVectorInitialize(b, ierr) @@ -397,7 +390,7 @@ & iupper(1,ib), values, ierr) enddo call HYPRE_StructVectorAssemble(b, ierr) -c call HYPRE_StructVectorPrint("driver.out.b", b, zero, ierr) +! call HYPRE_StructVectorPrint("driver.out.b", b, zero, ierr) call HYPRE_StructVectorCreate(MPI_COMM_WORLD, grid, x, ierr) call HYPRE_StructVectorInitialize(x, ierr) @@ -409,15 +402,15 @@ & iupper(1,ib), values, ierr) enddo call HYPRE_StructVectorAssemble(x, ierr) -c call HYPRE_StructVectorPrint(x, zero, ierr) -c call HYPRE_StructVectorPrint("driver.out.x0", x, zero, ierr) +! call HYPRE_StructVectorPrint(x, zero, ierr) +! call HYPRE_StructVectorPrint("driver.out.x0", x, zero, ierr) -c----------------------------------------------------------------------- -c Solve the linear system -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Solve the linear system +!----------------------------------------------------------------------- -c General solver parameters, passing hard coded constants -c will break the interface. +! General solver parameters, passing hard coded constants +! will break the interface. maxiter = 50 dscgmaxiter = 100 pcgmaxiter = 50 @@ -425,7 +418,7 @@ convtol = 0.9 if (solver_id .eq. 0) then -c Solve the system using SMG +! Solve the system using SMG call HYPRE_StructSMGCreate(MPI_COMM_WORLD, solver, ierr) call HYPRE_StructSMGSetMemoryUse(solver, zero, ierr) @@ -446,17 +439,17 @@ & ierr) call HYPRE_StructSMGDestroy(solver, ierr) elseif (solver_id .eq. 1) then -c Solve the system using PFMG +! 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_StructPFMGSetRelChange(solver, zero, ierr) -c weighted Jacobi = 1; red-black GS = 2 +! weighted Jacobi = 1; red-black GS = 2 call HYPRE_StructPFMGSetRelaxType(solver, one, ierr) call HYPRE_StructPFMGSetNumPreRelax(solver, n_pre, ierr) call HYPRE_StructPFMGSetNumPostRelax(solver, n_post, ierr) -c call HYPRE_StructPFMGSetDxyz(solver, dxyz, ierr) +! call HYPRE_StructPFMGSetDxyz(solver, dxyz, ierr) call HYPRE_StructPFMGSetLogging(solver, one, ierr) call HYPRE_StructPFMGSetup(solver, A, b, x, ierr) @@ -468,7 +461,7 @@ & ierr) call HYPRE_StructPFMGDestroy(solver, ierr) elseif ((solver_id .gt. 9) .and. (solver_id .lt. 20)) then -c Solve the system using CG +! Solve the system using CG precond_id = -1 call HYPRE_StructPCGCreate(MPI_COMM_WORLD, solver, ierr) @@ -479,7 +472,7 @@ call HYPRE_StructPCGSetLogging(solver, one, ierr) if (solver_id .eq. 10) then -c use symmetric SMG as preconditioner +! use symmetric SMG as preconditioner precond_id = 0 maxiter = 1 tol = 0.0 @@ -496,7 +489,7 @@ call HYPRE_StructPCGSetPrecond(solver, precond_id, precond, & ierr) elseif (solver_id .eq. 11) then -c use symmetric PFMG as preconditioner +! use symmetric PFMG as preconditioner precond_id = 1 maxiter = 1 tol = 0.0 @@ -505,24 +498,24 @@ & ierr) call HYPRE_StructPFMGSetMaxIter(precond, maxiter, ierr) call HYPRE_StructPFMGSetTol(precond, tol, ierr) -c weighted Jacobi = 1; red-black GS = 2 +! 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) -c call HYPRE_StructPFMGSetDxyz(precond, dxyz, ierr) +! 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 -c use diagonal scaling as preconditioner +! use diagonal scaling as preconditioner precond_id = 8 precond = zero call HYPRE_StructPCGSetPrecond(solver, precond_id, precond, & ierr) elseif (solver_id .eq. 19) then -c use diagonal scaling as preconditioner +! use diagonal scaling as preconditioner precond_id = 9 call HYPRE_StructPCGSetPrecond(solver, precond_id, precond, @@ -545,7 +538,7 @@ call HYPRE_StructPFMGDestroy(precond, ierr) endif elseif ((solver_id .gt. 19) .and. (solver_id .le. 30)) then -c Solve the system using Hybrid +! Solve the system using Hybrid precond_id = -1 call HYPRE_StructHybridCreate(MPI_COMM_WORLD, solver, ierr) @@ -558,7 +551,7 @@ call HYPRE_StructHybridSetLogging(solver, one, ierr) if (solver_id .eq. 20) then -c use symmetric SMG as preconditioner +! use symmetric SMG as preconditioner precond_id = 0 maxiter = 1 tol = 0.0 @@ -572,7 +565,7 @@ call HYPRE_StructSMGSetNumPostRelax(precond, n_post, ierr) call HYPRE_StructSMGSetLogging(precond, zero, ierr) elseif (solver_id .eq. 21) then -c use symmetric PFMG as preconditioner +! use symmetric PFMG as preconditioner precond_id = 1 maxiter = 1 tol = 0.0 @@ -581,11 +574,11 @@ & ierr) call HYPRE_StructPFMGSetMaxIter(precond, maxiter, ierr) call HYPRE_StructPFMGSetTol(precond, tol, ierr) -c weighted Jacobi = 1; red-black GS = 2 +! 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) -c call HYPRE_StructPFMGSetDxyz(precond, dxyz, ierr) +! call HYPRE_StructPFMGSetDxyz(precond, dxyz, ierr) call HYPRE_StructPFMGSetLogging(precond, zero, ierr) endif @@ -609,20 +602,20 @@ endif endif -c----------------------------------------------------------------------- -c Print the solution and other info -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Print the solution and other info +!----------------------------------------------------------------------- -c call HYPRE_StructVectorPrint("driver.out.x", x, zero, ierr) +! 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 endif -c----------------------------------------------------------------------- -c Finalize things -c----------------------------------------------------------------------- +!----------------------------------------------------------------------- +! Finalize things +!----------------------------------------------------------------------- call HYPRE_StructGridDestroy(grid, ierr) call HYPRE_StructStencilDestroy(stencil, ierr) @@ -630,7 +623,7 @@ call HYPRE_StructVectorDestroy(b, ierr) call HYPRE_StructVectorDestroy(x, ierr) -c Finalize MPI +! Finalize MPI call MPI_FINALIZE(ierr) diff -Nru hypre-2.16.0/src/test/fei.cxx hypre-2.18.2/src/test/fei.cxx --- hypre-2.16.0/src/test/fei.cxx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/fei.cxx 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*-------------------------------------------------------------------------- * Test driver for unstructured matrix interface (IJ_matrix interface). diff -Nru hypre-2.16.0/src/test/fei_lscore.c hypre-2.18.2/src/test/fei_lscore.c --- hypre-2.16.0/src/test/fei_lscore.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/fei_lscore.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*-------------------------------------------------------------------------- * Test driver for unstructured matrix interface (IJ_matrix interface). diff -Nru hypre-2.16.0/src/test/fij_mv.f hypre-2.18.2/src/test/fij_mv.f --- hypre-2.16.0/src/test/fij_mv.f 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/fij_mv.f 2019-10-28 22:30:04.000000000 +0000 @@ -1,22 +1,15 @@ -cBHEADER********************************************************************** -c Copyright (c) 2008, Lawrence Livermore National Security, LLC. -c Produced at the Lawrence Livermore National Laboratory. -c This file is part of HYPRE. See file COPYRIGHT for details. -c -c HYPRE is free software; you can redistribute it and/or modify it under the -c terms of the GNU Lesser General Public License (as published by the Free -c Software Foundation) version 2.1 dated February 1999. -c -c $Revision$ -cEHEADER********************************************************************** - -c***************************************************************************** -c HYPRE_IJMatrix Fortran interface -c***************************************************************************** - -c-------------------------------------------------------------------------- -c HYPRE_IJMatrixCreate -c-------------------------------------------------------------------------- +! Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +! HYPRE Project Developers. See the top-level COPYRIGHT file for details. +! +! SPDX-License-Identifier: (Apache-2.0 OR MIT) + +!***************************************************************************** +! HYPRE_IJMatrix Fortran interface +!***************************************************************************** + +!-------------------------------------------------------------------------- +! HYPRE_IJMatrixCreate +!-------------------------------------------------------------------------- subroutine fhypre_ijmatrixcreate(fcomm, filower, fiupper, 1 fjlower, fjupper, fmatrix) @@ -38,9 +31,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJMatrixDestroy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJMatrixDestroy +!-------------------------------------------------------------------------- subroutine fhypre_ijmatrixdestroy(fmatrix) integer ierr @@ -55,9 +48,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJMatrixInitialize -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJMatrixInitialize +!-------------------------------------------------------------------------- subroutine fhypre_ijmatrixinitialize(fmatrix) integer ierr @@ -72,9 +65,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJMatrixAssemble -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJMatrixAssemble +!-------------------------------------------------------------------------- subroutine fhypre_ijmatrixassemble(fmatrix) integer ierr @@ -89,9 +82,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJMatrixSetRowSizes -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJMatrixSetRowSizes +!-------------------------------------------------------------------------- subroutine fhypre_ijmatrixsetrowsizes(fmatrix, fizes) integer ierr @@ -107,9 +100,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJMatrixSetDiagOffdSizes -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJMatrixSetDiagOffdSizes +!-------------------------------------------------------------------------- subroutine fhypre_ijmatrixsetdiagoffdsizes(fmatrix, fdiag_sizes, 1 foffd_sizes) @@ -128,9 +121,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJMatrixSetValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJMatrixSetValues +!-------------------------------------------------------------------------- subroutine fhypre_ijmatrixsetvalues(fmatrix, fnrows, fncols, 1 frows, fcols, fvalues) @@ -152,9 +145,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJMatrixAddToValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJMatrixAddToValues +!-------------------------------------------------------------------------- subroutine fhypre_ijmatrixaddtovalues(fmatrix, fnrows, fncols, 1 frows, fcols, fvalues) @@ -176,9 +169,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJMatrixSetObjectType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJMatrixSetObjectType +!-------------------------------------------------------------------------- subroutine fhypre_ijmatrixsetobjecttype(fmatrix, ftype) integer ierr @@ -194,9 +187,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJMatrixGetObjectType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJMatrixGetObjectType +!-------------------------------------------------------------------------- subroutine fhypre_ijmatrixgetobjecttype(fmatrix, ftype) integer ierr @@ -212,9 +205,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJMatrixGetObject -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJMatrixGetObject +!-------------------------------------------------------------------------- subroutine fhypre_ijmatrixgetobject(fmatrix, fobject) integer ierr @@ -230,9 +223,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJMatrixRead -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJMatrixRead +!-------------------------------------------------------------------------- subroutine fhypre_ijmatrixread(ffilename, fcomm, fobject_type, 1 fmatrix) @@ -252,9 +245,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJMatrixPrint -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJMatrixPrint +!-------------------------------------------------------------------------- subroutine fhypre_ijmatrixprint(fmatrix, ffilename) integer ierr @@ -272,9 +265,9 @@ -c-------------------------------------------------------------------------- -c hypre_IJMatrixSetObject -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! hypre_IJMatrixSetObject +!-------------------------------------------------------------------------- subroutine fhypre_ijmatrixsetobject(fmatrix, fobject) integer ierr @@ -292,9 +285,9 @@ -c-------------------------------------------------------------------------- -c HYPRE_IJVectorCreate -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJVectorCreate +!-------------------------------------------------------------------------- subroutine fhypre_ijvectorcreate(fcomm, fjlower, fjupper, fvector) integer ierr @@ -312,9 +305,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJVectorDestroy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJVectorDestroy +!-------------------------------------------------------------------------- subroutine fhypre_ijvectordestroy(fvector) integer ierr @@ -329,9 +322,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJVectorInitialize -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJVectorInitialize +!-------------------------------------------------------------------------- subroutine fhypre_ijvectorinitialize(fvector) integer ierr @@ -346,9 +339,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJVectorSetValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJVectorSetValues +!-------------------------------------------------------------------------- subroutine fhypre_ijvectorsetvalues(fvector, fnum_values, 1 findices, fvalues) @@ -368,9 +361,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJVectorAddToValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJVectorAddToValues +!-------------------------------------------------------------------------- subroutine fhypre_ijvectoraddtovalues(fvector, fnum_values, 1 findices, fvalues) @@ -390,9 +383,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJVectorAssemble -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJVectorAssemble +!-------------------------------------------------------------------------- subroutine fhypre_ijvectorassemble(fvector) integer ierr @@ -407,9 +400,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJVectorGetValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJVectorGetValues +!-------------------------------------------------------------------------- subroutine fhypre_ijvectorgetvalues(fvector, fnum_values, 1 findices, fvalues) @@ -429,9 +422,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJVectorSetObjectType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJVectorSetObjectType +!-------------------------------------------------------------------------- subroutine fhypre_ijvectorsetobjecttype(fvector, ftype) integer ierr @@ -447,9 +440,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJVectorGetObjectType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJVectorGetObjectType +!-------------------------------------------------------------------------- subroutine fhypre_ijvectorgetobjecttype(fvector, ftype) integer ierr @@ -465,9 +458,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJVectorGetObject -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJVectorGetObject +!-------------------------------------------------------------------------- subroutine fhypre_ijvectorgetobject(fvector, fobject) integer ierr @@ -483,9 +476,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJVectorRead -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJVectorRead +!-------------------------------------------------------------------------- subroutine fhypre_ijvectorread(ffilename, fcomm, fobject_type, 1 fvector) @@ -505,9 +498,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_IJVectorPrint -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_IJVectorPrint +!-------------------------------------------------------------------------- subroutine fhypre_ijvectorprint(fvector, ffilename) integer ierr diff -Nru hypre-2.16.0/src/test/for_maxwell.c hypre-2.18.2/src/test/for_maxwell.c --- hypre-2.16.0/src/test/for_maxwell.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/for_maxwell.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/test/fparcsr_ls.f hypre-2.18.2/src/test/fparcsr_ls.f --- hypre-2.16.0/src/test/fparcsr_ls.f 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/fparcsr_ls.f 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,11 @@ -cBHEADER********************************************************************** -c Copyright (c) 2008, Lawrence Livermore National Security, LLC. -c Produced at the Lawrence Livermore National Laboratory. -c This file is part of HYPRE. See file COPYRIGHT for details. -c -c HYPRE is free software; you can redistribute it and/or modify it under the -c terms of the GNU Lesser General Public License (as published by the Free -c Software Foundation) version 2.1 dated February 1999. -c -c $Revision$ -cEHEADER********************************************************************** - -c-------------------------------------------------------------------------- -c GenerateLaplacian -c-------------------------------------------------------------------------- +! Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +! HYPRE Project Developers. See the top-level COPYRIGHT file for details. +! +! SPDX-License-Identifier: (Apache-2.0 OR MIT) + +!-------------------------------------------------------------------------- +! GenerateLaplacian +!-------------------------------------------------------------------------- subroutine fhypre_generatelaplacian(fcom, fnx, fny, fnz, 1 fcapp, fcapq, fcapr, 1 fp, fq, fr, @@ -36,9 +29,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGCreate -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGCreate +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgcreate(fsolver) integer ierr @@ -53,9 +46,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGDestroy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGDestroy +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgdestroy(fsolver) integer ierr @@ -70,9 +63,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetup -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetup +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetup(fsolver, fA, fb, fx) integer ierr @@ -90,9 +83,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSolve -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSolve +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsolve(fsolver, fA, fb, fx) integer ierr @@ -110,9 +103,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSolveT -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSolveT +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsolvet(fsolver, fA, fb, fx) integer ierr @@ -130,9 +123,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetRestriction -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetRestriction +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetrestriction(fsolver, frestr_par) integer ierr @@ -148,9 +141,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetMaxLevels -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetMaxLevels +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetmaxlevels(fsolver, fmaxlvl) integer ierr @@ -166,9 +159,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetMaxLevels -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetMaxLevels +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetmaxlevels(fsolver, fmaxlvl) integer ierr @@ -184,9 +177,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetStrongThreshold -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetStrongThreshold +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetstrongthrshl(fsolver, fstrong) integer ierr @@ -202,9 +195,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetStrongThreshold -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetStrongThreshold +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetstrongthrshl(fsolver, fstrong) integer ierr @@ -220,9 +213,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetMaxRowSum -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetMaxRowSum +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetmaxrowsum(fsolver, fmaxrowsum) integer ierr @@ -238,9 +231,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetMaxRowSum -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetMaxRowSum +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetmaxrowsum(fsolver, fmaxrowsum) integer ierr @@ -256,9 +249,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetTruncFactor -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetTruncFactor +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsettruncfactor(fsolver, ftrunc_factor) integer ierr @@ -274,9 +267,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetTruncFactor -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetTruncFactor +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggettruncfactor(fsolver, ftrunc_factor) integer ierr @@ -292,9 +285,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetSCommPkgSwitch -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetSCommPkgSwitch +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetscommpkgswit(fsolver, fcommswtch) integer ierr @@ -310,9 +303,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetInterpType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetInterpType +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetinterptype(fsolver, finterp) integer ierr @@ -328,9 +321,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetMinIter -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetMinIter +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetminiter(fsolver, fminiter) integer ierr @@ -346,9 +339,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetMaxIter -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetMaxIter +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetmaxiter(fsolver, fmaxiter) integer ierr @@ -364,9 +357,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetMaxIter -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetMaxIter +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetmaxiter(fsolver, fmaxiter) integer ierr @@ -382,9 +375,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetCoarsenType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetCoarsenType +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetcoarsentype(fsolver, fcoarsen) integer ierr @@ -400,9 +393,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetCoarsenType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetCoarsenType +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetcoarsentype(fsolver, fcoarsen) integer ierr @@ -418,9 +411,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetMeasureType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetMeasureType +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetmeasuretype(fsolver, fmeasure) integer ierr @@ -436,9 +429,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetMeasureType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetMeasureType +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetmeasuretype(fsolver, fmeasure) integer ierr @@ -454,9 +447,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetSetupType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetSetupType +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetsetuptype(fsolver, fsetup) integer ierr @@ -472,9 +465,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetCycleType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetCycleType +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetcycletype(fsolver, fcycle) integer ierr @@ -490,9 +483,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetCycleType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetCycleType +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetcycletype(fsolver, fcycle) integer ierr @@ -508,9 +501,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetTol -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetTol +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsettol(fsolver, ftol) integer ierr @@ -526,9 +519,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetTol -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetTol +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggettol(fsolver, ftol) integer ierr @@ -544,9 +537,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetNumSweeps -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetNumSweeps +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetnumsweeps(fsolver, fnumsweeps) integer ierr @@ -562,9 +555,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetCycleNumSweeps -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetCycleNumSweeps +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetcyclenumswee(fsolver, fnumsweeps, 1 fk) @@ -583,9 +576,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetCycleNumSweeps -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetCycleNumSweeps +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetcyclenumswee(fsolver, fnumsweeps, 1 fk) @@ -603,9 +596,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGInitGridRelaxation -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGInitGridRelaxation +!-------------------------------------------------------------------------- subroutine fhypre_boomeramginitgridrelaxat(fnumsweeps, fgridtype, 1 fgridrelax, fcoarsen, 2 frelaxwt, fmaxlvl) @@ -629,9 +622,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGFinalizeGridRelaxation -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGFinalizeGridRelaxation +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgfingridrelaxatn(fnumsweeps, fgridtype, 1 fgridrelax, frelaxwt) @@ -641,19 +634,19 @@ integer*8 fgridrelax integer*8 frelaxwt -c hypre_TFree(num_grid_sweeps); -c hypre_TFree(grid_relax_type); -c hypre_TFree(grid_relax_points); -c hypre_TFree(relax_weights); +! hypre_TFree(num_grid_sweeps); +! hypre_TFree(grid_relax_type); +! hypre_TFree(grid_relax_points); +! hypre_TFree(relax_weights); ierr = 0 return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetRelaxType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetRelaxType +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetrelaxtype(fsolver, frelaxtype) integer ierr @@ -669,9 +662,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetCycleRelaxType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetCycleRelaxType +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetcyclerelaxty(fsolver, frelaxtype, 1 fk) @@ -690,9 +683,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetCycleRelaxType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetCycleRelaxType +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetcyclerelaxty(fsolver, frelaxtype, 1 fk) @@ -711,9 +704,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetRelaxOrder -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetRelaxOrder +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetrelaxorder(fsolver, frlxorder) integer ierr @@ -729,9 +722,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetRelaxWt -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetRelaxWt +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetrelaxwt(fsolver, frelaxwt) integer ierr @@ -747,9 +740,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetLevelRelaxWt -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetLevelRelaxWt +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetlevelrelaxwt(fsolver, frelaxwt, 1 flevel) @@ -768,9 +761,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetOuterWt -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetOuterWt +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetouterwt(fsolver, fouterwt) integer ierr @@ -786,9 +779,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetLevelOuterWt -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetLevelOuterWt +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetlevelouterwt(fsolver, fouterwt, 1 flevel) @@ -807,9 +800,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetSmoothType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetSmoothType +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetsmoothtype(fsolver, fsmooth) integer ierr @@ -825,9 +818,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetSmoothType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetSmoothType +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetsmoothtype(fsolver, fsmooth) integer ierr @@ -843,9 +836,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetSmoothNumLvls -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetSmoothNumLvls +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetsmoothnumlvl(fsolver, fsmooth) integer ierr @@ -861,9 +854,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetSmoothNumLvls -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetSmoothNumLvls +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetsmoothnumlvl(fsolver, fsmooth) integer ierr @@ -879,9 +872,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetSmoothNumSwps -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetSmoothNumSwps +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetsmoothnumswp(fsolver, fsmooth) integer ierr @@ -897,9 +890,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetSmoothNumSwps -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetSmoothNumSwps +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetsmoothnumswp(fsolver, fsmooth) integer ierr @@ -915,9 +908,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetLogging -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetLogging +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetlogging(fsolver, flogging) integer ierr @@ -933,9 +926,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetLogging -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetLogging +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetlogging(fsolver, flogging) integer ierr @@ -951,9 +944,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetPrintLevel -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetPrintLevel +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetprintlevel(fsolver, fprintlevel) integer ierr @@ -969,9 +962,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetPrintLevel -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetPrintLevel +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetprintlevel(fsolver, fprintlevel) integer ierr @@ -987,9 +980,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetPrintFileName -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetPrintFileName +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetprintfilenam(fsolver, fname) integer ierr @@ -1005,9 +998,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetDebugFlag -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetDebugFlag +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetdebugflag(fsolver, fdebug) integer ierr @@ -1023,9 +1016,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetDebugFlag -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetDebugFlag +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetdebugflag(fsolver, fdebug) integer ierr @@ -1041,9 +1034,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetNumIterations -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetNumIterations +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetnumiteration(fsolver, fnumiter) integer ierr @@ -1059,9 +1052,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetCumNumIterations -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetCumNumIterations +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetcumnumiterat(fsolver, fnumiter) integer ierr @@ -1077,9 +1070,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetResidual -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetResidual +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetresidual(fsolver, fresid) integer ierr @@ -1095,9 +1088,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetFinalRelativeResidual -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetFinalRelativeResidual +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetfinalreltvre(fsolver, frelresid) integer ierr @@ -1113,9 +1106,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetVariant -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetVariant +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetvariant(fsolver, fvariant) integer ierr @@ -1131,9 +1124,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetVariant -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetVariant +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetvariant(fsolver, fvariant) integer ierr @@ -1149,9 +1142,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetOverlap -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetOverlap +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetoverlap(fsolver, foverlap) integer ierr @@ -1167,9 +1160,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetOverlap -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetOverlap +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetoverlap(fsolver, foverlap) integer ierr @@ -1185,9 +1178,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetDomainType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetDomainType +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetdomaintype(fsolver, fdomain) integer ierr @@ -1203,9 +1196,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetDomainType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetDomainType +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetdomaintype(fsolver, fdomain) integer ierr @@ -1221,9 +1214,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetSchwarzRlxWt -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetSchwarzRlxWt +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetschwarzrlxwt(fsolver, fschwarz) integer ierr @@ -1239,9 +1232,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetSchwarzRlxWt -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetSchwarzRlxWt +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetschwarzrlxwt(fsolver, fschwarz) integer ierr @@ -1257,9 +1250,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetSym -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetSym +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetsym(fsolver, fsym) integer ierr @@ -1275,9 +1268,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetLevel -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetLevel +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetlevel(fsolver, flevel) integer ierr @@ -1293,9 +1286,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetFilter -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetFilter +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetfilter(fsolver, ffilter) integer ierr @@ -1311,9 +1304,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetDropTol -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetDropTol +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetdroptol(fsolver, fdroptol) integer ierr @@ -1329,9 +1322,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetMaxNzPerRow -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetMaxNzPerRow +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetmaxnzperrow(fsolver, fmaxnzperrow) integer ierr @@ -1347,9 +1340,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetEuclidFile -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetEuclidFile +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgseteuclidfile(fsolver, ffile) integer ierr @@ -1365,9 +1358,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetNumFunctions -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetNumFunctions +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetnumfunctions(fsolver, fnfncs) integer ierr @@ -1383,9 +1376,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGGetNumFunctions -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGGetNumFunctions +!-------------------------------------------------------------------------- subroutine fhypre_boomeramggetnumfunctions(fsolver, fnfncs) integer ierr @@ -1401,9 +1394,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetNodal -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetNodal +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetnodal(fsolver, fnodal) integer ierr @@ -1419,9 +1412,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetDofFunc -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetDofFunc +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetdoffunc(fsolver, fdoffunc) integer ierr @@ -1437,9 +1430,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetNumPaths -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetNumPaths +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetnumpaths(fsolver, fnumpaths) integer ierr @@ -1455,9 +1448,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetAggNumLevels -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetAggNumLevels +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetaggnumlevels(fsolver, fagglvl) integer ierr @@ -1473,9 +1466,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetGSMG -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetGSMG +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetgsmg(fsolver, fgsmg) integer ierr @@ -1491,9 +1484,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_BoomerAMGSetNumSamples -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_BoomerAMGSetNumSamples +!-------------------------------------------------------------------------- subroutine fhypre_boomeramgsetnumsamples(fsolver, fsamples) integer ierr @@ -1509,9 +1502,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRBiCGSTABCreate -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRBiCGSTABCreate +!-------------------------------------------------------------------------- subroutine fhypre_parcsrbicgstabcreate(fcomm, fsolver) integer fcomm @@ -1527,9 +1520,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRBiCGSTABDestroy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRBiCGSTABDestroy +!-------------------------------------------------------------------------- subroutine fhypre_parcsrbicgstabdestroy(fsolver) integer ierr @@ -1544,9 +1537,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRBiCGSTABSetup -c------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRBiCGSTABSetup +!------------------------------------------------------------------------- subroutine fhypre_parcsrbicgstabsetup(fsolver, fA, fb, fx) integer ierr @@ -1564,9 +1557,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRBiCGSTABSolve -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRBiCGSTABSolve +!-------------------------------------------------------------------------- subroutine fhypre_parcsrbicgstabsolve(fsolver, fA, fb, fx) integer ierr @@ -1584,9 +1577,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRBiCGSTABSetTol -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRBiCGSTABSetTol +!------------------------------------------------------------------------- subroutine fhypre_parcsrbicgstabsettol(fsolver, ftol) integer ierr @@ -1602,9 +1595,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRBiCGSTABSetMinIter -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRBiCGSTABSetMinIter +!------------------------------------------------------------------------- subroutine fhypre_parcsrbicgstabsetminiter(fsolver, fminiter) integer ierr @@ -1620,9 +1613,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRBiCGSTABSetMaxIter -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRBiCGSTABSetMaxIter +!------------------------------------------------------------------------- subroutine fhypre_parcsrbicgstabsetmaxiter(fsolver, fmaxiter) integer ierr @@ -1638,9 +1631,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRBiCGSTABSetStopCrit -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRBiCGSTABSetStopCrit +!------------------------------------------------------------------------- subroutine fhypre_parcsrbicgstabsetstopcrit(fsolver, fstopcrit) integer ierr @@ -1656,9 +1649,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRBiCGSTABSetPrecond -c-------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRBiCGSTABSetPrecond +!-------------------------------------------------------------------------- subroutine fhypre_parcsrbicgstabsetprecond(fsolver, fprecond_id, 1 fprecond) @@ -1677,9 +1670,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRBiCGSTABGetPrecond -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRBiCGSTABGetPrecond +!------------------------------------------------------------------------- subroutine fhypre_parcsrbicgstabgetprecond(fsolver, fprecond) integer ierr @@ -1695,9 +1688,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRBiCGSTABSetLogging -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRBiCGSTABSetLogging +!------------------------------------------------------------------------- subroutine fhypre_parcsrbicgstabsetlogging(fsolver, flog) integer ierr @@ -1713,9 +1706,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRBiCGSTABSetPrintLevel -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRBiCGSTABSetPrintLevel +!------------------------------------------------------------------------- subroutine fhypre_parcsrbicgstabsetprintle(fsolver, fprntlvl) integer ierr @@ -1731,9 +1724,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRBiCGSTABGetNumIter -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRBiCGSTABGetNumIter +!------------------------------------------------------------------------- subroutine fhypre_parcsrbicgstabgetnumiter(fsolver, fnumiter) integer ierr @@ -1749,9 +1742,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRBiCGSTABGetFinalRelativeResidualNorm -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRBiCGSTABGetFinalRelativeResidualNorm +!------------------------------------------------------------------------- subroutine fhypre_parcsrbicgstabgetfinalre(fsolver, fnorm) integer ierr @@ -1768,9 +1761,9 @@ -c------------------------------------------------------------------------- -c HYPRE_BlockTridiagCreate -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_BlockTridiagCreate +!------------------------------------------------------------------------- subroutine fhypre_blocktridiagcreate(fsolver) integer ierr @@ -1785,9 +1778,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_BlockTridiagDestroy -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_BlockTridiagDestroy +!------------------------------------------------------------------------- subroutine fhypre_blocktridiagdestroy(fsolver) integer ierr @@ -1802,9 +1795,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_BlockTridiagSetup -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_BlockTridiagSetup +!------------------------------------------------------------------------- subroutine fhypre_blocktridiagsetup(fsolver, fA, fb, fx) integer ierr @@ -1822,9 +1815,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_BlockTridiagSolve -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_BlockTridiagSolve +!------------------------------------------------------------------------- subroutine fhypre_blocktridiagsolve(fsolver, fA, fb, fx) integer ierr @@ -1842,9 +1835,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_BlockTridiagSetIndexSet -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_BlockTridiagSetIndexSet +!------------------------------------------------------------------------- subroutine fhypre_blocktridiagsetindexset(fsolver, fn, finds) integer ierr @@ -1861,9 +1854,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_BlockTridiagSetAMGStrengthThreshold -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_BlockTridiagSetAMGStrengthThreshold +!------------------------------------------------------------------------- subroutine fhypre_blocktridiagsetamgstreng(fsolver, fthresh) integer ierr @@ -1881,9 +1874,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_BlockTridiagSetAMGNumSweeps -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_BlockTridiagSetAMGNumSweeps +!------------------------------------------------------------------------- subroutine fhypre_blocktridiagsetamgnumswe(fsolver, fnumsweep) integer ierr @@ -1899,9 +1892,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_BlockTridiagSetAMGRelaxType -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_BlockTridiagSetAMGRelaxType +!------------------------------------------------------------------------- subroutine fhypre_blocktridiagsetamgrelaxt(fsolver, frlxtyp) integer ierr @@ -1917,9 +1910,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_BlockTridiagSetPrintLevel -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_BlockTridiagSetPrintLevel +!------------------------------------------------------------------------- subroutine fhypre_blocktridiagsetprintleve(fsolver, fprntlvl) integer ierr @@ -1937,9 +1930,9 @@ -c------------------------------------------------------------------------- -c HYPRE_ParCSRCGNRCreate -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRCGNRCreate +!------------------------------------------------------------------------- subroutine fhypre_parcsrcgnrcreate(fcomm, fsolver) integer ierr @@ -1955,9 +1948,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRCGNRDestroy -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRCGNRDestroy +!------------------------------------------------------------------------- subroutine fhypre_parcsrcgnrdestroy(fsolver) integer ierr @@ -1972,9 +1965,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRCGNRSetup -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRCGNRSetup +!------------------------------------------------------------------------- subroutine fhypre_parcsrcgnrsetup(fsolver, fA, fb, fx) integer ierr @@ -1991,9 +1984,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRCGNRSolve -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRCGNRSolve +!------------------------------------------------------------------------- subroutine fhypre_parcsrcgnrsolve(fsolver, fA, fb, fx) integer ierr @@ -2010,9 +2003,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRCGNRSetTol -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRCGNRSetTol +!------------------------------------------------------------------------- subroutine fhypre_parcsrcgnrsettol(fsolver, ftol) integer ierr @@ -2028,9 +2021,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRCGNRSetMinIter -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRCGNRSetMinIter +!------------------------------------------------------------------------- subroutine fhypre_parcsrcgnrsetminiter(fsolver, fminiter) integer ierr @@ -2046,9 +2039,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRCGNRSetMaxIter -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRCGNRSetMaxIter +!------------------------------------------------------------------------- subroutine fhypre_parcsrcgnrsetmaxiter(fsolver, fmaxiter) integer ierr @@ -2064,9 +2057,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRCGNRSetStopCrit -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRCGNRSetStopCrit +!------------------------------------------------------------------------- subroutine fhypre_parcsrcgnrsetstopcri(fsolver, fstopcrit) integer ierr @@ -2082,9 +2075,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRCGNRSetPrecond -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRCGNRSetPrecond +!------------------------------------------------------------------------- subroutine fhypre_parcsrcgnrsetprecond(fsolver, fprecond_id, 1 fprecond) @@ -2103,9 +2096,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRCGNRGetPrecond -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRCGNRGetPrecond +!------------------------------------------------------------------------- subroutine fhypre_parcsrcgnrgetprecond(fsolver, fprecond) integer ierr @@ -2121,9 +2114,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRCGNRSetLogging -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRCGNRSetLogging +!------------------------------------------------------------------------- subroutine fhypre_parcsrcgnrsetlogging(fsolver, flog) integer ierr @@ -2139,9 +2132,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRCGNRGetNumIteration -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRCGNRGetNumIteration +!------------------------------------------------------------------------- subroutine fhypre_parcsrcgnrgetnumiteratio(fsolver, fnumiter) integer ierr @@ -2157,9 +2150,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRCGNRGetFinalRelativeResidualNorm -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRCGNRGetFinalRelativeResidualNorm +!------------------------------------------------------------------------- subroutine fhypre_parcsrcgnrgetfinalrelati(fsolver, fnorm) integer ierr @@ -2177,9 +2170,9 @@ -c------------------------------------------------------------------------- -c HYPRE_EuclidCreate -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_EuclidCreate +!------------------------------------------------------------------------- subroutine fhypre_euclidcreate(fcomm, fsolver) integer ierr @@ -2195,9 +2188,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_EuclidDestroy -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_EuclidDestroy +!------------------------------------------------------------------------- subroutine fhypre_eucliddestroy(fsolver) integer ierr @@ -2212,9 +2205,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_EuclidSetup -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_EuclidSetup +!------------------------------------------------------------------------- subroutine fhypre_euclidsetup(fsolver, fA, fb, fx) integer ierr @@ -2232,9 +2225,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_EuclidSolve -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_EuclidSolve +!------------------------------------------------------------------------- subroutine fhypre_euclidsolve(fsolver, fA, fb, fx) integer ierr @@ -2252,9 +2245,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_EuclidSetParams -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_EuclidSetParams +!------------------------------------------------------------------------- subroutine fhypre_euclidsetparams(fsolver, fargc, fargv) integer ierr @@ -2271,9 +2264,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_EuclidSetParamsFromFile -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_EuclidSetParamsFromFile +!------------------------------------------------------------------------- subroutine fhypre_euclidsetparamsfromfile(fsolver, ffile) integer ierr @@ -2291,9 +2284,9 @@ -c------------------------------------------------------------------------- -c HYPRE_ParCSRGMRESCreate -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRGMRESCreate +!------------------------------------------------------------------------- subroutine fhypre_parcsrgmrescreate(fcomm, fsolver) integer ierr @@ -2309,9 +2302,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRGMRESDestroy -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRGMRESDestroy +!------------------------------------------------------------------------- subroutine fhypre_parcsrgmresdestroy(fsolver) integer ierr @@ -2326,9 +2319,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRGMRESSetup -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRGMRESSetup +!------------------------------------------------------------------------- subroutine fhypre_parcsrgmressetup(fsolver, fA, fb, fx) integer ierr @@ -2346,9 +2339,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRGMRESSolve -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRGMRESSolve +!------------------------------------------------------------------------- subroutine fhypre_parcsrgmressolve(fsolver, fA, fb, fx) integer ierr @@ -2366,9 +2359,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRGMRESSetKDim -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRGMRESSetKDim +!------------------------------------------------------------------------- subroutine fhypre_parcsrgmressetkdim(fsolver, fkdim) integer ierr @@ -2384,9 +2377,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRGMRESSetTol -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRGMRESSetTol +!------------------------------------------------------------------------- subroutine fhypre_parcsrgmressettol(fsolver, ftol) integer ierr @@ -2402,9 +2395,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRGMRESSetMinIter -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRGMRESSetMinIter +!------------------------------------------------------------------------- subroutine fhypre_parcsrgmressetminiter(fsolver, fminiter) integer ierr @@ -2420,9 +2413,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRGMRESSetMaxIter -c-------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRGMRESSetMaxIter +!-------------------------------------------------------------------------- subroutine fhypre_parcsrgmressetmaxiter(fsolver, fmaxiter) integer ierr @@ -2438,9 +2431,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRGMRESSetStopCrit -c-------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRGMRESSetStopCrit +!-------------------------------------------------------------------------- subroutine fhypre_parcsrgmressetstopcrit(fsolver, fstopcrit) integer ierr @@ -2456,9 +2449,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRGMRESSetPrecond -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRGMRESSetPrecond +!------------------------------------------------------------------------- subroutine fhypre_parcsrgmressetprecond(fsolver, fprecond_id, 1 fprecond) @@ -2477,9 +2470,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRGMRESGetPrecond -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRGMRESGetPrecond +!------------------------------------------------------------------------- subroutine fhypre_parcsrgmresgetprecond(fsolver, fprecond) integer ierr @@ -2495,9 +2488,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRGMRESSetLogging -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRGMRESSetLogging +!------------------------------------------------------------------------- subroutine fhypre_parcsrgmressetlogging(fsolver, flog) integer ierr @@ -2513,9 +2506,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRGMRESSetPrintLevel -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRGMRESSetPrintLevel +!------------------------------------------------------------------------- subroutine fhypre_parcsrgmressetprintlevel(fsolver, fprntlvl) integer ierr @@ -2531,9 +2524,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRGMRESGetNumIterations -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRGMRESGetNumIterations +!------------------------------------------------------------------------- subroutine fhypre_parcsrgmresgetnumiterati(fsolver, fnumiter) integer ierr @@ -2549,9 +2542,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRGMRESGetFinalRelativeResidualNorm -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRGMRESGetFinalRelativeResidualNorm +!------------------------------------------------------------------------- subroutine fhypre_parcsrgmresgetfinalrelat(fsolver, fnorm) integer ierr @@ -2569,9 +2562,9 @@ -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridCreate -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridCreate +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridcreate(fsolver) integer ierr @@ -2586,9 +2579,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridDestroy -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridDestroy +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybriddestroy(fsolver) integer ierr @@ -2603,9 +2596,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetup -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetup +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetup(fsolver, fA, fb, fx) integer ierr @@ -2623,9 +2616,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSolve -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSolve +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsolve(fsolver, fA, fb, fx) integer ierr @@ -2643,9 +2636,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetTol -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetTol +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsettol(fsolver, ftol) integer ierr @@ -2661,9 +2654,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetConvergenceTol -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetConvergenceTol +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetconvergenc(fsolver, fcftol) integer ierr @@ -2679,9 +2672,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetDSCGMaxIter -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetDSCGMaxIter +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetdscgmaxit(fsolver, fmaxiter) integer ierr @@ -2697,9 +2690,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetPCGMaxIter -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetPCGMaxIter +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetpcgmaxite(fsolver, fmaxiter) integer ierr @@ -2715,9 +2708,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetSolverType -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetSolverType +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetsolvertyp(fsolver, ftype) integer ierr @@ -2733,9 +2726,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetKDim -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetKDim +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetkdim(fsolver, fkdim) integer ierr @@ -2751,9 +2744,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetTwoNorm -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetTwoNorm +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsettwonorm(fsolver, f2norm) integer ierr @@ -2769,9 +2762,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetStopCrit -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetStopCrit +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetstopcrit(fsolver, fstopcrit) integer ierr @@ -2787,9 +2780,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetRelChange -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetRelChange +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetrelchange(fsolver, frelchg) integer ierr @@ -2805,9 +2798,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetPrecond -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetPrecond +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetprecond(fsolver, fpreid, 1 fpresolver) @@ -2826,9 +2819,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetLogging -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetLogging +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetlogging(fsolver, flogging) integer ierr @@ -2844,9 +2837,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetPrintLevel -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetPrintLevel +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetprintlevel(fsolver, fprntlvl) integer ierr @@ -2862,9 +2855,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetStrongThreshold -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetStrongThreshold +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetstrongthr(fsolver, fthresh) integer ierr @@ -2880,9 +2873,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetMaxRowSum -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetMaxRowSum +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetmaxrowsum(fsolver, fsum) integer ierr @@ -2898,9 +2891,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetTruncFactor -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetTruncFactor +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsettruncfact(fsolver, ftfact) integer ierr @@ -2916,9 +2909,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetMaxLevels -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetMaxLevels +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetmaxlevels(fsolver, fmaxlvl) integer ierr @@ -2934,9 +2927,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetMeasureType -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetMeasureType +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetmeasurety(fsolver, fmtype) integer ierr @@ -2952,9 +2945,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetCoarsenType -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetCoarsenType +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetcoarsenty(fsolver, fcoarse) integer ierr @@ -2970,9 +2963,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetCycleType -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetCycleType +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetcycletype(fsolver, fcycle) integer ierr @@ -2988,9 +2981,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetNumGridSweeps -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetNumGridSweeps +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetnumgridsw(fsolver, fsweep) integer ierr @@ -3006,9 +2999,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetGridRelaxType -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetGridRelaxType +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetgridrlxtyp(fsolver, frlxt) integer ierr @@ -3024,9 +3017,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetGridRelaxPoints -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetGridRelaxPoints +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetgridrlxpts(fsolver, frlxp) integer ierr @@ -3042,9 +3035,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetNumSweeps -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetNumSweeps +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetnumsweeps(fsolver, fsweep) integer ierr @@ -3060,9 +3053,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetCycleNumSweeps -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetCycleNumSweeps +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetcyclenums(fsolver, fsweep) integer ierr @@ -3078,9 +3071,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetRelaxType -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetRelaxType +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetrelaxtype(fsolver, frlxt) integer ierr @@ -3096,9 +3089,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetCycleRelaxType -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetCycleRelaxType +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetcyclerela(fsolver, frlxt) integer ierr @@ -3114,9 +3107,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetRelaxOrder -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetRelaxOrder +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetrelaxorde(fsolver, frlx) integer ierr @@ -3132,9 +3125,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetRelaxWt -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetRelaxWt +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetrelaxwt(fsolver, frlx) integer ierr @@ -3150,9 +3143,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetLevelRelaxWt -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetLevelRelaxWt +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetlevelrela(fsolver, frlx) integer ierr @@ -3168,9 +3161,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetOuterWt -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetOuterWt +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetouterwt(fsolver, fout) integer ierr @@ -3186,9 +3179,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetLevelOuterWt -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetLevelOuterWt +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetleveloute(fsolver, fout) integer ierr @@ -3204,9 +3197,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetRelaxWeight -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetRelaxWeight +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetrelaxweig(fsolver, frlx) integer ierr @@ -3222,9 +3215,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridSetOmega -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridSetOmega +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridsetomega(fsolver, fomega) integer ierr @@ -3240,9 +3233,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridGetNumIterations -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridGetNumIterations +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridgetnumiterat(fsolver, fiters) integer ierr @@ -3258,9 +3251,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridGetDSCGNumIterations -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridGetDSCGNumIterations +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridgetdscgnumit(fsolver, fiters) integer ierr @@ -3277,9 +3270,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridGetPCGNumIterations -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridGetPCGNumIterations +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridgetpcgnumite(fsolver, fiters) integer ierr @@ -3296,9 +3289,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRHybridGetFinalRelativeResidualNorm -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRHybridGetFinalRelativeResidualNorm +!------------------------------------------------------------------------- subroutine fhypre_parcsrhybridgetfinalrela(fsolver, fnorm) integer ierr @@ -3319,9 +3312,9 @@ -c------------------------------------------------------------------------- -c HYPRE_ParSetRandomValues -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParSetRandomValues +!------------------------------------------------------------------------- subroutine fhypre_parsetrandomvalues(fv, fseed) integer ierr @@ -3337,9 +3330,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParPrintVector -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParPrintVector +!------------------------------------------------------------------------- subroutine fhypre_parprintvector(fv, ffile) integer ierr @@ -3355,9 +3348,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParReadVector -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParReadVector +!------------------------------------------------------------------------- subroutine fhypre_parreadvector(fcomm, ffile) integer ierr @@ -3373,9 +3366,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParVectorSize -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParVectorSize +!------------------------------------------------------------------------- subroutine fhypre_parvectorsize(fx) integer ierr @@ -3390,9 +3383,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRMultiVectorPrint -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRMultiVectorPrint +!------------------------------------------------------------------------- subroutine fhypre_parcsrmultivectorprint(fx, ffile) integer ierr @@ -3408,9 +3401,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRMultiVectorRead -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRMultiVectorRead +!------------------------------------------------------------------------- subroutine fhypre_parcsrmultivectorread(fcomm, fii, ffile) integer ierr @@ -3427,9 +3420,9 @@ return end -c------------------------------------------------------------------------- -c aux_maskCount -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! aux_maskCount +!------------------------------------------------------------------------- subroutine fhypre_aux_maskcount(fn, fmask) integer ierr @@ -3445,9 +3438,9 @@ return end -c------------------------------------------------------------------------- -c aux_indexFromMask -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! aux_indexFromMask +!------------------------------------------------------------------------- subroutine fhypre_auxindexfrommask(fn, fmask, findex) integer ierr @@ -3464,9 +3457,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_TempParCSRSetupInterpreter -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_TempParCSRSetupInterpreter +!------------------------------------------------------------------------- subroutine fhypre_tempparcsrsetupinterpret(fi) integer ierr @@ -3481,9 +3474,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRSetupInterpreter -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRSetupInterpreter +!------------------------------------------------------------------------- subroutine fhypre_parcsrsetupinterpreter(fi) integer ierr @@ -3498,9 +3491,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRSetupMatvec -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRSetupMatvec +!------------------------------------------------------------------------- subroutine fhypre_parcsrsetupmatvec(fmv) integer ierr @@ -3517,9 +3510,9 @@ -c------------------------------------------------------------------------- -c HYPRE_ParaSailsCreate -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsCreate +!------------------------------------------------------------------------- subroutine fhypre_parasailscreate(fcomm, fsolver) integer ierr @@ -3535,9 +3528,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsDestroy -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsDestroy +!------------------------------------------------------------------------- subroutine fhypre_parasailsdestroy(fsolver) integer ierr @@ -3552,9 +3545,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsSetup -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsSetup +!------------------------------------------------------------------------- subroutine fhypre_parasailssetup(fsolver, fA, fb, fx) integer ierr @@ -3572,9 +3565,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsSolve -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsSolve +!------------------------------------------------------------------------- subroutine fhypre_parasailssolve(fsolver, fA, fb, fx) integer ierr @@ -3592,9 +3585,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsSetParams -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsSetParams +!------------------------------------------------------------------------- subroutine fhypre_parasailssetparams(fsolver, fthresh, fnlevels) integer ierr @@ -3611,9 +3604,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsSetThresh -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsSetThresh +!------------------------------------------------------------------------- subroutine fhypre_parasailssetthresh(fsolver, fthresh) integer ierr @@ -3629,9 +3622,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsGetThresh -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsGetThresh +!------------------------------------------------------------------------- subroutine fhypre_parasailsgetthresh(fsolver, fthresh) integer ierr @@ -3647,9 +3640,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsSetNlevels -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsSetNlevels +!------------------------------------------------------------------------- subroutine fhypre_parasailssetnlevels(fsolver, fnlevels) integer ierr @@ -3665,9 +3658,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsGetNlevels -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsGetNlevels +!------------------------------------------------------------------------- subroutine fhypre_parasailsgetnlevels(fsolver, fnlevels) integer ierr @@ -3683,9 +3676,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsSetFilter -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsSetFilter +!------------------------------------------------------------------------- subroutine fhypre_parasailssetfilter(fsolver, ffilter) integer ierr @@ -3701,9 +3694,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsGetFilter -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsGetFilter +!------------------------------------------------------------------------- subroutine fhypre_parasailsgetfilter(fsolver, ffilter) integer ierr @@ -3719,9 +3712,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsSetSym -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsSetSym +!------------------------------------------------------------------------- subroutine fhypre_parasailssetsym(fsolver, fsym) integer ierr @@ -3737,9 +3730,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsGetSym -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsGetSym +!------------------------------------------------------------------------- subroutine fhypre_parasailsgetsym(fsolver, fsym) integer ierr @@ -3755,9 +3748,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsSetLoadbal -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsSetLoadbal +!------------------------------------------------------------------------- subroutine fhypre_parasailssetloadbal(fsolver, floadbal) integer ierr @@ -3773,9 +3766,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsGetLoadbal -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsGetLoadbal +!------------------------------------------------------------------------- subroutine fhypre_parasailsgetloadbal(fsolver, floadbal) integer ierr @@ -3791,9 +3784,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsSetReuse -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsSetReuse +!------------------------------------------------------------------------- subroutine fhypre_parasailssetreuse(fsolver, freuse) integer ierr @@ -3809,9 +3802,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsGetReuse -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsGetReuse +!------------------------------------------------------------------------- subroutine fhypre_parasailsgetreuse(fsolver, freuse) integer ierr @@ -3827,9 +3820,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsSetLogging -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsSetLogging +!------------------------------------------------------------------------- subroutine fhypre_parasailssetlogging(fsolver, flog) integer ierr @@ -3845,9 +3838,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParaSailsGetLogging -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParaSailsGetLogging +!------------------------------------------------------------------------- subroutine fhypre_parasailsgetlogging(fsolver, flog) integer ierr @@ -3865,9 +3858,9 @@ -c------------------------------------------------------------------------- -c HYPRE_ParCSRPCGCreate -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPCGCreate +!------------------------------------------------------------------------- subroutine fhypre_parcsrpcgcreate(fcomm, fsolver) integer ierr @@ -3883,9 +3876,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPCGDestroy -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPCGDestroy +!------------------------------------------------------------------------- subroutine fhypre_parcsrpcgdestroy(fsolver) integer ierr @@ -3900,9 +3893,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPCGSetup -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPCGSetup +!------------------------------------------------------------------------- subroutine fhypre_parcsrpcgsetup(fsolver, fA, fb, fx) integer ierr @@ -3920,9 +3913,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPCGSolve -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPCGSolve +!------------------------------------------------------------------------- subroutine fhypre_parcsrpcgsolve(fsolver, fA, fb, fx) integer ierr @@ -3940,9 +3933,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPCGSetTol -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPCGSetTol +!------------------------------------------------------------------------- subroutine fhypre_parcsrpcgsettol(fsolver, ftol) integer ierr @@ -3958,9 +3951,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPCGSetMaxIter -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPCGSetMaxIter +!------------------------------------------------------------------------- subroutine fhypre_parcsrpcgsetmaxiter(fsolver, fmaxiter) integer ierr @@ -3976,9 +3969,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPCGSetStopCrit -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPCGSetStopCrit +!------------------------------------------------------------------------- subroutine fhypre_parcsrpcgsetstopcrit(fsolver, ftol) integer ierr @@ -3994,9 +3987,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPCGSetTwoNorm -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPCGSetTwoNorm +!------------------------------------------------------------------------- subroutine fhypre_parcsrpcgsettwonorm(fsolver, ftwonorm) integer ierr @@ -4012,9 +4005,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPCGSetRelChange -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPCGSetRelChange +!------------------------------------------------------------------------- subroutine fhypre_parcsrpcgsetrelchange(fsolver, frelchange) integer ierr @@ -4030,9 +4023,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPCGSetPrecond -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPCGSetPrecond +!------------------------------------------------------------------------- subroutine fhypre_parcsrpcgsetprecond(fsolver, fprecond_id, 1 fprecond) @@ -4051,9 +4044,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPCGGetPrecond -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPCGGetPrecond +!------------------------------------------------------------------------- subroutine fhypre_parcsrpcggetprecond(fsolver, fprecond) integer ierr @@ -4069,9 +4062,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPCGSetPrintLevel -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPCGSetPrintLevel +!------------------------------------------------------------------------- subroutine fhypre_parcsrpcgsetprintlevel(fsolver, flevel) integer ierr @@ -4087,9 +4080,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPCGGetNumIterations -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPCGGetNumIterations +!------------------------------------------------------------------------- subroutine fhypre_parcsrpcggetnumiteration(fsolver, fnumiter) integer ierr @@ -4105,9 +4098,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPCGGetFinalRelativeResidualNorm -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPCGGetFinalRelativeResidualNorm +!------------------------------------------------------------------------- subroutine fhypre_parcsrpcggetfinalrelativ(fsolver, fnorm) integer ierr @@ -4122,9 +4115,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRDiagScaleSetup -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRDiagScaleSetup +!------------------------------------------------------------------------- subroutine fhypre_parcsrdiagscalesetup(fsolver, fA, fb, fx) integer ierr @@ -4142,9 +4135,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRDiagScale -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRDiagScale +!------------------------------------------------------------------------- subroutine fhypre_parcsrdiagscale(fsolver, fHA, fHy, fHx) integer ierr @@ -4164,9 +4157,9 @@ -c------------------------------------------------------------------------- -c HYPRE_ParCSRPilutCreate -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPilutCreate +!------------------------------------------------------------------------- subroutine fhypre_parcsrpilutcreate(fcomm, fsolver) integer ierr @@ -4182,9 +4175,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPilutDestroy -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPilutDestroy +!------------------------------------------------------------------------- subroutine fhypre_parcsrpilutdestroy(fsolver) integer ierr @@ -4199,9 +4192,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPilutSetup -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPilutSetup +!------------------------------------------------------------------------- subroutine fhypre_parcsrpilutsetup(fsolver, fA, fb, fx) integer ierr @@ -4219,9 +4212,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPilutSolve -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPilutSolve +!------------------------------------------------------------------------- subroutine fhypre_parcsrpilutsolve(fsolver, fA, fb, fx) integer ierr @@ -4239,9 +4232,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPilutSetMaxIter -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPilutSetMaxIter +!------------------------------------------------------------------------- subroutine fhypre_parcsrpilutsetmaxiter(fsolver, fmaxiter) integer ierr @@ -4257,9 +4250,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_ParCSRPilutSetDropToleran -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_ParCSRPilutSetDropToleran +!------------------------------------------------------------------------- subroutine fhypre_parcsrpilutsetdroptolera(fsolver, ftol) integer ierr @@ -4275,9 +4268,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRPilutSetFacRowSize -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRPilutSetFacRowSize +!-------------------------------------------------------------------------- subroutine fhypre_parcsrpilutsetfacrowsize(fsolver, fsize) integer ierr @@ -4295,9 +4288,9 @@ -c------------------------------------------------------------------------- -c HYPRE_SchwarzCreate -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_SchwarzCreate +!------------------------------------------------------------------------- subroutine fhypre_schwarzcreate(fsolver) integer ierr @@ -4312,9 +4305,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_SchwarzDestroy -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_SchwarzDestroy +!------------------------------------------------------------------------- subroutine fhypre_schwarzdestroy(fsolver) integer ierr @@ -4329,9 +4322,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_SchwarzSetup -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_SchwarzSetup +!------------------------------------------------------------------------- subroutine fhypre_schwarzsetup(fsolver, fA, fb, fx) integer ierr @@ -4349,9 +4342,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_SchwarzSolve -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_SchwarzSolve +!------------------------------------------------------------------------- subroutine fhypre_schwarzsolve(fsolver, fA, fb, fx) integer ierr @@ -4369,9 +4362,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_SchwarzSetVariant -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_SchwarzSetVariant +!------------------------------------------------------------------------- subroutine fhypre_schwarzsetvariant(fsolver, fvariant) integer ierr @@ -4387,9 +4380,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_SchwarzSetOverlap -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_SchwarzSetOverlap +!------------------------------------------------------------------------- subroutine fhypre_schwarzsetoverlap(fsolver, foverlap) integer ierr @@ -4405,9 +4398,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_SchwarzSetDomainType -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_SchwarzSetDomainType +!------------------------------------------------------------------------- subroutine fhypre_schwarzsetdomaintype(fsolver, fdomaint) integer ierr @@ -4423,9 +4416,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_SchwarzSetDomainStructure -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_SchwarzSetDomainStructure +!------------------------------------------------------------------------- subroutine fhypre_schwarzsetdomainstructur(fsolver, fdomains) integer ierr @@ -4441,9 +4434,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_SchwarzSetNumFunctions -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_SchwarzSetNumFunctions +!------------------------------------------------------------------------- subroutine fhypre_schwarzsetnumfunctions(fsolver, fnumfncs) integer ierr @@ -4459,9 +4452,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_SchwarzSetRelaxWeight -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_SchwarzSetRelaxWeight +!------------------------------------------------------------------------- subroutine fhypre_schwarzsetrelaxweight(fsolver, frlxwt) integer ierr @@ -4477,9 +4470,9 @@ return end -c------------------------------------------------------------------------- -c HYPRE_SchwarzSetDofFunc -c------------------------------------------------------------------------- +!------------------------------------------------------------------------- +! HYPRE_SchwarzSetDofFunc +!------------------------------------------------------------------------- subroutine fhypre_schwarzsetdoffunc(fsolver, fdofnc) integer ierr diff -Nru hypre-2.16.0/src/test/fparcsr_mv.f hypre-2.18.2/src/test/fparcsr_mv.f --- hypre-2.16.0/src/test/fparcsr_mv.f 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/fparcsr_mv.f 2019-10-28 22:30:04.000000000 +0000 @@ -1,22 +1,15 @@ -cBHEADER********************************************************************** -c Copyright (c) 2008, Lawrence Livermore National Security, LLC. -c Produced at the Lawrence Livermore National Laboratory. -c This file is part of HYPRE. See file COPYRIGHT for details. -c -c HYPRE is free software; you can redistribute it and/or modify it under the -c terms of the GNU Lesser General Public License (as published by the Free -c Software Foundation) version 2.1 dated February 1999. -c -c $Revision$ -cEHEADER********************************************************************** - -c***************************************************************************** -c Routines to test HYPRE_ParCSRMatrix Fortran interface -c***************************************************************************** - -c-------------------------------------------------------------------------- -c fhypre_parcsrmatrixcreate -c-------------------------------------------------------------------------- +! Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +! HYPRE Project Developers. See the top-level COPYRIGHT file for details. +! +! SPDX-License-Identifier: (Apache-2.0 OR MIT) + +!***************************************************************************** +! Routines to test HYPRE_ParCSRMatrix Fortran interface +!***************************************************************************** + +!-------------------------------------------------------------------------- +! fhypre_parcsrmatrixcreate +!-------------------------------------------------------------------------- subroutine fhypre_parcsrmatrixcreate(fcomm, fglobal_num_rows, 1 fglobal_num_cols, 1 frow_starts, fcol_starts, @@ -46,9 +39,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRMatrixDestroy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRMatrixDestroy +!-------------------------------------------------------------------------- subroutine fhypre_parcsrmatrixdestroy (fmatrix) integer ierr integer*8 fmatrix @@ -61,9 +54,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRMatrixInitialize -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRMatrixInitialize +!-------------------------------------------------------------------------- subroutine fhypre_parcsrmatrixinitialize (fmatrix) integer ierr integer*8 fmatrix @@ -77,9 +70,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRMatrixRead -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRMatrixRead +!-------------------------------------------------------------------------- subroutine fhypre_parcsrmatrixread (fcomm, ffile_name, fmatrix) integer fcomm @@ -96,9 +89,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRMatrixPrint -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRMatrixPrint +!-------------------------------------------------------------------------- subroutine fhypre_parcsrmatrixprint (fmatrix, fname) integer ierr @@ -114,9 +107,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRMatrixGetComm -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRMatrixGetComm +!-------------------------------------------------------------------------- subroutine fhypre_parcsrmatrixgetcomm (fmatrix, fcomm) integer ierr @@ -132,9 +125,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRMatrixGetDims -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRMatrixGetDims +!-------------------------------------------------------------------------- subroutine fhypre_parcsrmatrixgetdims (fmatrix, fM, fN) integer ierr @@ -151,9 +144,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRMatrixGetRowPartitioning -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRMatrixGetRowPartitioning +!-------------------------------------------------------------------------- subroutine fhypre_parcsrmatrixgetrowpartit (fmatrix, frow_ptr) integer ierr @@ -171,9 +164,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRMatrixGetColPartitioning -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRMatrixGetColPartitioning +!-------------------------------------------------------------------------- subroutine fhypre_parcsrmatrixgetcolpartit (fmatrix, fcol_ptr) integer ierr @@ -191,9 +184,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRMatrixGetLocalRange -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRMatrixGetLocalRange +!-------------------------------------------------------------------------- subroutine fhypre_parcsrmatrixgetlocalrange (fmatrix, frow_start, 1 frow_end, fcol_start, 2 fcol_end) @@ -216,9 +209,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRMatrixGetRow -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRMatrixGetRow +!-------------------------------------------------------------------------- subroutine fhypre_parcsrmatrixgetrow (fmatrix, frow, fsize, 1 fcolptr, fvalptr) @@ -239,9 +232,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRMatrixRestoreRow -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRMatrixRestoreRow +!-------------------------------------------------------------------------- subroutine fhypre_parcsrmatrixrestorerow (fmatrix, frow, fsize, 1 fcolptr, fvalptr) @@ -262,9 +255,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_CSRMatrixtoParCSRMatrix -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_CSRMatrixtoParCSRMatrix +!-------------------------------------------------------------------------- subroutine fhypre_csrmatrixtoparcsrmatrix (fcomm, fA_CSR, 1 frow_part, fcol_part, 2 fmatrix) @@ -286,9 +279,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRMatrixMatvec -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRMatrixMatvec +!-------------------------------------------------------------------------- subroutine fhypre_parcsrmatrixmatvec (falpha, fA, fx, fbeta, fy) integer ierr @@ -307,9 +300,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParCSRMatrixMatvecT -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParCSRMatrixMatvecT +!-------------------------------------------------------------------------- subroutine fhypre_parcsrmatrixmatvect (falpha, fA, fx, fbeta, fy) integer ierr @@ -330,9 +323,9 @@ -c-------------------------------------------------------------------------- -c HYPRE_ParVectorCreate -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParVectorCreate +!-------------------------------------------------------------------------- subroutine fhypre_parvectorcreate(fcomm, fsize, fpartion, fvector) integer ierr @@ -350,9 +343,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParMultiVectorCreate -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParMultiVectorCreate +!-------------------------------------------------------------------------- subroutine fhypre_parmultivectorcreate(fcomm, fsize, fpartion, 1 fnumvecs, fvector) @@ -373,9 +366,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParVectorDestroy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParVectorDestroy +!-------------------------------------------------------------------------- subroutine fhypre_parvectordestroy (fvector) integer ierr @@ -390,9 +383,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParVectorInitialize -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParVectorInitialize +!-------------------------------------------------------------------------- subroutine fhypre_parvectorinitialize (fvector) integer ierr @@ -407,9 +400,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParVectorRead -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParVectorRead +!-------------------------------------------------------------------------- subroutine fhypre_parvectorread (fcomm, fvector, fname) integer ierr @@ -426,9 +419,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParVectorPrint -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParVectorPrint +!-------------------------------------------------------------------------- subroutine fhypre_parvectorprint (fvector, fname, fsize) integer ierr @@ -445,9 +438,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParVectorSetConstantValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParVectorSetConstantValues +!-------------------------------------------------------------------------- subroutine fhypre_parvectorsetconstantvalue (fvector, fvalue) integer ierr @@ -463,9 +456,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParVectorSetRandomValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParVectorSetRandomValues +!-------------------------------------------------------------------------- subroutine fhypre_parvectorsetrandomvalues (fvector, fseed) integer ierr @@ -481,9 +474,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParVectorCopy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParVectorCopy +!-------------------------------------------------------------------------- subroutine fhypre_parvectorcopy (fx, fy) integer ierr @@ -499,9 +492,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParVectorCloneShallow -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParVectorCloneShallow +!-------------------------------------------------------------------------- subroutine fhypre_parvectorcloneshallow (fx) integer ierr @@ -516,9 +509,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParVectorScale -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParVectorScale +!-------------------------------------------------------------------------- subroutine fhypre_parvectorscale (fvalue, fx) integer ierr @@ -534,9 +527,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParVectorAxpy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParVectorAxpy +!-------------------------------------------------------------------------- subroutine fhypre_parvectoraxpy (fvalue, fx, fy) integer ierr @@ -553,9 +546,9 @@ return end -c-------------------------------------------------------------------------- -c HYPRE_ParVectorInnerProd -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_ParVectorInnerProd +!-------------------------------------------------------------------------- subroutine fhypre_parvectorinnerprod (fx, fy, fprod) integer ierr @@ -574,9 +567,9 @@ -c-------------------------------------------------------------------------- -c hypre_ParCSRMatrixGlobalNumRows -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! hypre_ParCSRMatrixGlobalNumRows +!-------------------------------------------------------------------------- subroutine fhypre_parcsrmatrixglobalnumrow (fmatrix, fnrows) integer ierr @@ -592,9 +585,9 @@ return end -c-------------------------------------------------------------------------- -c hypre_ParCSRMatrixRowStarts -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! hypre_ParCSRMatrixRowStarts +!-------------------------------------------------------------------------- subroutine fhypre_parcsrmatrixrowstarts (fmatrix, frows) integer ierr @@ -612,9 +605,9 @@ -c-------------------------------------------------------------------------- -c hypre_ParVectorSetDataOwner -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! hypre_ParVectorSetDataOwner +!-------------------------------------------------------------------------- subroutine fhypre_parvectorsetdataowner (fv, fown) integer ierr diff -Nru hypre-2.16.0/src/test/fsstruct_ls.f hypre-2.18.2/src/test/fsstruct_ls.f --- hypre-2.16.0/src/test/fsstruct_ls.f 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/fsstruct_ls.f 2019-10-28 22:30:04.000000000 +0000 @@ -1,27 +1,20 @@ -cBHEADER********************************************************************* -c Copyright (c) 2008, Lawrence Livermore National Security, LLC. -c Produced at the Lawrence Livermore National Laboratory. -c This file is part of HYPRE. See file COPYRIGHT for details. -c -c HYPRE is free software; you can redistribute it and/or modify it under the -c terms of the GNU Lesser General Public License (as published by the Free -c Software Foundation) version 2.1 dated February 1999. -c -c $Revision$ -cEHEADER********************************************************************* - -c**************************************************************************** -c HYPRE_SStruct_ls fortran interface routines -c**************************************************************************** - - -c**************************************************************************** -c HYPRE_SStructBiCGSTAB routines -c**************************************************************************** - -c-------------------------------------------------------------------------- -c HYPRE_SStructBiCGSTABCreate -c-------------------------------------------------------------------------- +! Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +! HYPRE Project Developers. See the top-level COPYRIGHT file for details. +! +! SPDX-License-Identifier: (Apache-2.0 OR MIT) + +!**************************************************************************** +! HYPRE_SStruct_ls fortran interface routines +!**************************************************************************** + + +!**************************************************************************** +! HYPRE_SStructBiCGSTAB routines +!**************************************************************************** + +!-------------------------------------------------------------------------- +! HYPRE_SStructBiCGSTABCreate +!-------------------------------------------------------------------------- subroutine fhypre_sstructbicgstabcreate(fcomm, fsolver) integer ierr @@ -38,9 +31,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructBiCGSTABDestroy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructBiCGSTABDestroy +!-------------------------------------------------------------------------- subroutine fhypre_sstructbicgstabdestroy(fsolver) integer ierr @@ -56,9 +49,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructBiCGSTABSetup -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructBiCGSTABSetup +!-------------------------------------------------------------------------- subroutine fhypre_sstructbicgstabsetup(fsolver, fA, fb, fx) integer ierr @@ -77,9 +70,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructBiCGSTABSolve -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructBiCGSTABSolve +!-------------------------------------------------------------------------- subroutine fhypre_sstructbicgstabsolve(fsolver, fA, fb, fx) integer ierr @@ -98,9 +91,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructBiCGSTABSetTol -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructBiCGSTABSetTol +!-------------------------------------------------------------------------- subroutine fhypre_sstructbicgstabsettol(fsolver, ftol) integer ierr @@ -117,9 +110,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructBiCGSTABSetMinIter -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructBiCGSTABSetMinIter +!-------------------------------------------------------------------------- subroutine fhypre_sstructbicgstabsetminite(fsolver, fmin_iter) integer ierr @@ -136,9 +129,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructBiCGSTABSetMaxIter -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructBiCGSTABSetMaxIter +!-------------------------------------------------------------------------- subroutine fhypre_sstructbicgstabsetmaxite(fsolver, fmax_iter) integer ierr @@ -155,9 +148,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructBiCGSTABSetStopCrit -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructBiCGSTABSetStopCrit +!-------------------------------------------------------------------------- subroutine fhypre_sstructbicgstabsetstopcr(fsolver, fstop_crit) integer ierr @@ -174,9 +167,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructBiCGSTABSetPrecond -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructBiCGSTABSetPrecond +!-------------------------------------------------------------------------- subroutine fhypre_sstructbicgstabsetprecon(fsolver, fprecond_id, 1 fprecond) @@ -196,9 +189,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructBiCGSTABSetLogging -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructBiCGSTABSetLogging +!-------------------------------------------------------------------------- subroutine fhypre_sstructbicgstabsetloggin(fsolver, flog) integer ierr @@ -215,9 +208,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructBiCGSTABSetPrintLevel -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructBiCGSTABSetPrintLevel +!-------------------------------------------------------------------------- subroutine fhypre_sstructbicgstabsetprintl(fsolver, fprint) integer ierr @@ -234,9 +227,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructBiCGSTABGetNumIterations -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructBiCGSTABGetNumIterations +!-------------------------------------------------------------------------- subroutine fhypre_sstructbicgstabgetnumite(fsolver, fnumiter) integer ierr @@ -255,9 +248,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructBiCGSTABGetFinalRelativeResidualNorm -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructBiCGSTABGetFinalRelativeResidualNorm +!-------------------------------------------------------------------------- subroutine fhypre_sstructbicgstabgetfinalr(fsolver, fnorm) integer ierr @@ -275,9 +268,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructBiCGSTABGetResidual -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructBiCGSTABGetResidual +!-------------------------------------------------------------------------- subroutine fhypre_sstructbicgstabgetresidu(fsolver, fresidual) integer ierr @@ -297,13 +290,13 @@ -c**************************************************************************** -c HYPRE_SStructGMRES routines -c**************************************************************************** - -c-------------------------------------------------------------------------- -c HYPRE_SStructGMRESCreate -c-------------------------------------------------------------------------- +!**************************************************************************** +! HYPRE_SStructGMRES routines +!**************************************************************************** + +!-------------------------------------------------------------------------- +! HYPRE_SStructGMRESCreate +!-------------------------------------------------------------------------- subroutine fhypre_sstructgmrescreate(fcomm, fsolver) integer ierr @@ -320,9 +313,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGMRESDestroy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGMRESDestroy +!-------------------------------------------------------------------------- subroutine fhypre_sstructgmresdestroy(fsolver) integer ierr @@ -338,9 +331,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGMRESSetup -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGMRESSetup +!-------------------------------------------------------------------------- subroutine fhypre_sstructgmressetup(fsolver, fA, fb, fx) integer ierr @@ -359,9 +352,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGMRESSolve -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGMRESSolve +!-------------------------------------------------------------------------- subroutine fhypre_sstructgmressolve(fsolver, fA, fb, fx) integer ierr @@ -380,9 +373,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGMRESSetKDim -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGMRESSetKDim +!-------------------------------------------------------------------------- subroutine fhypre_sstructgmressetkdim(fsolver, fkdim) integer ierr @@ -399,9 +392,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGMRESSetTol -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGMRESSetTol +!-------------------------------------------------------------------------- subroutine fhypre_sstructgmressettol(fsolver, ftol) integer ierr @@ -418,9 +411,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGMRESSetMinIter -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGMRESSetMinIter +!-------------------------------------------------------------------------- subroutine fhypre_sstructgmressetminiter(fsolver, fmin_iter) integer ierr @@ -437,9 +430,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGMRESSetMaxIter -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGMRESSetMaxIter +!-------------------------------------------------------------------------- subroutine fhypre_sstructgmressetmaxiter(fsolver, fmax_iter) integer ierr @@ -456,9 +449,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGMRESSetStopCrit -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGMRESSetStopCrit +!-------------------------------------------------------------------------- subroutine fhypre_sstructgmressetstopcrit(fsolver, fstop_crit) integer ierr @@ -475,9 +468,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGMRESSetPrecond -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGMRESSetPrecond +!-------------------------------------------------------------------------- subroutine fhypre_sstructgmressetprecond(fsolver, fprecond_id, 1 fprecond) @@ -497,9 +490,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGMRESSetLogging -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGMRESSetLogging +!-------------------------------------------------------------------------- subroutine fhypre_sstructgmressetlogging(fsolver, flog) integer ierr @@ -516,9 +509,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGMRESSetPrintLevel -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGMRESSetPrintLevel +!-------------------------------------------------------------------------- subroutine fhypre_sstructgmressetprintleve(fsolver, flevel) integer ierr @@ -535,9 +528,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGMRESGetNumIterations -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGMRESGetNumIterations +!-------------------------------------------------------------------------- subroutine fhypre_sstructgmresgetnumiterat(fsolver, fnumiter) integer ierr @@ -554,9 +547,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGMRESGetFinalRelativeResidualNorm -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGMRESGetFinalRelativeResidualNorm +!-------------------------------------------------------------------------- subroutine fhypre_sstructgmresgetfinalrela(fsolver, fnorm) integer ierr @@ -573,9 +566,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGMRESGetResidual -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGMRESGetResidual +!-------------------------------------------------------------------------- subroutine fhypre_sstructgmresgetresidual(fsolver, fresidual) integer ierr @@ -595,13 +588,13 @@ -c**************************************************************************** -c HYPRE_SStructInterpreter routines -c**************************************************************************** - -c-------------------------------------------------------------------------- -c HYPRE_SStructPVectorSetRandomValues -c-------------------------------------------------------------------------- +!**************************************************************************** +! HYPRE_SStructInterpreter routines +!**************************************************************************** + +!-------------------------------------------------------------------------- +! HYPRE_SStructPVectorSetRandomValues +!-------------------------------------------------------------------------- subroutine fhypre_sstructpvectorsetrandomv(fsolver, fseed) integer ierr @@ -618,9 +611,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructVectorSetRandomValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructVectorSetRandomValues +!-------------------------------------------------------------------------- subroutine fhypre_sstructvectorsetrandomva(fsolver, fseed) integer ierr @@ -637,9 +630,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSetRandomValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSetRandomValues +!-------------------------------------------------------------------------- subroutine fhypre_sstructsetrandomvalues(fsolver, fseed) integer ierr @@ -656,9 +649,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSetupInterpreter -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSetupInterpreter +!-------------------------------------------------------------------------- subroutine fhypre_sstructsetupinterpreter(fsolver) integer ierr @@ -674,9 +667,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSetupMatvec -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSetupMatvec +!-------------------------------------------------------------------------- subroutine fhypre_sstructsetupmatvec(fsolver) integer ierr @@ -695,13 +688,13 @@ -c**************************************************************************** -c HYPRE_SStructFAC routines -c**************************************************************************** - -c-------------------------------------------------------------------------- -c HYPRE_SStructFACCreate -c-------------------------------------------------------------------------- +!**************************************************************************** +! HYPRE_SStructFAC routines +!**************************************************************************** + +!-------------------------------------------------------------------------- +! HYPRE_SStructFACCreate +!-------------------------------------------------------------------------- subroutine fhypre_sstructfaccreate(fcomm, fsolver) integer ierr @@ -718,9 +711,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACDestroy2 -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACDestroy2 +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacdestroy2(fsolver) integer ierr @@ -736,9 +729,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACSetup2 -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACSetup2 +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacsetup2(fsolver, fA, fb, fx) integer ierr @@ -757,9 +750,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACSolve3 -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACSolve3 +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacsolve3(fsolver, fA, fb, fx) integer ierr @@ -778,9 +771,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACSetTol -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACSetTol +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacsettol(fsolver, ftol) integer ierr @@ -797,9 +790,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACSetPLevels -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACSetPLevels +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacsetplevels(fsolver, fnparts, fplevels) integer ierr @@ -817,9 +810,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACSetPRefinements -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACSetPRefinements +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacsetprefinement(fsolver, fnparts, 1 frfactors) @@ -839,9 +832,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACSetMaxLevels -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACSetMaxLevels +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacsetmaxlevels(fsolver, fmaxlevels) integer ierr @@ -858,9 +851,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACSetMaxIter -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACSetMaxIter +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacsetmaxiter(fsolver, fmaxiter) integer ierr @@ -877,9 +870,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACSetRelChange -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACSetRelChange +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacsetrelchange(fsolver, frelchange) integer ierr @@ -896,9 +889,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACSetZeroGuess -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACSetZeroGuess +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacsetzeroguess(fsolver) integer ierr @@ -914,9 +907,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACSetNonZeroGuess -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACSetNonZeroGuess +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacsetnonzerogues(fsolver) integer ierr @@ -932,9 +925,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACSetRelaxType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACSetRelaxType +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacsetrelaxtype(fsolver, frelaxtype) integer ierr @@ -951,9 +944,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACSetNumPreRelax -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACSetNumPreRelax +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacsetnumprerelax(fsolver, fnumprerelax) integer ierr @@ -970,9 +963,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACSetNumPostRelax -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACSetNumPostRelax +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacsetnumpostrela(fsolver, 1 fnumpostrelax) @@ -990,9 +983,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACSetCoarseSolverType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACSetCoarseSolverType +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacsetcoarsesolve(fsolver, 1 fcsolvertype) @@ -1011,9 +1004,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACSetLogging -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACSetLogging +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacsetlogging(fsolver, flog) integer ierr @@ -1030,9 +1023,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACGetNumIterations -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACGetNumIterations +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacgetnumiteratio(fsolver, fnumiter) integer ierr @@ -1049,9 +1042,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructFACGetFinalRelativeResidualNorm -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructFACGetFinalRelativeResidualNorm +!-------------------------------------------------------------------------- subroutine fhypre_sstructfacgetfinalrelati(fsolver, fnorm) integer ierr @@ -1071,13 +1064,13 @@ -c**************************************************************************** -c HYPRE_SStructPCG routines -c**************************************************************************** - -c-------------------------------------------------------------------------- -c HYPRE_SStructPCGCreate -c-------------------------------------------------------------------------- +!**************************************************************************** +! HYPRE_SStructPCG routines +!**************************************************************************** + +!-------------------------------------------------------------------------- +! HYPRE_SStructPCGCreate +!-------------------------------------------------------------------------- subroutine fhypre_sstructpcgcreate(fcomm, fsolver) integer ierr @@ -1094,9 +1087,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructPCGDestroy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructPCGDestroy +!-------------------------------------------------------------------------- subroutine fhypre_sstructpcgdestroy(fsolver) integer ierr @@ -1112,9 +1105,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructPCGSetup -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructPCGSetup +!-------------------------------------------------------------------------- subroutine fhypre_sstructpcgsetup(fsolver, fA, fb, fx) integer ierr @@ -1133,9 +1126,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructPCGSolve -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructPCGSolve +!-------------------------------------------------------------------------- subroutine fhypre_sstructpcgsolve(fsolver, fA, fb, fx) integer ierr @@ -1154,9 +1147,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructPCGSetTol -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructPCGSetTol +!-------------------------------------------------------------------------- subroutine fhypre_sstructpcgsettol(fsolver, ftol) integer ierr @@ -1173,9 +1166,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructPCGSetMaxIter -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructPCGSetMaxIter +!-------------------------------------------------------------------------- subroutine fhypre_sstructpcgsetmaxiter(fsolver, fmax_iter) integer ierr @@ -1192,9 +1185,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructPCGSetTwoNorm -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructPCGSetTwoNorm +!-------------------------------------------------------------------------- subroutine fhypre_sstructpcgsettwonorm(fsolver, ftwo_norm) integer ierr @@ -1211,9 +1204,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructPCGSetRelChange -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructPCGSetRelChange +!-------------------------------------------------------------------------- subroutine fhypre_sstructpcgsetrelchange(fsolver, frel_change) integer ierr @@ -1230,9 +1223,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructPCGSetPrecond -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructPCGSetPrecond +!-------------------------------------------------------------------------- subroutine fhypre_sstructpcgsetprecond(fsolver, fprecond_id, 1 fprecond) @@ -1252,9 +1245,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructPCGSetLogging -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructPCGSetLogging +!-------------------------------------------------------------------------- subroutine fhypre_sstructpcgsetlogging(fsolver, flog) integer ierr @@ -1271,9 +1264,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructPCGSetPrintLevel -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructPCGSetPrintLevel +!-------------------------------------------------------------------------- subroutine fhypre_sstructpcgsetprintlevel(fsolver, flevel) integer ierr @@ -1290,9 +1283,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructPCGGetNumIterations -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructPCGGetNumIterations +!-------------------------------------------------------------------------- subroutine fhypre_sstructpcggetnumiteratio(fsolver, fnumiter) integer ierr @@ -1309,9 +1302,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructPCGGetFinalRelativeResidualNorm -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructPCGGetFinalRelativeResidualNorm +!-------------------------------------------------------------------------- subroutine fhypre_sstructpcggetfinalrelati(fsolver, fnorm) integer ierr @@ -1328,9 +1321,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructPCGGetResidual -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructPCGGetResidual +!-------------------------------------------------------------------------- subroutine fhypre_sstructpcggetresidual(fsolver, fresidual) integer ierr @@ -1347,9 +1340,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructDiagScaleSetup -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructDiagScaleSetup +!-------------------------------------------------------------------------- subroutine fhypre_sstructdiagscalesetup(fsolver, fA, fy, fx) integer ierr @@ -1368,9 +1361,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructDiagScale -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructDiagScale +!-------------------------------------------------------------------------- subroutine fhypre_sstructdiagscale(fsolver, fA, fy, fx) integer ierr @@ -1392,13 +1385,13 @@ -c**************************************************************************** -c HYPRE_SStructSplit routines -c**************************************************************************** - -c-------------------------------------------------------------------------- -c HYPRE_SStructSplitCreate -c-------------------------------------------------------------------------- +!**************************************************************************** +! HYPRE_SStructSplit routines +!**************************************************************************** + +!-------------------------------------------------------------------------- +! HYPRE_SStructSplitCreate +!-------------------------------------------------------------------------- subroutine fhypre_sstructsplitcreate(fcomm, fsolver) integer ierr @@ -1415,9 +1408,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSplitDestroy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSplitDestroy +!-------------------------------------------------------------------------- subroutine fhypre_sstructsplitdestroy(fsolver) integer ierr @@ -1433,9 +1426,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSplitSetup -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSplitSetup +!-------------------------------------------------------------------------- subroutine fhypre_sstructsplitsetup(fsolver, fA, fb, fx) integer ierr @@ -1454,9 +1447,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSplitSolve -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSplitSolve +!-------------------------------------------------------------------------- subroutine fhypre_sstructsplitsolve(fsolver, fA, fb, fx) integer ierr @@ -1475,9 +1468,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSplitSetTol -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSplitSetTol +!-------------------------------------------------------------------------- subroutine fhypre_sstructsplitsettol(fsolver, ftol) integer ierr @@ -1494,9 +1487,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSplitSetMaxIter -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSplitSetMaxIter +!-------------------------------------------------------------------------- subroutine fhypre_sstructsplitsetmaxiter(fsolver, fmax_iter) integer ierr @@ -1513,9 +1506,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSplitSetZeroGuess -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSplitSetZeroGuess +!-------------------------------------------------------------------------- subroutine fhypre_sstructsplitsetzeroguess(fsolver) integer ierr @@ -1531,9 +1524,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSplitSetNonZeroGuess -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSplitSetNonZeroGuess +!-------------------------------------------------------------------------- subroutine fhypre_sstructsplitsetnonzerogu(fsolver) integer ierr @@ -1549,9 +1542,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSplitSetStructSolver -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSplitSetStructSolver +!-------------------------------------------------------------------------- subroutine fhypre_sstructsplitsetstructsol(fsolver, fssolver) integer ierr @@ -1568,9 +1561,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSplitGetNumIterations -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSplitGetNumIterations +!-------------------------------------------------------------------------- subroutine fhypre_sstructsplitgetnumiterat(fsolver, fnumiter) integer ierr @@ -1587,9 +1580,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSplitGetFinalRelativeResidualNorm -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSplitGetFinalRelativeResidualNorm +!-------------------------------------------------------------------------- subroutine fhypre_sstructsplitgetfinalrela(fsolver, fnorm) integer ierr @@ -1609,13 +1602,13 @@ -c**************************************************************************** -c HYPRE_SStructSYSPFMG routines -c**************************************************************************** - -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGCreate -c-------------------------------------------------------------------------- +!**************************************************************************** +! HYPRE_SStructSYSPFMG routines +!**************************************************************************** + +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGCreate +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmgcreate(fcomm, fsolver) integer ierr @@ -1632,9 +1625,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGDestroy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGDestroy +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmgdestroy(fsolver) integer ierr @@ -1650,9 +1643,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGSetup -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGSetup +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmgsetup(fsolver, fA, fb, fx) integer ierr @@ -1671,9 +1664,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGSolve -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGSolve +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmgsolve(fsolver, fA, fb, fx) integer ierr @@ -1692,9 +1685,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGSetTol -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGSetTol +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmgsettol(fsolver, ftol) integer ierr @@ -1711,9 +1704,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGSetMaxIter -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGSetMaxIter +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmgsetmaxiter(fsolver, fmax_iter) integer ierr @@ -1730,9 +1723,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGSetRelChange -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGSetRelChange +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmgsetrelchang(fsolver, frel_change) integer ierr @@ -1749,9 +1742,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGSetZeroGuess -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGSetZeroGuess +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmgsetzerogue(fsolver) integer ierr @@ -1767,9 +1760,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGSetNonZeroGuess -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGSetNonZeroGuess +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmgsetnonzero(fsolver) integer ierr @@ -1785,9 +1778,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGSetRelaxType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGSetRelaxType +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmgsetrelaxty(fsolver, frelax_type) integer ierr @@ -1804,9 +1797,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGSetNumPreRelax -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGSetNumPreRelax +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmgsetnumprer(fsolver, 1 fnum_pre_relax) @@ -1825,9 +1818,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGSetNumPostRelax -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGSetNumPostRelax +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmgsetnumpost(fsolver, 1 fnum_post_relax) @@ -1846,9 +1839,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGSetSkipRelax -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGSetSkipRelax +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmgsetskiprel(fsolver, fskip_relax) integer ierr @@ -1865,9 +1858,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGSetDxyz -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGSetDxyz +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmgsetdxyz(fsolver, fdxyz) integer ierr @@ -1884,9 +1877,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGSetLogging -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGSetLogging +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmgsetlogging(fsolver, flog) integer ierr @@ -1903,9 +1896,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGSetPrintLevel -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGSetPrintLevel +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmgsetprintle(fsolver, fprint_level) integer ierr @@ -1923,9 +1916,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGGetNumIterations -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGGetNumIterations +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmggetnumiter(fsolver, fnumiter) integer ierr @@ -1942,9 +1935,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructSysPFMGGetFinalRelativeResidualNorm -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructSysPFMGGetFinalRelativeResidualNorm +!-------------------------------------------------------------------------- subroutine fhypre_sstructsyspfmggetfinalre(fsolver, fnorm) integer ierr @@ -1961,15 +1954,15 @@ end -c***************************************************************************** -c* -c* HYPRE_SStructMaxwell interface -c* -c***************************************************************************** - -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellCreate -c*-------------------------------------------------------------------------- +!***************************************************************************** +!* +!* HYPRE_SStructMaxwell interface +!* +!***************************************************************************** + +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellCreate +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellcreate(fcomm, fsolver) integer ierr @@ -1986,9 +1979,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellDestroy -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellDestroy +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwelldestroy(fsolver) integer ierr @@ -2004,9 +1997,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellSetup -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellSetup +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellsetup (fsolver, fA, fb, fx) integer ierr @@ -2025,9 +2018,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellSolve -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellSolve +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellsolve (fsolver, fA, fb, fx) integer ierr @@ -2046,9 +2039,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellSolve2 -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellSolve2 +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellsolve2(fsolver, fA, fb, fx) integer ierr @@ -2067,9 +2060,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_MaxwellGrad -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_MaxwellGrad +!*-------------------------------------------------------------------------- subroutine fhypre_maxwellgrad (fgrid, fT) integer ierr @@ -2086,9 +2079,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellSetGrad -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellSetGrad +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellsetgrad (fsolver, fT) integer ierr @@ -2105,9 +2098,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellSetRfactors -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellSetRfactors +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellsetrfactor (fsolver,frfactors) integer ierr @@ -2124,9 +2117,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellSetTol -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellSetTol +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellsettol (fsolver, ftol) integer ierr @@ -2143,9 +2136,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellSetConstantCoef -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellSetConstantCoef +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellsetconstan (fsolver, 1 fconstant_coef) @@ -2164,9 +2157,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellSetMaxIter -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellSetMaxIter +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellsetmaxiter (fsolver, fmax_iter) integer ierr @@ -2183,9 +2176,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellSetRelChange -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellSetRelChange +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellsetrelchan (fsolver, frel_change) integer ierr @@ -2202,9 +2195,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellSetNumPreRelax -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellSetNumPreRelax +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellsetnumprer (fsolver, 1 fnum_pre_relax) @@ -2223,9 +2216,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellSetNumPostRelax -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellSetNumPostRelax +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellsetnumpost (fsolver, 1 fnum_post_relax) @@ -2244,9 +2237,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellSetLogging -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellSetLogging +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellsetlogging (fsolver, flogging) integer ierr @@ -2263,9 +2256,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellSetPrintLevel -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellSetPrintLevel +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellsetprintle (fsolver, fprint_level) integer ierr @@ -2283,9 +2276,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellPrintLogging -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellPrintLogging +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellprintloggi (fsolver, fmyid) integer ierr @@ -2302,9 +2295,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellGetNumIterations -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellGetNumIterations +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellgetnumiter (fsolver, 1 fnum_iterations) @@ -2323,9 +2316,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellGetFinalRelativeResidualNorm -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellGetFinalRelativeResidualNorm +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellgetfinalre (fsolver, fnorm) integer ierr @@ -2343,9 +2336,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellPhysBdy -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellPhysBdy +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellphysbdy (fgrid_l, fnum_levels, 1 frfactors, 2 fBdryRanks_ptr, @@ -2370,9 +2363,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellEliminateRowsCols -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellEliminateRowsCols +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwelleliminater (fparA, fnrows, frows) integer ierr @@ -2391,9 +2384,9 @@ end -c*-------------------------------------------------------------------------- -c* HYPRE_SStructMaxwellZeroVector -c*-------------------------------------------------------------------------- +!*-------------------------------------------------------------------------- +!* HYPRE_SStructMaxwellZeroVector +!*-------------------------------------------------------------------------- subroutine fhypre_sstructmaxwellzerovector (fb, frows, fnrows) integer ierr diff -Nru hypre-2.16.0/src/test/fsstruct_mv.f hypre-2.18.2/src/test/fsstruct_mv.f --- hypre-2.16.0/src/test/fsstruct_mv.f 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/fsstruct_mv.f 2019-10-28 22:30:04.000000000 +0000 @@ -1,27 +1,20 @@ -cBHEADER********************************************************************** -c Copyright (c) 2008, Lawrence Livermore National Security, LLC. -c Produced at the Lawrence Livermore National Laboratory. -c This file is part of HYPRE. See file COPYRIGHT for details. -c -c HYPRE is free software; you can redistribute it and/or modify it under the -c terms of the GNU Lesser General Public License (as published by the Free -c Software Foundation) version 2.1 dated February 1999. -c -c $Revision$ -cEHEADER********************************************************************** - -c*************************************************************************** -c HYPRE_SStruct fortran interface -c*************************************************************************** - - -c*************************************************************************** -c HYPRE_SStructGraph routines -c*************************************************************************** - -c------------------------------------------------------------------------- -c HYPRE_SStructGraphCreate -c------------------------------------------------------------------------- +! Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +! HYPRE Project Developers. See the top-level COPYRIGHT file for details. +! +! SPDX-License-Identifier: (Apache-2.0 OR MIT) + +!*************************************************************************** +! HYPRE_SStruct fortran interface +!*************************************************************************** + + +!*************************************************************************** +! HYPRE_SStructGraph routines +!*************************************************************************** + +!------------------------------------------------------------------------- +! HYPRE_SStructGraphCreate +!------------------------------------------------------------------------- subroutine fhypre_sstructgraphcreate(fcomm, fgrid, fgraphptr) integer ierr @@ -39,9 +32,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGraphDestroy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGraphDestroy +!-------------------------------------------------------------------------- subroutine fhypre_sstructgraphdestroy(fgraph) integer ierr @@ -57,9 +50,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGraphSetStencil -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGraphSetStencil +!-------------------------------------------------------------------------- subroutine fhypre_sstructgraphsetstencil(fgraph, fpart, fvar, 1 fstencil) @@ -80,10 +73,10 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGraphAddEntries- -c THIS IS FOR A NON-OVERLAPPING GRID GRAPH. -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGraphAddEntries- +! THIS IS FOR A NON-OVERLAPPING GRID GRAPH. +!-------------------------------------------------------------------------- subroutine fhypre_sstructgraphaddentries(fgraph, fpart, findex, 1 fvar, fto_part, 1 fto_index, fto_var) @@ -109,9 +102,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGraphAssemble -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGraphAssemble +!-------------------------------------------------------------------------- subroutine fhypre_sstructgraphassemble(fgraph) integer ierr @@ -127,9 +120,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGraphSetObjectType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGraphSetObjectType +!-------------------------------------------------------------------------- subroutine fhypre_sstructgraphsetobjecttyp(fgraph, ftype) integer ierr @@ -148,13 +141,13 @@ -c*************************************************************************** -c HYPRE_SStructGrid routines -c*************************************************************************** - -c-------------------------------------------------------------------------- -c HYPRE_SStructGridCreate -c-------------------------------------------------------------------------- +!*************************************************************************** +! HYPRE_SStructGrid routines +!*************************************************************************** + +!-------------------------------------------------------------------------- +! HYPRE_SStructGridCreate +!-------------------------------------------------------------------------- subroutine fhypre_sstructgridcreate(fcomm, fndim, fnparts, 1 fgridptr) @@ -175,9 +168,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGridDestroy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGridDestroy +!-------------------------------------------------------------------------- subroutine fhypre_sstructgriddestroy(fgrid) integer ierr @@ -193,9 +186,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGridSetExtents -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGridSetExtents +!-------------------------------------------------------------------------- subroutine fhypre_sstructgridsetextents(fgrid, fpart, filower, 1 fiupper) @@ -216,9 +209,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGridSetVariables -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGridSetVariables +!-------------------------------------------------------------------------- subroutine fhypre_sstructgridsetvariables(fgrid, fpart, fnvars, 1 fvartypes) @@ -239,9 +232,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGridAddVariables -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGridAddVariables +!-------------------------------------------------------------------------- subroutine fhypre_sstructgridaddvariables(fgrid, fpart, findex, 1 fnvars, fvartypes) @@ -263,9 +256,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGridSetNeighborBox -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGridSetNeighborBox +!-------------------------------------------------------------------------- subroutine fhypre_sstructgridsetneighborbo(fgrid, fpart, filower, 1 fiupper, fnbor_part, 2 fnbor_ilower, @@ -295,9 +288,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGridAssemble -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGridAssemble +!-------------------------------------------------------------------------- subroutine fhypre_sstructgridassemble(fgrid) integer ierr @@ -313,9 +306,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGridSetPeriodic -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGridSetPeriodic +!-------------------------------------------------------------------------- subroutine fhypre_sstructgridsetperiodic(fgrid, fpart, fperiodic) integer ierr @@ -333,9 +326,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructGridSetNumGhost -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructGridSetNumGhost +!-------------------------------------------------------------------------- subroutine fhypre_sstructgridsetnumghost(fgrid, fnum_ghost) integer ierr @@ -354,13 +347,13 @@ -c*************************************************************************** -c HYPRE_SStructMatrix routines -c*************************************************************************** - -c-------------------------------------------------------------------------- -c HYPRE_SStructMatrixCreate -c-------------------------------------------------------------------------- +!*************************************************************************** +! HYPRE_SStructMatrix routines +!*************************************************************************** + +!-------------------------------------------------------------------------- +! HYPRE_SStructMatrixCreate +!-------------------------------------------------------------------------- subroutine fhypre_sstructmatrixcreate(fcomm, fgraph, fmatrix_ptr) integer ierr @@ -378,9 +371,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructMatrixDestroy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructMatrixDestroy +!-------------------------------------------------------------------------- subroutine fhypre_sstructmatrixdestroy(fmatrix) integer ierr @@ -396,9 +389,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructMatrixInitialize -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructMatrixInitialize +!-------------------------------------------------------------------------- subroutine fhypre_sstructmatrixinitialize(fmatrix) integer ierr @@ -414,9 +407,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructMatrixSetValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructMatrixSetValues +!-------------------------------------------------------------------------- subroutine fhypre_sstructmatrixsetvalues(fmatrix, fpart, findex, 1 fvar, fnentries, 2 fentries, fvalues) @@ -442,9 +435,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructMatrixSetBoxValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructMatrixSetBoxValues +!-------------------------------------------------------------------------- subroutine fhypre_sstructmatrixsetboxvalue(fmatrix, fpart, 1 filower, fiupper, 2 fvar, fnentries, @@ -472,9 +465,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructMatrixGetValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructMatrixGetValues +!-------------------------------------------------------------------------- subroutine fhypre_sstructmatrixgetvalues(fmatrix, fpart, findex, 1 fvar, fnentries, 2 fentries, fvalues) @@ -500,9 +493,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructMatrixGetBoxValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructMatrixGetBoxValues +!-------------------------------------------------------------------------- subroutine fhypre_sstructmatrixgetboxvalue(fmatrix, fpart, 1 filower, fiupper, 2 fvar, fnentries, @@ -529,9 +522,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructMatrixAddToValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructMatrixAddToValues +!-------------------------------------------------------------------------- subroutine fhypre_sstructmatrixaddtovalues(fmatrix, fpart, findex, 1 fvar, fnentries, 2 fentries, fvalues) @@ -557,9 +550,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructMatrixAddToBoxValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructMatrixAddToBoxValues +!-------------------------------------------------------------------------- subroutine fhypre_sstructmatrixaddtoboxval(fmatrix, fpart, 1 filower, fiupper, 2 fvar, fnentries, @@ -586,9 +579,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructMatrixAssemble -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructMatrixAssemble +!-------------------------------------------------------------------------- subroutine fhypre_sstructmatrixassemble(fmatrix) integer ierr @@ -604,9 +597,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructMatrixSetSymmetric -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructMatrixSetSymmetric +!-------------------------------------------------------------------------- subroutine fhypre_sstructmatrixsetsymmetri(fmatrix, fpart, fvar, 1 fto_var, fsymmetric) @@ -628,9 +621,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructMatrixSetNSSymmetric -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructMatrixSetNSSymmetric +!-------------------------------------------------------------------------- subroutine fhypre_sstructmatrixsetnssymmet(fmatrix, fsymmetric) integer ierr @@ -647,9 +640,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructMatrixSetObjectType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructMatrixSetObjectType +!-------------------------------------------------------------------------- subroutine fhypre_sstructmatrixsetobjectty(fmatrix, ftype) integer ierr @@ -666,9 +659,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructMatrixGetObject -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructMatrixGetObject +!-------------------------------------------------------------------------- subroutine fhypre_sstructmatrixgetobject(fmatrix, fobject) integer ierr @@ -685,9 +678,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructMatrixGetObject2 -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructMatrixGetObject2 +!-------------------------------------------------------------------------- subroutine fhypre_sstructmatrixgetobject2(fmatrix, fobject) integer ierr @@ -704,9 +697,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructMatrixPrint -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructMatrixPrint +!-------------------------------------------------------------------------- subroutine fhypre_sstructmatrixprint(ffilename, fmatrix, fall) integer ierr @@ -724,9 +717,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructMatrixMatvec -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructMatrixMatvec +!-------------------------------------------------------------------------- subroutine fhypre_sstructmatrixmatvec(falpha, fA, fx, fbeta, fy) integer ierr @@ -748,13 +741,13 @@ -c*************************************************************************** -c HYPRE_SStructStencil routines -c*************************************************************************** - -c-------------------------------------------------------------------------- -c HYPRE_SStructStencilCreate -c-------------------------------------------------------------------------- +!*************************************************************************** +! HYPRE_SStructStencil routines +!*************************************************************************** + +!-------------------------------------------------------------------------- +! HYPRE_SStructStencilCreate +!-------------------------------------------------------------------------- subroutine fhypre_sstructstencilcreate(fndim, fsize, fstencil_ptr) integer ierr @@ -772,9 +765,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructStencilDestroy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructStencilDestroy +!-------------------------------------------------------------------------- subroutine fhypre_sstructstencildestroy(fstencil) integer ierr @@ -790,9 +783,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructStencilSetEntry -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructStencilSetEntry +!-------------------------------------------------------------------------- subroutine fhypre_sstructstencilsetentry(fstencil, fentry, 1 foffset, fvar) @@ -815,13 +808,13 @@ -c*************************************************************************** -c HYPRE_SStructVector routines -c*************************************************************************** - -c-------------------------------------------------------------------------- -c HYPRE_SStructVectorCreate -c-------------------------------------------------------------------------- +!*************************************************************************** +! HYPRE_SStructVector routines +!*************************************************************************** + +!-------------------------------------------------------------------------- +! HYPRE_SStructVectorCreate +!-------------------------------------------------------------------------- subroutine fhypre_sstructvectorcreate(fcomm, fgrid, fvector_ptr) integer ierr @@ -839,9 +832,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructVectorDestroy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructVectorDestroy +!-------------------------------------------------------------------------- subroutine fhypre_sstructvectordestroy(fvector) integer ierr @@ -857,9 +850,9 @@ end -c--------------------------------------------------------- -c HYPRE_SStructVectorInitialize -c--------------------------------------------------------- +!--------------------------------------------------------- +! HYPRE_SStructVectorInitialize +!--------------------------------------------------------- subroutine fhypre_sstructvectorinitialize(fvector) integer ierr @@ -875,9 +868,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructVectorSetValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructVectorSetValues +!-------------------------------------------------------------------------- subroutine fhypre_sstructvectorsetvalues(fvector, fpart, findex, 1 fvar, fvalue) @@ -899,9 +892,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructVectorSetBoxValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructVectorSetBoxValues +!-------------------------------------------------------------------------- subroutine fhypre_sstructvectorsetboxvalue(fvector, fpart, 1 filower, fiupper, 2 fvar, fvalues) @@ -925,9 +918,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructVectorAddToValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructVectorAddToValues +!-------------------------------------------------------------------------- subroutine fhypre_sstructvectoraddtovalues(fvector, fpart, findex, 1 fvar, fvalue) @@ -949,9 +942,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructVectorAddToBoxValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructVectorAddToBoxValues +!-------------------------------------------------------------------------- subroutine fhypre_sstructvectoraddtoboxval(fvector, fpart, 1 filower, fiupper, 2 fvar, fvalues) @@ -975,9 +968,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructVectorAssemble -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructVectorAssemble +!-------------------------------------------------------------------------- subroutine fhypre_sstructvectorassemble(fvector) integer ierr @@ -993,9 +986,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructVectorGather -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructVectorGather +!-------------------------------------------------------------------------- subroutine fhypre_sstructvectorgather(fvector) integer ierr @@ -1011,9 +1004,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructVectorGetValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructVectorGetValues +!-------------------------------------------------------------------------- subroutine fhypre_sstructvectorgetvalues(fvector, fpart, findex, 1 fvar, fvalue) @@ -1035,9 +1028,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructVectorGetBoxValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructVectorGetBoxValues +!-------------------------------------------------------------------------- subroutine fhypre_sstructvectorgetboxvalue(fvector, fpart, 1 filower, fiupper, 2 fvar, fvalues) @@ -1061,9 +1054,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructVectorSetConstantValues -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructVectorSetConstantValues +!-------------------------------------------------------------------------- subroutine fhypre_sstructvectorsetconstant(fvector, fvalue) integer ierr @@ -1081,9 +1074,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructVectorSetObjectType -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructVectorSetObjectType +!-------------------------------------------------------------------------- subroutine fhypre_sstructvectorsetobjectty(fvector, ftype) integer ierr @@ -1100,9 +1093,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructVectorGetObject -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructVectorGetObject +!-------------------------------------------------------------------------- subroutine fhypre_sstructvectorgetobject(fvector, fobject) integer ierr @@ -1119,9 +1112,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructVectorPrint -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructVectorPrint +!-------------------------------------------------------------------------- subroutine fhypre_sstructvectorprint(ffilename, fvector, fall) integer ierr @@ -1139,9 +1132,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructVectorCopy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructVectorCopy +!-------------------------------------------------------------------------- subroutine fhypre_sstructvectorcopy(fx, fy) integer ierr @@ -1158,9 +1151,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructVectorScale -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructVectorScale +!-------------------------------------------------------------------------- subroutine fhypre_sstructvectorscale(falpha, fy) integer ierr @@ -1177,9 +1170,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructInnerProd -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructInnerProd +!-------------------------------------------------------------------------- subroutine fhypre_sstructinnerprod(fx, fy, fresult) integer ierr @@ -1197,9 +1190,9 @@ end -c-------------------------------------------------------------------------- -c HYPRE_SStructAxpy -c-------------------------------------------------------------------------- +!-------------------------------------------------------------------------- +! HYPRE_SStructAxpy +!-------------------------------------------------------------------------- subroutine fhypre_sstructaxpy(falpha, fx, fy) integer ierr diff -Nru hypre-2.16.0/src/test/fstruct_ls.f hypre-2.18.2/src/test/fstruct_ls.f --- hypre-2.16.0/src/test/fstruct_ls.f 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/fstruct_ls.f 2019-10-28 22:30:04.000000000 +0000 @@ -1,27 +1,20 @@ -cBHEADER********************************************************************** -c Copyright (c) 2008, Lawrence Livermore National Security, LLC. -c Produced at the Lawrence Livermore National Laboratory. -c This file is part of HYPRE. See file COPYRIGHT for details. -c -c HYPRE is free software; you can redistribute it and/or modify it under the -c terms of the GNU Lesser General Public License (as published by the Free -c Software Foundation) version 2.1 dated February 1999. -c -c $Revision$ -cEHEADER********************************************************************** - -c*********************************************************************** -c Routines to test struct_ls fortran interfaces -c*********************************************************************** - - -c*********************************************************************** -c HYPRE_StructBiCGSTAB routines -c*********************************************************************** - -c*********************************************************************** -c fhypre_structbicgstabcreate -c*********************************************************************** +! Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +! HYPRE Project Developers. See the top-level COPYRIGHT file for details. +! +! SPDX-License-Identifier: (Apache-2.0 OR MIT) + +!*********************************************************************** +! Routines to test struct_ls fortran interfaces +!*********************************************************************** + + +!*********************************************************************** +! HYPRE_StructBiCGSTAB routines +!*********************************************************************** + +!*********************************************************************** +! fhypre_structbicgstabcreate +!*********************************************************************** subroutine fhypre_structbicgstabcreate(fcomm, fsolver) integer ierr integer fcomm @@ -35,9 +28,9 @@ return end -c*********************************************************************** -c fhypre_structbicgstabdestroy -c*********************************************************************** +!*********************************************************************** +! fhypre_structbicgstabdestroy +!*********************************************************************** subroutine fhypre_structbicgstabdestroy(fsolver) integer ierr integer*8 fsolver @@ -50,9 +43,9 @@ return end -c*********************************************************************** -c fhypre_structbicgstabsetup -c*********************************************************************** +!*********************************************************************** +! fhypre_structbicgstabsetup +!*********************************************************************** subroutine fhypre_structbicgstabsetup(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -68,9 +61,9 @@ return end -c*********************************************************************** -c fhypre_structbicgstabsolve -c*********************************************************************** +!*********************************************************************** +! fhypre_structbicgstabsolve +!*********************************************************************** subroutine fhypre_structbicgstabsolve(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -86,9 +79,9 @@ return end -c*********************************************************************** -c fhypre_structbicgstabsettol -c*********************************************************************** +!*********************************************************************** +! fhypre_structbicgstabsettol +!*********************************************************************** subroutine fhypre_structbicgstabsettol(fsolver, ftol) integer ierr integer*8 fsolver @@ -102,9 +95,9 @@ return end -c*********************************************************************** -c fhypre_structbicgstabsetmaxiter -c*********************************************************************** +!*********************************************************************** +! fhypre_structbicgstabsetmaxiter +!*********************************************************************** subroutine fhypre_structbicgstabsetmaxiter(fsolver, fmaxiter) integer ierr integer fmaxiter @@ -118,9 +111,9 @@ return end -c*********************************************************************** -c fhypre_structbicgstabsetprecond -c*********************************************************************** +!*********************************************************************** +! fhypre_structbicgstabsetprecond +!*********************************************************************** subroutine fhypre_structbicgstabsetprecond(fsolver, fprecond_id, 1 fprecond_solver) integer ierr @@ -137,9 +130,9 @@ return end -c*********************************************************************** -c fhypre_structbicgstabsetlogging -c*********************************************************************** +!*********************************************************************** +! fhypre_structbicgstabsetlogging +!*********************************************************************** subroutine fhypre_structbicgstabsetlogging(fsolver, flogging) integer ierr integer flogging @@ -153,9 +146,9 @@ return end -c*********************************************************************** -c fhypre_structbicgstabsetprintlevel -c*********************************************************************** +!*********************************************************************** +! fhypre_structbicgstabsetprintlevel +!*********************************************************************** subroutine fhypre_structbicgstabsetprintle(fsolver, fprintlev) integer ierr integer fprintlev @@ -169,9 +162,9 @@ return end -c*********************************************************************** -c fhypre_structbicgstabgetnumiterations -c*********************************************************************** +!*********************************************************************** +! fhypre_structbicgstabgetnumiterations +!*********************************************************************** subroutine fhypre_structbicgstabgetnumiter(fsolver, fnumiter) integer ierr integer fnumiter @@ -185,9 +178,9 @@ return end -c*********************************************************************** -c fhypre_structbicgstabgetresidual -c*********************************************************************** +!*********************************************************************** +! fhypre_structbicgstabgetresidual +!*********************************************************************** subroutine fhypre_structbicgstabgetresidua(fsolver, fresidual) integer ierr integer*8 fsolver @@ -201,9 +194,9 @@ return end -c*********************************************************************** -c fhypre_structbicgstabgetfinalrelativeresidualnorm -c*********************************************************************** +!*********************************************************************** +! fhypre_structbicgstabgetfinalrelativeresidualnorm +!*********************************************************************** subroutine fhypre_structbicgstabgetfinalre(fsolver, fnorm) integer ierr integer*8 fsolver @@ -221,13 +214,13 @@ -c*********************************************************************** -c HYPRE_StructGMRES routines -c*********************************************************************** - -c*********************************************************************** -c fhypre_structgmrescreate -c*********************************************************************** +!*********************************************************************** +! HYPRE_StructGMRES routines +!*********************************************************************** + +!*********************************************************************** +! fhypre_structgmrescreate +!*********************************************************************** subroutine fhypre_structgmrescreate(fcomm, fsolver) integer ierr integer fcomm @@ -241,9 +234,9 @@ return end -c*********************************************************************** -c fhypre_structgmresdestroy -c*********************************************************************** +!*********************************************************************** +! fhypre_structgmresdestroy +!*********************************************************************** subroutine fhypre_structgmresdestroy(fsolver) integer ierr integer*8 fsolver @@ -256,9 +249,9 @@ return end -c*********************************************************************** -c fhypre_structgmressetup -c*********************************************************************** +!*********************************************************************** +! fhypre_structgmressetup +!*********************************************************************** subroutine fhypre_structgmressetup(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -274,9 +267,9 @@ return end -c*********************************************************************** -c fhypre_structgmressolve -c*********************************************************************** +!*********************************************************************** +! fhypre_structgmressolve +!*********************************************************************** subroutine fhypre_structgmressolve(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -292,9 +285,9 @@ return end -c*********************************************************************** -c fhypre_structgmressettol -c*********************************************************************** +!*********************************************************************** +! fhypre_structgmressettol +!*********************************************************************** subroutine fhypre_structgmressettol(fsolver, ftol) integer ierr integer*8 fsolver @@ -308,9 +301,9 @@ return end -c*********************************************************************** -c fhypre_structgmressetmaxiter -c*********************************************************************** +!*********************************************************************** +! fhypre_structgmressetmaxiter +!*********************************************************************** subroutine fhypre_structgmressetmaxiter(fsolver, fmaxiter) integer ierr integer fmaxiter @@ -324,9 +317,9 @@ return end -c*********************************************************************** -c fhypre_structgmressetprecond -c*********************************************************************** +!*********************************************************************** +! fhypre_structgmressetprecond +!*********************************************************************** subroutine fhypre_structgmressetprecond(fsolver, fprecond_id, 1 fprecond_solver) integer ierr @@ -343,9 +336,9 @@ return end -c*********************************************************************** -c fhypre_structgmressetlogging -c*********************************************************************** +!*********************************************************************** +! fhypre_structgmressetlogging +!*********************************************************************** subroutine fhypre_structgmressetlogging(fsolver, flogging) integer ierr integer flogging @@ -359,9 +352,9 @@ return end -c*********************************************************************** -c fhypre_structgmressetprintlevel -c*********************************************************************** +!*********************************************************************** +! fhypre_structgmressetprintlevel +!*********************************************************************** subroutine fhypre_structgmressetprintlevel(fsolver, fprintlevel) integer ierr integer fprintlevel @@ -375,9 +368,9 @@ return end -c*********************************************************************** -c fhypre_structgmresgetnumiterations -c*********************************************************************** +!*********************************************************************** +! fhypre_structgmresgetnumiterations +!*********************************************************************** subroutine fhypre_structgmresgetnumiterati(fsolver, fnumiters) integer ierr integer fnumiters @@ -391,9 +384,9 @@ return end -c*********************************************************************** -c fhypre_structgmresgetfinalrelativeresidualnorm -c*********************************************************************** +!*********************************************************************** +! fhypre_structgmresgetfinalrelativeresidualnorm +!*********************************************************************** subroutine fhypre_structgmresgetfinalrelat(fsolver, fnorm) integer ierr integer*8 fsolver @@ -411,13 +404,13 @@ -c*********************************************************************** -c HYPRE_StructHybrid routines -c*********************************************************************** - -c*********************************************************************** -c fhypre_structhybridcreate -c*********************************************************************** +!*********************************************************************** +! HYPRE_StructHybrid routines +!*********************************************************************** + +!*********************************************************************** +! fhypre_structhybridcreate +!*********************************************************************** subroutine fhypre_structhybridcreate(fcomm, fsolver) integer ierr integer fcomm @@ -431,9 +424,9 @@ return end -c*********************************************************************** -c fhypre_structhybriddestroy -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybriddestroy +!*********************************************************************** subroutine fhypre_structhybriddestroy(fsolver) integer ierr integer*8 fsolver @@ -446,9 +439,9 @@ return end -c*********************************************************************** -c fhypre_structhybridsetup -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridsetup +!*********************************************************************** subroutine fhypre_structhybridsetup(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -464,9 +457,9 @@ return end -c*********************************************************************** -c fhypre_structhybridsolve -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridsolve +!*********************************************************************** subroutine fhypre_structhybridsolve(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -482,9 +475,9 @@ return end -c*********************************************************************** -c fhypre_structhybridsetsolvertype -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridsetsolvertype +!*********************************************************************** subroutine fhypre_structhybridsetsolvertyp(fsolver, fsolver_typ) integer ierr integer fsolver_typ @@ -498,9 +491,9 @@ return end -c*********************************************************************** -c fhypre_structhybridsetstopcrit -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridsetstopcrit +!*********************************************************************** subroutine fhypre_structhybridsetstopcrit(fsolver, fstop_crit) integer ierr integer fstop_crit @@ -514,9 +507,9 @@ return end -c*********************************************************************** -c fhypre_structhybridsetkdim -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridsetkdim +!*********************************************************************** subroutine fhypre_structhybridsetkdim(fsolver, fkdim) integer ierr integer fkdim @@ -530,9 +523,9 @@ return end -c*********************************************************************** -c fhypre_structhybridsettol -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridsettol +!*********************************************************************** subroutine fhypre_structhybridsettol(fsolver, ftol) integer ierr integer*8 fsolver @@ -546,9 +539,9 @@ return end -c*********************************************************************** -c fhypre_structhybridsetconvergencetol -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridsetconvergencetol +!*********************************************************************** subroutine fhypre_structhybridsetconvergen(fsolver, fcftol) integer ierr integer*8 fsolver @@ -562,9 +555,9 @@ return end -c*********************************************************************** -c fhypre_structhybridsetpcgabsolutetolfactor -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridsetpcgabsolutetolfactor +!*********************************************************************** subroutine fhypre_structhybridsetpcgabsolu(fsolver, fpcgtol) integer ierr integer*8 fsolver @@ -578,9 +571,9 @@ return end -c*********************************************************************** -c fhypre_structhybridsetdscgmaxiter -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridsetdscgmaxiter +!*********************************************************************** subroutine fhypre_structhybridsetdscgmaxit(fsolver, fdscgmaxitr) integer ierr integer fdscgmaxitr @@ -594,9 +587,9 @@ return end -c*********************************************************************** -c fhypre_structhybridsetpcgmaxiter -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridsetpcgmaxiter +!*********************************************************************** subroutine fhypre_structhybridsetpcgmaxite(fsolver, fpcgmaxitr) integer ierr integer fpcgmaxitr @@ -610,9 +603,9 @@ return end -c*********************************************************************** -c fhypre_structhybridsettwonorm -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridsettwonorm +!*********************************************************************** subroutine fhypre_structhybridsettwonorm(fsolver, ftwonorm) integer ierr integer ftwonorm @@ -626,9 +619,9 @@ return end -c*********************************************************************** -c fhypre_structhybridsetrelchange -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridsetrelchange +!*********************************************************************** subroutine fhypre_structhybridsetrelchange(fsolver, frelchng) integer ierr integer frelchng @@ -642,9 +635,9 @@ return end -c*********************************************************************** -c fhypre_structhybridsetprecond -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridsetprecond +!*********************************************************************** subroutine fhypre_structhybridsetprecond(fsolver, fprecond_id, 1 fprecond) integer ierr @@ -661,9 +654,9 @@ return end -c*********************************************************************** -c fhypre_structhybridsetlogging -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridsetlogging +!*********************************************************************** subroutine fhypre_structhybridsetlogging(fsolver, flogging) integer ierr integer flogging @@ -677,9 +670,9 @@ return end -c*********************************************************************** -c fhypre_structhybridsetprintlevel -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridsetprintlevel +!*********************************************************************** subroutine fhypre_structhybridsetprintleve(fsolver, fprntlvl) integer ierr integer fprntlvl @@ -693,9 +686,9 @@ return end -c*********************************************************************** -c fhypre_structhybridgetnumiterations -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridgetnumiterations +!*********************************************************************** subroutine fhypre_structhybridgetnumiterat(fsolver, fnumits) integer ierr integer fnumits @@ -709,9 +702,9 @@ return end -c*********************************************************************** -c fhypre_structhybridgetdscgnumiterations -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridgetdscgnumiterations +!*********************************************************************** subroutine fhypre_structhybridgetdscgnumit(fsolver, fdscgnumits) integer ierr integer fdscgnumits @@ -725,9 +718,9 @@ return end -c*********************************************************************** -c fhypre_structhybridgetpcgnumiterations -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridgetpcgnumiterations +!*********************************************************************** subroutine fhypre_structhybridgetpcgnumite(fsolver, fpcgnumits) integer ierr integer fpcgnumits @@ -741,9 +734,9 @@ return end -c*********************************************************************** -c fhypre_structhybridgetfinalrelativeresidualnorm -c*********************************************************************** +!*********************************************************************** +! fhypre_structhybridgetfinalrelativeresidualnorm +!*********************************************************************** subroutine fhypre_structhybridgetfinalrela(fsolver, fnorm) integer ierr integer*8 fsolver @@ -761,13 +754,13 @@ -c*********************************************************************** -c HYPRE_StructInterpreter routines -c*********************************************************************** - -c*********************************************************************** -c fhypre_structvectorsetrandomvalues -c*********************************************************************** +!*********************************************************************** +! HYPRE_StructInterpreter routines +!*********************************************************************** + +!*********************************************************************** +! fhypre_structvectorsetrandomvalues +!*********************************************************************** subroutine fhypre_structvectorsetrandomvalu(fvector, fseed) integer ierr integer fseed @@ -782,9 +775,9 @@ end -c*********************************************************************** -c fhypre_structsetrandomvalues -c*********************************************************************** +!*********************************************************************** +! fhypre_structsetrandomvalues +!*********************************************************************** subroutine fhypre_structsetrandomvalues(fvector, fseed) integer ierr integer fseed @@ -799,9 +792,9 @@ end -c*********************************************************************** -c fhypre_structsetupinterpreter -c*********************************************************************** +!*********************************************************************** +! fhypre_structsetupinterpreter +!*********************************************************************** subroutine fhypre_structsetupinterpreter(fi) integer ierr integer*8 fi @@ -815,9 +808,9 @@ end -c*********************************************************************** -c fhypre_structsetupmatvec -c*********************************************************************** +!*********************************************************************** +! fhypre_structsetupmatvec +!*********************************************************************** subroutine fhypre_structsetupmatvec(fmv) integer ierr integer*8 fmv @@ -833,13 +826,13 @@ -c*********************************************************************** -c HYPRE_StructJacobi routines -c*********************************************************************** - -c*********************************************************************** -c fhypre_structjacobicreate -c*********************************************************************** +!*********************************************************************** +! HYPRE_StructJacobi routines +!*********************************************************************** + +!*********************************************************************** +! fhypre_structjacobicreate +!*********************************************************************** subroutine fhypre_structjacobicreate(fcomm, fsolver) integer ierr integer fcomm @@ -853,9 +846,9 @@ return end -c*********************************************************************** -c fhypre_structjacobidestroy -c*********************************************************************** +!*********************************************************************** +! fhypre_structjacobidestroy +!*********************************************************************** subroutine fhypre_structjacobidestroy(fsolver) integer ierr integer*8 fsolver @@ -868,9 +861,9 @@ return end -c*********************************************************************** -c fhypre_structjacobisetup -c*********************************************************************** +!*********************************************************************** +! fhypre_structjacobisetup +!*********************************************************************** subroutine fhypre_structjacobisetup(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -886,9 +879,9 @@ return end -c*********************************************************************** -c fhypre_structjacobisolve -c*********************************************************************** +!*********************************************************************** +! fhypre_structjacobisolve +!*********************************************************************** subroutine fhypre_structjacobisolve(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -904,9 +897,9 @@ return end -c*********************************************************************** -c fhypre_structjacobisettol -c*********************************************************************** +!*********************************************************************** +! fhypre_structjacobisettol +!*********************************************************************** subroutine fhypre_structjacobisettol(fsolver, ftol) integer ierr integer*8 fsolver @@ -920,9 +913,9 @@ return end -c*********************************************************************** -c fhypre_structjacobigettol -c*********************************************************************** +!*********************************************************************** +! fhypre_structjacobigettol +!*********************************************************************** subroutine fhypre_structjacobigettol(fsolver, ftol) integer ierr integer*8 fsolver @@ -936,9 +929,9 @@ return end -c*********************************************************************** -c fhypre_structjacobisetmaxiter -c*********************************************************************** +!*********************************************************************** +! fhypre_structjacobisetmaxiter +!*********************************************************************** subroutine fhypre_structjacobisetmaxiter(fsolver, fmaxiter) integer ierr integer fmaxiter @@ -952,9 +945,9 @@ return end -c*********************************************************************** -c fhypre_structjacobigetmaxiter -c*********************************************************************** +!*********************************************************************** +! fhypre_structjacobigetmaxiter +!*********************************************************************** subroutine fhypre_structjacobigetmaxiter(fsolver, fmaxiter) integer ierr integer fmaxiter @@ -968,9 +961,9 @@ return end -c*********************************************************************** -c fhypre_structjacobisetzeroguess -c*********************************************************************** +!*********************************************************************** +! fhypre_structjacobisetzeroguess +!*********************************************************************** subroutine fhypre_structjacobisetzeroguess(fsolver) integer ierr integer*8 fsolver @@ -983,9 +976,9 @@ return end -c*********************************************************************** -c fhypre_structjacobigetzeroguess -c*********************************************************************** +!*********************************************************************** +! fhypre_structjacobigetzeroguess +!*********************************************************************** subroutine fhypre_structjacobigetzeroguess(fsolver) integer ierr integer*8 fsolver @@ -998,9 +991,9 @@ return end -c*********************************************************************** -c fhypre_structjacobisetnonzeroguess -c*********************************************************************** +!*********************************************************************** +! fhypre_structjacobisetnonzeroguess +!*********************************************************************** subroutine fhypre_structjacobisetnonzerogu(fsolver) integer ierr integer*8 fsolver @@ -1013,9 +1006,9 @@ return end -c*********************************************************************** -c fhypre_structjacobigetnumiterations -c*********************************************************************** +!*********************************************************************** +! fhypre_structjacobigetnumiterations +!*********************************************************************** subroutine fhypre_structjacobigetnumiterat(fsolver, fnumiters) integer ierr integer fnumiters @@ -1029,9 +1022,9 @@ return end -c*********************************************************************** -c fhypre_structjacobigetfinalrelativeresidualnorm -c*********************************************************************** +!*********************************************************************** +! fhypre_structjacobigetfinalrelativeresidualnorm +!*********************************************************************** subroutine fhypre_structjacobigetfinalrela(fsolver, fnorm) integer ierr integer*8 fsolver @@ -1049,13 +1042,13 @@ -c*********************************************************************** -c HYPRE_StructPCG routines -c*********************************************************************** - -c*********************************************************************** -c fhypre_structpcgcreate -c*********************************************************************** +!*********************************************************************** +! HYPRE_StructPCG routines +!*********************************************************************** + +!*********************************************************************** +! fhypre_structpcgcreate +!*********************************************************************** subroutine fhypre_structpcgcreate(fcomm, fsolver) integer ierr integer fcomm @@ -1069,9 +1062,9 @@ return end -c*********************************************************************** -c fhypre_structpcgdestroy -c*********************************************************************** +!*********************************************************************** +! fhypre_structpcgdestroy +!*********************************************************************** subroutine fhypre_structpcgdestroy(fsolver) integer ierr integer*8 fsolver @@ -1084,9 +1077,9 @@ return end -c*********************************************************************** -c fhypre_structpcgsetup -c*********************************************************************** +!*********************************************************************** +! fhypre_structpcgsetup +!*********************************************************************** subroutine fhypre_structpcgsetup(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -1102,9 +1095,9 @@ return end -c*********************************************************************** -c fhypre_structpcgsolve -c*********************************************************************** +!*********************************************************************** +! fhypre_structpcgsolve +!*********************************************************************** subroutine fhypre_structpcgsolve(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -1120,9 +1113,9 @@ return end -c*********************************************************************** -c fhypre_structpcgsettol -c*********************************************************************** +!*********************************************************************** +! fhypre_structpcgsettol +!*********************************************************************** subroutine fhypre_structpcgsettol(fsolver, ftol) integer ierr integer*8 fsolver @@ -1136,9 +1129,9 @@ return end -c*********************************************************************** -c fhypre_structpcgsetmaxiter -c*********************************************************************** +!*********************************************************************** +! fhypre_structpcgsetmaxiter +!*********************************************************************** subroutine fhypre_structpcgsetmaxiter(fsolver, fmaxiter) integer ierr integer fmaxiter @@ -1152,9 +1145,9 @@ return end -c*********************************************************************** -c fhypre_structpcgsettwonorm -c*********************************************************************** +!*********************************************************************** +! fhypre_structpcgsettwonorm +!*********************************************************************** subroutine fhypre_structpcgsettwonorm(fsolver, ftwonorm) integer ierr integer ftwonorm @@ -1168,9 +1161,9 @@ return end -c*********************************************************************** -c fhypre_structpcgsetrelchange -c*********************************************************************** +!*********************************************************************** +! fhypre_structpcgsetrelchange +!*********************************************************************** subroutine fhypre_structpcgsetrelchange(fsolver, frelchng) integer ierr integer frelchng @@ -1184,9 +1177,9 @@ return end -c*********************************************************************** -c fhypre_structpcgsetprecond -c*********************************************************************** +!*********************************************************************** +! fhypre_structpcgsetprecond +!*********************************************************************** subroutine fhypre_structpcgsetprecond(fsolver, fprecond_id, 1 fprecond) integer ierr @@ -1203,9 +1196,9 @@ return end -c*********************************************************************** -c fhypre_structpcgsetlogging -c*********************************************************************** +!*********************************************************************** +! fhypre_structpcgsetlogging +!*********************************************************************** subroutine fhypre_structpcgsetlogging(fsolver, flogging) integer ierr integer flogging @@ -1219,9 +1212,9 @@ return end -c*********************************************************************** -c fhypre_structpcgsetprintlevel -c*********************************************************************** +!*********************************************************************** +! fhypre_structpcgsetprintlevel +!*********************************************************************** subroutine fhypre_structpcgsetprintlevel(fsolver, fprntlvl) integer ierr integer fprntlvl @@ -1235,9 +1228,9 @@ return end -c*********************************************************************** -c fhypre_structpcggetnumiterations -c*********************************************************************** +!*********************************************************************** +! fhypre_structpcggetnumiterations +!*********************************************************************** subroutine fhypre_structpcggetnumiteration(fsolver, fnumiters) integer ierr integer fnumiters @@ -1251,9 +1244,9 @@ return end -c*********************************************************************** -c fhypre_structpcggetfinalrelativeresidualnorm -c*********************************************************************** +!*********************************************************************** +! fhypre_structpcggetfinalrelativeresidualnorm +!*********************************************************************** subroutine fhypre_structpcggetfinalrelativ(fsolver, fnorm) integer ierr integer*8 fsolver @@ -1269,9 +1262,9 @@ -c*********************************************************************** -c fhypre_structdiagscalesetup -c*********************************************************************** +!*********************************************************************** +! fhypre_structdiagscalesetup +!*********************************************************************** subroutine fhypre_structdiagscalesetup(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -1287,9 +1280,9 @@ return end -c*********************************************************************** -c fhypre_structdiagscale -c*********************************************************************** +!*********************************************************************** +! fhypre_structdiagscale +!*********************************************************************** subroutine fhypre_structdiagscale(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -1309,13 +1302,13 @@ -c*********************************************************************** -c HYPRE_StructPFMG routines -c*********************************************************************** - -c*********************************************************************** -c fhypre_structpfmgcreate -c*********************************************************************** +!*********************************************************************** +! HYPRE_StructPFMG routines +!*********************************************************************** + +!*********************************************************************** +! fhypre_structpfmgcreate +!*********************************************************************** subroutine fhypre_structpfmgcreate(fcomm, fsolver) integer ierr integer fcomm @@ -1329,9 +1322,9 @@ return end -c*********************************************************************** -c fhypre_structpfmgdestroy -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmgdestroy +!*********************************************************************** subroutine fhypre_structpfmgdestroy(fsolver) integer ierr integer*8 fsolver @@ -1344,9 +1337,9 @@ return end -c*********************************************************************** -c fhypre_structpfmgsetup -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmgsetup +!*********************************************************************** subroutine fhypre_structpfmgsetup(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -1362,9 +1355,9 @@ return end -c*********************************************************************** -c fhypre_structpfmgsolve -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmgsolve +!*********************************************************************** subroutine fhypre_structpfmgsolve(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -1380,9 +1373,9 @@ return end -c*********************************************************************** -c fhypre_structpfmgsettol -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmgsettol +!*********************************************************************** subroutine fhypre_structpfmgsettol(fsolver, ftol) integer ierr integer*8 fsolver @@ -1396,9 +1389,9 @@ return end -c*********************************************************************** -c fhypre_structpfmggettol -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmggettol +!*********************************************************************** subroutine fhypre_structpfmggettol(fsolver, ftol) integer ierr integer*8 fsolver @@ -1412,9 +1405,9 @@ return end -c*********************************************************************** -c fhypre_structpfmgsetmaxiter -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmgsetmaxiter +!*********************************************************************** subroutine fhypre_structpfmgsetmaxiter(fsolver, fmaxiter) integer ierr integer fmaxiter @@ -1428,9 +1421,9 @@ return end -c*********************************************************************** -c fhypre_structpfmggetmaxiter -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmggetmaxiter +!*********************************************************************** subroutine fhypre_structpfmggetmaxiter(fsolver, fmaxiter) integer ierr integer fmaxiter @@ -1444,9 +1437,9 @@ return end -c*********************************************************************** -c fhypre_structpfmgsetmaxlevels -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmgsetmaxlevels +!*********************************************************************** subroutine fhypre_structpfmgsetmaxlevels(fsolver, fmaxlevels) integer ierr integer fmaxlevels @@ -1460,9 +1453,9 @@ return end -c*********************************************************************** -c fhypre_structpfmggetmaxlevels -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmggetmaxlevels +!*********************************************************************** subroutine fhypre_structpfmggetmaxlevels(fsolver, fmaxlevels) integer ierr integer fmaxlevels @@ -1476,9 +1469,9 @@ return end -c*********************************************************************** -c fhypre_structpfmgsetrelchange -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmgsetrelchange +!*********************************************************************** subroutine fhypre_structpfmgsetrelchange(fsolver, frelchange) integer ierr integer frelchange @@ -1492,9 +1485,9 @@ return end -c*********************************************************************** -c fhypre_structpfmggetrelchange -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmggetrelchange +!*********************************************************************** subroutine fhypre_structpfmggetrelchange(fsolver, frelchange) integer ierr integer frelchange @@ -1508,9 +1501,9 @@ return end -c*********************************************************************** -c fhypre_structpfmgsetzeroguess -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmgsetzeroguess +!*********************************************************************** subroutine fhypre_structpfmgsetzeroguess(fsolver) integer ierr integer*8 fsolver @@ -1523,9 +1516,9 @@ return end -c*********************************************************************** -c fhypre_structpfmggetzeroguess -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmggetzeroguess +!*********************************************************************** subroutine fhypre_structpfmggetzeroguess(fsolver) integer ierr integer*8 fsolver @@ -1538,9 +1531,9 @@ return end -c*********************************************************************** -c fhypre_structpfmgsetnonzeroguess -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmgsetnonzeroguess +!*********************************************************************** subroutine fhypre_structpfmgsetnonzerogues(fsolver) integer ierr integer*8 fsolver @@ -1553,9 +1546,9 @@ return end -c*********************************************************************** -c fhypre_structpfmggetnumiterations -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmggetnumiterations +!*********************************************************************** subroutine fhypre_structpfmggetnumiteratio(fsolver, fnumiters) integer ierr integer fnumiters @@ -1569,9 +1562,9 @@ return end -c*********************************************************************** -c fhypre_structpfmggetfinalrelativeresidualnorm -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmggetfinalrelativeresidualnorm +!*********************************************************************** subroutine fhypre_structpfmggetfinalrelati(fsolver, fnorm) integer ierr integer*8 fsolver @@ -1585,9 +1578,9 @@ return end -c*********************************************************************** -c fhypre_structpfmgsetskiprelax -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmgsetskiprelax +!*********************************************************************** subroutine fhypre_structpfmgsetskiprelax(fsolver, fskiprelax) integer ierr integer fskiprelax @@ -1601,9 +1594,9 @@ return end -c*********************************************************************** -c fhypre_structpfmggetskiprelax -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmggetskiprelax +!*********************************************************************** subroutine fhypre_structpfmggetskiprelax(fsolver, fskiprelax) integer ierr integer fskiprelax @@ -1617,9 +1610,9 @@ return end -c*********************************************************************** -c fhypre_structpfmgsetrelaxtype -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmgsetrelaxtype +!*********************************************************************** subroutine fhypre_structpfmgsetrelaxtype(fsolver, frelaxtype) integer ierr integer frelaxtype @@ -1633,9 +1626,9 @@ return end -c*********************************************************************** -c fhypre_structpfmggetrelaxtype -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmggetrelaxtype +!*********************************************************************** subroutine fhypre_structpfmggetrelaxtype(fsolver, frelaxtype) integer ierr integer frelaxtype @@ -1649,9 +1642,9 @@ return end -c*********************************************************************** -c fhypre_structpfmgsetraptype -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmgsetraptype +!*********************************************************************** subroutine fhypre_structpfmgsetraptype(fsolver, fraptype) integer ierr integer fraptype @@ -1665,9 +1658,9 @@ return end -c*********************************************************************** -c fhypre_structpfmggetraptype -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmggetraptype +!*********************************************************************** subroutine fhypre_structpfmggetraptype(fsolver, fraptype) integer ierr integer fraptype @@ -1681,9 +1674,9 @@ return end -c*********************************************************************** -c fhypre_structpfmgsetnumprerelax -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmgsetnumprerelax +!*********************************************************************** subroutine fhypre_structpfmgsetnumprerelax(fsolver, 1 fnumprerelax) integer ierr @@ -1698,9 +1691,9 @@ return end -c*********************************************************************** -c fhypre_structpfmggetnumprerelax -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmggetnumprerelax +!*********************************************************************** subroutine fhypre_structpfmggetnumprerelax(fsolver, 1 fnumprerelax) integer ierr @@ -1715,9 +1708,9 @@ return end -c*********************************************************************** -c fhypre_structpfmgsetnumpostrelax -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmgsetnumpostrelax +!*********************************************************************** subroutine fhypre_structpfmgsetnumpostrela(fsolver, 1 fnumpostrelax) integer ierr @@ -1732,9 +1725,9 @@ return end -c*********************************************************************** -c fhypre_structpfmggetnumpostrelax -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmggetnumpostrelax +!*********************************************************************** subroutine fhypre_structpfmggetnumpostrela(fsolver, 1 fnumpostrelax) integer ierr @@ -1749,9 +1742,9 @@ return end -c*********************************************************************** -c fhypre_structpfmgsetdxyz -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmgsetdxyz +!*********************************************************************** subroutine fhypre_structpfmgsetdxyz(fsolver, fdxyz) integer ierr integer*8 fsolver @@ -1765,9 +1758,9 @@ return end -c*********************************************************************** -c fhypre_structpfmgsetlogging -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmgsetlogging +!*********************************************************************** subroutine fhypre_structpfmgsetlogging(fsolver, flogging) integer ierr integer flogging @@ -1781,9 +1774,9 @@ return end -c*********************************************************************** -c fhypre_structpfmggetlogging -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmggetlogging +!*********************************************************************** subroutine fhypre_structpfmggetlogging(fsolver, flogging) integer ierr integer flogging @@ -1797,9 +1790,9 @@ return end -c*********************************************************************** -c fhypre_structpfmgsetprintlevel -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmgsetprintlevel +!*********************************************************************** subroutine fhypre_structpfmgsetprintlevel(fsolver, fprintlevel) integer ierr integer fprintlevel @@ -1813,9 +1806,9 @@ return end -c*********************************************************************** -c fhypre_structpfmggetprintlevel -c*********************************************************************** +!*********************************************************************** +! fhypre_structpfmggetprintlevel +!*********************************************************************** subroutine fhypre_structpfmggetprintlevel(fsolver, fprintlevel) integer ierr integer fprintlevel @@ -1833,13 +1826,13 @@ -c*********************************************************************** -c HYPRE_StructSMG routines -c*********************************************************************** - -c*********************************************************************** -c fhypre_structsmgcreate -c*********************************************************************** +!*********************************************************************** +! HYPRE_StructSMG routines +!*********************************************************************** + +!*********************************************************************** +! fhypre_structsmgcreate +!*********************************************************************** subroutine fhypre_structsmgcreate(fcomm, fsolver) integer ierr integer fcomm @@ -1853,9 +1846,9 @@ return end -c*********************************************************************** -c fhypre_structsmgdestroy -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmgdestroy +!*********************************************************************** subroutine fhypre_structsmgdestroy(fsolver) integer ierr integer*8 fsolver @@ -1868,9 +1861,9 @@ return end -c*********************************************************************** -c fhypre_structsmgsetup -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmgsetup +!*********************************************************************** subroutine fhypre_structsmgsetup(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -1886,9 +1879,9 @@ return end -c*********************************************************************** -c fhypre_structsmgsolve -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmgsolve +!*********************************************************************** subroutine fhypre_structsmgsolve(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -1904,9 +1897,9 @@ return end -c*********************************************************************** -c fhypre_structsmgsetmemoryuse -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmgsetmemoryuse +!*********************************************************************** subroutine fhypre_structsmgsetmemoryuse(fsolver, fmemuse) integer ierr integer fmemuse @@ -1920,9 +1913,9 @@ return end -c*********************************************************************** -c fhypre_structsmggetmemoryuse -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmggetmemoryuse +!*********************************************************************** subroutine fhypre_structsmggetmemoryuse(fsolver, fmemuse) integer ierr integer fmemuse @@ -1936,9 +1929,9 @@ return end -c*********************************************************************** -c fhypre_structsmgsettol -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmgsettol +!*********************************************************************** subroutine fhypre_structsmgsettol(fsolver, ftol) integer ierr integer*8 fsolver @@ -1952,9 +1945,9 @@ return end -c*********************************************************************** -c fhypre_structsmggettol -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmggettol +!*********************************************************************** subroutine fhypre_structsmggettol(fsolver, ftol) integer ierr integer*8 fsolver @@ -1968,9 +1961,9 @@ return end -c*********************************************************************** -c fhypre_structsmgsetmaxiter -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmgsetmaxiter +!*********************************************************************** subroutine fhypre_structsmgsetmaxiter(fsolver, fmaxiter) integer ierr integer fmaxiter @@ -1984,9 +1977,9 @@ return end -c*********************************************************************** -c fhypre_structsmggetmaxiter -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmggetmaxiter +!*********************************************************************** subroutine fhypre_structsmggetmaxiter(fsolver, fmaxiter) integer ierr integer fmaxiter @@ -2000,9 +1993,9 @@ return end -c*********************************************************************** -c fhypre_structsmgsetrelchange -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmgsetrelchange +!*********************************************************************** subroutine fhypre_structsmgsetrelchange(fsolver, frelchange) integer ierr integer frelchange @@ -2016,9 +2009,9 @@ return end -c*********************************************************************** -c fhypre_structsmggetrelchange -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmggetrelchange +!*********************************************************************** subroutine fhypre_structsmggetrelchange(fsolver, frelchange) integer ierr integer frelchange @@ -2032,9 +2025,9 @@ return end -c*********************************************************************** -c fhypre_structsmgsetzeroguess -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmgsetzeroguess +!*********************************************************************** subroutine fhypre_structsmgsetzeroguess(fsolver) integer ierr integer*8 fsolver @@ -2047,9 +2040,9 @@ return end -c*********************************************************************** -c fhypre_structsmggetzeroguess -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmggetzeroguess +!*********************************************************************** subroutine fhypre_structsmggetzeroguess(fsolver) integer ierr integer*8 fsolver @@ -2062,9 +2055,9 @@ return end -c*********************************************************************** -c fhypre_structsmgsetnonzeroguess -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmgsetnonzeroguess +!*********************************************************************** subroutine fhypre_structsmgsetnonzeroguess(fsolver) integer ierr integer*8 fsolver @@ -2077,9 +2070,9 @@ return end -c*********************************************************************** -c fhypre_structsmggetnumiterations -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmggetnumiterations +!*********************************************************************** subroutine fhypre_structsmggetnumiteration(fsolver, fnumiters) integer ierr integer fnumiters @@ -2093,9 +2086,9 @@ return end -c*********************************************************************** -c fhypre_structsmggetfinalrelativeresidualnorm -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmggetfinalrelativeresidualnorm +!*********************************************************************** subroutine fhypre_structsmggetfinalrelativ(fsolver, fnorm) integer ierr integer*8 fsolver @@ -2109,9 +2102,9 @@ return end -c*********************************************************************** -c fhypre_structsmgsetnumprerelax -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmgsetnumprerelax +!*********************************************************************** subroutine fhypre_structsmgsetnumprerelax(fsolver, fnumprerelax) integer ierr integer fnumprerelax @@ -2125,9 +2118,9 @@ return end -c*********************************************************************** -c fhypre_structsmggetnumprerelax -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmggetnumprerelax +!*********************************************************************** subroutine fhypre_structsmggetnumprerelax(fsolver, fnumprerelax) integer ierr integer fnumprerelax @@ -2141,9 +2134,9 @@ return end -c*********************************************************************** -c fhypre_structsmgsetnumpostrelax -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmgsetnumpostrelax +!*********************************************************************** subroutine fhypre_structsmgsetnumpostrelax(fsolver, fnumpstrlx) integer ierr integer fnumpstrlx @@ -2157,9 +2150,9 @@ return end -c*********************************************************************** -c fhypre_structsmggetnumpostrelax -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmggetnumpostrelax +!*********************************************************************** subroutine fhypre_structsmggetnumpostrelax(fsolver, fnumpstrlx) integer ierr integer fnumpstrlx @@ -2173,9 +2166,9 @@ return end -c*********************************************************************** -c fhypre_structsmgsetlogging -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmgsetlogging +!*********************************************************************** subroutine fhypre_structsmgsetlogging(fsolver, flogging) integer ierr integer flogging @@ -2189,9 +2182,9 @@ return end -c*********************************************************************** -c fhypre_structsmggetlogging -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmggetlogging +!*********************************************************************** subroutine fhypre_structsmggetlogging(fsolver, flogging) integer ierr integer flogging @@ -2205,9 +2198,9 @@ return end -c*********************************************************************** -c fhypre_structsmgsetprintlevel -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmgsetprintlevel +!*********************************************************************** subroutine fhypre_structsmgsetprintlevel(fsolver, fprintlevel) integer ierr integer fprintlevel @@ -2221,9 +2214,9 @@ return end -c*********************************************************************** -c fhypre_structsmggetprintlevel -c*********************************************************************** +!*********************************************************************** +! fhypre_structsmggetprintlevel +!*********************************************************************** subroutine fhypre_structsmggetprintlevel(fsolver, fprintlevel) integer ierr integer fprintlevel @@ -2241,13 +2234,13 @@ -c*********************************************************************** -c HYPRE_StructSparseMSG routines -c*********************************************************************** - -c*********************************************************************** -c fhypre_structsparsemsgcreate -c*********************************************************************** +!*********************************************************************** +! HYPRE_StructSparseMSG routines +!*********************************************************************** + +!*********************************************************************** +! fhypre_structsparsemsgcreate +!*********************************************************************** subroutine fhypre_structsparsemsgcreate(fcomm, fsolver) integer ierr integer fcomm @@ -2261,9 +2254,9 @@ return end -c*********************************************************************** -c fhypre_structsparsemsgdestroy -c*********************************************************************** +!*********************************************************************** +! fhypre_structsparsemsgdestroy +!*********************************************************************** subroutine fhypre_structsparsemsgdestroy(fsolver) integer ierr integer*8 fsolver @@ -2276,9 +2269,9 @@ return end -c*********************************************************************** -c fhypre_structsparsemsgsetup -c*********************************************************************** +!*********************************************************************** +! fhypre_structsparsemsgsetup +!*********************************************************************** subroutine fhypre_structsparsemsgsetup(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -2294,9 +2287,9 @@ return end -c*********************************************************************** -c fhypre_structsparsemsgsolve -c*********************************************************************** +!*********************************************************************** +! fhypre_structsparsemsgsolve +!*********************************************************************** subroutine fhypre_structsparsemsgsolve(fsolver, fA, fb, fx) integer ierr integer*8 fsolver @@ -2312,9 +2305,9 @@ return end -c*********************************************************************** -c fhypre_structsparsemsgsetjump -c*********************************************************************** +!*********************************************************************** +! fhypre_structsparsemsgsetjump +!*********************************************************************** subroutine fhypre_structsparsemsgsetjump(fsolver, fjump) integer ierr integer fjump @@ -2328,9 +2321,9 @@ return end -c*********************************************************************** -c fhypre_structsparsemsgsettol -c*********************************************************************** +!*********************************************************************** +! fhypre_structsparsemsgsettol +!*********************************************************************** subroutine fhypre_structsparsemsgsettol(fsolver, ftol) integer ierr integer*8 fsolver @@ -2344,9 +2337,9 @@ return end -c*********************************************************************** -c fhypre_structsparsemsgsetmaxiter -c*********************************************************************** +!*********************************************************************** +! fhypre_structsparsemsgsetmaxiter +!*********************************************************************** subroutine fhypre_structsparsemsgsetmaxite(fsolver, fmaxiter) integer ierr integer fmaxiter @@ -2360,9 +2353,9 @@ return end -c*********************************************************************** -c fhypre_structsparsemsgsetrelchange -c*********************************************************************** +!*********************************************************************** +! fhypre_structsparsemsgsetrelchange +!*********************************************************************** subroutine fhypre_structsparsemsgsetrelcha(fsolver, frelchange) integer ierr integer frelchange @@ -2376,9 +2369,9 @@ return end -c*********************************************************************** -c fhypre_structsparsemsgsetzeroguess -c*********************************************************************** +!*********************************************************************** +! fhypre_structsparsemsgsetzeroguess +!*********************************************************************** subroutine fhypre_structsparsemsgsetzerogu(fsolver) integer ierr integer*8 fsolver @@ -2391,9 +2384,9 @@ return end -c*********************************************************************** -c fhypre_structsparsemsgsetnonzeroguess -c*********************************************************************** +!*********************************************************************** +! fhypre_structsparsemsgsetnonzeroguess +!*********************************************************************** subroutine fhypre_structsparsemsgsetnonzer(fsolver) integer ierr integer*8 fsolver @@ -2406,9 +2399,9 @@ return end -c*********************************************************************** -c fhypre_structsparsemsggetnumiterations -c*********************************************************************** +!*********************************************************************** +! fhypre_structsparsemsggetnumiterations +!*********************************************************************** subroutine fhypre_structsparsemsggetnumite(fsolver, fniters) integer ierr integer fniters @@ -2422,9 +2415,9 @@ return end -c*********************************************************************** -c fhypre_structsparsemsggetfinalrelativeresidualnorm -c*********************************************************************** +!*********************************************************************** +! fhypre_structsparsemsggetfinalrelativeresidualnorm +!*********************************************************************** subroutine fhypre_structsparsemsggetfinalr(fsolver, fnorm) integer ierr integer*8 fsolver @@ -2438,9 +2431,9 @@ return end -c*********************************************************************** -c fhypre_structsparsemsgsetrelaxtype -c*********************************************************************** +!*********************************************************************** +! fhypre_structsparsemsgsetrelaxtype +!*********************************************************************** subroutine fhypre_structsparsemsgsetrelaxt(fsolver, frelaxtype) integer ierr integer frelaxtype @@ -2454,9 +2447,9 @@ return end -c*********************************************************************** -c fhypre_structsparsemsgsetnumprerelax -c*********************************************************************** +!*********************************************************************** +! fhypre_structsparsemsgsetnumprerelax +!*********************************************************************** subroutine fhypre_structsparsemsgsetnumpre(fsolver, fnprelax) integer ierr integer fnprelax @@ -2470,9 +2463,9 @@ return end -c*********************************************************************** -c fhypre_structsparsemsgsetnumpostrelax -c*********************************************************************** +!*********************************************************************** +! fhypre_structsparsemsgsetnumpostrelax +!*********************************************************************** subroutine fhypre_structsparsemsgsetnumpos(fsolver, fnpstrlx) integer ierr integer fnpstrlx @@ -2486,9 +2479,9 @@ return end -c*********************************************************************** -c fhypre_structsparsemsgsetnumfinerelax -c*********************************************************************** +!*********************************************************************** +! fhypre_structsparsemsgsetnumfinerelax +!*********************************************************************** subroutine fhypre_structsparsemsgsetnumfin(fsolver, fnfine) integer ierr integer fnfine @@ -2502,9 +2495,9 @@ return end -c*********************************************************************** -c fhypre_structsparsemsgsetlogging -c*********************************************************************** +!*********************************************************************** +! fhypre_structsparsemsgsetlogging +!*********************************************************************** subroutine fhypre_structsparsemsgsetloggin(fsolver, flogging) integer ierr integer flogging @@ -2518,9 +2511,9 @@ return end -c*********************************************************************** -c fhypre_structsparsemsgsetprintlevel -c*********************************************************************** +!*********************************************************************** +! fhypre_structsparsemsgsetprintlevel +!*********************************************************************** subroutine fhypre_structsparsemsgsetprintl(fsolver, fprntlvl) integer ierr integer fprntlvl diff -Nru hypre-2.16.0/src/test/fstruct_mv.f hypre-2.18.2/src/test/fstruct_mv.f --- hypre-2.16.0/src/test/fstruct_mv.f 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/fstruct_mv.f 2019-10-28 22:30:04.000000000 +0000 @@ -1,27 +1,20 @@ -cBHEADER********************************************************************** -c Copyright (c) 2008, Lawrence Livermore National Security, LLC. -c Produced at the Lawrence Livermore National Laboratory. -c This file is part of HYPRE. See file COPYRIGHT for details. -c -c HYPRE is free software; you can redistribute it and/or modify it under the -c terms of the GNU Lesser General Public License (as published by the Free -c Software Foundation) version 2.1 dated February 1999. -c -c $Revision$ -cEHEADER********************************************************************** - -c************************************************** -c Routines to test struct_mv fortran interface -c************************************************** - - -c************************************************** -c HYPRE_StructStencil routines -c************************************************** - -c****************************************** -c fhypre_structstencilcreate -c****************************************** +! Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +! HYPRE Project Developers. See the top-level COPYRIGHT file for details. +! +! SPDX-License-Identifier: (Apache-2.0 OR MIT) + +!************************************************** +! Routines to test struct_mv fortran interface +!************************************************** + + +!************************************************** +! HYPRE_StructStencil routines +!************************************************** + +!****************************************** +! fhypre_structstencilcreate +!****************************************** subroutine fhypre_structstencilcreate(fdim, fdim1, fstencil) integer ierr integer fdim @@ -36,9 +29,9 @@ return end -c****************************************** -c fhypre_structstencilsetelement -c****************************************** +!****************************************** +! fhypre_structstencilsetelement +!****************************************** subroutine fhypre_structstencilsetelement(fstencil, findx, 1 foffset) integer ierr @@ -55,9 +48,9 @@ return end -c****************************************** -c fhypre_structstencildestroy -c****************************************** +!****************************************** +! fhypre_structstencildestroy +!****************************************** subroutine fhypre_structstencildestroy(fstencil) integer ierr integer*8 fstencil @@ -72,13 +65,13 @@ -c************************************************** -c HYPRE_StructGrid routines -c************************************************** - -c****************************************** -c fhypre_structgridcreate -c****************************************** +!************************************************** +! HYPRE_StructGrid routines +!************************************************** + +!****************************************** +! fhypre_structgridcreate +!****************************************** subroutine fhypre_structgridcreate(fcomm, fdim, fgrid) integer ierr integer fcomm @@ -93,9 +86,9 @@ return end -c****************************************** -c fhypre_structgriddestroy -c****************************************** +!****************************************** +! fhypre_structgriddestroy +!****************************************** subroutine fhypre_structgriddestroy(fgrid) integer ierr integer*8 fgrid @@ -108,9 +101,9 @@ return end -c****************************************** -c fhypre_structgridsetextents -c****************************************** +!****************************************** +! fhypre_structgridsetextents +!****************************************** subroutine fhypre_structgridsetextents(fgrid, flower, fupper) integer ierr integer flower(*) @@ -125,9 +118,9 @@ return end -c****************************************** -c fhypre_structgridsetperiodic -c****************************************** +!****************************************** +! fhypre_structgridsetperiodic +!****************************************** subroutine fhypre_structgridsetperiodic(fgrid, fperiod) integer ierr integer fperiod(*) @@ -141,9 +134,9 @@ return end -c****************************************** -c fhypre_structgridassemble -c****************************************** +!****************************************** +! fhypre_structgridassemble +!****************************************** subroutine fhypre_structgridassemble(fgrid) integer ierr integer*8 fgrid @@ -156,9 +149,9 @@ return end -c****************************************** -c fhypre_structgridsetnumghost -c****************************************** +!****************************************** +! fhypre_structgridsetnumghost +!****************************************** subroutine fhypre_structgridsetnumghost(fgrid, fnumghost) integer ierr integer fnumghost @@ -174,13 +167,13 @@ -c************************************************** -c HYPRE_StructMatrix routines -c************************************************** - -c****************************************** -c fhypre_structmatrixcreate -c****************************************** +!************************************************** +! HYPRE_StructMatrix routines +!************************************************** + +!****************************************** +! fhypre_structmatrixcreate +!****************************************** subroutine fhypre_structmatrixcreate(fcomm, fgrid, fstencil, 1 fmatrix) integer ierr @@ -198,9 +191,9 @@ return end -c****************************************** -c fhypre_structmatrixdestroy -c****************************************** +!****************************************** +! fhypre_structmatrixdestroy +!****************************************** subroutine fhypre_structmatrixdestroy(fmatrix) integer ierr integer*8 fmatrix @@ -213,9 +206,9 @@ return end -c****************************************** -c fhypre_structmatrixinitialize -c****************************************** +!****************************************** +! fhypre_structmatrixinitialize +!****************************************** subroutine fhypre_structmatrixinitialize(fmatrix) integer ierr integer*8 fmatrix @@ -228,9 +221,9 @@ return end -c****************************************** -c fhypre_structmatrixsetvalues -c****************************************** +!****************************************** +! fhypre_structmatrixsetvalues +!****************************************** subroutine fhypre_structmatrixsetvalues(fmatrix, fgridindx, 1 fnumsindx, fsindx, fvals) integer ierr @@ -249,9 +242,9 @@ return end -c****************************************** -c fhypre_structmatrixsetboxvalues -c****************************************** +!****************************************** +! fhypre_structmatrixsetboxvalues +!****************************************** subroutine fhypre_structmatrixsetboxvalues(fmatrix, flower, 1 fupper, fnumsindx, 2 fsindx, fvals) @@ -273,9 +266,9 @@ return end -c****************************************** -c fhypre_structmatrixgetboxvalues -c****************************************** +!****************************************** +! fhypre_structmatrixgetboxvalues +!****************************************** subroutine fhypre_structmatrixgetboxvalues(fmatrix, flower, 1 fupper, fnumsindx, 2 fsindx, fvals) @@ -297,9 +290,9 @@ return end -c****************************************** -c fhypre_structmatrixsetconstantentries -c****************************************** +!****************************************** +! fhypre_structmatrixsetconstantentries +!****************************************** subroutine fhypre_structmatrixsetconstante(fmatrix, fnument, 1 fentries) integer ierr @@ -316,9 +309,9 @@ return end -c****************************************** -c fhypre_structmatrixsetconstantvalues -c****************************************** +!****************************************** +! fhypre_structmatrixsetconstantvalues +!****************************************** subroutine fhypre_structmatrixsetconstantv(fmatrix, 1 fnumsindx, fsindx, 2 fvals) @@ -337,9 +330,9 @@ return end -c****************************************** -c fhypre_structmatrixaddtovalues -c****************************************** +!****************************************** +! fhypre_structmatrixaddtovalues +!****************************************** subroutine fhypre_structmatrixaddtovalues(fmatrix, fgrdindx, 1 fnumsindx, fsindx, 2 fvals) @@ -360,9 +353,9 @@ return end -c****************************************** -c fhypre_structmatrixaddtoboxvalues -c****************************************** +!****************************************** +! fhypre_structmatrixaddtoboxvalues +!****************************************** subroutine fhypre_structmatrixaddtoboxvalues(fmatrix, filower, 1 fiupper, fnumsindx, 2 fsindx, fvals) @@ -384,9 +377,9 @@ return end -c****************************************** -c fhypre_structmatrixaddtoconstantvalues -c****************************************** +!****************************************** +! fhypre_structmatrixaddtoconstantvalues +!****************************************** subroutine fhypre_structmatrixaddtoconstant(fmatrix, fnumsindx, 2 fsindx, fvals) integer ierr @@ -405,9 +398,9 @@ return end -c****************************************** -c fhypre_structmatrixassemble -c****************************************** +!****************************************** +! fhypre_structmatrixassemble +!****************************************** subroutine fhypre_structmatrixassemble(fmatrix) integer ierr integer*8 fmatrix @@ -420,9 +413,9 @@ return end -c****************************************** -c fhypre_structmatrixsetnumghost -c****************************************** +!****************************************** +! fhypre_structmatrixsetnumghost +!****************************************** subroutine fhypre_structmatrixsetnumghost(fmatrix, fnumghost) integer ierr integer fnumghost @@ -436,9 +429,9 @@ return end -c****************************************** -c fhypre_structmatrixgetgrid -c****************************************** +!****************************************** +! fhypre_structmatrixgetgrid +!****************************************** subroutine fhypre_structmatrixgetgrid(fmatrix, fgrid) integer ierr integer*8 fmatrix @@ -452,9 +445,9 @@ return end -c****************************************** -c fhypre_structmatrixsetsymmetric -c****************************************** +!****************************************** +! fhypre_structmatrixsetsymmetric +!****************************************** subroutine fhypre_structmatrixsetsymmetric(fmatrix, fsymmetric) integer ierr integer fsymmetric @@ -468,9 +461,9 @@ return end -c****************************************** -c fhypre_structmatrixprint -c****************************************** +!****************************************** +! fhypre_structmatrixprint +!****************************************** subroutine fhypre_structmatrixprint(fmatrix, fall) integer ierr integer fall @@ -484,9 +477,9 @@ return end -c****************************************** -c fhypre_structmatrixmatvec -c****************************************** +!****************************************** +! fhypre_structmatrixmatvec +!****************************************** subroutine fhypre_structmatrixmatvec(falpha, fA, fx, fbeta, fy) integer ierr integer falpha @@ -505,13 +498,13 @@ -c************************************************** -c HYPRE_StructVector routines -c************************************************** - -c****************************************** -c fhypre_structvectorcreate -c****************************************** +!************************************************** +! HYPRE_StructVector routines +!************************************************** + +!****************************************** +! fhypre_structvectorcreate +!****************************************** subroutine fhypre_structvectorcreate(fcomm, fgrid, fvector) integer ierr integer fcomm @@ -526,9 +519,9 @@ return end -c****************************************** -c fhypre_structvectordestroy -c****************************************** +!****************************************** +! fhypre_structvectordestroy +!****************************************** subroutine fhypre_structvectordestroy(fvector) integer ierr integer*8 fvector @@ -541,9 +534,9 @@ return end -c****************************************** -c fhypre_structvectorinitialize -c****************************************** +!****************************************** +! fhypre_structvectorinitialize +!****************************************** subroutine fhypre_structvectorinitialize(fvector) integer ierr integer*8 fvector @@ -556,9 +549,9 @@ return end -c****************************************** -c fhypre_structvectorsetvalues -c****************************************** +!****************************************** +! fhypre_structvectorsetvalues +!****************************************** subroutine fhypre_structvectorsetvalues(fvector, fgridindx, 1 fvals) integer ierr @@ -574,9 +567,9 @@ return end -c****************************************** -c fhypre_structvectorsetboxvalues -c****************************************** +!****************************************** +! fhypre_structvectorsetboxvalues +!****************************************** subroutine fhypre_structvectorsetboxvalues(fvector, flower, 1 fupper, fvals) integer ierr @@ -594,9 +587,9 @@ return end -c****************************************** -c fhypre_structvectorsetconstantvalues -c****************************************** +!****************************************** +! fhypre_structvectorsetconstantvalues +!****************************************** subroutine fhypre_structvectorsetconstantv(fvector, fvals) integer ierr double precision fvals(*) @@ -610,9 +603,9 @@ return end -c****************************************** -c fhypre_structvectoraddtovalues -c****************************************** +!****************************************** +! fhypre_structvectoraddtovalues +!****************************************** subroutine fhypre_structvectoraddtovalues(fvector, fgrdindx, 1 fvals) integer ierr @@ -628,9 +621,9 @@ return end -c****************************************** -c fhypre_structvectoraddtoboxvalues -c****************************************** +!****************************************** +! fhypre_structvectoraddtoboxvalues +!****************************************** subroutine fhypre_structvectoraddtoboxvalu(fvector, flower, 1 fupper, fvals) integer ierr @@ -648,9 +641,9 @@ return end -c****************************************** -c fhypre_structvectorscalevalues -c****************************************** +!****************************************** +! fhypre_structvectorscalevalues +!****************************************** subroutine fhypre_structvectorscalevalues(fvector, ffactor) integer ierr double precision ffactor @@ -664,9 +657,9 @@ return end -c****************************************** -c fhypre_structvectorgetvalues -c****************************************** +!****************************************** +! fhypre_structvectorgetvalues +!****************************************** subroutine fhypre_structvectorgetvalues(fvector, fgrdindx, 1 fvals) integer ierr @@ -682,9 +675,9 @@ return end -c****************************************** -c fhypre_structvectorgetboxvalues -c****************************************** +!****************************************** +! fhypre_structvectorgetboxvalues +!****************************************** subroutine fhypre_structvectorgetboxvalues(fvector, flower, 1 fupper, fvals) integer ierr @@ -702,9 +695,9 @@ return end -c****************************************** -c fhypre_structvectorassemble -c****************************************** +!****************************************** +! fhypre_structvectorassemble +!****************************************** subroutine fhypre_structvectorassemble(fvector) integer ierr integer*8 fvector @@ -717,9 +710,9 @@ return end -c****************************************** -c fhypre_structvectorsetnumghost -c****************************************** +!****************************************** +! fhypre_structvectorsetnumghost +!****************************************** subroutine fhypre_structvectorsetnumghost(fvector, fnumghost) integer ierr integer fnumghost @@ -733,9 +726,9 @@ return end -c****************************************** -c fhypre_structvectorcopy -c****************************************** +!****************************************** +! fhypre_structvectorcopy +!****************************************** subroutine fhypre_structvectorcopy(fx, fy) integer ierr integer*8 fx @@ -749,9 +742,9 @@ return end -c****************************************** -c fhypre_structvectorgetmigratecommpkg -c****************************************** +!****************************************** +! fhypre_structvectorgetmigratecommpkg +!****************************************** subroutine fhypre_structvectorgetmigrateco(ffromvec, ftovec, 1 fcommpkg) integer ierr @@ -768,9 +761,9 @@ return end -c****************************************** -c fhypre_structvectormigrate -c****************************************** +!****************************************** +! fhypre_structvectormigrate +!****************************************** subroutine fhypre_structvectormigrate(fcommpkg, ffromvec, 1 ftovec) integer ierr @@ -786,9 +779,9 @@ return end -c****************************************** -c fhypre_commpkgdestroy -c****************************************** +!****************************************** +! fhypre_commpkgdestroy +!****************************************** subroutine fhypre_commpkgdestroy(fcommpkg) integer ierr integer*8 fcommpkg @@ -801,9 +794,9 @@ return end -c****************************************** -c fhypre_structvectorprint -c****************************************** +!****************************************** +! fhypre_structvectorprint +!****************************************** subroutine fhypre_structvectorprint(fvector, fall) integer ierr integer fall diff -Nru hypre-2.16.0/src/test/hypre_ij_fortran_test.h hypre-2.18.2/src/test/hypre_ij_fortran_test.h --- hypre-2.16.0/src/test/hypre_ij_fortran_test.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/hypre_ij_fortran_test.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifdef __cplusplus extern "C" { diff -Nru hypre-2.16.0/src/test/hypre_parcsr_fortran_test.h hypre-2.18.2/src/test/hypre_parcsr_fortran_test.h --- hypre-2.16.0/src/test/hypre_parcsr_fortran_test.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/hypre_parcsr_fortran_test.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifdef __cplusplus extern "C" { diff -Nru hypre-2.16.0/src/test/hypre_set_precond.c hypre-2.18.2/src/test/hypre_set_precond.c --- hypre-2.16.0/src/test/hypre_set_precond.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/hypre_set_precond.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*-------------------------------------------------------------------------- * Routines to set up preconditioners for use in test codes. diff -Nru hypre-2.16.0/src/test/hypre_sstruct_fortran_test.h hypre-2.18.2/src/test/hypre_sstruct_fortran_test.h --- hypre-2.16.0/src/test/hypre_sstruct_fortran_test.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/hypre_sstruct_fortran_test.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + #ifdef __cplusplus extern "C" { diff -Nru hypre-2.16.0/src/test/hypre_struct_fortran_test.h hypre-2.18.2/src/test/hypre_struct_fortran_test.h --- hypre-2.16.0/src/test/hypre_struct_fortran_test.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/hypre_struct_fortran_test.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,10 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + #ifdef __cplusplus extern "C" { #endif diff -Nru hypre-2.16.0/src/test/hypre_test.h hypre-2.18.2/src/test/hypre_test.h --- hypre-2.16.0/src/test/hypre_test.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/hypre_test.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*-------------------------------------------------------------------------- * Header file for test drivers diff -Nru hypre-2.16.0/src/test/ij.c hypre-2.18.2/src/test/ij.c --- hypre-2.16.0/src/test/ij.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/ij.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*-------------------------------------------------------------------------- * Test driver for unstructured matrix interface (IJ_matrix interface). @@ -30,7 +25,7 @@ #include "_hypre_parcsr_mv.h" #include "HYPRE_krylov.h" -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU #include "superlu_ddefs.h" #endif @@ -118,6 +113,7 @@ HYPRE_Int build_funcs_arg_index; HYPRE_Int solver_id; HYPRE_Int solver_type = 1; + HYPRE_Int recompute_res = 0; /* What should be the default here? */ HYPRE_Int ioutdat; HYPRE_Int poutdat; HYPRE_Int debug_flag; @@ -150,23 +146,23 @@ HYPRE_Solver pcg_solver; HYPRE_Solver pcg_precond=NULL, pcg_precond_gotten; - HYPRE_Int check_residual = 0; - HYPRE_Int num_procs, myid; - HYPRE_Int local_row; - HYPRE_Int *row_sizes; - HYPRE_Int *diag_sizes; - HYPRE_Int *offdiag_sizes; - HYPRE_BigInt *rows; - HYPRE_Int size; - HYPRE_Int *ncols; - HYPRE_BigInt *col_inds; - HYPRE_Int *dof_func; - HYPRE_Int num_functions = 1; - HYPRE_Int num_paths = 1; - HYPRE_Int agg_num_levels = 0; - HYPRE_Int ns_coarse = 1, ns_down = -1, ns_up = -1; + HYPRE_Int check_residual = 0; + HYPRE_Int num_procs, myid; + HYPRE_Int local_row; + HYPRE_Int *row_sizes; + HYPRE_Int *diag_sizes; + HYPRE_Int *offdiag_sizes; + HYPRE_BigInt *rows; + HYPRE_Int size; + HYPRE_Int *ncols; + HYPRE_BigInt *col_inds; + HYPRE_Int *dof_func; + HYPRE_Int num_functions = 1; + HYPRE_Int num_paths = 1; + HYPRE_Int agg_num_levels = 0; + HYPRE_Int ns_coarse = 1, ns_down = -1, ns_up = -1; - HYPRE_Int time_index; + HYPRE_Int time_index; MPI_Comm comm = hypre_MPI_COMM_WORLD; HYPRE_BigInt M, N, big_i; HYPRE_Int local_num_rows, local_num_cols; @@ -190,7 +186,9 @@ /* parameters for BoomerAMG */ HYPRE_Real A_drop_tol = 0.0; + HYPRE_Int A_drop_type = -1; HYPRE_Real strong_threshold; + HYPRE_Real strong_thresholdR; HYPRE_Real trunc_factor; HYPRE_Real jacobi_trunc_threshold; HYPRE_Real S_commpkg_switch = 1.0; @@ -199,6 +197,7 @@ HYPRE_Int CR_use_CG = 0; HYPRE_Int P_max_elmts = 4; HYPRE_Int cycle_type; + HYPRE_Int fcycle; HYPRE_Int coarsen_type = 10; HYPRE_Int measure_type = 0; HYPRE_Int num_sweeps = 1; @@ -212,10 +211,10 @@ HYPRE_Int relax_order = 0; HYPRE_Int level_w = -1; HYPRE_Int level_ow = -1; -/* HYPRE_Int smooth_lev; */ -/* HYPRE_Int smooth_rlx = 8; */ - HYPRE_Int smooth_type = 6; - HYPRE_Int smooth_num_levels = 0; + /* HYPRE_Int smooth_lev; */ + /* HYPRE_Int smooth_rlx = 8; */ + HYPRE_Int smooth_type = 6; + HYPRE_Int smooth_num_levels = 0; HYPRE_Int smooth_num_sweeps = 1; HYPRE_Int coarse_threshold = 9; HYPRE_Int min_coarse_size = 0; @@ -230,9 +229,16 @@ HYPRE_Int add_P_max_elmts = 0; HYPRE_Real add_trunc_factor = 0; +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + HYPRE_Int rap2=0; + HYPRE_Int mod_rap2=0; + HYPRE_Int keepTranspose = 1; +#else HYPRE_Int rap2=0; + HYPRE_Int mod_rap2=0; HYPRE_Int keepTranspose = 0; -#ifdef HAVE_DSUPERLU +#endif +#ifdef HYPRE_USING_DSUPERLU HYPRE_Int dslu_threshold = -1; #endif HYPRE_Real relax_wt; @@ -270,19 +276,19 @@ /* parameters for Euclid or ILU smoother in AMG */ HYPRE_Real eu_ilut = 0.0; HYPRE_Real eu_sparse_A = 0.0; - HYPRE_Int eu_bj = 0; - HYPRE_Int eu_level = -1; - HYPRE_Int eu_stats = 0; - HYPRE_Int eu_mem = 0; - HYPRE_Int eu_row_scale = 0; /* Euclid only */ + HYPRE_Int eu_bj = 0; + HYPRE_Int eu_level = -1; + HYPRE_Int eu_stats = 0; + HYPRE_Int eu_mem = 0; + HYPRE_Int eu_row_scale = 0; /* Euclid only */ /* parameters for GMRES */ - HYPRE_Int k_dim; + HYPRE_Int k_dim; /* parameters for COGMRES */ - HYPRE_Int cgs = 1; - HYPRE_Int unroll = 0; + HYPRE_Int cgs = 1; + HYPRE_Int unroll = 0; /* parameters for LGMRES */ - HYPRE_Int aug_dim; + HYPRE_Int aug_dim; /* parameters for GSMG */ HYPRE_Int gsmg_samples = 5; /* interpolation */ @@ -389,13 +395,26 @@ hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + time_index = hypre_InitializeTiming("Hypre init"); + hypre_BeginTiming(time_index); + /* Initialize Hypre */ HYPRE_Init(argc, argv); + hypre_EndTiming(time_index); + hypre_PrintTiming("Hypre init times", hypre_MPI_COMM_WORLD); + hypre_FinalizeTiming(time_index); + hypre_ClearTiming(); + +#ifdef HYPRE_USING_CUDA + //hypre_SetExecPolicy(HYPRE_EXEC_DEVICE); + hypre_SetExecPolicy(HYPRE_EXEC_HOST); +#endif + //omp_set_default_device(0); //nvtxDomainHandle_t domain = nvtxDomainCreateA("Domain_A"); /* - hypre_InitMemoryDebug(myid); + hypre_InitMemoryDebug(myid); */ /*----------------------------------------------------------- * Set defaults @@ -546,11 +565,11 @@ arg_index++; /* begin lobpcg */ if ( strcmp(argv[arg_index], "none") == 0 ) { - solver_id = NO_SOLVER; - arg_index++; + solver_id = NO_SOLVER; + arg_index++; } else /* end lobpcg */ - solver_id = atoi(argv[arg_index++]); + solver_id = atoi(argv[arg_index++]); } else if ( strcmp(argv[arg_index], "-rbm") == 0 ) { @@ -874,70 +893,70 @@ } /* begin lobpcg */ else if ( strcmp(argv[arg_index], "-lobpcg") == 0 ) - { /* use lobpcg */ - arg_index++; - lobpcgFlag = 1; - } + { /* use lobpcg */ + arg_index++; + lobpcgFlag = 1; + } else if ( strcmp(argv[arg_index], "-gen") == 0 ) - { /* generalized evp */ - arg_index++; - lobpcgGen = 1; - } + { /* generalized evp */ + arg_index++; + lobpcgGen = 1; + } else if ( strcmp(argv[arg_index], "-con") == 0 ) - { /* constrained evp */ - arg_index++; - constrained = 1; - } + { /* constrained evp */ + arg_index++; + constrained = 1; + } else if ( strcmp(argv[arg_index], "-orthchk") == 0 ) - { /* lobpcg: check orthonormality */ - arg_index++; - checkOrtho = 1; - } + { /* lobpcg: check orthonormality */ + arg_index++; + checkOrtho = 1; + } else if ( strcmp(argv[arg_index], "-vfromfile") == 0 ) - { /* lobpcg: get initial vectors from file */ - arg_index++; - vFromFileFlag = 1; - } + { /* lobpcg: get initial vectors from file */ + arg_index++; + vFromFileFlag = 1; + } else if ( strcmp(argv[arg_index], "-vrand") == 0 ) - { /* lobpcg: block size */ - arg_index++; - blockSize = atoi(argv[arg_index++]); - } + { /* lobpcg: block size */ + arg_index++; + blockSize = atoi(argv[arg_index++]); + } else if ( strcmp(argv[arg_index], "-seed") == 0 ) - { /* lobpcg: seed for srand */ - arg_index++; - lobpcgSeed = atoi(argv[arg_index++]); - } + { /* lobpcg: seed for srand */ + arg_index++; + lobpcgSeed = atoi(argv[arg_index++]); + } else if ( strcmp(argv[arg_index], "-itr") == 0 ) - { /* lobpcg: max # of iterations */ - arg_index++; - maxIterations = atoi(argv[arg_index++]); - } + { /* lobpcg: max # of iterations */ + arg_index++; + maxIterations = atoi(argv[arg_index++]); + } else if ( strcmp(argv[arg_index], "-verb") == 0 ) - { /* lobpcg: verbosity level */ - arg_index++; - verbosity = atoi(argv[arg_index++]); - } + { /* lobpcg: verbosity level */ + arg_index++; + verbosity = atoi(argv[arg_index++]); + } else if ( strcmp(argv[arg_index], "-vout") == 0 ) - { /* lobpcg: print level */ - arg_index++; - printLevel = atoi(argv[arg_index++]); - } + { /* lobpcg: print level */ + arg_index++; + printLevel = atoi(argv[arg_index++]); + } else if ( strcmp(argv[arg_index], "-pcgitr") == 0 ) - { /* lobpcg: inner pcg iterations */ - arg_index++; - pcgIterations = atoi(argv[arg_index++]); - } + { /* lobpcg: inner pcg iterations */ + arg_index++; + pcgIterations = atoi(argv[arg_index++]); + } else if ( strcmp(argv[arg_index], "-pcgtol") == 0 ) - { /* lobpcg: inner pcg iterations */ - arg_index++; - pcgTol = atof(argv[arg_index++]); - } + { /* lobpcg: inner pcg iterations */ + arg_index++; + pcgTol = atof(argv[arg_index++]); + } else if ( strcmp(argv[arg_index], "-pcgmode") == 0 ) - { /* lobpcg: initial guess for inner pcg */ - arg_index++; /* 0: zero, otherwise rhs */ - pcgMode = atoi(argv[arg_index++]); - } + { /* lobpcg: initial guess for inner pcg */ + arg_index++; /* 0: zero, otherwise rhs */ + pcgMode = atoi(argv[arg_index++]); + } /* end lobpcg */ /* begin mgr options*/ else if ( strcmp(argv[arg_index], "-mgr_bsize") == 0 ) @@ -1006,6 +1025,16 @@ mgr_num_restrict_sweeps = atoi(argv[arg_index++]); } /* end mgr options */ + else if ( strcmp(argv[arg_index], "-exec_host") == 0 ) + { + arg_index++; + hypre_SetExecPolicy(HYPRE_EXEC_HOST); + } + else if ( strcmp(argv[arg_index], "-exec_device") == 0 ) + { + arg_index++; + hypre_SetExecPolicy(HYPRE_EXEC_DEVICE); + } else { arg_index++; @@ -1032,7 +1061,7 @@ /* begin lobpcg */ if ( solver_id == 0 && lobpcgFlag ) - solver_id = 1; + solver_id = 1; /* end lobpcg */ @@ -1048,10 +1077,11 @@ || solver_id == 16 || solver_id == 70 || solver_id == 71 || solver_id == 72) { - strong_threshold = 0.25; + strong_threshold = strong_thresholdR = 0.25; trunc_factor = 0.; jacobi_trunc_threshold = 0.01; cycle_type = 1; + fcycle = 0; relax_wt = 1.; outer_wt = 1.; @@ -1146,6 +1176,11 @@ arg_index++; A_drop_tol = atof(argv[arg_index++]); } + else if ( strcmp(argv[arg_index], "-adroptype") == 0 ) + { + arg_index++; + A_drop_type = atoi(argv[arg_index++]); + } else if ( strcmp(argv[arg_index], "-min_cs") == 0 ) { arg_index++; @@ -1166,6 +1201,11 @@ arg_index++; strong_threshold = atof(argv[arg_index++]); } + else if ( strcmp(argv[arg_index], "-thR") == 0 ) + { + arg_index++; + strong_thresholdR = atof(argv[arg_index++]); + } else if ( strcmp(argv[arg_index], "-CF") == 0 ) { arg_index++; @@ -1291,6 +1331,11 @@ arg_index++; solver_type = atoi(argv[arg_index++]); } + else if ( strcmp(argv[arg_index], "-recompute") == 0 ) + { + arg_index++; + recompute_res = atoi(argv[arg_index++]); + } else if ( strcmp(argv[arg_index], "-iout") == 0 ) { arg_index++; @@ -1334,6 +1379,11 @@ arg_index++; cycle_type = atoi(argv[arg_index++]); } + else if ( strcmp(argv[arg_index], "-fmg") == 0 ) + { + arg_index++; + fcycle = 1; + } else if ( strcmp(argv[arg_index], "-numsamp") == 0 ) { arg_index++; @@ -1459,12 +1509,17 @@ arg_index++; rap2 = atoi(argv[arg_index++]); } + else if ( strcmp(argv[arg_index], "-mod_rap2") == 0 ) + { + arg_index++; + mod_rap2 = atoi(argv[arg_index++]); + } else if ( strcmp(argv[arg_index], "-keepT") == 0 ) { arg_index++; keepTranspose = atoi(argv[arg_index++]); } -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU else if ( strcmp(argv[arg_index], "-dslu_th") == 0 ) { arg_index++; @@ -1493,7 +1548,7 @@ else if ( strcmp(argv[arg_index], "-plot_file_name") == 0 ) { arg_index++; - hypre_sprintf (plot_file_name,"%s",argv[arg_index++]); + hypre_sprintf (plot_file_name,"%s",argv[arg_index++]); } else if ( strcmp(argv[arg_index], "-AIR") == 0 ) { @@ -1628,9 +1683,9 @@ hypre_printf(" 46=Euclid-COGMRES\n"); hypre_printf(" 50=DS-LGMRES 51=AMG-LGMRES \n"); hypre_printf(" 60=DS-FlexGMRES 61=AMG-FlexGMRES \n"); - hypre_printf(" 70=MGR 71=MGR-PCG \n"); - hypre_printf(" 72=MGR-FlexGMRES 73=MGR-BICGSTAB \n"); - hypre_printf(" 74=MGR-COGMRES \n"); + hypre_printf(" 70=MGR 71=MGR-PCG \n"); + hypre_printf(" 72=MGR-FlexGMRES 73=MGR-BICGSTAB \n"); + hypre_printf(" 74=MGR-COGMRES \n"); hypre_printf("\n"); hypre_printf(" -cljp : CLJP coarsening \n"); hypre_printf(" -cljp1 : CLJP coarsening, fixed random \n"); @@ -1678,7 +1733,7 @@ /* RL */ hypre_printf(" -restritype : set restriction type\n"); hypre_printf(" 0=transpose of the interpolation \n"); - hypre_printf(" 1=local approximate ideal restriction (AIR) \n"); + hypre_printf(" k=local approximate ideal restriction (AIR-k) \n"); hypre_printf("\n"); hypre_printf(" -rlx : relaxation type\n"); @@ -2004,20 +2059,20 @@ num_rows = local_num_rows; if (off_proc) { - if (myid != num_procs-1) num_rows++; - if (myid) num_rows++; + if (myid != num_procs-1) num_rows++; + if (myid) num_rows++; } /* The following shows how to build an IJMatrix if one has only an estimate for the row sizes */ - row_nums = hypre_CTAlloc(HYPRE_BigInt, num_rows, HYPRE_MEMORY_HOST); - num_cols = hypre_CTAlloc(HYPRE_Int, num_rows, HYPRE_MEMORY_HOST); - if (sparsity_known == 1) - { + row_nums = hypre_CTAlloc(HYPRE_BigInt, num_rows, HYPRE_MEMORY_HOST); + num_cols = hypre_CTAlloc(HYPRE_Int, num_rows, HYPRE_MEMORY_HOST); + if (sparsity_known == 1) + { diag_sizes = hypre_CTAlloc(HYPRE_Int, local_num_rows, HYPRE_MEMORY_HOST); offdiag_sizes = hypre_CTAlloc(HYPRE_Int, local_num_rows, HYPRE_MEMORY_HOST); - } - else - { + } + else + { size = 5; if (sparsity_known == 0) { @@ -2025,33 +2080,33 @@ if (build_matrix_type == 3) size = 9; if (build_matrix_type == 4) size = 27; } - row_sizes = hypre_CTAlloc(HYPRE_Int, num_rows, HYPRE_MEMORY_HOST); - for (i=0; i < num_rows; i++) - row_sizes[i] = size; - } - local_row = 0; - if (build_matrix_type == 2) mx_size = 7; - if (build_matrix_type == 3) mx_size = 9; - if (build_matrix_type == 4) mx_size = 27; - col_nums = hypre_CTAlloc(HYPRE_BigInt, mx_size*num_rows, HYPRE_MEMORY_HOST); - data = hypre_CTAlloc(HYPRE_Real, mx_size*num_rows, HYPRE_MEMORY_HOST); - i_indx = 0; - j_indx = 0; - if (off_proc && myid) - { - num_cols[i_indx] = 2; - row_nums[i_indx++] = first_local_row-1; + row_sizes = hypre_CTAlloc(HYPRE_Int, num_rows, HYPRE_MEMORY_HOST); + for (i=0; i < num_rows; i++) + row_sizes[i] = size; + } + local_row = 0; + if (build_matrix_type == 2) mx_size = 7; + if (build_matrix_type == 3) mx_size = 9; + if (build_matrix_type == 4) mx_size = 27; + col_nums = hypre_CTAlloc(HYPRE_BigInt, mx_size*num_rows, HYPRE_MEMORY_HOST); + data = hypre_CTAlloc(HYPRE_Real, mx_size*num_rows, HYPRE_MEMORY_HOST); + i_indx = 0; + j_indx = 0; + if (off_proc && myid) + { + num_cols[i_indx] = 2; + row_nums[i_indx++] = first_local_row-1; col_nums[j_indx] = first_local_row-1; data[j_indx++] = 6.; col_nums[j_indx] = first_local_row-2; data[j_indx++] = -1; - } - for (i=0; i < local_num_rows; i++) - { + } + for (i=0; i < local_num_rows; i++) + { row_nums[i_indx] = first_local_row +i; ierr += HYPRE_ParCSRMatrixGetRow( parcsr_A, first_local_row+i, &size, - &col_inds, &values); - num_cols[i_indx++] = size; + &col_inds, &values); + num_cols[i_indx++] = size; for (j = 0; j < size; j++) { col_nums[j_indx] = col_inds[j]; @@ -2066,66 +2121,66 @@ } local_row++; ierr += HYPRE_ParCSRMatrixRestoreRow( parcsr_A, first_local_row+i, &size, - &col_inds, &values ); - } - if (off_proc && myid != num_procs-1) - { - num_cols[i_indx] = 2; - row_nums[i_indx++] = last_local_row+1; + &col_inds, &values ); + } + if (off_proc && myid != num_procs-1) + { + num_cols[i_indx] = 2; + row_nums[i_indx++] = last_local_row+1; col_nums[j_indx] = last_local_row+2; data[j_indx++] = -1.; col_nums[j_indx] = last_local_row+1; data[j_indx++] = 6; - } + } - /*ierr += HYPRE_IJMatrixSetRowSizes ( ij_A, (const HYPRE_Int *) num_cols );*/ - if (sparsity_known == 1) - ierr += HYPRE_IJMatrixSetDiagOffdSizes( ij_A, (const HYPRE_Int *) diag_sizes, - (const HYPRE_Int *) offdiag_sizes ); - else - ierr = HYPRE_IJMatrixSetRowSizes ( ij_A, (const HYPRE_Int *) row_sizes ); + /*ierr += HYPRE_IJMatrixSetRowSizes ( ij_A, (const HYPRE_Int *) num_cols );*/ + if (sparsity_known == 1) + ierr += HYPRE_IJMatrixSetDiagOffdSizes( ij_A, (const HYPRE_Int *) diag_sizes, + (const HYPRE_Int *) offdiag_sizes ); + else + ierr = HYPRE_IJMatrixSetRowSizes ( ij_A, (const HYPRE_Int *) row_sizes ); - ierr += HYPRE_IJMatrixInitialize( ij_A ); + ierr += HYPRE_IJMatrixInitialize( ij_A ); - if (omp_flag) HYPRE_IJMatrixSetOMPFlag(ij_A, 1); + if (omp_flag) HYPRE_IJMatrixSetOMPFlag(ij_A, 1); - if (chunk) - { + if (chunk) + { if (add) - ierr += HYPRE_IJMatrixAddToValues(ij_A, num_rows, num_cols, row_nums, - (const HYPRE_BigInt *) col_nums, - (const HYPRE_Real *) data); + ierr += HYPRE_IJMatrixAddToValues(ij_A, num_rows, num_cols, row_nums, + (const HYPRE_BigInt *) col_nums, + (const HYPRE_Real *) data); else ierr += HYPRE_IJMatrixSetValues(ij_A, num_rows, num_cols, row_nums, - (const HYPRE_BigInt *) col_nums, - (const HYPRE_Real *) data); - } - else - { + (const HYPRE_BigInt *) col_nums, + (const HYPRE_Real *) data); + } + else + { j_indx = 0; for (i=0; i < num_rows; i++) { if (add) ierr += HYPRE_IJMatrixAddToValues( ij_A, 1, &num_cols[i], &row_nums[i], - (const HYPRE_BigInt *) &col_nums[j_indx], - (const HYPRE_Real *) &data[j_indx] ); + (const HYPRE_BigInt *) &col_nums[j_indx], + (const HYPRE_Real *) &data[j_indx] ); else ierr += HYPRE_IJMatrixSetValues( ij_A, 1, &num_cols[i], &row_nums[i], - (const HYPRE_BigInt *) &col_nums[j_indx], - (const HYPRE_Real *) &data[j_indx] ); + (const HYPRE_BigInt *) &col_nums[j_indx], + (const HYPRE_Real *) &data[j_indx] ); j_indx += num_cols[i]; } - } - hypre_TFree(col_nums, HYPRE_MEMORY_HOST); - hypre_TFree(data, HYPRE_MEMORY_HOST); - hypre_TFree(row_nums, HYPRE_MEMORY_HOST); - hypre_TFree(num_cols, HYPRE_MEMORY_HOST); - if (sparsity_known == 1) - { + } + hypre_TFree(col_nums, HYPRE_MEMORY_HOST); + hypre_TFree(data, HYPRE_MEMORY_HOST); + hypre_TFree(row_nums, HYPRE_MEMORY_HOST); + hypre_TFree(num_cols, HYPRE_MEMORY_HOST); + if (sparsity_known == 1) + { hypre_TFree(diag_sizes, HYPRE_MEMORY_HOST); hypre_TFree(offdiag_sizes, HYPRE_MEMORY_HOST); - } - else + } + else hypre_TFree(row_sizes, HYPRE_MEMORY_HOST); ierr += HYPRE_IJMatrixAssemble( ij_A ); @@ -2141,13 +2196,13 @@ return(-1); } - /* This is to emphasize that one can IJMatrixAddToValues after an - IJMatrixRead or an IJMatrixAssemble. After an IJMatrixRead, - assembly is unnecessary if the sparsity pattern of the matrix is - not changed somehow. If one has not used IJMatrixRead, one has - the opportunity to IJMatrixAddTo before a IJMatrixAssemble. - This first sets all matrix coefficients to -1 and then adds 7.0 - to the diagonal to restore the original matrix*/ + /* This is to emphasize that one can IJMatrixAddToValues after an + IJMatrixRead or an IJMatrixAssemble. After an IJMatrixRead, + assembly is unnecessary if the sparsity pattern of the matrix is + not changed somehow. If one has not used IJMatrixRead, one has + the opportunity to IJMatrixAddTo before a IJMatrixAssemble. + This first sets all matrix coefficients to -1 and then adds 7.0 + to the diagonal to restore the original matrix*/ if (check_constant) ierr += HYPRE_IJMatrixSetConstantValues( ij_A, -1.0 ); @@ -2175,36 +2230,35 @@ } ierr += HYPRE_IJMatrixAddToValues( ij_A, - local_num_rows, - ncols, rows, - (const HYPRE_BigInt *) col_inds, - (const HYPRE_Real *) values ); + local_num_rows, + ncols, rows, + (const HYPRE_BigInt *) col_inds, + (const HYPRE_Real *) values ); hypre_TFree(values, HYPRE_MEMORY_HOST); hypre_TFree(col_inds, HYPRE_MEMORY_HOST); hypre_TFree(rows, HYPRE_MEMORY_HOST); hypre_TFree(ncols, HYPRE_MEMORY_HOST); - /* If sparsity pattern is not changed since last IJMatrixAssemble call, - this should be a no-op */ + /* If sparsity pattern is not changed since last IJMatrixAssemble call, + this should be a no-op */ ierr += HYPRE_IJMatrixAssemble( ij_A ); - /*----------------------------------------------------------- - * Fetch the resulting underlying matrix out - *-----------------------------------------------------------*/ - if (build_matrix_type > -1) + /*----------------------------------------------------------- + * Fetch the resulting underlying matrix out + *-----------------------------------------------------------*/ + if (build_matrix_type > -1) ierr += HYPRE_ParCSRMatrixDestroy(parcsr_A); - ierr += HYPRE_IJMatrixGetObject( ij_A, &object); - parcsr_A = (HYPRE_ParCSRMatrix) object; + ierr += HYPRE_IJMatrixGetObject( ij_A, &object); + parcsr_A = (HYPRE_ParCSRMatrix) object; } /*----------------------------------------------------------- * Set up the interp vector *-----------------------------------------------------------*/ - if ( build_rbm) { char new_file_name[80]; @@ -2215,7 +2269,7 @@ { hypre_sprintf(new_file_name, "%s.%d", argv[build_rbm_index],i); ierr = HYPRE_IJVectorRead( new_file_name, hypre_MPI_COMM_WORLD, - HYPRE_PARCSR, &ij_rbm[i] ); + HYPRE_PARCSR, &ij_rbm[i] ); ierr = HYPRE_IJVectorGetObject( ij_rbm[i], &object ); interp_vecs[i] = (HYPRE_ParVector) object; } @@ -2732,16 +2786,16 @@ dof_func = NULL; if (build_funcs_type == 1) { - BuildFuncsFromOneFile(argc, argv, build_funcs_arg_index, parcsr_A, &dof_func); + BuildFuncsFromOneFile(argc, argv, build_funcs_arg_index, parcsr_A, &dof_func); } else if (build_funcs_type == 2) { - BuildFuncsFromFiles(argc, argv, build_funcs_arg_index, parcsr_A, &dof_func); + BuildFuncsFromFiles(argc, argv, build_funcs_arg_index, parcsr_A, &dof_func); } else { if (myid == 0) - hypre_printf (" Number of functions = %d \n", num_functions); + hypre_printf (" Number of functions = %d \n", num_functions); } } @@ -2787,6 +2841,7 @@ HYPRE_ParCSRHybridSetAbsoluteTol(amg_solver, atol); HYPRE_ParCSRHybridSetConvergenceTol(amg_solver, cf_tol); HYPRE_ParCSRHybridSetSolverType(amg_solver, solver_type); + HYPRE_ParCSRHybridSetRecomputeResidual(amg_solver, recompute_res); HYPRE_ParCSRHybridSetLogging(amg_solver, ioutdat); HYPRE_ParCSRHybridSetPrintLevel(amg_solver, poutdat); HYPRE_ParCSRHybridSetDSCGMaxIter(amg_solver, max_iter); @@ -2820,7 +2875,7 @@ HYPRE_ParCSRHybridSetLevelRelaxWt(amg_solver, relax_wt_level, level_w); if (level_ow > -1) HYPRE_ParCSRHybridSetLevelOuterWt(amg_solver, outer_wt_level, level_ow); - HYPRE_ParCSRHybridSetNonGalerkinTol(amg_solver, nongalerk_num_tol, nongalerk_tol); + HYPRE_ParCSRHybridSetNonGalerkinTol(amg_solver, nongalerk_num_tol, nongalerk_tol); HYPRE_ParCSRHybridSetup(amg_solver, parcsr_A, b, x); @@ -2875,13 +2930,16 @@ hypre_assert(restri_type >= 0); HYPRE_BoomerAMGSetRestriction(amg_solver, restri_type); /* 0: P^T, 1: AIR, 2: AIR-2 */ HYPRE_BoomerAMGSetGridRelaxPoints(amg_solver, grid_relax_points); + HYPRE_BoomerAMGSetStrongThresholdR(amg_solver, strong_thresholdR); } /* RL */ HYPRE_BoomerAMGSetADropTol(amg_solver, A_drop_tol); + HYPRE_BoomerAMGSetADropType(amg_solver, A_drop_type); /* BM Aug 25, 2006 */ HYPRE_BoomerAMGSetCGCIts(amg_solver, cgcits); HYPRE_BoomerAMGSetInterpType(amg_solver, interp_type); + HYPRE_BoomerAMGSetRestriction(amg_solver, restri_type); /* 0: P^T, 1: AIR, 2: AIR-2 */ HYPRE_BoomerAMGSetPostInterpType(amg_solver, post_interp_type); HYPRE_BoomerAMGSetNumSamples(amg_solver, gsmg_samples); HYPRE_BoomerAMGSetCoarsenType(amg_solver, coarsen_type); @@ -2901,6 +2959,7 @@ HYPRE_BoomerAMGSetPrintLevel(amg_solver, 3); HYPRE_BoomerAMGSetPrintFileName(amg_solver, "driver.out.log"); HYPRE_BoomerAMGSetCycleType(amg_solver, cycle_type); + HYPRE_BoomerAMGSetFCycle(amg_solver, fcycle); HYPRE_BoomerAMGSetNumSweeps(amg_solver, num_sweeps); HYPRE_BoomerAMGSetISType(amg_solver, IS_type); HYPRE_BoomerAMGSetNumCRRelaxSteps(amg_solver, num_CR_relax_steps); @@ -2974,8 +3033,9 @@ HYPRE_BoomerAMGSetMaxIter(amg_solver, mg_max_iter); HYPRE_BoomerAMGSetRAP2(amg_solver, rap2); + HYPRE_BoomerAMGSetModuleRAP2(amg_solver, mod_rap2); HYPRE_BoomerAMGSetKeepTranspose(amg_solver, keepTranspose); -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU HYPRE_BoomerAMGSetDSLUThreshold(amg_solver, dslu_threshold); #endif /*HYPRE_BoomerAMGSetNonGalerkTol(amg_solver, nongalerk_num_tol, nongalerk_tol);*/ @@ -3003,6 +3063,10 @@ HYPRE_BoomerAMGSetup(amg_solver, parcsr_A, b, x); +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + cudaDeviceSynchronize(); +#endif + hypre_EndTiming(time_index); hypre_PrintTiming("Setup phase times", hypre_MPI_COMM_WORLD); hypre_FinalizeTiming(time_index); @@ -3011,7 +3075,13 @@ time_index = hypre_InitializeTiming("BoomerAMG Solve"); hypre_BeginTiming(time_index); + //PUSH_RANGE("solve", 1) HYPRE_BoomerAMGSolve(amg_solver, parcsr_A, b, x); + //POP_RANGE + +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + cudaDeviceSynchronize(); +#endif hypre_EndTiming(time_index); hypre_PrintTiming("Solve phase times", hypre_MPI_COMM_WORLD); @@ -3077,6 +3147,7 @@ HYPRE_BoomerAMGSetPrintFileName(amg_solver, "driver.out.log"); HYPRE_BoomerAMGSetMaxIter(amg_solver, mg_max_iter); HYPRE_BoomerAMGSetCycleType(amg_solver, cycle_type); + HYPRE_BoomerAMGSetFCycle(amg_solver, fcycle); HYPRE_BoomerAMGSetNumSweeps(amg_solver, num_sweeps); if (relax_type > -1) HYPRE_BoomerAMGSetRelaxType(amg_solver, relax_type); if (relax_down > -1) @@ -3133,6 +3204,7 @@ HYPRE_BoomerAMGSetMultAddPMaxElmts(amg_solver, add_P_max_elmts); HYPRE_BoomerAMGSetMultAddTruncFactor(amg_solver, add_trunc_factor); HYPRE_BoomerAMGSetRAP2(amg_solver, rap2); + HYPRE_BoomerAMGSetModuleRAP2(amg_solver, mod_rap2); HYPRE_BoomerAMGSetKeepTranspose(amg_solver, keepTranspose); if (nongalerk_tol) { @@ -3200,8 +3272,8 @@ /* begin lobpcg */ if (!lobpcgFlag && (solver_id == 1 || solver_id == 2 || solver_id == 8 || - solver_id == 12 || solver_id == 14 || solver_id == 43 || solver_id == 71)) - /*end lobpcg */ + solver_id == 12 || solver_id == 14 || solver_id == 43 || solver_id == 71)) + /*end lobpcg */ { time_index = hypre_InitializeTiming("PCG Setup"); hypre_BeginTiming(time_index); @@ -3213,6 +3285,7 @@ HYPRE_PCGSetRelChange(pcg_solver, rel_change); HYPRE_PCGSetPrintLevel(pcg_solver, ioutdat); HYPRE_PCGSetAbsoluteTol(pcg_solver, atol); + HYPRE_PCGSetRecomputeResidual(pcg_solver, recompute_res); if (solver_id == 1) { @@ -3240,6 +3313,7 @@ HYPRE_BoomerAMGSetPrintFileName(pcg_precond, "driver.out.log"); HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); + HYPRE_BoomerAMGSetFCycle(pcg_precond, fcycle); HYPRE_BoomerAMGSetNumSweeps(pcg_precond, num_sweeps); HYPRE_BoomerAMGSetISType(pcg_precond, IS_type); HYPRE_BoomerAMGSetNumCRRelaxSteps(pcg_precond, num_CR_relax_steps); @@ -3302,8 +3376,9 @@ HYPRE_BoomerAMGSetMultAddPMaxElmts(pcg_precond, add_P_max_elmts); HYPRE_BoomerAMGSetMultAddTruncFactor(pcg_precond, add_trunc_factor); HYPRE_BoomerAMGSetRAP2(pcg_precond, rap2); + HYPRE_BoomerAMGSetModuleRAP2(pcg_precond, mod_rap2); HYPRE_BoomerAMGSetKeepTranspose(pcg_precond, keepTranspose); -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU HYPRE_BoomerAMGSetDSLUThreshold(pcg_precond, dslu_threshold); #endif if (nongalerk_tol) @@ -3342,7 +3417,7 @@ /* use ParaSails preconditioner */ if (myid == 0) hypre_printf("Solver: ParaSails-PCG\n"); - HYPRE_ParaSailsCreate(hypre_MPI_COMM_WORLD, &pcg_precond); + HYPRE_ParaSailsCreate(hypre_MPI_COMM_WORLD, &pcg_precond); HYPRE_ParaSailsSetParams(pcg_precond, sai_threshold, max_levels); HYPRE_ParaSailsSetFilter(pcg_precond, sai_filter); HYPRE_ParaSailsSetLogging(pcg_precond, poutdat); @@ -3357,10 +3432,10 @@ /* use Schwarz preconditioner */ if (myid == 0) hypre_printf("Solver: Schwarz-PCG\n"); - HYPRE_SchwarzCreate(&pcg_precond); - HYPRE_SchwarzSetVariant(pcg_precond, variant); - HYPRE_SchwarzSetOverlap(pcg_precond, overlap); - HYPRE_SchwarzSetDomainType(pcg_precond, domain_type); + HYPRE_SchwarzCreate(&pcg_precond); + HYPRE_SchwarzSetVariant(pcg_precond, variant); + HYPRE_SchwarzSetOverlap(pcg_precond, overlap); + HYPRE_SchwarzSetDomainType(pcg_precond, domain_type); HYPRE_SchwarzSetRelaxWeight(pcg_precond, schwarz_rlx_weight); HYPRE_SchwarzSetNonSymm(pcg_precond, use_nonsymm_schwarz); HYPRE_PCGSetPrecond(pcg_solver, @@ -3401,6 +3476,7 @@ HYPRE_BoomerAMGSetPrintFileName(pcg_precond, "driver.out.log"); HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); + HYPRE_BoomerAMGSetFCycle(pcg_precond, fcycle); HYPRE_BoomerAMGSetNumSweeps(pcg_precond, num_sweeps); HYPRE_BoomerAMGSetISType(pcg_precond, IS_type); HYPRE_BoomerAMGSetNumCRRelaxSteps(pcg_precond, num_CR_relax_steps); @@ -3462,8 +3538,9 @@ HYPRE_BoomerAMGSetMultAddPMaxElmts(pcg_precond, add_P_max_elmts); HYPRE_BoomerAMGSetMultAddTruncFactor(pcg_precond, add_trunc_factor); HYPRE_BoomerAMGSetRAP2(pcg_precond, rap2); + HYPRE_BoomerAMGSetModuleRAP2(pcg_precond, mod_rap2); HYPRE_BoomerAMGSetKeepTranspose(pcg_precond, keepTranspose); -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU HYPRE_BoomerAMGSetDSLUThreshold(pcg_precond, dslu_threshold); #endif if (nongalerk_tol) @@ -3565,6 +3642,7 @@ /* note: log is written to standard output, not to file */ HYPRE_BoomerAMGSetPrintLevel(amg_solver, 1); HYPRE_BoomerAMGSetCycleType(amg_solver, cycle_type); + HYPRE_BoomerAMGSetFCycle(amg_solver, fcycle); HYPRE_BoomerAMGSetNumSweeps(amg_solver, num_sweeps); HYPRE_BoomerAMGSetRelaxType(amg_solver, 3); if (relax_down > -1) @@ -3638,15 +3716,15 @@ } else if (solver_id == 8) { - HYPRE_ParaSailsDestroy(pcg_precond); + HYPRE_ParaSailsDestroy(pcg_precond); } else if (solver_id == 12) { - HYPRE_SchwarzDestroy(pcg_precond); + HYPRE_SchwarzDestroy(pcg_precond); } else if (solver_id == 14) { - HYPRE_BoomerAMGDestroy(pcg_precond); + HYPRE_BoomerAMGDestroy(pcg_precond); } else if (solver_id == 43) { @@ -3667,8 +3745,8 @@ { for( i=0; i last_local_row) + offdiag_sizes[local_row]++; + else + diag_sizes[local_row]++; + } + local_row++; + ierr += HYPRE_ParCSRMatrixRestoreRow( parcsr_B, big_i, &size, + &col_inds, &values ); + } + ierr += HYPRE_IJMatrixSetDiagOffdSizes( ij_B, + (const HYPRE_Int *) diag_sizes, + (const HYPRE_Int *) offdiag_sizes ); + hypre_TFree(diag_sizes, HYPRE_MEMORY_HOST); + hypre_TFree(offdiag_sizes, HYPRE_MEMORY_HOST); - ierr += HYPRE_IJMatrixSetObjectType( ij_B, HYPRE_PARCSR ); + ierr = HYPRE_IJMatrixInitialize( ij_B ); - if (sparsity_known == 1) { - diag_sizes = hypre_CTAlloc(HYPRE_Int, local_num_rows, HYPRE_MEMORY_HOST); - offdiag_sizes = hypre_CTAlloc(HYPRE_Int, local_num_rows, HYPRE_MEMORY_HOST); - local_row = 0; - for (big_i=first_local_row; big_i<= last_local_row; big_i++) { - ierr += HYPRE_ParCSRMatrixGetRow( parcsr_B, big_i, &size, - &col_inds, &values ); - for (j=0; j < size; j++) - { - if (col_inds[j] < first_local_row || col_inds[j] > last_local_row) - offdiag_sizes[local_row]++; - else - diag_sizes[local_row]++; - } - local_row++; - ierr += HYPRE_ParCSRMatrixRestoreRow( parcsr_B, big_i, &size, + for (big_i=first_local_row; big_i<= last_local_row; big_i++) + { + ierr += HYPRE_ParCSRMatrixGetRow( parcsr_B, big_i, &size, &col_inds, &values ); - } - ierr += HYPRE_IJMatrixSetDiagOffdSizes( ij_B, - (const HYPRE_Int *) diag_sizes, - (const HYPRE_Int *) offdiag_sizes ); - hypre_TFree(diag_sizes, HYPRE_MEMORY_HOST); - hypre_TFree(offdiag_sizes, HYPRE_MEMORY_HOST); - ierr = HYPRE_IJMatrixInitialize( ij_B ); + ierr += HYPRE_IJMatrixSetValues( ij_B, 1, &size, &big_i, + (const HYPRE_BigInt *) col_inds, + (const HYPRE_Real *) values ); - for (big_i=first_local_row; big_i<= last_local_row; big_i++) - { - ierr += HYPRE_ParCSRMatrixGetRow( parcsr_B, big_i, &size, - &col_inds, &values ); + ierr += HYPRE_ParCSRMatrixRestoreRow( parcsr_B, big_i, &size, + &col_inds, &values ); + } + } + else + { + row_sizes = hypre_CTAlloc(HYPRE_Int, local_num_rows, HYPRE_MEMORY_HOST); + + size = 5; /* this is in general too low, and supposed to test + the capability of the reallocation of the interface */ - ierr += HYPRE_IJMatrixSetValues( ij_B, 1, &size, &big_i, - (const HYPRE_BigInt *) col_inds, - (const HYPRE_Real *) values ); - - ierr += HYPRE_ParCSRMatrixRestoreRow( parcsr_B, big_i, &size, - &col_inds, &values ); - } - } - else - { - row_sizes = hypre_CTAlloc(HYPRE_Int, local_num_rows, HYPRE_MEMORY_HOST); - - size = 5; /* this is in general too low, and supposed to test - the capability of the reallocation of the interface */ - - if (sparsity_known == 0) /* tries a more accurate estimate of the - storage */ - { + if (sparsity_known == 0) /* tries a more accurate estimate of the + storage */ + { if (build_matrix_type == 2) size = 7; if (build_matrix_type == 3) size = 9; if (build_matrix_type == 4) size = 27; - } + } - for (i=0; i < local_num_rows; i++) - row_sizes[i] = size; + for (i=0; i < local_num_rows; i++) + row_sizes[i] = size; - ierr = HYPRE_IJMatrixSetRowSizes ( ij_B, (const HYPRE_Int *) row_sizes ); + ierr = HYPRE_IJMatrixSetRowSizes ( ij_B, (const HYPRE_Int *) row_sizes ); - hypre_TFree(row_sizes, HYPRE_MEMORY_HOST); + hypre_TFree(row_sizes, HYPRE_MEMORY_HOST); - ierr = HYPRE_IJMatrixInitialize( ij_B ); + ierr = HYPRE_IJMatrixInitialize( ij_B ); - /* Loop through all locally stored rows and insert them into ij_matrix */ - for (big_i=first_local_row; big_i<= last_local_row; big_i++) - { + /* Loop through all locally stored rows and insert them into ij_matrix */ + for (big_i=first_local_row; big_i<= last_local_row; big_i++) + { ierr += HYPRE_ParCSRMatrixGetRow( parcsr_B, big_i, &size, &col_inds, &values ); @@ -3796,765 +3874,768 @@ ierr += HYPRE_ParCSRMatrixRestoreRow( parcsr_B, big_i, &size, &col_inds, &values ); - } + } } - ierr += HYPRE_IJMatrixAssemble( ij_B ); + ierr += HYPRE_IJMatrixAssemble( ij_B ); - ierr += HYPRE_ParCSRMatrixDestroy(parcsr_B); + ierr += HYPRE_ParCSRMatrixDestroy(parcsr_B); - ierr += HYPRE_IJMatrixGetObject( ij_B, &object); - parcsr_B = (HYPRE_ParCSRMatrix) object; - - } /* if ( lobpcgGen ) */ - - - if ( pcgIterations > 0 ) { /* do inner pcg iterations */ - - time_index = hypre_InitializeTiming("PCG Setup"); - hypre_BeginTiming(time_index); - - HYPRE_ParCSRPCGCreate(hypre_MPI_COMM_WORLD, &pcg_solver); - HYPRE_PCGSetMaxIter(pcg_solver, pcgIterations); - HYPRE_PCGSetTol(pcg_solver, pcgTol); - HYPRE_PCGSetTwoNorm(pcg_solver, two_norm); - HYPRE_PCGSetRelChange(pcg_solver, 0); - HYPRE_PCGSetPrintLevel(pcg_solver, 0); - - HYPRE_PCGGetPrecond(pcg_solver, &pcg_precond); - - if (solver_id == 1) - { - /* use BoomerAMG as preconditioner */ - if (myid == 0) hypre_printf("Solver: AMG-PCG\n"); - HYPRE_BoomerAMGCreate(&pcg_precond); - /* BM Aug 25, 2006 */ - HYPRE_BoomerAMGSetCGCIts(pcg_precond, cgcits); - HYPRE_BoomerAMGSetInterpType(pcg_precond, interp_type); - HYPRE_BoomerAMGSetNumSamples(pcg_precond, gsmg_samples); - HYPRE_BoomerAMGSetTol(pcg_precond, pc_tol); - HYPRE_BoomerAMGSetCoarsenType(pcg_precond, (hybrid*coarsen_type)); - HYPRE_BoomerAMGSetMeasureType(pcg_precond, measure_type); - HYPRE_BoomerAMGSetStrongThreshold(pcg_precond, strong_threshold); - HYPRE_BoomerAMGSetTruncFactor(pcg_precond, trunc_factor); - HYPRE_BoomerAMGSetPMaxElmts(pcg_precond, P_max_elmts); - HYPRE_BoomerAMGSetPostInterpType(pcg_precond, post_interp_type); - HYPRE_BoomerAMGSetJacobiTruncThreshold(pcg_precond, jacobi_trunc_threshold); - HYPRE_BoomerAMGSetPrintLevel(pcg_precond, poutdat); - HYPRE_BoomerAMGSetPrintFileName(pcg_precond, "driver.out.log"); - HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); - HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); - HYPRE_BoomerAMGSetNumSweeps(pcg_precond, num_sweeps); - if (relax_type > -1) HYPRE_BoomerAMGSetRelaxType(pcg_precond, relax_type); - if (relax_down > -1) - HYPRE_BoomerAMGSetCycleRelaxType(pcg_precond, relax_down, 1); - if (relax_up > -1) - HYPRE_BoomerAMGSetCycleRelaxType(pcg_precond, relax_up, 2); - if (relax_coarse > -1) - HYPRE_BoomerAMGSetCycleRelaxType(pcg_precond, relax_coarse, 3); - HYPRE_BoomerAMGSetAddRelaxType(pcg_precond, add_relax_type); - HYPRE_BoomerAMGSetAddRelaxWt(pcg_precond, add_relax_wt); - HYPRE_BoomerAMGSetRelaxWt(pcg_precond, relax_wt); - HYPRE_BoomerAMGSetOuterWt(pcg_precond, outer_wt); - HYPRE_BoomerAMGSetSmoothType(pcg_precond, smooth_type); - HYPRE_BoomerAMGSetSmoothNumLevels(pcg_precond, smooth_num_levels); - HYPRE_BoomerAMGSetSmoothNumSweeps(pcg_precond, smooth_num_sweeps); - HYPRE_BoomerAMGSetRelaxOrder(pcg_precond, relax_order); - HYPRE_BoomerAMGSetMaxLevels(pcg_precond, max_levels); - HYPRE_BoomerAMGSetMaxRowSum(pcg_precond, max_row_sum); - HYPRE_BoomerAMGSetDebugFlag(pcg_precond, debug_flag); - HYPRE_BoomerAMGSetNumFunctions(pcg_precond, num_functions); - HYPRE_BoomerAMGSetNumPaths(pcg_precond, num_paths); - HYPRE_BoomerAMGSetAggNumLevels(pcg_precond, agg_num_levels); - HYPRE_BoomerAMGSetVariant(pcg_precond, variant); - HYPRE_BoomerAMGSetOverlap(pcg_precond, overlap); - HYPRE_BoomerAMGSetDomainType(pcg_precond, domain_type); - HYPRE_BoomerAMGSetSchwarzRlxWeight(pcg_precond, schwarz_rlx_weight); - if (num_functions > 1) - HYPRE_BoomerAMGSetDofFunc(pcg_precond, dof_func); - HYPRE_PCGSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSolve, - (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSetup, - pcg_precond); - } - else if (solver_id == 2) - { + ierr += HYPRE_IJMatrixGetObject( ij_B, &object); + parcsr_B = (HYPRE_ParCSRMatrix) object; - /* use diagonal scaling as preconditioner */ - if (myid == 0) hypre_printf("Solver: DS-PCG\n"); - pcg_precond = NULL; + } /* if ( lobpcgGen ) */ - HYPRE_PCGSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSRDiagScale, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSRDiagScaleSetup, - pcg_precond); + + if ( pcgIterations > 0 ) /* do inner pcg iterations */ + { + time_index = hypre_InitializeTiming("PCG Setup"); + hypre_BeginTiming(time_index); + + HYPRE_ParCSRPCGCreate(hypre_MPI_COMM_WORLD, &pcg_solver); + HYPRE_PCGSetMaxIter(pcg_solver, pcgIterations); + HYPRE_PCGSetTol(pcg_solver, pcgTol); + HYPRE_PCGSetTwoNorm(pcg_solver, two_norm); + HYPRE_PCGSetRelChange(pcg_solver, 0); + HYPRE_PCGSetPrintLevel(pcg_solver, 0); + HYPRE_PCGSetRecomputeResidual(pcg_solver, recompute_res); + + HYPRE_PCGGetPrecond(pcg_solver, &pcg_precond); + + if (solver_id == 1) + { + /* use BoomerAMG as preconditioner */ + if (myid == 0) hypre_printf("Solver: AMG-PCG\n"); + HYPRE_BoomerAMGCreate(&pcg_precond); + /* BM Aug 25, 2006 */ + HYPRE_BoomerAMGSetCGCIts(pcg_precond, cgcits); + HYPRE_BoomerAMGSetInterpType(pcg_precond, interp_type); + HYPRE_BoomerAMGSetNumSamples(pcg_precond, gsmg_samples); + HYPRE_BoomerAMGSetTol(pcg_precond, pc_tol); + HYPRE_BoomerAMGSetCoarsenType(pcg_precond, (hybrid*coarsen_type)); + HYPRE_BoomerAMGSetMeasureType(pcg_precond, measure_type); + HYPRE_BoomerAMGSetStrongThreshold(pcg_precond, strong_threshold); + HYPRE_BoomerAMGSetTruncFactor(pcg_precond, trunc_factor); + HYPRE_BoomerAMGSetPMaxElmts(pcg_precond, P_max_elmts); + HYPRE_BoomerAMGSetPostInterpType(pcg_precond, post_interp_type); + HYPRE_BoomerAMGSetJacobiTruncThreshold(pcg_precond, jacobi_trunc_threshold); + HYPRE_BoomerAMGSetPrintLevel(pcg_precond, poutdat); + HYPRE_BoomerAMGSetPrintFileName(pcg_precond, "driver.out.log"); + HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); + HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); + HYPRE_BoomerAMGSetFCycle(pcg_precond, fcycle); + HYPRE_BoomerAMGSetNumSweeps(pcg_precond, num_sweeps); + if (relax_type > -1) HYPRE_BoomerAMGSetRelaxType(pcg_precond, relax_type); + if (relax_down > -1) + HYPRE_BoomerAMGSetCycleRelaxType(pcg_precond, relax_down, 1); + if (relax_up > -1) + HYPRE_BoomerAMGSetCycleRelaxType(pcg_precond, relax_up, 2); + if (relax_coarse > -1) + HYPRE_BoomerAMGSetCycleRelaxType(pcg_precond, relax_coarse, 3); + HYPRE_BoomerAMGSetAddRelaxType(pcg_precond, add_relax_type); + HYPRE_BoomerAMGSetAddRelaxWt(pcg_precond, add_relax_wt); + HYPRE_BoomerAMGSetRelaxWt(pcg_precond, relax_wt); + HYPRE_BoomerAMGSetOuterWt(pcg_precond, outer_wt); + HYPRE_BoomerAMGSetSmoothType(pcg_precond, smooth_type); + HYPRE_BoomerAMGSetSmoothNumLevels(pcg_precond, smooth_num_levels); + HYPRE_BoomerAMGSetSmoothNumSweeps(pcg_precond, smooth_num_sweeps); + HYPRE_BoomerAMGSetRelaxOrder(pcg_precond, relax_order); + HYPRE_BoomerAMGSetMaxLevels(pcg_precond, max_levels); + HYPRE_BoomerAMGSetMaxRowSum(pcg_precond, max_row_sum); + HYPRE_BoomerAMGSetDebugFlag(pcg_precond, debug_flag); + HYPRE_BoomerAMGSetNumFunctions(pcg_precond, num_functions); + HYPRE_BoomerAMGSetNumPaths(pcg_precond, num_paths); + HYPRE_BoomerAMGSetAggNumLevels(pcg_precond, agg_num_levels); + HYPRE_BoomerAMGSetVariant(pcg_precond, variant); + HYPRE_BoomerAMGSetOverlap(pcg_precond, overlap); + HYPRE_BoomerAMGSetDomainType(pcg_precond, domain_type); + HYPRE_BoomerAMGSetSchwarzRlxWeight(pcg_precond, schwarz_rlx_weight); + if (num_functions > 1) + HYPRE_BoomerAMGSetDofFunc(pcg_precond, dof_func); + HYPRE_PCGSetPrecond(pcg_solver, + (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSolve, + (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSetup, + pcg_precond); } - else if (solver_id == 8) + else if (solver_id == 2) { - /* use ParaSails preconditioner */ - if (myid == 0) hypre_printf("Solver: ParaSails-PCG\n"); + /* use diagonal scaling as preconditioner */ + if (myid == 0) hypre_printf("Solver: DS-PCG\n"); + pcg_precond = NULL; - HYPRE_ParaSailsCreate(hypre_MPI_COMM_WORLD, &pcg_precond); - HYPRE_ParaSailsSetParams(pcg_precond, sai_threshold, max_levels); - HYPRE_ParaSailsSetFilter(pcg_precond, sai_filter); - HYPRE_ParaSailsSetLogging(pcg_precond, poutdat); + HYPRE_PCGSetPrecond(pcg_solver, + (HYPRE_PtrToSolverFcn) HYPRE_ParCSRDiagScale, + (HYPRE_PtrToSolverFcn) HYPRE_ParCSRDiagScaleSetup, + pcg_precond); + } + else if (solver_id == 8) + { + /* use ParaSails preconditioner */ + if (myid == 0) hypre_printf("Solver: ParaSails-PCG\n"); - HYPRE_PCGSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_ParaSailsSolve, - (HYPRE_PtrToSolverFcn) HYPRE_ParaSailsSetup, - pcg_precond); + HYPRE_ParaSailsCreate(hypre_MPI_COMM_WORLD, &pcg_precond); + HYPRE_ParaSailsSetParams(pcg_precond, sai_threshold, max_levels); + HYPRE_ParaSailsSetFilter(pcg_precond, sai_filter); + HYPRE_ParaSailsSetLogging(pcg_precond, poutdat); + + HYPRE_PCGSetPrecond(pcg_solver, + (HYPRE_PtrToSolverFcn) HYPRE_ParaSailsSolve, + (HYPRE_PtrToSolverFcn) HYPRE_ParaSailsSetup, + pcg_precond); } - else if (solver_id == 12) + else if (solver_id == 12) { - /* use Schwarz preconditioner */ - if (myid == 0) hypre_printf("Solver: Schwarz-PCG\n"); + /* use Schwarz preconditioner */ + if (myid == 0) hypre_printf("Solver: Schwarz-PCG\n"); - HYPRE_SchwarzCreate(&pcg_precond); - HYPRE_SchwarzSetVariant(pcg_precond, variant); - HYPRE_SchwarzSetOverlap(pcg_precond, overlap); - HYPRE_SchwarzSetDomainType(pcg_precond, domain_type); - HYPRE_SchwarzSetRelaxWeight(pcg_precond, schwarz_rlx_weight); - - HYPRE_PCGSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_SchwarzSolve, - (HYPRE_PtrToSolverFcn) HYPRE_SchwarzSetup, - pcg_precond); + HYPRE_SchwarzCreate(&pcg_precond); + HYPRE_SchwarzSetVariant(pcg_precond, variant); + HYPRE_SchwarzSetOverlap(pcg_precond, overlap); + HYPRE_SchwarzSetDomainType(pcg_precond, domain_type); + HYPRE_SchwarzSetRelaxWeight(pcg_precond, schwarz_rlx_weight); + + HYPRE_PCGSetPrecond(pcg_solver, + (HYPRE_PtrToSolverFcn) HYPRE_SchwarzSolve, + (HYPRE_PtrToSolverFcn) HYPRE_SchwarzSetup, + pcg_precond); } - else if (solver_id == 14) + else if (solver_id == 14) { - /* use GSMG as preconditioner */ + /* use GSMG as preconditioner */ - /* reset some smoother parameters */ + /* reset some smoother parameters */ - num_sweeps = num_sweep; - relax_type = relax_default; - relax_order = 0; - - if (myid == 0) hypre_printf("Solver: GSMG-PCG\n"); - HYPRE_BoomerAMGCreate(&pcg_precond); - /* BM Aug 25, 2006 */ - HYPRE_BoomerAMGSetCGCIts(pcg_precond, cgcits); - HYPRE_BoomerAMGSetGSMG(pcg_precond, 4); - HYPRE_BoomerAMGSetInterpType(pcg_precond, interp_type); - HYPRE_BoomerAMGSetNumSamples(pcg_precond, gsmg_samples); - HYPRE_BoomerAMGSetTol(pcg_precond, pc_tol); - HYPRE_BoomerAMGSetCoarsenType(pcg_precond, (hybrid*coarsen_type)); - HYPRE_BoomerAMGSetMeasureType(pcg_precond, measure_type); - HYPRE_BoomerAMGSetStrongThreshold(pcg_precond, strong_threshold); - HYPRE_BoomerAMGSetTruncFactor(pcg_precond, trunc_factor); - HYPRE_BoomerAMGSetPMaxElmts(pcg_precond, P_max_elmts); - HYPRE_BoomerAMGSetPostInterpType(pcg_precond, post_interp_type); - HYPRE_BoomerAMGSetJacobiTruncThreshold(pcg_precond, jacobi_trunc_threshold); - HYPRE_BoomerAMGSetPrintLevel(pcg_precond, poutdat); - HYPRE_BoomerAMGSetPrintFileName(pcg_precond, "driver.out.log"); - HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); - HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); - HYPRE_BoomerAMGSetNumSweeps(pcg_precond, num_sweeps); - HYPRE_BoomerAMGSetRelaxType(pcg_precond, relax_type); - HYPRE_BoomerAMGSetRelaxWt(pcg_precond, relax_wt); - HYPRE_BoomerAMGSetAddRelaxType(pcg_precond, add_relax_type); - HYPRE_BoomerAMGSetAddRelaxWt(pcg_precond, add_relax_wt); - HYPRE_BoomerAMGSetOuterWt(pcg_precond, outer_wt); - HYPRE_BoomerAMGSetSmoothType(pcg_precond, smooth_type); - HYPRE_BoomerAMGSetSmoothNumLevels(pcg_precond, smooth_num_levels); - HYPRE_BoomerAMGSetSmoothNumSweeps(pcg_precond, smooth_num_sweeps); - HYPRE_BoomerAMGSetVariant(pcg_precond, variant); - HYPRE_BoomerAMGSetOverlap(pcg_precond, overlap); - HYPRE_BoomerAMGSetDomainType(pcg_precond, domain_type); - HYPRE_BoomerAMGSetSchwarzRlxWeight(pcg_precond, schwarz_rlx_weight); - HYPRE_BoomerAMGSetRelaxOrder(pcg_precond, relax_order); - HYPRE_BoomerAMGSetMaxLevels(pcg_precond, max_levels); - HYPRE_BoomerAMGSetMaxRowSum(pcg_precond, max_row_sum); - HYPRE_BoomerAMGSetDebugFlag(pcg_precond, debug_flag); - HYPRE_BoomerAMGSetNumFunctions(pcg_precond, num_functions); - HYPRE_BoomerAMGSetNumPaths(pcg_precond, num_paths); - HYPRE_BoomerAMGSetAggNumLevels(pcg_precond, agg_num_levels); - if (num_functions > 1) - HYPRE_BoomerAMGSetDofFunc(pcg_precond, dof_func); - HYPRE_PCGSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSolve, - (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSetup, - pcg_precond); + num_sweeps = num_sweep; + relax_type = relax_default; + relax_order = 0; + + if (myid == 0) hypre_printf("Solver: GSMG-PCG\n"); + HYPRE_BoomerAMGCreate(&pcg_precond); + /* BM Aug 25, 2006 */ + HYPRE_BoomerAMGSetCGCIts(pcg_precond, cgcits); + HYPRE_BoomerAMGSetGSMG(pcg_precond, 4); + HYPRE_BoomerAMGSetInterpType(pcg_precond, interp_type); + HYPRE_BoomerAMGSetNumSamples(pcg_precond, gsmg_samples); + HYPRE_BoomerAMGSetTol(pcg_precond, pc_tol); + HYPRE_BoomerAMGSetCoarsenType(pcg_precond, (hybrid*coarsen_type)); + HYPRE_BoomerAMGSetMeasureType(pcg_precond, measure_type); + HYPRE_BoomerAMGSetStrongThreshold(pcg_precond, strong_threshold); + HYPRE_BoomerAMGSetTruncFactor(pcg_precond, trunc_factor); + HYPRE_BoomerAMGSetPMaxElmts(pcg_precond, P_max_elmts); + HYPRE_BoomerAMGSetPostInterpType(pcg_precond, post_interp_type); + HYPRE_BoomerAMGSetJacobiTruncThreshold(pcg_precond, jacobi_trunc_threshold); + HYPRE_BoomerAMGSetPrintLevel(pcg_precond, poutdat); + HYPRE_BoomerAMGSetPrintFileName(pcg_precond, "driver.out.log"); + HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); + HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); + HYPRE_BoomerAMGSetFCycle(pcg_precond, fcycle); + HYPRE_BoomerAMGSetNumSweeps(pcg_precond, num_sweeps); + HYPRE_BoomerAMGSetRelaxType(pcg_precond, relax_type); + HYPRE_BoomerAMGSetRelaxWt(pcg_precond, relax_wt); + HYPRE_BoomerAMGSetAddRelaxType(pcg_precond, add_relax_type); + HYPRE_BoomerAMGSetAddRelaxWt(pcg_precond, add_relax_wt); + HYPRE_BoomerAMGSetOuterWt(pcg_precond, outer_wt); + HYPRE_BoomerAMGSetSmoothType(pcg_precond, smooth_type); + HYPRE_BoomerAMGSetSmoothNumLevels(pcg_precond, smooth_num_levels); + HYPRE_BoomerAMGSetSmoothNumSweeps(pcg_precond, smooth_num_sweeps); + HYPRE_BoomerAMGSetVariant(pcg_precond, variant); + HYPRE_BoomerAMGSetOverlap(pcg_precond, overlap); + HYPRE_BoomerAMGSetDomainType(pcg_precond, domain_type); + HYPRE_BoomerAMGSetSchwarzRlxWeight(pcg_precond, schwarz_rlx_weight); + HYPRE_BoomerAMGSetRelaxOrder(pcg_precond, relax_order); + HYPRE_BoomerAMGSetMaxLevels(pcg_precond, max_levels); + HYPRE_BoomerAMGSetMaxRowSum(pcg_precond, max_row_sum); + HYPRE_BoomerAMGSetDebugFlag(pcg_precond, debug_flag); + HYPRE_BoomerAMGSetNumFunctions(pcg_precond, num_functions); + HYPRE_BoomerAMGSetNumPaths(pcg_precond, num_paths); + HYPRE_BoomerAMGSetAggNumLevels(pcg_precond, agg_num_levels); + if (num_functions > 1) + HYPRE_BoomerAMGSetDofFunc(pcg_precond, dof_func); + HYPRE_PCGSetPrecond(pcg_solver, + (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSolve, + (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSetup, + pcg_precond); } - else if (solver_id == 43) + else if (solver_id == 43) { - /* use Euclid preconditioning */ - if (myid == 0) hypre_printf("Solver: Euclid-PCG\n"); + /* use Euclid preconditioning */ + if (myid == 0) hypre_printf("Solver: Euclid-PCG\n"); - HYPRE_EuclidCreate(hypre_MPI_COMM_WORLD, &pcg_precond); + HYPRE_EuclidCreate(hypre_MPI_COMM_WORLD, &pcg_precond); - /* note: There are three three methods of setting run-time - * parameters for Euclid: (see HYPRE_parcsr_ls.h); here - * we'll use what I think is simplest: let Euclid internally - * parse the command line. - * */ - HYPRE_EuclidSetParams(pcg_precond, argc, argv); - - HYPRE_PCGSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_EuclidSolve, - (HYPRE_PtrToSolverFcn) HYPRE_EuclidSetup, - pcg_precond); + /* note: There are three three methods of setting run-time + * parameters for Euclid: (see HYPRE_parcsr_ls.h); here + * we'll use what I think is simplest: let Euclid internally + * parse the command line. + * */ + HYPRE_EuclidSetParams(pcg_precond, argc, argv); + + HYPRE_PCGSetPrecond(pcg_solver, + (HYPRE_PtrToSolverFcn) HYPRE_EuclidSolve, + (HYPRE_PtrToSolverFcn) HYPRE_EuclidSetup, + pcg_precond); } - else if (solver_id != NO_SOLVER ) + else if (solver_id != NO_SOLVER ) { - if ( verbosity ) - hypre_printf("Solver ID not recognized - running inner PCG iterations without preconditioner\n\n"); + if ( verbosity ) + hypre_printf("Solver ID not recognized - running inner PCG iterations without preconditioner\n\n"); } - HYPRE_PCGGetPrecond(pcg_solver, &pcg_precond_gotten); - if (pcg_precond_gotten != pcg_precond) + HYPRE_PCGGetPrecond(pcg_solver, &pcg_precond_gotten); + if (pcg_precond_gotten != pcg_precond) { - hypre_printf("HYPRE_ParCSRPCGGetPrecond got bad precond\n"); - return(-1); + hypre_printf("HYPRE_ParCSRPCGGetPrecond got bad precond\n"); + return(-1); } - else - if (myid == 0) - hypre_printf("HYPRE_ParCSRPCGGetPrecond got good precond\n"); - - /* HYPRE_PCGSetup(pcg_solver, (HYPRE_Matrix)parcsr_A, - * (HYPRE_Vector)b, (HYPRE_Vector)x); */ - - hypre_EndTiming(time_index); - hypre_PrintTiming("Setup phase times", hypre_MPI_COMM_WORLD); - hypre_FinalizeTiming(time_index); - hypre_ClearTiming(); - - HYPRE_LOBPCGCreate(interpreter, &matvec_fn, &lobpcg_solver); - - HYPRE_LOBPCGSetMaxIter(lobpcg_solver, maxIterations); - HYPRE_LOBPCGSetPrecondUsageMode(lobpcg_solver, pcgMode); - HYPRE_LOBPCGSetTol(lobpcg_solver, tol); - HYPRE_LOBPCGSetPrintLevel(lobpcg_solver, verbosity); - - HYPRE_LOBPCGSetPrecond(lobpcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_PCGSolve, - (HYPRE_PtrToSolverFcn) HYPRE_PCGSetup, - pcg_solver); + else + if (myid == 0) + hypre_printf("HYPRE_ParCSRPCGGetPrecond got good precond\n"); - HYPRE_LOBPCGSetupT(lobpcg_solver, (HYPRE_Matrix)parcsr_A, - (HYPRE_Vector)x); + /* HYPRE_PCGSetup(pcg_solver, (HYPRE_Matrix)parcsr_A, + * (HYPRE_Vector)b, (HYPRE_Vector)x); */ - HYPRE_LOBPCGSetup(lobpcg_solver, (HYPRE_Matrix)parcsr_A, - (HYPRE_Vector)b, (HYPRE_Vector)x); + hypre_EndTiming(time_index); + hypre_PrintTiming("Setup phase times", hypre_MPI_COMM_WORLD); + hypre_FinalizeTiming(time_index); + hypre_ClearTiming(); + + HYPRE_LOBPCGCreate(interpreter, &matvec_fn, &lobpcg_solver); + + HYPRE_LOBPCGSetMaxIter(lobpcg_solver, maxIterations); + HYPRE_LOBPCGSetPrecondUsageMode(lobpcg_solver, pcgMode); + HYPRE_LOBPCGSetTol(lobpcg_solver, tol); + HYPRE_LOBPCGSetPrintLevel(lobpcg_solver, verbosity); + + HYPRE_LOBPCGSetPrecond(lobpcg_solver, + (HYPRE_PtrToSolverFcn) HYPRE_PCGSolve, + (HYPRE_PtrToSolverFcn) HYPRE_PCGSetup, + pcg_solver); - if ( lobpcgGen ) - HYPRE_LOBPCGSetupB(lobpcg_solver, (HYPRE_Matrix)parcsr_B, + HYPRE_LOBPCGSetupT(lobpcg_solver, (HYPRE_Matrix)parcsr_A, (HYPRE_Vector)x); - if ( vFromFileFlag ) { - eigenvectors = mv_MultiVectorWrap( interpreter, - hypre_ParCSRMultiVectorRead(hypre_MPI_COMM_WORLD, - interpreter, - "vectors" ),1); - hypre_assert( eigenvectors != NULL ); - blockSize = mv_MultiVectorWidth( eigenvectors ); - } - else { - eigenvectors = mv_MultiVectorCreateFromSampleVector( interpreter, + HYPRE_LOBPCGSetup(lobpcg_solver, (HYPRE_Matrix)parcsr_A, + (HYPRE_Vector)b, (HYPRE_Vector)x); + + if ( lobpcgGen ) + HYPRE_LOBPCGSetupB(lobpcg_solver, (HYPRE_Matrix)parcsr_B, + (HYPRE_Vector)x); + + if ( vFromFileFlag ) { + eigenvectors = mv_MultiVectorWrap( interpreter, + hypre_ParCSRMultiVectorRead(hypre_MPI_COMM_WORLD, + interpreter, + "vectors" ),1); + hypre_assert( eigenvectors != NULL ); + blockSize = mv_MultiVectorWidth( eigenvectors ); + } + else { + eigenvectors = mv_MultiVectorCreateFromSampleVector( interpreter, blockSize, x ); - if ( lobpcgSeed ) - mv_MultiVectorSetRandom( eigenvectors, lobpcgSeed ); - else - mv_MultiVectorSetRandom( eigenvectors, (HYPRE_Int)time(0) ); - } + if ( lobpcgSeed ) + mv_MultiVectorSetRandom( eigenvectors, lobpcgSeed ); + else + mv_MultiVectorSetRandom( eigenvectors, (HYPRE_Int)time(0) ); + } - if ( constrained ) { - constraints = mv_MultiVectorWrap( interpreter, - hypre_ParCSRMultiVectorRead(hypre_MPI_COMM_WORLD, - interpreter, - "vectors" ),1); - hypre_assert( constraints != NULL ); - } + if ( constrained ) { + constraints = mv_MultiVectorWrap( interpreter, + hypre_ParCSRMultiVectorRead(hypre_MPI_COMM_WORLD, + interpreter, + "vectors" ),1); + hypre_assert( constraints != NULL ); + } - eigenvalues = hypre_CTAlloc(HYPRE_Real, blockSize, HYPRE_MEMORY_HOST); + eigenvalues = hypre_CTAlloc(HYPRE_Real, blockSize, HYPRE_MEMORY_HOST); - time_index = hypre_InitializeTiming("LOBPCG Solve"); - hypre_BeginTiming(time_index); + time_index = hypre_InitializeTiming("LOBPCG Solve"); + hypre_BeginTiming(time_index); - HYPRE_LOBPCGSolve(lobpcg_solver, constraints, eigenvectors, eigenvalues ); + HYPRE_LOBPCGSolve(lobpcg_solver, constraints, eigenvectors, eigenvalues ); - hypre_EndTiming(time_index); - hypre_PrintTiming("Solve phase times", hypre_MPI_COMM_WORLD); - hypre_FinalizeTiming(time_index); - hypre_ClearTiming(); + hypre_EndTiming(time_index); + hypre_PrintTiming("Solve phase times", hypre_MPI_COMM_WORLD); + hypre_FinalizeTiming(time_index); + hypre_ClearTiming(); - if ( checkOrtho ) { + if ( checkOrtho ) { - gramXX = utilities_FortranMatrixCreate(); - identity = utilities_FortranMatrixCreate(); + gramXX = utilities_FortranMatrixCreate(); + identity = utilities_FortranMatrixCreate(); - utilities_FortranMatrixAllocateData( blockSize, blockSize, gramXX ); - utilities_FortranMatrixAllocateData( blockSize, blockSize, identity ); + utilities_FortranMatrixAllocateData( blockSize, blockSize, gramXX ); + utilities_FortranMatrixAllocateData( blockSize, blockSize, identity ); - if ( lobpcgGen ) { - workspace = mv_MultiVectorCreateCopy( eigenvectors, 0 ); - hypre_LOBPCGMultiOperatorB( lobpcg_solver, - mv_MultiVectorGetData(eigenvectors), - mv_MultiVectorGetData(workspace) ); - lobpcg_MultiVectorByMultiVector( eigenvectors, workspace, gramXX ); - } - else - lobpcg_MultiVectorByMultiVector( eigenvectors, eigenvectors, gramXX ); + if ( lobpcgGen ) { + workspace = mv_MultiVectorCreateCopy( eigenvectors, 0 ); + hypre_LOBPCGMultiOperatorB( lobpcg_solver, + mv_MultiVectorGetData(eigenvectors), + mv_MultiVectorGetData(workspace) ); + lobpcg_MultiVectorByMultiVector( eigenvectors, workspace, gramXX ); + } + else + lobpcg_MultiVectorByMultiVector( eigenvectors, eigenvectors, gramXX ); - utilities_FortranMatrixSetToIdentity( identity ); - utilities_FortranMatrixAdd( -1, identity, gramXX, gramXX ); - nonOrthF = utilities_FortranMatrixFNorm( gramXX ); - if ( myid == 0 ) - hypre_printf("Non-orthonormality of eigenvectors: %12.5e\n", nonOrthF); + utilities_FortranMatrixSetToIdentity( identity ); + utilities_FortranMatrixAdd( -1, identity, gramXX, gramXX ); + nonOrthF = utilities_FortranMatrixFNorm( gramXX ); + if ( myid == 0 ) + hypre_printf("Non-orthonormality of eigenvectors: %12.5e\n", nonOrthF); - utilities_FortranMatrixDestroy( gramXX ); - utilities_FortranMatrixDestroy( identity ); + utilities_FortranMatrixDestroy( gramXX ); + utilities_FortranMatrixDestroy( identity ); - } + } - if ( printLevel ) { + if ( printLevel ) { - hypre_ParCSRMultiVectorPrint( mv_MultiVectorGetData(eigenvectors), "vectors" ); + hypre_ParCSRMultiVectorPrint( mv_MultiVectorGetData(eigenvectors), "vectors" ); - if ( myid == 0 ) { - if ( (filePtr = fopen("values.txt", "w")) ) { - hypre_fprintf(filePtr, "%d\n", blockSize); - for ( i = 0; i < blockSize; i++ ) - hypre_fprintf(filePtr, "%22.14e\n", eigenvalues[i]); - fclose(filePtr); - } + if ( myid == 0 ) { + if ( (filePtr = fopen("values.txt", "w")) ) { + hypre_fprintf(filePtr, "%d\n", blockSize); + for ( i = 0; i < blockSize; i++ ) + hypre_fprintf(filePtr, "%22.14e\n", eigenvalues[i]); + fclose(filePtr); + } - if ( (filePtr = fopen("residuals.txt", "w")) ) { - residualNorms = HYPRE_LOBPCGResidualNorms( lobpcg_solver ); - residuals = utilities_FortranMatrixValues( residualNorms ); - hypre_fprintf(filePtr, "%d\n", blockSize); - for ( i = 0; i < blockSize; i++ ) - hypre_fprintf(filePtr, "%22.14e\n", residuals[i]); - fclose(filePtr); - } + if ( (filePtr = fopen("residuals.txt", "w")) ) { + residualNorms = HYPRE_LOBPCGResidualNorms( lobpcg_solver ); + residuals = utilities_FortranMatrixValues( residualNorms ); + hypre_fprintf(filePtr, "%d\n", blockSize); + for ( i = 0; i < blockSize; i++ ) + hypre_fprintf(filePtr, "%22.14e\n", residuals[i]); + fclose(filePtr); + } - if ( printLevel > 1 ) { + if ( printLevel > 1 ) { - printBuffer = utilities_FortranMatrixCreate(); + printBuffer = utilities_FortranMatrixCreate(); - iterations = HYPRE_LOBPCGIterations( lobpcg_solver ); + iterations = HYPRE_LOBPCGIterations( lobpcg_solver ); - eigenvaluesHistory = HYPRE_LOBPCGEigenvaluesHistory( lobpcg_solver ); - utilities_FortranMatrixSelectBlock( eigenvaluesHistory, - 1, blockSize, 1, iterations + 1, printBuffer ); - utilities_FortranMatrixPrint( printBuffer, "val_hist.txt" ); - residualNormsHistory = HYPRE_LOBPCGResidualNormsHistory( lobpcg_solver ); - utilities_FortranMatrixSelectBlock(residualNormsHistory, - 1, blockSize, 1, iterations + 1, printBuffer ); - utilities_FortranMatrixPrint( printBuffer, "res_hist.txt" ); + eigenvaluesHistory = HYPRE_LOBPCGEigenvaluesHistory( lobpcg_solver ); + utilities_FortranMatrixSelectBlock( eigenvaluesHistory, + 1, blockSize, 1, iterations + 1, printBuffer ); + utilities_FortranMatrixPrint( printBuffer, "val_hist.txt" ); + residualNormsHistory = HYPRE_LOBPCGResidualNormsHistory( lobpcg_solver ); + utilities_FortranMatrixSelectBlock(residualNormsHistory, + 1, blockSize, 1, iterations + 1, printBuffer ); + utilities_FortranMatrixPrint( printBuffer, "res_hist.txt" ); - utilities_FortranMatrixDestroy( printBuffer ); - } + utilities_FortranMatrixDestroy( printBuffer ); + } + } } - } - HYPRE_LOBPCGDestroy(lobpcg_solver); - mv_MultiVectorDestroy( eigenvectors ); - if ( constrained ) - mv_MultiVectorDestroy( constraints ); - if ( lobpcgGen ) - mv_MultiVectorDestroy( workspace ); - free( eigenvalues ); + HYPRE_LOBPCGDestroy(lobpcg_solver); + mv_MultiVectorDestroy( eigenvectors ); + if ( constrained ) + mv_MultiVectorDestroy( constraints ); + if ( lobpcgGen ) + mv_MultiVectorDestroy( workspace ); + free( eigenvalues ); + + HYPRE_ParCSRPCGDestroy(pcg_solver); + + if (solver_id == 1) + { + HYPRE_BoomerAMGDestroy(pcg_precond); + } + else if (solver_id == 8) + { + HYPRE_ParaSailsDestroy(pcg_precond); + } + else if (solver_id == 12) + { + HYPRE_SchwarzDestroy(pcg_precond); + } + else if (solver_id == 14) + { + HYPRE_BoomerAMGDestroy(pcg_precond); + } + else if (solver_id == 43) + { + HYPRE_EuclidDestroy(pcg_precond); + } + + } + else { /* pcgIterations <= 0 --> use the preconditioner directly */ + + time_index = hypre_InitializeTiming("LOBPCG Setup"); + hypre_BeginTiming(time_index); + if (myid != 0) + verbosity = 0; + HYPRE_LOBPCGCreate(interpreter, &matvec_fn, &pcg_solver); + HYPRE_LOBPCGSetMaxIter(pcg_solver, maxIterations); + HYPRE_LOBPCGSetTol(pcg_solver, tol); + HYPRE_LOBPCGSetPrintLevel(pcg_solver, verbosity); + + HYPRE_LOBPCGGetPrecond(pcg_solver, &pcg_precond); + + if (solver_id == 1) + { + /* use BoomerAMG as preconditioner */ + if (myid == 0) + hypre_printf("Solver: AMG-PCG\n"); + + HYPRE_BoomerAMGCreate(&pcg_precond); + /* BM Aug 25, 2006 */ + HYPRE_BoomerAMGSetCGCIts(pcg_precond, cgcits); + HYPRE_BoomerAMGSetInterpType(pcg_precond, interp_type); + HYPRE_BoomerAMGSetNumSamples(pcg_precond, gsmg_samples); + HYPRE_BoomerAMGSetTol(pcg_precond, pc_tol); + HYPRE_BoomerAMGSetCoarsenType(pcg_precond, (hybrid*coarsen_type)); + HYPRE_BoomerAMGSetMeasureType(pcg_precond, measure_type); + HYPRE_BoomerAMGSetStrongThreshold(pcg_precond, strong_threshold); + HYPRE_BoomerAMGSetTruncFactor(pcg_precond, trunc_factor); + HYPRE_BoomerAMGSetPMaxElmts(pcg_precond, P_max_elmts); + HYPRE_BoomerAMGSetPostInterpType(pcg_precond, post_interp_type); + HYPRE_BoomerAMGSetJacobiTruncThreshold(pcg_precond, jacobi_trunc_threshold); + HYPRE_BoomerAMGSetPrintLevel(pcg_precond, poutdat); + HYPRE_BoomerAMGSetPrintFileName(pcg_precond, "driver.out.log"); + HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); + HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); + HYPRE_BoomerAMGSetFCycle(pcg_precond, fcycle); + HYPRE_BoomerAMGSetNumSweeps(pcg_precond, num_sweeps); + if (relax_type > -1) HYPRE_BoomerAMGSetRelaxType(pcg_precond, relax_type); + if (relax_down > -1) + HYPRE_BoomerAMGSetCycleRelaxType(pcg_precond, relax_down, 1); + if (relax_up > -1) + HYPRE_BoomerAMGSetCycleRelaxType(pcg_precond, relax_up, 2); + if (relax_coarse > -1) + HYPRE_BoomerAMGSetCycleRelaxType(pcg_precond, relax_coarse, 3); + HYPRE_BoomerAMGSetAddRelaxType(pcg_precond, add_relax_type); + HYPRE_BoomerAMGSetAddRelaxWt(pcg_precond, add_relax_wt); + HYPRE_BoomerAMGSetRelaxWt(pcg_precond, relax_wt); + HYPRE_BoomerAMGSetOuterWt(pcg_precond, outer_wt); + HYPRE_BoomerAMGSetSmoothType(pcg_precond, smooth_type); + HYPRE_BoomerAMGSetSmoothNumLevels(pcg_precond, smooth_num_levels); + HYPRE_BoomerAMGSetSmoothNumSweeps(pcg_precond, smooth_num_sweeps); + HYPRE_BoomerAMGSetRelaxOrder(pcg_precond, relax_order); + HYPRE_BoomerAMGSetMaxLevels(pcg_precond, max_levels); + HYPRE_BoomerAMGSetMaxRowSum(pcg_precond, max_row_sum); + HYPRE_BoomerAMGSetDebugFlag(pcg_precond, debug_flag); + HYPRE_BoomerAMGSetNumFunctions(pcg_precond, num_functions); + HYPRE_BoomerAMGSetNumPaths(pcg_precond, num_paths); + HYPRE_BoomerAMGSetAggNumLevels(pcg_precond, agg_num_levels); + HYPRE_BoomerAMGSetVariant(pcg_precond, variant); + HYPRE_BoomerAMGSetOverlap(pcg_precond, overlap); + HYPRE_BoomerAMGSetDomainType(pcg_precond, domain_type); + HYPRE_BoomerAMGSetSchwarzRlxWeight(pcg_precond, schwarz_rlx_weight); + if (num_functions > 1) + HYPRE_BoomerAMGSetDofFunc(pcg_precond, dof_func); + HYPRE_LOBPCGSetPrecond(pcg_solver, + (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSolve, + (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSetup, + pcg_precond); + } + else if (solver_id == 2) + { - HYPRE_ParCSRPCGDestroy(pcg_solver); + /* use diagonal scaling as preconditioner */ + if (myid == 0) + hypre_printf("Solver: DS-PCG\n"); - if (solver_id == 1) + pcg_precond = NULL; + + HYPRE_LOBPCGSetPrecond(pcg_solver, + (HYPRE_PtrToSolverFcn) HYPRE_ParCSRDiagScale, + (HYPRE_PtrToSolverFcn) HYPRE_ParCSRDiagScaleSetup, + pcg_precond); + } + else if (solver_id == 8) { - HYPRE_BoomerAMGDestroy(pcg_precond); + /* use ParaSails preconditioner */ + if (myid == 0) + hypre_printf("Solver: ParaSails-PCG\n"); + + HYPRE_ParaSailsCreate(hypre_MPI_COMM_WORLD, &pcg_precond); + HYPRE_ParaSailsSetParams(pcg_precond, sai_threshold, max_levels); + HYPRE_ParaSailsSetFilter(pcg_precond, sai_filter); + HYPRE_ParaSailsSetLogging(pcg_precond, poutdat); + + HYPRE_LOBPCGSetPrecond(pcg_solver, + (HYPRE_PtrToSolverFcn) HYPRE_ParaSailsSolve, + (HYPRE_PtrToSolverFcn) HYPRE_ParaSailsSetup, + pcg_precond); } - else if (solver_id == 8) + else if (solver_id == 12) { - HYPRE_ParaSailsDestroy(pcg_precond); + /* use Schwarz preconditioner */ + if (myid == 0) + hypre_printf("Solver: Schwarz-PCG\n"); + + HYPRE_SchwarzCreate(&pcg_precond); + HYPRE_SchwarzSetVariant(pcg_precond, variant); + HYPRE_SchwarzSetOverlap(pcg_precond, overlap); + HYPRE_SchwarzSetDomainType(pcg_precond, domain_type); + HYPRE_SchwarzSetRelaxWeight(pcg_precond, schwarz_rlx_weight); + + HYPRE_LOBPCGSetPrecond(pcg_solver, + (HYPRE_PtrToSolverFcn) HYPRE_SchwarzSolve, + (HYPRE_PtrToSolverFcn) HYPRE_SchwarzSetup, + pcg_precond); } - else if (solver_id == 12) + else if (solver_id == 14) { - HYPRE_SchwarzDestroy(pcg_precond); + /* use GSMG as preconditioner */ + + /* reset some smoother parameters */ + + num_sweeps = num_sweep; + relax_type = relax_default; + relax_order = 0; + + if (myid == 0) hypre_printf("Solver: GSMG-PCG\n"); + HYPRE_BoomerAMGCreate(&pcg_precond); + /* BM Aug 25, 2006 */ + HYPRE_BoomerAMGSetCGCIts(pcg_precond, cgcits); + HYPRE_BoomerAMGSetGSMG(pcg_precond, 4); + HYPRE_BoomerAMGSetInterpType(pcg_precond, interp_type); + HYPRE_BoomerAMGSetNumSamples(pcg_precond, gsmg_samples); + HYPRE_BoomerAMGSetTol(pcg_precond, pc_tol); + HYPRE_BoomerAMGSetCoarsenType(pcg_precond, (hybrid*coarsen_type)); + HYPRE_BoomerAMGSetMeasureType(pcg_precond, measure_type); + HYPRE_BoomerAMGSetStrongThreshold(pcg_precond, strong_threshold); + HYPRE_BoomerAMGSetTruncFactor(pcg_precond, trunc_factor); + HYPRE_BoomerAMGSetPMaxElmts(pcg_precond, P_max_elmts); + HYPRE_BoomerAMGSetPostInterpType(pcg_precond, post_interp_type); + HYPRE_BoomerAMGSetJacobiTruncThreshold(pcg_precond, jacobi_trunc_threshold); + HYPRE_BoomerAMGSetPrintLevel(pcg_precond, poutdat); + HYPRE_BoomerAMGSetPrintFileName(pcg_precond, "driver.out.log"); + HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); + HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); + HYPRE_BoomerAMGSetFCycle(pcg_precond, fcycle); + HYPRE_BoomerAMGSetNumSweeps(pcg_precond, num_sweeps); + HYPRE_BoomerAMGSetRelaxType(pcg_precond, relax_type); + HYPRE_BoomerAMGSetAddRelaxType(pcg_precond, add_relax_type); + HYPRE_BoomerAMGSetAddRelaxWt(pcg_precond, add_relax_wt); + HYPRE_BoomerAMGSetRelaxWt(pcg_precond, relax_wt); + HYPRE_BoomerAMGSetOuterWt(pcg_precond, outer_wt); + HYPRE_BoomerAMGSetSmoothType(pcg_precond, smooth_type); + HYPRE_BoomerAMGSetSmoothNumLevels(pcg_precond, smooth_num_levels); + HYPRE_BoomerAMGSetSmoothNumSweeps(pcg_precond, smooth_num_sweeps); + HYPRE_BoomerAMGSetVariant(pcg_precond, variant); + HYPRE_BoomerAMGSetOverlap(pcg_precond, overlap); + HYPRE_BoomerAMGSetDomainType(pcg_precond, domain_type); + HYPRE_BoomerAMGSetSchwarzRlxWeight(pcg_precond, schwarz_rlx_weight); + HYPRE_BoomerAMGSetRelaxOrder(pcg_precond, relax_order); + HYPRE_BoomerAMGSetMaxLevels(pcg_precond, max_levels); + HYPRE_BoomerAMGSetMaxRowSum(pcg_precond, max_row_sum); + HYPRE_BoomerAMGSetDebugFlag(pcg_precond, debug_flag); + HYPRE_BoomerAMGSetNumFunctions(pcg_precond, num_functions); + HYPRE_BoomerAMGSetNumPaths(pcg_precond, num_paths); + HYPRE_BoomerAMGSetAggNumLevels(pcg_precond, agg_num_levels); + if (num_functions > 1) + HYPRE_BoomerAMGSetDofFunc(pcg_precond, dof_func); + + HYPRE_LOBPCGSetPrecond(pcg_solver, + (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSolve, + (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSetup, + pcg_precond); } - else if (solver_id == 14) + else if (solver_id == 43) { - HYPRE_BoomerAMGDestroy(pcg_precond); + /* use Euclid preconditioning */ + if (myid == 0) + hypre_printf("Solver: Euclid-PCG\n"); + + HYPRE_EuclidCreate(hypre_MPI_COMM_WORLD, &pcg_precond); + + /* note: There are three three methods of setting run-time + * parameters for Euclid: (see HYPRE_parcsr_ls.h); here we'll + * use what I think is simplest: let Euclid internally parse + * the command line. */ + HYPRE_EuclidSetParams(pcg_precond, argc, argv); + + HYPRE_LOBPCGSetPrecond(pcg_solver, + (HYPRE_PtrToSolverFcn) HYPRE_EuclidSolve, + (HYPRE_PtrToSolverFcn) HYPRE_EuclidSetup, + pcg_precond); } - else if (solver_id == 43) + else if (solver_id != NO_SOLVER ) { - HYPRE_EuclidDestroy(pcg_precond); + if ( verbosity ) + hypre_printf("Solver ID not recognized - running LOBPCG without preconditioner\n\n"); } - } - else { /* pcgIterations <= 0 --> use the preconditioner directly */ + HYPRE_LOBPCGGetPrecond(pcg_solver, &pcg_precond_gotten); + if (pcg_precond_gotten != pcg_precond && pcgIterations) + { + hypre_printf("HYPRE_ParCSRLOBPCGGetPrecond got bad precond\n"); + return(-1); + } + else + if (myid == 0) + hypre_printf("HYPRE_ParCSRLOBPCGGetPrecond got good precond\n"); - time_index = hypre_InitializeTiming("LOBPCG Setup"); - hypre_BeginTiming(time_index); - if (myid != 0) - verbosity = 0; - HYPRE_LOBPCGCreate(interpreter, &matvec_fn, &pcg_solver); - HYPRE_LOBPCGSetMaxIter(pcg_solver, maxIterations); - HYPRE_LOBPCGSetTol(pcg_solver, tol); - HYPRE_LOBPCGSetPrintLevel(pcg_solver, verbosity); - - HYPRE_LOBPCGGetPrecond(pcg_solver, &pcg_precond); - - if (solver_id == 1) - { - /* use BoomerAMG as preconditioner */ - if (myid == 0) - hypre_printf("Solver: AMG-PCG\n"); - - HYPRE_BoomerAMGCreate(&pcg_precond); - /* BM Aug 25, 2006 */ - HYPRE_BoomerAMGSetCGCIts(pcg_precond, cgcits); - HYPRE_BoomerAMGSetInterpType(pcg_precond, interp_type); - HYPRE_BoomerAMGSetNumSamples(pcg_precond, gsmg_samples); - HYPRE_BoomerAMGSetTol(pcg_precond, pc_tol); - HYPRE_BoomerAMGSetCoarsenType(pcg_precond, (hybrid*coarsen_type)); - HYPRE_BoomerAMGSetMeasureType(pcg_precond, measure_type); - HYPRE_BoomerAMGSetStrongThreshold(pcg_precond, strong_threshold); - HYPRE_BoomerAMGSetTruncFactor(pcg_precond, trunc_factor); - HYPRE_BoomerAMGSetPMaxElmts(pcg_precond, P_max_elmts); - HYPRE_BoomerAMGSetPostInterpType(pcg_precond, post_interp_type); - HYPRE_BoomerAMGSetJacobiTruncThreshold(pcg_precond, jacobi_trunc_threshold); - HYPRE_BoomerAMGSetPrintLevel(pcg_precond, poutdat); - HYPRE_BoomerAMGSetPrintFileName(pcg_precond, "driver.out.log"); - HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); - HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); - HYPRE_BoomerAMGSetNumSweeps(pcg_precond, num_sweeps); - if (relax_type > -1) HYPRE_BoomerAMGSetRelaxType(pcg_precond, relax_type); - if (relax_down > -1) - HYPRE_BoomerAMGSetCycleRelaxType(pcg_precond, relax_down, 1); - if (relax_up > -1) - HYPRE_BoomerAMGSetCycleRelaxType(pcg_precond, relax_up, 2); - if (relax_coarse > -1) - HYPRE_BoomerAMGSetCycleRelaxType(pcg_precond, relax_coarse, 3); - HYPRE_BoomerAMGSetAddRelaxType(pcg_precond, add_relax_type); - HYPRE_BoomerAMGSetAddRelaxWt(pcg_precond, add_relax_wt); - HYPRE_BoomerAMGSetRelaxWt(pcg_precond, relax_wt); - HYPRE_BoomerAMGSetOuterWt(pcg_precond, outer_wt); - HYPRE_BoomerAMGSetSmoothType(pcg_precond, smooth_type); - HYPRE_BoomerAMGSetSmoothNumLevels(pcg_precond, smooth_num_levels); - HYPRE_BoomerAMGSetSmoothNumSweeps(pcg_precond, smooth_num_sweeps); - HYPRE_BoomerAMGSetRelaxOrder(pcg_precond, relax_order); - HYPRE_BoomerAMGSetMaxLevels(pcg_precond, max_levels); - HYPRE_BoomerAMGSetMaxRowSum(pcg_precond, max_row_sum); - HYPRE_BoomerAMGSetDebugFlag(pcg_precond, debug_flag); - HYPRE_BoomerAMGSetNumFunctions(pcg_precond, num_functions); - HYPRE_BoomerAMGSetNumPaths(pcg_precond, num_paths); - HYPRE_BoomerAMGSetAggNumLevels(pcg_precond, agg_num_levels); - HYPRE_BoomerAMGSetVariant(pcg_precond, variant); - HYPRE_BoomerAMGSetOverlap(pcg_precond, overlap); - HYPRE_BoomerAMGSetDomainType(pcg_precond, domain_type); - HYPRE_BoomerAMGSetSchwarzRlxWeight(pcg_precond, schwarz_rlx_weight); - if (num_functions > 1) - HYPRE_BoomerAMGSetDofFunc(pcg_precond, dof_func); - HYPRE_LOBPCGSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSolve, - (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSetup, - pcg_precond); - } - else if (solver_id == 2) - { + HYPRE_LOBPCGSetup(pcg_solver, (HYPRE_Matrix)parcsr_A, + (HYPRE_Vector)b, (HYPRE_Vector)x); - /* use diagonal scaling as preconditioner */ - if (myid == 0) - hypre_printf("Solver: DS-PCG\n"); + if ( lobpcgGen ) + HYPRE_LOBPCGSetupB(pcg_solver, (HYPRE_Matrix)parcsr_B, + (HYPRE_Vector)x); + + hypre_EndTiming(time_index); + hypre_PrintTiming("Setup phase times", hypre_MPI_COMM_WORLD); + hypre_FinalizeTiming(time_index); + hypre_ClearTiming(); + + if ( vFromFileFlag ) { + eigenvectors = mv_MultiVectorWrap( interpreter, + hypre_ParCSRMultiVectorRead(hypre_MPI_COMM_WORLD, + interpreter, + "vectors" ),1); + hypre_assert( eigenvectors != NULL ); + blockSize = mv_MultiVectorWidth( eigenvectors ); + } + else { + eigenvectors = mv_MultiVectorCreateFromSampleVector( interpreter, + blockSize, + x ); + if ( lobpcgSeed ) + mv_MultiVectorSetRandom( eigenvectors, lobpcgSeed ); + else + mv_MultiVectorSetRandom( eigenvectors, (HYPRE_Int)time(0) ); + } - pcg_precond = NULL; + if ( constrained ) { + constraints = mv_MultiVectorWrap( interpreter, + hypre_ParCSRMultiVectorRead(hypre_MPI_COMM_WORLD, + interpreter, + "vectors" ),1); + hypre_assert( constraints != NULL ); + } - HYPRE_LOBPCGSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSRDiagScale, - (HYPRE_PtrToSolverFcn) HYPRE_ParCSRDiagScaleSetup, - pcg_precond); - } - else if (solver_id == 8) - { - /* use ParaSails preconditioner */ - if (myid == 0) - hypre_printf("Solver: ParaSails-PCG\n"); - - HYPRE_ParaSailsCreate(hypre_MPI_COMM_WORLD, &pcg_precond); - HYPRE_ParaSailsSetParams(pcg_precond, sai_threshold, max_levels); - HYPRE_ParaSailsSetFilter(pcg_precond, sai_filter); - HYPRE_ParaSailsSetLogging(pcg_precond, poutdat); - - HYPRE_LOBPCGSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_ParaSailsSolve, - (HYPRE_PtrToSolverFcn) HYPRE_ParaSailsSetup, - pcg_precond); - } - else if (solver_id == 12) - { - /* use Schwarz preconditioner */ - if (myid == 0) - hypre_printf("Solver: Schwarz-PCG\n"); - - HYPRE_SchwarzCreate(&pcg_precond); - HYPRE_SchwarzSetVariant(pcg_precond, variant); - HYPRE_SchwarzSetOverlap(pcg_precond, overlap); - HYPRE_SchwarzSetDomainType(pcg_precond, domain_type); - HYPRE_SchwarzSetRelaxWeight(pcg_precond, schwarz_rlx_weight); - - HYPRE_LOBPCGSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_SchwarzSolve, - (HYPRE_PtrToSolverFcn) HYPRE_SchwarzSetup, - pcg_precond); - } - else if (solver_id == 14) - { - /* use GSMG as preconditioner */ - - /* reset some smoother parameters */ - - num_sweeps = num_sweep; - relax_type = relax_default; - relax_order = 0; - - if (myid == 0) hypre_printf("Solver: GSMG-PCG\n"); - HYPRE_BoomerAMGCreate(&pcg_precond); - /* BM Aug 25, 2006 */ - HYPRE_BoomerAMGSetCGCIts(pcg_precond, cgcits); - HYPRE_BoomerAMGSetGSMG(pcg_precond, 4); - HYPRE_BoomerAMGSetInterpType(pcg_precond, interp_type); - HYPRE_BoomerAMGSetNumSamples(pcg_precond, gsmg_samples); - HYPRE_BoomerAMGSetTol(pcg_precond, pc_tol); - HYPRE_BoomerAMGSetCoarsenType(pcg_precond, (hybrid*coarsen_type)); - HYPRE_BoomerAMGSetMeasureType(pcg_precond, measure_type); - HYPRE_BoomerAMGSetStrongThreshold(pcg_precond, strong_threshold); - HYPRE_BoomerAMGSetTruncFactor(pcg_precond, trunc_factor); - HYPRE_BoomerAMGSetPMaxElmts(pcg_precond, P_max_elmts); - HYPRE_BoomerAMGSetPostInterpType(pcg_precond, post_interp_type); - HYPRE_BoomerAMGSetJacobiTruncThreshold(pcg_precond, jacobi_trunc_threshold); - HYPRE_BoomerAMGSetPrintLevel(pcg_precond, poutdat); - HYPRE_BoomerAMGSetPrintFileName(pcg_precond, "driver.out.log"); - HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); - HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); - HYPRE_BoomerAMGSetNumSweeps(pcg_precond, num_sweeps); - HYPRE_BoomerAMGSetRelaxType(pcg_precond, relax_type); - HYPRE_BoomerAMGSetAddRelaxType(pcg_precond, add_relax_type); - HYPRE_BoomerAMGSetAddRelaxWt(pcg_precond, add_relax_wt); - HYPRE_BoomerAMGSetRelaxWt(pcg_precond, relax_wt); - HYPRE_BoomerAMGSetOuterWt(pcg_precond, outer_wt); - HYPRE_BoomerAMGSetSmoothType(pcg_precond, smooth_type); - HYPRE_BoomerAMGSetSmoothNumLevels(pcg_precond, smooth_num_levels); - HYPRE_BoomerAMGSetSmoothNumSweeps(pcg_precond, smooth_num_sweeps); - HYPRE_BoomerAMGSetVariant(pcg_precond, variant); - HYPRE_BoomerAMGSetOverlap(pcg_precond, overlap); - HYPRE_BoomerAMGSetDomainType(pcg_precond, domain_type); - HYPRE_BoomerAMGSetSchwarzRlxWeight(pcg_precond, schwarz_rlx_weight); - HYPRE_BoomerAMGSetRelaxOrder(pcg_precond, relax_order); - HYPRE_BoomerAMGSetMaxLevels(pcg_precond, max_levels); - HYPRE_BoomerAMGSetMaxRowSum(pcg_precond, max_row_sum); - HYPRE_BoomerAMGSetDebugFlag(pcg_precond, debug_flag); - HYPRE_BoomerAMGSetNumFunctions(pcg_precond, num_functions); - HYPRE_BoomerAMGSetNumPaths(pcg_precond, num_paths); - HYPRE_BoomerAMGSetAggNumLevels(pcg_precond, agg_num_levels); - if (num_functions > 1) - HYPRE_BoomerAMGSetDofFunc(pcg_precond, dof_func); + eigenvalues = hypre_CTAlloc(HYPRE_Real, blockSize, HYPRE_MEMORY_HOST); - HYPRE_LOBPCGSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSolve, - (HYPRE_PtrToSolverFcn) HYPRE_BoomerAMGSetup, - pcg_precond); - } - else if (solver_id == 43) - { - /* use Euclid preconditioning */ - if (myid == 0) - hypre_printf("Solver: Euclid-PCG\n"); - - HYPRE_EuclidCreate(hypre_MPI_COMM_WORLD, &pcg_precond); - - /* note: There are three three methods of setting run-time - * parameters for Euclid: (see HYPRE_parcsr_ls.h); here - * we'll use what I think is simplest: let Euclid internally - * parse the command line. - * */ - HYPRE_EuclidSetParams(pcg_precond, argc, argv); + time_index = hypre_InitializeTiming("LOBPCG Solve"); + hypre_BeginTiming(time_index); - HYPRE_LOBPCGSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_EuclidSolve, - (HYPRE_PtrToSolverFcn) HYPRE_EuclidSetup, - pcg_precond); - } - else if (solver_id != NO_SOLVER ) - { - if ( verbosity ) - hypre_printf("Solver ID not recognized - running LOBPCG without preconditioner\n\n"); - } - - HYPRE_LOBPCGGetPrecond(pcg_solver, &pcg_precond_gotten); - if (pcg_precond_gotten != pcg_precond && pcgIterations) - { - hypre_printf("HYPRE_ParCSRLOBPCGGetPrecond got bad precond\n"); - return(-1); - } - else - if (myid == 0) - hypre_printf("HYPRE_ParCSRLOBPCGGetPrecond got good precond\n"); + HYPRE_LOBPCGSolve(pcg_solver, constraints, eigenvectors, eigenvalues); - HYPRE_LOBPCGSetup(pcg_solver, (HYPRE_Matrix)parcsr_A, - (HYPRE_Vector)b, (HYPRE_Vector)x); + hypre_EndTiming(time_index); + hypre_PrintTiming("Solve phase times", hypre_MPI_COMM_WORLD); + hypre_FinalizeTiming(time_index); + hypre_ClearTiming(); - if ( lobpcgGen ) - HYPRE_LOBPCGSetupB(pcg_solver, (HYPRE_Matrix)parcsr_B, - (HYPRE_Vector)x); + if ( checkOrtho ) { - hypre_EndTiming(time_index); - hypre_PrintTiming("Setup phase times", hypre_MPI_COMM_WORLD); - hypre_FinalizeTiming(time_index); - hypre_ClearTiming(); - - if ( vFromFileFlag ) { - eigenvectors = mv_MultiVectorWrap( interpreter, - hypre_ParCSRMultiVectorRead(hypre_MPI_COMM_WORLD, - interpreter, - "vectors" ),1); - hypre_assert( eigenvectors != NULL ); - blockSize = mv_MultiVectorWidth( eigenvectors ); - } - else { - eigenvectors = mv_MultiVectorCreateFromSampleVector( interpreter, - blockSize, - x ); - if ( lobpcgSeed ) - mv_MultiVectorSetRandom( eigenvectors, lobpcgSeed ); - else - mv_MultiVectorSetRandom( eigenvectors, (HYPRE_Int)time(0) ); - } + gramXX = utilities_FortranMatrixCreate(); + identity = utilities_FortranMatrixCreate(); + + utilities_FortranMatrixAllocateData( blockSize, blockSize, gramXX ); + utilities_FortranMatrixAllocateData( blockSize, blockSize, identity ); + + if ( lobpcgGen ) { + workspace = mv_MultiVectorCreateCopy( eigenvectors, 0 ); + hypre_LOBPCGMultiOperatorB( pcg_solver, + mv_MultiVectorGetData(eigenvectors), + mv_MultiVectorGetData(workspace) ); + lobpcg_MultiVectorByMultiVector( eigenvectors, workspace, gramXX ); + } + else + lobpcg_MultiVectorByMultiVector( eigenvectors, eigenvectors, gramXX ); + + utilities_FortranMatrixSetToIdentity( identity ); + utilities_FortranMatrixAdd( -1, identity, gramXX, gramXX ); + nonOrthF = utilities_FortranMatrixFNorm( gramXX ); + if ( myid == 0 ) + hypre_printf("Non-orthonormality of eigenvectors: %12.5e\n", nonOrthF); + + utilities_FortranMatrixDestroy( gramXX ); + utilities_FortranMatrixDestroy( identity ); - if ( constrained ) { - constraints = mv_MultiVectorWrap( interpreter, - hypre_ParCSRMultiVectorRead(hypre_MPI_COMM_WORLD, - interpreter, - "vectors" ),1); - hypre_assert( constraints != NULL ); - } - - eigenvalues = hypre_CTAlloc(HYPRE_Real, blockSize, HYPRE_MEMORY_HOST); - - time_index = hypre_InitializeTiming("LOBPCG Solve"); - hypre_BeginTiming(time_index); - - HYPRE_LOBPCGSolve(pcg_solver, constraints, eigenvectors, eigenvalues); - - hypre_EndTiming(time_index); - hypre_PrintTiming("Solve phase times", hypre_MPI_COMM_WORLD); - hypre_FinalizeTiming(time_index); - hypre_ClearTiming(); - - if ( checkOrtho ) { - - gramXX = utilities_FortranMatrixCreate(); - identity = utilities_FortranMatrixCreate(); - - utilities_FortranMatrixAllocateData( blockSize, blockSize, gramXX ); - utilities_FortranMatrixAllocateData( blockSize, blockSize, identity ); - - if ( lobpcgGen ) { - workspace = mv_MultiVectorCreateCopy( eigenvectors, 0 ); - hypre_LOBPCGMultiOperatorB( pcg_solver, - mv_MultiVectorGetData(eigenvectors), - mv_MultiVectorGetData(workspace) ); - lobpcg_MultiVectorByMultiVector( eigenvectors, workspace, gramXX ); } - else - lobpcg_MultiVectorByMultiVector( eigenvectors, eigenvectors, gramXX ); - utilities_FortranMatrixSetToIdentity( identity ); - utilities_FortranMatrixAdd( -1, identity, gramXX, gramXX ); - nonOrthF = utilities_FortranMatrixFNorm( gramXX ); - if ( myid == 0 ) - hypre_printf("Non-orthonormality of eigenvectors: %12.5e\n", nonOrthF); - - utilities_FortranMatrixDestroy( gramXX ); - utilities_FortranMatrixDestroy( identity ); - - } - - if ( printLevel ) { - hypre_ParCSRMultiVectorPrint( mv_MultiVectorGetData(eigenvectors), "vectors" ); - - if ( myid == 0 ) { - if ( (filePtr = fopen("values.txt", "w")) ) { - hypre_fprintf(filePtr, "%d\n", blockSize); - for ( i = 0; i < blockSize; i++ ) - hypre_fprintf(filePtr, "%22.14e\n", eigenvalues[i]); - fclose(filePtr); - } - - if ( (filePtr = fopen("residuals.txt", "w")) ) { - residualNorms = HYPRE_LOBPCGResidualNorms( pcg_solver ); - residuals = utilities_FortranMatrixValues( residualNorms ); - hypre_fprintf(filePtr, "%d\n", blockSize); - for ( i = 0; i < blockSize; i++ ) - hypre_fprintf(filePtr, "%22.14e\n", residuals[i]); - fclose(filePtr); - } - - if ( printLevel > 1 ) { - - printBuffer = utilities_FortranMatrixCreate(); - - iterations = HYPRE_LOBPCGIterations( pcg_solver ); - - eigenvaluesHistory = HYPRE_LOBPCGEigenvaluesHistory( pcg_solver ); - utilities_FortranMatrixSelectBlock( eigenvaluesHistory, - 1, blockSize, 1, iterations + 1, printBuffer ); - utilities_FortranMatrixPrint( printBuffer, "val_hist.txt" ); - - residualNormsHistory = HYPRE_LOBPCGResidualNormsHistory( pcg_solver ); - utilities_FortranMatrixSelectBlock(residualNormsHistory, - 1, blockSize, 1, iterations + 1, printBuffer ); - utilities_FortranMatrixPrint( printBuffer, "res_hist.txt" ); + if ( printLevel ) { + hypre_ParCSRMultiVectorPrint( mv_MultiVectorGetData(eigenvectors), "vectors" ); + + if ( myid == 0 ) { + if ( (filePtr = fopen("values.txt", "w")) ) { + hypre_fprintf(filePtr, "%d\n", blockSize); + for ( i = 0; i < blockSize; i++ ) + hypre_fprintf(filePtr, "%22.14e\n", eigenvalues[i]); + fclose(filePtr); + } + + if ( (filePtr = fopen("residuals.txt", "w")) ) { + residualNorms = HYPRE_LOBPCGResidualNorms( pcg_solver ); + residuals = utilities_FortranMatrixValues( residualNorms ); + hypre_fprintf(filePtr, "%d\n", blockSize); + for ( i = 0; i < blockSize; i++ ) + hypre_fprintf(filePtr, "%22.14e\n", residuals[i]); + fclose(filePtr); + } - utilities_FortranMatrixDestroy( printBuffer ); - } + if ( printLevel > 1 ) { + + printBuffer = utilities_FortranMatrixCreate(); + + iterations = HYPRE_LOBPCGIterations( pcg_solver ); + + eigenvaluesHistory = HYPRE_LOBPCGEigenvaluesHistory( pcg_solver ); + utilities_FortranMatrixSelectBlock( eigenvaluesHistory, + 1, blockSize, 1, iterations + 1, printBuffer ); + utilities_FortranMatrixPrint( printBuffer, "val_hist.txt" ); + + residualNormsHistory = HYPRE_LOBPCGResidualNormsHistory( pcg_solver ); + utilities_FortranMatrixSelectBlock(residualNormsHistory, + 1, blockSize, 1, iterations + 1, printBuffer ); + utilities_FortranMatrixPrint( printBuffer, "res_hist.txt" ); + + utilities_FortranMatrixDestroy( printBuffer ); + } + } } - } #if SECOND_TIME - /* run a second time to check for memory leaks */ - mv_MultiVectorSetRandom( eigenvectors, 775 ); - HYPRE_LOBPCGSetup(pcg_solver, (HYPRE_Matrix)parcsr_A, - (HYPRE_Vector)b, (HYPRE_Vector)x); - HYPRE_LOBPCGSolve(pcg_solver, constraints, eigenvectors, eigenvalues ); + /* run a second time to check for memory leaks */ + mv_MultiVectorSetRandom( eigenvectors, 775 ); + HYPRE_LOBPCGSetup(pcg_solver, (HYPRE_Matrix)parcsr_A, + (HYPRE_Vector)b, (HYPRE_Vector)x); + HYPRE_LOBPCGSolve(pcg_solver, constraints, eigenvectors, eigenvalues ); #endif - HYPRE_LOBPCGDestroy(pcg_solver); + HYPRE_LOBPCGDestroy(pcg_solver); - if (solver_id == 1) + if (solver_id == 1) { - HYPRE_BoomerAMGDestroy(pcg_precond); + HYPRE_BoomerAMGDestroy(pcg_precond); } - else if (solver_id == 8) + else if (solver_id == 8) { - HYPRE_ParaSailsDestroy(pcg_precond); + HYPRE_ParaSailsDestroy(pcg_precond); } - else if (solver_id == 12) + else if (solver_id == 12) { - HYPRE_SchwarzDestroy(pcg_precond); + HYPRE_SchwarzDestroy(pcg_precond); } - else if (solver_id == 14) + else if (solver_id == 14) { - HYPRE_BoomerAMGDestroy(pcg_precond); + HYPRE_BoomerAMGDestroy(pcg_precond); } - else if (solver_id == 43) + else if (solver_id == 43) { - HYPRE_EuclidDestroy(pcg_precond); + HYPRE_EuclidDestroy(pcg_precond); } - mv_MultiVectorDestroy( eigenvectors ); - if ( constrained ) - mv_MultiVectorDestroy( constraints ); - if ( lobpcgGen ) - mv_MultiVectorDestroy( workspace ); - free( eigenvalues ); + mv_MultiVectorDestroy( eigenvectors ); + if ( constrained ) + mv_MultiVectorDestroy( constraints ); + if ( lobpcgGen ) + mv_MultiVectorDestroy( workspace ); + free( eigenvalues ); - } /* if ( pcgIterations > 0 ) */ + } /* if ( pcgIterations > 0 ) */ - hypre_TFree( interpreter , HYPRE_MEMORY_HOST); + hypre_TFree( interpreter , HYPRE_MEMORY_HOST); - if ( lobpcgGen ) - HYPRE_IJMatrixDestroy(ij_B); + if ( lobpcgGen ) + HYPRE_IJMatrixDestroy(ij_B); } /* if ( lobpcgFlag ) */ @@ -4592,10 +4673,12 @@ hypre_assert(restri_type >= 0); HYPRE_BoomerAMGSetRestriction(pcg_precond, restri_type); /* 0: P^T, 1: AIR, 2: AIR-2 */ HYPRE_BoomerAMGSetGridRelaxPoints(pcg_precond, grid_relax_points); + HYPRE_BoomerAMGSetStrongThresholdR(amg_solver, strong_thresholdR); } HYPRE_BoomerAMGSetCGCIts(pcg_precond, cgcits); HYPRE_BoomerAMGSetInterpType(pcg_precond, interp_type); + HYPRE_BoomerAMGSetRestriction(pcg_precond, restri_type); /* 0: P^T, 1: AIR, 2: AIR-2 */ HYPRE_BoomerAMGSetPostInterpType(pcg_precond, post_interp_type); HYPRE_BoomerAMGSetNumSamples(pcg_precond, gsmg_samples); HYPRE_BoomerAMGSetTol(pcg_precond, pc_tol); @@ -4614,6 +4697,7 @@ HYPRE_BoomerAMGSetPrintFileName(pcg_precond, "driver.out.log"); HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); + HYPRE_BoomerAMGSetFCycle(pcg_precond, fcycle); HYPRE_BoomerAMGSetNumSweeps(pcg_precond, num_sweeps); HYPRE_BoomerAMGSetISType(pcg_precond, IS_type); HYPRE_BoomerAMGSetNumCRRelaxSteps(pcg_precond, num_CR_relax_steps); @@ -4684,8 +4768,9 @@ HYPRE_BoomerAMGSetMultAddPMaxElmts(pcg_precond, add_P_max_elmts); HYPRE_BoomerAMGSetMultAddTruncFactor(pcg_precond, add_trunc_factor); HYPRE_BoomerAMGSetRAP2(pcg_precond, rap2); + HYPRE_BoomerAMGSetModuleRAP2(pcg_precond, mod_rap2); HYPRE_BoomerAMGSetKeepTranspose(pcg_precond, keepTranspose); -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU HYPRE_BoomerAMGSetDSLUThreshold(pcg_precond, dslu_threshold); #endif if (nongalerk_tol) @@ -4772,6 +4857,7 @@ HYPRE_BoomerAMGSetPrintFileName(pcg_precond, "driver.out.log"); HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); + HYPRE_BoomerAMGSetFCycle(pcg_precond, fcycle); HYPRE_BoomerAMGSetNumSweeps(pcg_precond, num_sweeps); HYPRE_BoomerAMGSetISType(pcg_precond, IS_type); HYPRE_BoomerAMGSetNumCRRelaxSteps(pcg_precond, num_CR_relax_steps); @@ -4834,8 +4920,9 @@ HYPRE_BoomerAMGSetMultAddPMaxElmts(pcg_precond, add_P_max_elmts); HYPRE_BoomerAMGSetMultAddTruncFactor(pcg_precond, add_trunc_factor); HYPRE_BoomerAMGSetRAP2(pcg_precond, rap2); + HYPRE_BoomerAMGSetModuleRAP2(pcg_precond, mod_rap2); HYPRE_BoomerAMGSetKeepTranspose(pcg_precond, keepTranspose); -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU HYPRE_BoomerAMGSetDSLUThreshold(pcg_precond, dslu_threshold); #endif if (nongalerk_tol) @@ -4855,11 +4942,11 @@ /* use ParaSails preconditioner */ if (myid == 0) hypre_printf("Solver: ParaSails-GMRES\n"); - HYPRE_ParaSailsCreate(hypre_MPI_COMM_WORLD, &pcg_precond); - HYPRE_ParaSailsSetParams(pcg_precond, sai_threshold, max_levels); + HYPRE_ParaSailsCreate(hypre_MPI_COMM_WORLD, &pcg_precond); + HYPRE_ParaSailsSetParams(pcg_precond, sai_threshold, max_levels); HYPRE_ParaSailsSetFilter(pcg_precond, sai_filter); HYPRE_ParaSailsSetLogging(pcg_precond, poutdat); - HYPRE_ParaSailsSetSym(pcg_precond, 0); + HYPRE_ParaSailsSetSym(pcg_precond, 0); HYPRE_GMRESSetPrecond(pcg_solver, (HYPRE_PtrToSolverFcn) HYPRE_ParaSailsSolve, @@ -4925,8 +5012,8 @@ HYPRE_Int num_values = 20; HYPRE_ParCSRGMRESGetResidual(pcg_solver, &residual); HYPRE_ParCSRMatrixGetLocalRange( parcsr_A, - &first_local_row, &last_local_row , - &first_local_col, &last_local_col ); + &first_local_row, &last_local_row , + &first_local_col, &last_local_col ); local_num_rows = (HYPRE_Int)(last_local_row - first_local_row + 1); if (local_num_rows < 20) num_values = local_num_rows; indices = hypre_CTAlloc(HYPRE_BigInt, num_values, HYPRE_MEMORY_HOST); @@ -4935,7 +5022,7 @@ indices[i] = first_local_row+i; HYPRE_ParVectorGetValues((HYPRE_ParVector) residual,num_values,indices,values); for (i=0; i < num_values; i++) - if (myid ==0) hypre_printf("index %d value %e\n", i, values[i]); + if (myid ==0) hypre_printf("index %d value %e\n", i, values[i]); hypre_TFree(indices, HYPRE_MEMORY_HOST); hypre_TFree(values, HYPRE_MEMORY_HOST); } @@ -4962,7 +5049,7 @@ } else if (solver_id == 18) { - HYPRE_ParaSailsDestroy(pcg_precond); + HYPRE_ParaSailsDestroy(pcg_precond); } else if (solver_id == 44) { @@ -5021,6 +5108,7 @@ HYPRE_BoomerAMGSetPrintFileName(pcg_precond, "driver.out.log"); HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); + HYPRE_BoomerAMGSetFCycle(pcg_precond, fcycle); HYPRE_BoomerAMGSetNumSweeps(pcg_precond, num_sweeps); HYPRE_BoomerAMGSetISType(pcg_precond, IS_type); HYPRE_BoomerAMGSetNumCRRelaxSteps(pcg_precond, num_CR_relax_steps); @@ -5083,8 +5171,9 @@ HYPRE_BoomerAMGSetMultAddPMaxElmts(pcg_precond, add_P_max_elmts); HYPRE_BoomerAMGSetMultAddTruncFactor(pcg_precond, add_trunc_factor); HYPRE_BoomerAMGSetRAP2(pcg_precond, rap2); + HYPRE_BoomerAMGSetModuleRAP2(pcg_precond, mod_rap2); HYPRE_BoomerAMGSetKeepTranspose(pcg_precond, keepTranspose); -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU HYPRE_BoomerAMGSetDSLUThreshold(pcg_precond, dslu_threshold); #endif if (nongalerk_tol) @@ -5201,6 +5290,7 @@ HYPRE_BoomerAMGSetPrintFileName(pcg_precond, "driver.out.log"); HYPRE_BoomerAMGSetMaxIter(pcg_precond, 1); HYPRE_BoomerAMGSetCycleType(pcg_precond, cycle_type); + HYPRE_BoomerAMGSetFCycle(pcg_precond, fcycle); HYPRE_BoomerAMGSetNumSweeps(pcg_precond, num_sweeps); HYPRE_BoomerAMGSetISType(pcg_precond, IS_type); HYPRE_BoomerAMGSetNumCRRelaxSteps(pcg_precond, num_CR_relax_steps); @@ -5263,8 +5353,9 @@ HYPRE_BoomerAMGSetMultAddPMaxElmts(pcg_precond, add_P_max_elmts); HYPRE_BoomerAMGSetMultAddTruncFactor(pcg_precond, add_trunc_factor); HYPRE_BoomerAMGSetRAP2(pcg_precond, rap2); + HYPRE_BoomerAMGSetModuleRAP2(pcg_precond, mod_rap2); HYPRE_BoomerAMGSetKeepTranspose(pcg_precond, keepTranspose); -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU HYPRE_BoomerAMGSetDSLUThreshold(pcg_precond, dslu_threshold); #endif if (nongalerk_tol) @@ -5342,6 +5433,7 @@ /* note: log is written to standard output, not to file */ HYPRE_BoomerAMGSetPrintLevel(amg_solver, 1); HYPRE_BoomerAMGSetCycleType(amg_solver, cycle_type); + HYPRE_BoomerAMGSetFCycle(amg_solver, fcycle); HYPRE_BoomerAMGSetNumSweeps(amg_solver, num_sweeps); HYPRE_BoomerAMGSetRelaxType(amg_solver, 3); if (relax_down > -1) @@ -5361,10 +5453,10 @@ HYPRE_MGRSetCoarseSolver( pcg_precond, HYPRE_BoomerAMGSolve, HYPRE_BoomerAMGSetup, amg_solver); /* setup MGR-PCG solver */ - HYPRE_FlexGMRESSetMaxIter(pcg_solver, mg_max_iter); + HYPRE_FlexGMRESSetMaxIter(pcg_solver, mg_max_iter); HYPRE_FlexGMRESSetPrecond(pcg_solver, - (HYPRE_PtrToSolverFcn) HYPRE_MGRSolve, - (HYPRE_PtrToSolverFcn) HYPRE_MGRSetup, + (HYPRE_PtrToSolverFcn) HYPRE_MGRSolve, + (HYPRE_PtrToSolverFcn) HYPRE_MGRSetup, pcg_precond); } else if (solver_id == 60) @@ -5438,8 +5530,8 @@ { for( i=0; i -1) HYPRE_BoomerAMGSetRelaxType(pcg_precond, relax_type); if (relax_down > -1) @@ -6199,8 +6296,9 @@ HYPRE_BoomerAMGSetMultAddPMaxElmts(pcg_precond, add_P_max_elmts); HYPRE_BoomerAMGSetMultAddTruncFactor(pcg_precond, add_trunc_factor); HYPRE_BoomerAMGSetRAP2(pcg_precond, rap2); + HYPRE_BoomerAMGSetModuleRAP2(pcg_precond, mod_rap2); HYPRE_BoomerAMGSetKeepTranspose(pcg_precond, keepTranspose); -#ifdef HAVE_DSUPERLU +#ifdef HYPRE_USING_DSUPERLU HYPRE_BoomerAMGSetDSLUThreshold(pcg_precond, dslu_threshold); #endif if (nongalerk_tol) @@ -6354,6 +6452,7 @@ HYPRE_BoomerAMGSetTol(amg_solver, tol); HYPRE_BoomerAMGSetPMaxElmts(amg_solver, 0); HYPRE_BoomerAMGSetCycleType(amg_solver, cycle_type); + HYPRE_BoomerAMGSetFCycle(amg_solver, fcycle); HYPRE_BoomerAMGSetNumSweeps(amg_solver, num_sweeps); HYPRE_BoomerAMGSetRelaxType(amg_solver, 3); if (relax_down > -1) @@ -6447,7 +6546,7 @@ /* RDF: Why is this here? */ /*if (!(build_rhs_type ==1 || build_rhs_type ==7)) - HYPRE_IJVectorGetObjectType(ij_b, &j);*/ + HYPRE_IJVectorGetObjectType(ij_b, &j);*/ if (print_system) { @@ -6481,7 +6580,7 @@ /* hypre_FinalizeMemoryDebug(); */ - final: + final: /* Finalize Hypre */ HYPRE_Finalize(); @@ -6927,9 +7026,6 @@ mtrx[15] = 1; } - - - if (!system_vcoef) { A = (HYPRE_ParCSRMatrix) GenerateSysLaplacian(hypre_MPI_COMM_WORLD, @@ -6938,8 +7034,6 @@ } else { - - HYPRE_Real *mtrx_values; mtrx_values = hypre_CTAlloc(HYPRE_Real, num_fun*num_fun*4, HYPRE_MEMORY_HOST); @@ -6960,7 +7054,6 @@ mtrx[3] = 1.0; SetSysVcoefValues(num_fun, nx, ny, nz, 2.0, .02, 1.0, 3, mtrx_values); - } else if (vcoef_opt == 2) { @@ -6976,7 +7069,6 @@ mtrx[3] = 1.0; SetSysVcoefValues(num_fun, nx, ny, nz, 2.0, .02, 1.0, 3, mtrx_values); - } else if (vcoef_opt == 3) /* use with default sys_opt - ulrike ex 3*/ { @@ -7041,7 +7133,6 @@ /* mtrx[3] */ SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, 3.0, 1.0, 3, mtrx_values); } - } else if (num_fun == 3) { @@ -7071,17 +7162,12 @@ mtrx[8] = 1; SetSysVcoefValues(num_fun, nx, ny, nz, 1.5, .04, 1, 8, mtrx_values); - } A = (HYPRE_ParCSRMatrix) GenerateSysLaplacianVCoef(hypre_MPI_COMM_WORLD, nx, ny, nz, P, Q, R, p, q, r, num_fun, mtrx, mtrx_values); - - - - hypre_TFree(mtrx_values, HYPRE_MEMORY_HOST); } @@ -7419,10 +7505,10 @@ HYPRE_ParCSRMatrix A; HYPRE_CSRMatrix A_CSR = NULL; - HYPRE_Int myid, numprocs; - HYPRE_Int i, rest, size, num_nodes, num_dofs; - HYPRE_BigInt *row_part; - HYPRE_BigInt *col_part; + HYPRE_Int myid, numprocs; + HYPRE_Int i, rest, size, num_nodes, num_dofs; + HYPRE_BigInt *row_part; + HYPRE_BigInt *col_part; /*----------------------------------------------------------- * Initialize some stuff @@ -7468,19 +7554,19 @@ num_nodes = num_dofs/num_functions; if (num_dofs != num_functions*num_nodes) { - row_part = NULL; - col_part = NULL; + row_part = NULL; + col_part = NULL; } else { row_part = hypre_CTAlloc(HYPRE_BigInt, numprocs+1, HYPRE_MEMORY_HOST); - row_part[0] = 0; - size = num_nodes/numprocs; - rest = num_nodes-size*numprocs; - for (i=0; i < numprocs; i++) - { - row_part[i+1] = row_part[i]+size*num_functions; - if (i < rest) row_part[i+1] += num_functions; + row_part[0] = 0; + size = num_nodes/numprocs; + rest = num_nodes-size*numprocs; + for (i=0; i < numprocs; i++) + { + row_part[i+1] = row_part[i]+size*num_functions; + if (i < rest) row_part[i+1] += num_functions; } col_part = row_part; } @@ -7532,9 +7618,9 @@ HYPRE_Int i, j; HYPRE_Int local_size; HYPRE_Int global_size; - hypre_MPI_Request *requests; - hypre_MPI_Status *status, status0; - MPI_Comm comm; + hypre_MPI_Request *requests; + hypre_MPI_Status *status, status0; + MPI_Comm comm; /*----------------------------------------------------------- * Initialize some stuff @@ -8170,7 +8256,6 @@ /**************************************************************************/ - HYPRE_Int SetSysVcoefValues(HYPRE_Int num_fun, HYPRE_BigInt nx, HYPRE_BigInt ny, HYPRE_BigInt nz, HYPRE_Real vcx, HYPRE_Real vcy, HYPRE_Real vcz, HYPRE_Int mtx_entry, HYPRE_Real *values) { @@ -8294,8 +8379,8 @@ /* begin lobpcg */ /*---------------------------------------------------------------------- - * * Build standard 7-point laplacian in 3D. - * *----------------------------------------------------------------------*/ + * Build standard 7-point laplacian in 3D. + *----------------------------------------------------------------------*/ HYPRE_Int BuildParIsoLaplacian( HYPRE_Int argc, char** argv, HYPRE_ParCSRMatrix *A_ptr ) @@ -8315,15 +8400,15 @@ HYPRE_Int arg_index; /*----------------------------------------------------------- - * * Initialize some stuff - * *-----------------------------------------------------------*/ + * Initialize some stuff + *-----------------------------------------------------------*/ hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); /*----------------------------------------------------------- - * * Set defaults - * *-----------------------------------------------------------*/ + * Set defaults + *-----------------------------------------------------------*/ P = 1; Q = num_procs; @@ -8355,8 +8440,8 @@ } /*----------------------------------------------------------- - * * Print driver parameters - * *-----------------------------------------------------------*/ + * Print driver parameters + *-----------------------------------------------------------*/ if (myid == 0) { @@ -8367,8 +8452,8 @@ } /*----------------------------------------------------------- - * * Set up the grid structure - * *-----------------------------------------------------------*/ + * Set up the grid structure + *-----------------------------------------------------------*/ /* compute p,q,r from P,Q,R and myid */ p = myid % P; @@ -8376,8 +8461,8 @@ r = ( myid - p - P*q)/( P*Q ); /*----------------------------------------------------------- - * * Generate the matrix - * *-----------------------------------------------------------*/ + * Generate the matrix + *-----------------------------------------------------------*/ values = hypre_CTAlloc(HYPRE_Real, 4, HYPRE_MEMORY_HOST); @@ -8400,7 +8485,7 @@ } A = (HYPRE_ParCSRMatrix) GenerateLaplacian(hypre_MPI_COMM_WORLD, - nx, ny, nz, P, Q, R, p, q, r, values); + nx, ny, nz, P, Q, R, p, q, r, values); hypre_TFree(values, HYPRE_MEMORY_HOST); diff -Nru hypre-2.16.0/src/test/ij_device.c hypre-2.18.2/src/test/ij_device.c --- hypre-2.16.0/src/test/ij_device.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/test/ij_device.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,2149 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +/*-------------------------------------------------------------------------- + * Test driver for unstructured matrix interface (IJ_matrix interface). + * Do `driver -help' for usage info. + * This driver started from the driver for parcsr_linear_solvers, and it + * works by first building a parcsr matrix as before and then "copying" + * that matrix row-by-row into the IJMatrix interface. AJC 7/99. + *--------------------------------------------------------------------------*/ +#include +#include +#include + +#include "_hypre_utilities.h" +#include "HYPRE.h" +#include "HYPRE_parcsr_mv.h" + +#include "HYPRE_IJ_mv.h" +#include "HYPRE_parcsr_ls.h" +#include "_hypre_parcsr_ls.h" +#include "_hypre_parcsr_mv.h" +#include "HYPRE_krylov.h" + +#include "cuda_profiler_api.h" + +#ifdef __cplusplus +extern "C" { +#endif + + + +HYPRE_Int BuildParFromFile (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); +HYPRE_Int BuildParRhsFromFile (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParVector *b_ptr ); + +HYPRE_Int BuildParLaplacian (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); +HYPRE_Int BuildParSysLaplacian (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); +HYPRE_Int BuildParDifConv (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr); +HYPRE_Int BuildFuncsFromFiles (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix A , HYPRE_Int **dof_func_ptr ); +HYPRE_Int BuildFuncsFromOneFile (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix A , HYPRE_Int **dof_func_ptr ); +HYPRE_Int BuildParLaplacian9pt (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); +HYPRE_Int BuildParLaplacian27pt (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); +HYPRE_Int BuildParRotate7pt (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); +HYPRE_Int BuildParVarDifConv (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr , HYPRE_ParVector *rhs_ptr ); +HYPRE_ParCSRMatrix GenerateSysLaplacian (MPI_Comm comm, HYPRE_Int nx, HYPRE_Int ny, HYPRE_Int nz, + HYPRE_Int P, HYPRE_Int Q, HYPRE_Int R, HYPRE_Int p, HYPRE_Int q, HYPRE_Int r, + HYPRE_Int num_fun, HYPRE_Real *mtrx, HYPRE_Real *value); +HYPRE_ParCSRMatrix GenerateSysLaplacianVCoef (MPI_Comm comm, HYPRE_Int nx, HYPRE_Int ny, HYPRE_Int nz, + HYPRE_Int P, HYPRE_Int Q, HYPRE_Int R, HYPRE_Int p, HYPRE_Int q, HYPRE_Int r, + HYPRE_Int num_fun, HYPRE_Real *mtrx, HYPRE_Real *value); +HYPRE_Int SetSysVcoefValues(HYPRE_Int num_fun, HYPRE_Int nx, HYPRE_Int ny, HYPRE_Int nz, HYPRE_Real vcx, HYPRE_Real vcy, HYPRE_Real vcz, HYPRE_Int mtx_entry, HYPRE_Real *values); + +HYPRE_Int BuildParCoordinates (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_Int *coorddim_ptr , float **coord_ptr ); + +#ifdef __cplusplus +} +#endif + +hypre_int +main( hypre_int argc, + char *argv[] ) +{ + HYPRE_Int arg_index; + HYPRE_Int print_usage; + HYPRE_Int build_matrix_type; + HYPRE_Int build_matrix_arg_index; + HYPRE_Int ierr = 0; + void *object; + + HYPRE_IJMatrix ij_A = NULL; + HYPRE_ParCSRMatrix parcsr_A = NULL; + HYPRE_ParCSRMatrix parcsr_S = NULL; + HYPRE_ParCSRMatrix parcsr_S_device = NULL; + + HYPRE_Int *h_CF_marker, *h_CF_marker2, *d_CF_marker; + + HYPRE_Int errcode; + HYPRE_Int num_procs, myid; + HYPRE_Int time_index; + MPI_Comm comm = hypre_MPI_COMM_WORLD; + HYPRE_Int first_local_row, last_local_row, local_num_rows; + HYPRE_Int first_local_col, last_local_col, local_num_cols; + HYPRE_Int local_num_vars, *coarse_dof_func, *coarse_pnts_global, *col_offd_S_to_A; + + /* parameters for BoomerAMG */ + HYPRE_Real trunc_factor = 0.0; + HYPRE_Int P_max_elmts = 8; + HYPRE_Int cycle_type; + HYPRE_Int coarsen_type = 10; + HYPRE_Int measure_type = 0; + HYPRE_Int debug_flag = 0; + HYPRE_Int num_CR_relax_steps = 2; + HYPRE_Int rap2=0; + HYPRE_Int keepTranspose = 0; + HYPRE_Int num_functions = 1; + HYPRE_Real strong_threshold = 0.25; + HYPRE_Real max_row_sum = 1.0; + HYPRE_Real fnorm, rfnorm, fnorm0; + + /* interpolation */ + HYPRE_Int interp_type = 6; /* default value */ + HYPRE_Int post_interp_type = 0; /* default value */ + HYPRE_Int restri_type = 0; + + HYPRE_Int print_system = 0; + + HYPRE_Int mult_order = 0; + HYPRE_Int use_cusparse = 0; + HYPRE_Int rowest_mtd = 3; + HYPRE_Int rowest_nsamples = 32; + HYPRE_Real rowest_mult = 1.0; + char hash_type = 'L'; + HYPRE_Int nC1 = 0, nC2 = 0, i; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + /* Initialize MPI */ + hypre_MPI_Init(&argc, &argv); + + hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /* Initialize Hypre */ + HYPRE_Init(argc, argv); + + hypre_SetNumThreads(5); + hypre_printf("CPU #OMP THREADS %d\n", hypre_NumThreads()); + + /*----------------------------------------------------------- + * Set defaults + *-----------------------------------------------------------*/ + build_matrix_type = 2; + build_matrix_arg_index = argc; + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + + print_usage = 0; + arg_index = 1; + + while ( (arg_index < argc) && (!print_usage) ) + { + if ( strcmp(argv[arg_index], "-fromfile") == 0 ) + { + arg_index++; + build_matrix_type = -1; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-fromparcsrfile") == 0 ) + { + arg_index++; + build_matrix_type = 0; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-fromonecsrfile") == 0 ) + { + arg_index++; + build_matrix_type = 1; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-laplacian") == 0 ) + { + arg_index++; + build_matrix_type = 2; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-9pt") == 0 ) + { + arg_index++; + build_matrix_type = 3; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-27pt") == 0 ) + { + arg_index++; + build_matrix_type = 4; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-difconv") == 0 ) + { + arg_index++; + build_matrix_type = 5; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-vardifconv") == 0 ) + { + arg_index++; + build_matrix_type = 6; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-rotate") == 0 ) + { + arg_index++; + build_matrix_type = 7; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-concrete_parcsr") == 0 ) + { + arg_index++; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-cljp") == 0 ) + { + arg_index++; + coarsen_type = 0; + } + else if ( strcmp(argv[arg_index], "-cljp1") == 0 ) + { + arg_index++; + coarsen_type = 7; + } + else if ( strcmp(argv[arg_index], "-pmis") == 0 ) + { + arg_index++; + coarsen_type = 8; + } + else if ( strcmp(argv[arg_index], "-pmis1") == 0 ) + { + arg_index++; + coarsen_type = 9; + } + else if ( strcmp(argv[arg_index], "-cr1") == 0 ) + { + arg_index++; + coarsen_type = 98; + } + else if ( strcmp(argv[arg_index], "-cr") == 0 ) + { + arg_index++; + coarsen_type = 99; + } + else if ( strcmp(argv[arg_index], "-hmis") == 0 ) + { + arg_index++; + coarsen_type = 10; + } + else if ( strcmp(argv[arg_index], "-ruge") == 0 ) + { + arg_index++; + coarsen_type = 1; + } + else if ( strcmp(argv[arg_index], "-ruge1p") == 0 ) + { + arg_index++; + coarsen_type = 11; + } + else if ( strcmp(argv[arg_index], "-ruge2b") == 0 ) + { + arg_index++; + coarsen_type = 2; + } + else if ( strcmp(argv[arg_index], "-ruge3") == 0 ) + { + arg_index++; + coarsen_type = 3; + } + else if ( strcmp(argv[arg_index], "-ruge3c") == 0 ) + { + arg_index++; + coarsen_type = 4; + } + else if ( strcmp(argv[arg_index], "-rugerlx") == 0 ) + { + arg_index++; + coarsen_type = 5; + } + else if ( strcmp(argv[arg_index], "-falgout") == 0 ) + { + arg_index++; + coarsen_type = 6; + } + else if ( strcmp(argv[arg_index], "-gm") == 0 ) + { + arg_index++; + measure_type = 1; + } + else if ( strcmp(argv[arg_index], "-restritype") == 0 ) + { + arg_index++; + restri_type = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-help") == 0 ) + { + print_usage = 1; + } + else if ( strcmp(argv[arg_index], "-tr") == 0 ) + { + arg_index++; + trunc_factor = atof(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-th") == 0 ) + { + arg_index++; + strong_threshold = atof(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-Pmx") == 0 ) + { + arg_index++; + P_max_elmts = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-interptype") == 0 ) + { + arg_index++; + interp_type = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-print") == 0 ) + { + arg_index++; + print_system = 1; + } + else if ( strcmp(argv[arg_index], "-order") == 0 ) + { + arg_index++; + mult_order = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-cusparse") == 0 ) + { + arg_index++; + use_cusparse = 1; + } + else if ( strcmp(argv[arg_index], "-rowest") == 0 ) + { + arg_index++; + rowest_mtd = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-rowestmult") == 0 ) + { + arg_index++; + rowest_mult = atof(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-rowestnsamples") == 0 ) + { + arg_index++; + rowest_nsamples = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-hash") == 0 ) + { + arg_index++; + hash_type = argv[arg_index++][0];; + } + else + { + arg_index++; + } + } + + + /*----------------------------------------------------------- + * Print usage info + *-----------------------------------------------------------*/ + + if ( print_usage ) + { + if ( myid == 0 ) + { + hypre_printf("\n"); + hypre_printf("Usage: %s []\n", argv[0]); + hypre_printf("\n"); + hypre_printf(" -fromfile : "); + hypre_printf("matrix read from multiple files (IJ format)\n"); + hypre_printf(" -fromparcsrfile : "); + hypre_printf("matrix read from multiple files (ParCSR format)\n"); + hypre_printf(" -fromonecsrfile : "); + hypre_printf("matrix read from a single file (CSR format)\n"); + hypre_printf("\n"); + hypre_printf(" -laplacian [] : build 5pt 2D laplacian problem (default) \n"); + hypre_printf(" -sysL : build SYSTEMS laplacian 7pt operator\n"); + hypre_printf(" -9pt [] : build 9pt 2D laplacian problem\n"); + hypre_printf(" -27pt [] : build 27pt 3D laplacian problem\n"); + hypre_printf(" -difconv [] : build convection-diffusion problem\n"); + hypre_printf(" -n : total problem size \n"); + hypre_printf(" -P : processor topology\n"); + hypre_printf(" -c : diffusion coefficients\n"); + hypre_printf(" -a : convection coefficients\n"); + hypre_printf(" -atype : FD scheme for convection \n"); + hypre_printf(" 0=Forward (default) 1=Backward\n"); + hypre_printf(" 2=Centered 3=Upwind\n"); + hypre_printf("\n"); + hypre_printf(" -exact_size : inserts immediately into ParCSR structure\n"); + hypre_printf(" -storage_low : allocates not enough storage for aux struct\n"); + hypre_printf(" -concrete_parcsr : use parcsr matrix type as concrete type\n"); + hypre_printf("\n"); + hypre_printf(" -cljp : CLJP coarsening \n"); + hypre_printf(" -cljp1 : CLJP coarsening, fixed random \n"); + hypre_printf(" -cgc : CGC coarsening \n"); + hypre_printf(" -cgce : CGC-E coarsening \n"); + hypre_printf(" -pmis : PMIS coarsening \n"); + hypre_printf(" -pmis1 : PMIS coarsening, fixed random \n"); + hypre_printf(" -hmis : HMIS coarsening (default)\n"); + hypre_printf(" -ruge : Ruge-Stueben coarsening (local)\n"); + hypre_printf(" -ruge1p : Ruge-Stueben coarsening 1st pass only(local)\n"); + hypre_printf(" -ruge3 : third pass on boundary\n"); + hypre_printf(" -ruge3c : third pass on boundary, keep c-points\n"); + hypre_printf(" -falgout : local Ruge_Stueben followed by CLJP\n"); + hypre_printf(" -gm : use global measures\n"); + hypre_printf("\n"); + hypre_printf(" -interptype : set interpolation type\n"); + hypre_printf(" 0=Classical modified interpolation \n"); + hypre_printf(" 1=least squares interpolation (for GSMG only) \n"); + hypre_printf(" 0=Classical modified interpolation for hyperbolic PDEs \n"); + hypre_printf(" 3=direct interpolation with separation of weights \n"); + hypre_printf(" 4=multipass interpolation \n"); + hypre_printf(" 5=multipass interpolation with separation of weights \n"); + hypre_printf(" 6=extended classical modified interpolation (default) \n"); + hypre_printf(" 7=extended (only if no common C neighbor) interpolation \n"); + hypre_printf(" 8=standard interpolation \n"); + hypre_printf(" 9=standard interpolation with separation of weights \n"); + hypre_printf(" 12=FF interpolation \n"); + hypre_printf(" 13=FF1 interpolation \n"); + + hypre_printf(" 16=use modified unknown interpolation for a system (w/unknown or hybrid approach) \n"); + hypre_printf(" 17=use non-systems interp = 6 for a system (w/unknown or hybrid approach) \n"); + hypre_printf(" 18=use non-systems interp = 8 for a system (w/unknown or hybrid approach) \n"); + hypre_printf(" 19=use non-systems interp = 0 for a system (w/unknown or hybrid approach) \n"); + + hypre_printf(" 10=classical block interpolation for nodal systems AMG\n"); + hypre_printf(" 11=classical block interpolation with diagonal blocks for nodal systems AMG\n"); + hypre_printf(" 20=same as 10, but don't add weak connect. to diag \n"); + hypre_printf(" 21=same as 11, but don't add weak connect. to diag \n"); + hypre_printf(" 22=classical block interpolation w/Ruge's variant for nodal systems AMG \n"); + hypre_printf(" 23=same as 22, but use row sums for diag scaling matrices,for nodal systems AMG \n"); + hypre_printf(" 24=direct block interpolation for nodal systems AMG\n"); + hypre_printf(" 100=One point interpolation [a Boolean matrix]\n"); + hypre_printf("\n"); + + hypre_printf(" -restritype : set restriction type\n"); + hypre_printf(" 0=transpose of the interpolation \n"); + hypre_printf(" 1=local approximate ideal restriction (AIR) \n"); + hypre_printf("\n"); + + hypre_printf(" -Pmx : set maximal no. of elmts per row for AMG interpolation (default: 4)\n"); + } + goto final; + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + } + + errcode = HYPRE_CSRMatrixDeviceSpGemmSetRownnzEstimateMethod(rowest_mtd); + hypre_assert(errcode == 0); + errcode = HYPRE_CSRMatrixDeviceSpGemmSetRownnzEstimateNSamples(rowest_nsamples); + hypre_assert(errcode == 0); + errcode = HYPRE_CSRMatrixDeviceSpGemmSetRownnzEstimateMultFactor(rowest_mult); + hypre_assert(errcode == 0); + errcode = HYPRE_CSRMatrixDeviceSpGemmSetHashType(hash_type); + hypre_assert(errcode == 0); + errcode = HYPRE_CSRMatrixDeviceSpGemmSetUseCusparse(use_cusparse); + hypre_assert(errcode == 0); + + /*----------------------------------------------------------- + * Set up matrix + *-----------------------------------------------------------*/ + time_index = hypre_InitializeTiming("Generate Matrix"); + hypre_BeginTiming(time_index); + if ( build_matrix_type == -1 ) + { + ierr = HYPRE_IJMatrixRead( argv[build_matrix_arg_index], comm, + HYPRE_PARCSR, &ij_A ); + if (ierr) + { + hypre_printf("ERROR: Problem reading in the system matrix!\n"); + exit(1); + } + } + else if ( build_matrix_type == 0 ) + { + BuildParFromFile(argc, argv, build_matrix_arg_index, &parcsr_A); + } + else if ( build_matrix_type == 2 ) + { + BuildParLaplacian(argc, argv, build_matrix_arg_index, &parcsr_A); + } + else if ( build_matrix_type == 3 ) + { + BuildParLaplacian9pt(argc, argv, build_matrix_arg_index, &parcsr_A); + } + else if ( build_matrix_type == 4 ) + { + BuildParLaplacian27pt(argc, argv, build_matrix_arg_index, &parcsr_A); + } + else if ( build_matrix_type == 5 ) + { + BuildParDifConv(argc, argv, build_matrix_arg_index, &parcsr_A); + } + else if ( build_matrix_type == 7 ) + { + BuildParRotate7pt(argc, argv, build_matrix_arg_index, &parcsr_A); + } + else + { + hypre_printf("You have asked for an unsupported problem with\n"); + hypre_printf("build_matrix_type = %d.\n", build_matrix_type); + return(-1); + } + + if (build_matrix_type < 0) + { + ierr = HYPRE_IJMatrixGetLocalRange( ij_A, + &first_local_row, &last_local_row , + &first_local_col, &last_local_col ); + + ierr += HYPRE_IJMatrixGetObject( ij_A, &object); + parcsr_A = (HYPRE_ParCSRMatrix) object; + } + else + { + /*----------------------------------------------------------- + * Copy the parcsr matrix into the IJMatrix through interface calls + *-----------------------------------------------------------*/ + ierr = HYPRE_ParCSRMatrixGetLocalRange( parcsr_A, + &first_local_row, &last_local_row , + &first_local_col, &last_local_col ); + + local_num_rows = last_local_row - first_local_row + 1; + local_num_cols = last_local_col - first_local_col + 1; + } + + hypre_BoomerAMGCreateS(parcsr_A, strong_threshold, max_row_sum, + num_functions, NULL, &parcsr_S); + + parcsr_S_device = hypre_ParCSRMatrixClone_v2(parcsr_S, 0, HYPRE_MEMORY_DEVICE); + + hypre_EndTiming(time_index); + hypre_PrintTiming("Generate Matrix", hypre_MPI_COMM_WORLD); + hypre_FinalizeTiming(time_index); + hypre_ClearTiming(); + + /* PMIS on HOST */ + time_index = hypre_InitializeTiming("Host PMIS"); + hypre_BeginTiming(time_index); + + hypre_BoomerAMGCoarsenPMIS(parcsr_S, parcsr_A, 0, debug_flag, &h_CF_marker); + + hypre_EndTiming(time_index); + hypre_PrintTiming("Host PMIS", hypre_MPI_COMM_WORLD); + hypre_FinalizeTiming(time_index); + hypre_ClearTiming(); + + /* PMIS on DEVICE */ + hypre_BoomerAMGCoarsenPMISDevice(parcsr_S_device, parcsr_A, 0, debug_flag, &d_CF_marker); + hypre_TFree(d_CF_marker, HYPRE_MEMORY_DEVICE); + + time_index = hypre_InitializeTiming("Device PMIS"); + hypre_BeginTiming(time_index); + + hypre_BoomerAMGCoarsenPMISDevice(parcsr_S_device, parcsr_A, 0, debug_flag, &d_CF_marker); + + hypre_EndTiming(time_index); + hypre_PrintTiming("Device PMIS", hypre_MPI_COMM_WORLD); + hypre_FinalizeTiming(time_index); + hypre_ClearTiming(); + + local_num_rows = last_local_row - first_local_row + 1; + + h_CF_marker2 = hypre_TAlloc(HYPRE_Int, local_num_rows, HYPRE_MEMORY_HOST); + hypre_TMemcpy(h_CF_marker2, d_CF_marker, HYPRE_Int, local_num_rows, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); + + for (i = 0; i < local_num_rows; i++) + { + if (h_CF_marker[i] > 0) + { + nC1++; + } + + hypre_assert(h_CF_marker2[i] == 1 || h_CF_marker2[i] == -1 || h_CF_marker2[i] == -3); + + hypre_assert(h_CF_marker[i] == h_CF_marker2[i]); + + if (h_CF_marker2[i] > 0) + { + nC2++; + } + } + + + HYPRE_Int allnC1, allnC2; + hypre_MPI_Allreduce(&nC1, &allnC1, 1, HYPRE_MPI_INT, hypre_MPI_SUM, comm); + hypre_MPI_Allreduce(&nC2, &allnC2, 1, HYPRE_MPI_INT, hypre_MPI_SUM, comm); + if (myid == 0) + { + printf("nC1 %d nC2 %d\n", allnC1, allnC2); + } + + /*----------------------------------------------------------- + * Finalize things + *-----------------------------------------------------------*/ + + if (build_matrix_type == -1) + { + HYPRE_IJMatrixDestroy(ij_A); + } + else + { + HYPRE_ParCSRMatrixDestroy(parcsr_A); + } + + hypre_TFree(h_CF_marker, HYPRE_MEMORY_HOST); + hypre_TFree(h_CF_marker2, HYPRE_MEMORY_HOST); + hypre_TFree(d_CF_marker, HYPRE_MEMORY_DEVICE); + hypre_TFree(coarse_dof_func, HYPRE_MEMORY_HOST); + + hypre_ParCSRMatrixDestroy(parcsr_S); + + hypre_ParCSRMatrixDestroy(parcsr_S_device); + + final: + + /* Finalize Hypre */ + HYPRE_Finalize(); + + /* Finalize MPI */ + hypre_MPI_Finalize(); + + return (0); +} + +/*---------------------------------------------------------------------- + * Build matrix from file. Expects three files on each processor. + * filename.D.n contains the diagonal part, filename.O.n contains + * the offdiagonal part and filename.INFO.n contains global row + * and column numbers, number of columns of offdiagonal matrix + * and the mapping of offdiagonal column numbers to global column numbers. + * Parameters given in command line. + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParFromFile( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_ParCSRMatrix *A_ptr ) +{ + char *filename; + + HYPRE_ParCSRMatrix A; + + HYPRE_Int myid; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + + if (arg_index < argc) + { + filename = argv[arg_index]; + } + else + { + hypre_printf("Error: No filename specified \n"); + exit(1); + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + hypre_printf(" FromFile: %s\n", filename); + } + + /*----------------------------------------------------------- + * Generate the matrix + *-----------------------------------------------------------*/ + + HYPRE_ParCSRMatrixRead(hypre_MPI_COMM_WORLD, filename,&A); + + *A_ptr = A; + + return (0); +} + + +/*---------------------------------------------------------------------- + * Build rhs from file. Expects two files on each processor. + * filename.n contains the data and + * and filename.INFO.n contains global row + * numbers + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParRhsFromFile( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_ParVector *b_ptr ) +{ + char *filename; + + HYPRE_ParVector b; + + HYPRE_Int myid; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + + if (arg_index < argc) + { + filename = argv[arg_index]; + } + else + { + hypre_printf("Error: No filename specified \n"); + exit(1); + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + hypre_printf(" RhsFromParFile: %s\n", filename); + } + + /*----------------------------------------------------------- + * Generate the matrix + *-----------------------------------------------------------*/ + + HYPRE_ParVectorRead(hypre_MPI_COMM_WORLD, filename,&b); + + *b_ptr = b; + + return (0); +} + + + + +/*---------------------------------------------------------------------- + * Build standard 7-point laplacian in 3D with grid and anisotropy. + * Parameters given in command line. + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParLaplacian( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_ParCSRMatrix *A_ptr ) +{ + HYPRE_Int nx, ny, nz; + HYPRE_Int P, Q, R; + HYPRE_Real cx, cy, cz; + + HYPRE_ParCSRMatrix A; + + HYPRE_Int num_procs, myid; + HYPRE_Int p, q, r; + HYPRE_Int num_fun = 1; + HYPRE_Real *values; + HYPRE_Real *mtrx; + + HYPRE_Real ep = .1; + + HYPRE_Int system_vcoef = 0; + HYPRE_Int sys_opt = 0; + HYPRE_Int vcoef_opt = 0; + + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Set defaults + *-----------------------------------------------------------*/ + + nx = 10; + ny = 10; + nz = 10; + + P = 1; + Q = num_procs; + R = 1; + + cx = 1.; + cy = 1.; + cz = 1.; + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + arg_index = 0; + while (arg_index < argc) + { + if ( strcmp(argv[arg_index], "-n") == 0 ) + { + arg_index++; + nx = atoi(argv[arg_index++]); + ny = atoi(argv[arg_index++]); + nz = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-P") == 0 ) + { + arg_index++; + P = atoi(argv[arg_index++]); + Q = atoi(argv[arg_index++]); + R = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-c") == 0 ) + { + arg_index++; + cx = atof(argv[arg_index++]); + cy = atof(argv[arg_index++]); + cz = atof(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-sysL") == 0 ) + { + arg_index++; + num_fun = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-sysL_opt") == 0 ) + { + arg_index++; + sys_opt = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-sys_vcoef") == 0 ) + { + /* have to use -sysL for this to */ + arg_index++; + system_vcoef = 1; + } + else if ( strcmp(argv[arg_index], "-sys_vcoef_opt") == 0 ) + { + arg_index++; + vcoef_opt = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-ep") == 0 ) + { + arg_index++; + ep = atof(argv[arg_index++]); + } + else + { + arg_index++; + } + } + + /*----------------------------------------------------------- + * Check a few things + *-----------------------------------------------------------*/ + + if ((P*Q*R) != num_procs) + { + hypre_printf("Error: Invalid number of processors or processor topology \n"); + exit(1); + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + hypre_printf(" Laplacian: num_fun = %d\n", num_fun); + hypre_printf(" (nx, ny, nz) = (%d, %d, %d)\n", nx, ny, nz); + hypre_printf(" (Px, Py, Pz) = (%d, %d, %d)\n", P, Q, R); + hypre_printf(" (cx, cy, cz) = (%f, %f, %f)\n\n", cx, cy, cz); + } + + /*----------------------------------------------------------- + * Set up the grid structure + *-----------------------------------------------------------*/ + + /* compute p,q,r from P,Q,R and myid */ + p = myid % P; + q = (( myid - p)/P) % Q; + r = ( myid - p - P*q)/( P*Q ); + + /*----------------------------------------------------------- + * Generate the matrix + *-----------------------------------------------------------*/ + + values = hypre_CTAlloc(HYPRE_Real, 4, HYPRE_MEMORY_HOST); + + values[1] = -cx; + values[2] = -cy; + values[3] = -cz; + + values[0] = 0.; + if (nx > 1) + { + values[0] += 2.0*cx; + } + if (ny > 1) + { + values[0] += 2.0*cy; + } + if (nz > 1) + { + values[0] += 2.0*cz; + } + + if (num_fun == 1) + A = (HYPRE_ParCSRMatrix) GenerateLaplacian(hypre_MPI_COMM_WORLD, + nx, ny, nz, P, Q, R, p, q, r, values); + else + { + mtrx = hypre_CTAlloc(HYPRE_Real, num_fun*num_fun, HYPRE_MEMORY_HOST); + + if (num_fun == 2) + { + if (sys_opt ==1) /* identity */ + { + mtrx[0] = 1.0; + mtrx[1] = 0.0; + mtrx[2] = 0.0; + mtrx[3] = 1.0; + } + else if (sys_opt ==2) + { + mtrx[0] = 1.0; + mtrx[1] = 0.0; + mtrx[2] = 0.0; + mtrx[3] = 20.0; + } + else if (sys_opt ==3) /* similar to barry's talk - ex1 */ + { + mtrx[0] = 1.0; + mtrx[1] = 2.0; + mtrx[2] = 2.0; + mtrx[3] = 1.0; + } + else if (sys_opt ==4) /* can use with vcoef to get barry's ex*/ + { + mtrx[0] = 1.0; + mtrx[1] = 1.0; + mtrx[2] = 1.0; + mtrx[3] = 1.0; + } + else if (sys_opt ==5) /* barry's talk - ex1 */ + { + mtrx[0] = 1.0; + mtrx[1] = 1.1; + mtrx[2] = 1.1; + mtrx[3] = 1.0; + } + else if (sys_opt ==6) /* */ + { + mtrx[0] = 1.1; + mtrx[1] = 1.0; + mtrx[2] = 1.0; + mtrx[3] = 1.1; + } + + else /* == 0 */ + { + mtrx[0] = 2; + mtrx[1] = 1; + mtrx[2] = 1; + mtrx[3] = 2; + } + } + else if (num_fun == 3) + { + if (sys_opt ==1) + { + mtrx[0] = 1.0; + mtrx[1] = 0.0; + mtrx[2] = 0.0; + mtrx[3] = 0.0; + mtrx[4] = 1.0; + mtrx[5] = 0.0; + mtrx[6] = 0.0; + mtrx[7] = 0.0; + mtrx[8] = 1.0; + } + else if (sys_opt ==2) + { + mtrx[0] = 1.0; + mtrx[1] = 0.0; + mtrx[2] = 0.0; + mtrx[3] = 0.0; + mtrx[4] = 20.0; + mtrx[5] = 0.0; + mtrx[6] = 0.0; + mtrx[7] = 0.0; + mtrx[8] =.01; + } + else if (sys_opt ==3) + { + mtrx[0] = 1.01; + mtrx[1] = 1; + mtrx[2] = 0.0; + mtrx[3] = 1; + mtrx[4] = 2; + mtrx[5] = 1; + mtrx[6] = 0.0; + mtrx[7] = 1; + mtrx[8] = 1.01; + } + else if (sys_opt ==4) /* barry ex4 */ + { + mtrx[0] = 3; + mtrx[1] = 1; + mtrx[2] = 0.0; + mtrx[3] = 1; + mtrx[4] = 4; + mtrx[5] = 2; + mtrx[6] = 0.0; + mtrx[7] = 2; + mtrx[8] = .25; + } + else /* == 0 */ + { + mtrx[0] = 2.0; + mtrx[1] = 1.0; + mtrx[2] = 0.0; + mtrx[3] = 1.0; + mtrx[4] = 2.0; + mtrx[5] = 1.0; + mtrx[6] = 0.0; + mtrx[7] = 1.0; + mtrx[8] = 2.0; + } + + } + else if (num_fun == 4) + { + mtrx[0] = 1.01; + mtrx[1] = 1; + mtrx[2] = 0.0; + mtrx[3] = 0.0; + mtrx[4] = 1; + mtrx[5] = 2; + mtrx[6] = 1; + mtrx[7] = 0.0; + mtrx[8] = 0.0; + mtrx[9] = 1; + mtrx[10] = 1.01; + mtrx[11] = 0.0; + mtrx[12] = 2; + mtrx[13] = 1; + mtrx[14] = 0.0; + mtrx[15] = 1; + } + + + + + if (!system_vcoef) + { + A = (HYPRE_ParCSRMatrix) GenerateSysLaplacian(hypre_MPI_COMM_WORLD, + nx, ny, nz, P, Q, + R, p, q, r, num_fun, mtrx, values); + } + else + { + + + HYPRE_Real *mtrx_values; + + mtrx_values = hypre_CTAlloc(HYPRE_Real, num_fun*num_fun*4, HYPRE_MEMORY_HOST); + + if (num_fun == 2) + { + if (vcoef_opt == 1) + { + /* Barry's talk * - must also have sys_opt = 4, all fail */ + mtrx[0] = 1.0; + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, .10, 1.0, 0, mtrx_values); + + mtrx[1] = 1.0; + SetSysVcoefValues(num_fun, nx, ny, nz, .1, 1.0, 1.0, 1, mtrx_values); + + mtrx[2] = 1.0; + SetSysVcoefValues(num_fun, nx, ny, nz, .01, 1.0, 1.0, 2, mtrx_values); + + mtrx[3] = 1.0; + SetSysVcoefValues(num_fun, nx, ny, nz, 2.0, .02, 1.0, 3, mtrx_values); + + } + else if (vcoef_opt == 2) + { + /* Barry's talk * - ex2 - if have sys-opt = 4*/ + mtrx[0] = 1.0; + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, .010, 1.0, 0, mtrx_values); + + mtrx[1] = 200.0; + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, 1.0, 1.0, 1, mtrx_values); + + mtrx[2] = 200.0; + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, 1.0, 1.0, 2, mtrx_values); + + mtrx[3] = 1.0; + SetSysVcoefValues(num_fun, nx, ny, nz, 2.0, .02, 1.0, 3, mtrx_values); + + } + else if (vcoef_opt == 3) /* use with default sys_opt - ulrike ex 3*/ + { + + /* mtrx[0] */ + SetSysVcoefValues(num_fun, nx, ny, nz, ep*1.0, 1.0, 1.0, 0, mtrx_values); + + /* mtrx[1] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, 1.0, 1.0, 1, mtrx_values); + + /* mtrx[2] */ + SetSysVcoefValues(num_fun, nx, ny, nz, ep*1.0, 1.0, 1.0, 2, mtrx_values); + + /* mtrx[3] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, 1.0, 1.0, 3, mtrx_values); + } + else if (vcoef_opt == 4) /* use with default sys_opt - ulrike ex 4*/ + { + HYPRE_Real ep2 = ep; + + /* mtrx[0] */ + SetSysVcoefValues(num_fun, nx, ny, nz, ep*1.0, 1.0, 1.0, 0, mtrx_values); + + /* mtrx[1] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, ep*1.0, 1.0, 1, mtrx_values); + + /* mtrx[2] */ + SetSysVcoefValues(num_fun, nx, ny, nz, ep*1.0, 1.0, 1.0, 2, mtrx_values); + + /* mtrx[3] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, ep2*1.0, 1.0, 3, mtrx_values); + } + else if (vcoef_opt == 5) /* use with default sys_opt - */ + { + HYPRE_Real alp, beta; + alp = .001; + beta = 10; + + /* mtrx[0] */ + SetSysVcoefValues(num_fun, nx, ny, nz, alp*1.0, 1.0, 1.0, 0, mtrx_values); + + /* mtrx[1] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, beta*1.0, 1.0, 1, mtrx_values); + + /* mtrx[2] */ + SetSysVcoefValues(num_fun, nx, ny, nz, alp*1.0, 1.0, 1.0, 2, mtrx_values); + + /* mtrx[3] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, beta*1.0, 1.0, 3, mtrx_values); + } + else /* = 0 */ + { + /* mtrx[0] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, 1.0, 1.0, 0, mtrx_values); + + /* mtrx[1] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, 2.0, 1.0, 1, mtrx_values); + + /* mtrx[2] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 2.0, 1.0, 0.0, 2, mtrx_values); + + /* mtrx[3] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, 3.0, 1.0, 3, mtrx_values); + } + + } + else if (num_fun == 3) + { + mtrx[0] = 1; + SetSysVcoefValues(num_fun, nx, ny, nz, 1, .01, 1, 0, mtrx_values); + + mtrx[1] = 1; + SetSysVcoefValues(num_fun, nx, ny, nz, 1, 1, 1, 1, mtrx_values); + + mtrx[2] = 0.0; + SetSysVcoefValues(num_fun, nx, ny, nz, 1, 1, 1, 2, mtrx_values); + + mtrx[3] = 1; + SetSysVcoefValues(num_fun, nx, ny, nz, 1, 1, 1, 3, mtrx_values); + + mtrx[4] = 1; + SetSysVcoefValues(num_fun, nx, ny, nz, 2, .02, 1, 4, mtrx_values); + + mtrx[5] = 2; + SetSysVcoefValues(num_fun, nx, ny, nz, 1, 1, 1, 5, mtrx_values); + + mtrx[6] = 0.0; + SetSysVcoefValues(num_fun, nx, ny, nz, 1, 1, 1, 6, mtrx_values); + + mtrx[7] = 2; + SetSysVcoefValues(num_fun, nx, ny, nz, 1, 1, 1, 7, mtrx_values); + + mtrx[8] = 1; + SetSysVcoefValues(num_fun, nx, ny, nz, 1.5, .04, 1, 8, mtrx_values); + + } + + A = (HYPRE_ParCSRMatrix) GenerateSysLaplacianVCoef(hypre_MPI_COMM_WORLD, + nx, ny, nz, P, Q, + R, p, q, r, num_fun, mtrx, mtrx_values); + + + + + + hypre_TFree(mtrx_values, HYPRE_MEMORY_HOST); + } + + hypre_TFree(mtrx, HYPRE_MEMORY_HOST); + } + + hypre_TFree(values, HYPRE_MEMORY_HOST); + + *A_ptr = A; + + return (0); +} + +/*---------------------------------------------------------------------- + * returns the sign of a real number + * 1 : positive + * 0 : zero + * -1 : negative + *----------------------------------------------------------------------*/ +static inline HYPRE_Int sign_double(HYPRE_Real a) +{ + return ( (0.0 < a) - (0.0 > a) ); +} + +/*---------------------------------------------------------------------- + * Build standard 7-point convection-diffusion operator + * Parameters given in command line. + * Operator: + * + * -cx Dxx - cy Dyy - cz Dzz + ax Dx + ay Dy + az Dz = f + * + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParDifConv( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_ParCSRMatrix *A_ptr) +{ + HYPRE_Int nx, ny, nz; + HYPRE_Int P, Q, R; + HYPRE_Real cx, cy, cz; + HYPRE_Real ax, ay, az, atype; + HYPRE_Real hinx,hiny,hinz; + HYPRE_Int sign_prod; + + HYPRE_ParCSRMatrix A; + + HYPRE_Int num_procs, myid; + HYPRE_Int p, q, r; + HYPRE_Real *values; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Set defaults + *-----------------------------------------------------------*/ + + nx = 10; + ny = 10; + nz = 10; + + P = 1; + Q = num_procs; + R = 1; + + cx = 1.; + cy = 1.; + cz = 1.; + + ax = 1.; + ay = 1.; + az = 1.; + + atype = 0; + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + arg_index = 0; + while (arg_index < argc) + { + if ( strcmp(argv[arg_index], "-n") == 0 ) + { + arg_index++; + nx = atoi(argv[arg_index++]); + ny = atoi(argv[arg_index++]); + nz = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-P") == 0 ) + { + arg_index++; + P = atoi(argv[arg_index++]); + Q = atoi(argv[arg_index++]); + R = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-c") == 0 ) + { + arg_index++; + cx = atof(argv[arg_index++]); + cy = atof(argv[arg_index++]); + cz = atof(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-a") == 0 ) + { + arg_index++; + ax = atof(argv[arg_index++]); + ay = atof(argv[arg_index++]); + az = atof(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-atype") == 0 ) + { + arg_index++; + atype = atoi(argv[arg_index++]); + } + else + { + arg_index++; + } + } + + /*----------------------------------------------------------- + * Check a few things + *-----------------------------------------------------------*/ + + if ((P*Q*R) != num_procs) + { + hypre_printf("Error: Invalid number of processors or processor topology \n"); + exit(1); + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + hypre_printf(" Convection-Diffusion: \n"); + hypre_printf(" -cx Dxx - cy Dyy - cz Dzz + ax Dx + ay Dy + az Dz = f\n"); + hypre_printf(" (nx, ny, nz) = (%d, %d, %d)\n", nx, ny, nz); + hypre_printf(" (Px, Py, Pz) = (%d, %d, %d)\n", P, Q, R); + hypre_printf(" (cx, cy, cz) = (%f, %f, %f)\n", cx, cy, cz); + hypre_printf(" (ax, ay, az) = (%f, %f, %f)\n\n", ax, ay, az); + } + + /*----------------------------------------------------------- + * Set up the grid structure + *-----------------------------------------------------------*/ + + /* compute p,q,r from P,Q,R and myid */ + p = myid % P; + q = (( myid - p)/P) % Q; + r = ( myid - p - P*q)/( P*Q ); + + hinx = 1./(nx+1); + hiny = 1./(ny+1); + hinz = 1./(nz+1); + + /*----------------------------------------------------------- + * Generate the matrix + *-----------------------------------------------------------*/ + /* values[7]: + * [0]: center + * [1]: X- + * [2]: Y- + * [3]: Z- + * [4]: X+ + * [5]: Y+ + * [6]: Z+ + */ + values = hypre_CTAlloc(HYPRE_Real, 7, HYPRE_MEMORY_HOST); + + values[0] = 0.; + + if (0 == atype) /* forward scheme for conv */ + { + values[1] = -cx/(hinx*hinx); + values[2] = -cy/(hiny*hiny); + values[3] = -cz/(hinz*hinz); + values[4] = -cx/(hinx*hinx) + ax/hinx; + values[5] = -cy/(hiny*hiny) + ay/hiny; + values[6] = -cz/(hinz*hinz) + az/hinz; + + if (nx > 1) + { + values[0] += 2.0*cx/(hinx*hinx) - 1.*ax/hinx; + } + if (ny > 1) + { + values[0] += 2.0*cy/(hiny*hiny) - 1.*ay/hiny; + } + if (nz > 1) + { + values[0] += 2.0*cz/(hinz*hinz) - 1.*az/hinz; + } + } + else if (1 == atype) /* backward scheme for conv */ + { + values[1] = -cx/(hinx*hinx) - ax/hinx; + values[2] = -cy/(hiny*hiny) - ay/hiny; + values[3] = -cz/(hinz*hinz) - az/hinz; + values[4] = -cx/(hinx*hinx); + values[5] = -cy/(hiny*hiny); + values[6] = -cz/(hinz*hinz); + + if (nx > 1) + { + values[0] += 2.0*cx/(hinx*hinx) + 1.*ax/hinx; + } + if (ny > 1) + { + values[0] += 2.0*cy/(hiny*hiny) + 1.*ay/hiny; + } + if (nz > 1) + { + values[0] += 2.0*cz/(hinz*hinz) + 1.*az/hinz; + } + } + else if (3 == atype) /* upwind scheme */ + { + sign_prod = sign_double(cx) * sign_double(ax); + if (sign_prod == 1) /* same sign use back scheme */ + { + values[1] = -cx/(hinx*hinx) - ax/hinx; + values[4] = -cx/(hinx*hinx); + if (nx > 1) + { + values[0] += 2.0*cx/(hinx*hinx) + 1.*ax/hinx; + } + } + else /* diff sign use forward scheme */ + { + values[1] = -cx/(hinx*hinx); + values[4] = -cx/(hinx*hinx) + ax/hinx; + if (nx > 1) + { + values[0] += 2.0*cx/(hinx*hinx) - 1.*ax/hinx; + } + } + + sign_prod = sign_double(cy) * sign_double(ay); + if (sign_prod == 1) /* same sign use back scheme */ + { + values[2] = -cy/(hiny*hiny) - ay/hiny; + values[5] = -cy/(hiny*hiny); + if (ny > 1) + { + values[0] += 2.0*cy/(hiny*hiny) + 1.*ay/hiny; + } + } + else /* diff sign use forward scheme */ + { + values[2] = -cy/(hiny*hiny); + values[5] = -cy/(hiny*hiny) + ay/hiny; + if (ny > 1) + { + values[0] += 2.0*cy/(hiny*hiny) - 1.*ay/hiny; + } + } + + sign_prod = sign_double(cz) * sign_double(az); + if (sign_prod == 1) /* same sign use back scheme */ + { + values[3] = -cz/(hinz*hinz) - az/hinz; + values[6] = -cz/(hinz*hinz); + if (nz > 1) + { + values[0] += 2.0*cz/(hinz*hinz) + 1.*az/hinz; + } + } + else /* diff sign use forward scheme */ + { + values[3] = -cz/(hinz*hinz); + values[6] = -cz/(hinz*hinz) + az/hinz; + if (nz > 1) + { + values[0] += 2.0*cz/(hinz*hinz) - 1.*az/hinz; + } + } + } + else /* centered difference scheme */ + { + values[1] = -cx/(hinx*hinx) - ax/(2.*hinx); + values[2] = -cy/(hiny*hiny) - ay/(2.*hiny); + values[3] = -cz/(hinz*hinz) - az/(2.*hinz); + values[4] = -cx/(hinx*hinx) + ax/(2.*hinx); + values[5] = -cy/(hiny*hiny) + ay/(2.*hiny); + values[6] = -cz/(hinz*hinz) + az/(2.*hinz); + + if (nx > 1) + { + values[0] += 2.0*cx/(hinx*hinx); + } + if (ny > 1) + { + values[0] += 2.0*cy/(hiny*hiny); + } + if (nz > 1) + { + values[0] += 2.0*cz/(hinz*hinz); + } + } + + A = (HYPRE_ParCSRMatrix) GenerateDifConv(hypre_MPI_COMM_WORLD, + nx, ny, nz, P, Q, R, p, q, r, values); + + hypre_TFree(values, HYPRE_MEMORY_HOST); + + *A_ptr = A; + + return (0); +} + +/*---------------------------------------------------------------------- + * Build standard 9-point laplacian in 2D with grid and anisotropy. + * Parameters given in command line. + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParLaplacian9pt( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_ParCSRMatrix *A_ptr ) +{ + HYPRE_Int nx, ny; + HYPRE_Int P, Q; + + HYPRE_ParCSRMatrix A; + + HYPRE_Int num_procs, myid; + HYPRE_Int p, q; + HYPRE_Real *values; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Set defaults + *-----------------------------------------------------------*/ + + nx = 10; + ny = 10; + + P = 1; + Q = num_procs; + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + arg_index = 0; + while (arg_index < argc) + { + if ( strcmp(argv[arg_index], "-n") == 0 ) + { + arg_index++; + nx = atoi(argv[arg_index++]); + ny = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-P") == 0 ) + { + arg_index++; + P = atoi(argv[arg_index++]); + Q = atoi(argv[arg_index++]); + } + else + { + arg_index++; + } + } + + /*----------------------------------------------------------- + * Check a few things + *-----------------------------------------------------------*/ + + if ((P*Q) != num_procs) + { + hypre_printf("Error: Invalid number of processors or processor topology \n"); + exit(1); + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + hypre_printf(" Laplacian 9pt:\n"); + hypre_printf(" (nx, ny) = (%d, %d)\n", nx, ny); + hypre_printf(" (Px, Py) = (%d, %d)\n\n", P, Q); + } + + /*----------------------------------------------------------- + * Set up the grid structure + *-----------------------------------------------------------*/ + + /* compute p,q from P,Q and myid */ + p = myid % P; + q = ( myid - p)/P; + + /*----------------------------------------------------------- + * Generate the matrix + *-----------------------------------------------------------*/ + + values = hypre_CTAlloc(HYPRE_Real, 2, HYPRE_MEMORY_HOST); + + values[1] = -1.; + + values[0] = 0.; + if (nx > 1) + { + values[0] += 2.0; + } + if (ny > 1) + { + values[0] += 2.0; + } + if (nx > 1 && ny > 1) + { + values[0] += 4.0; + } + + A = (HYPRE_ParCSRMatrix) GenerateLaplacian9pt(hypre_MPI_COMM_WORLD, + nx, ny, P, Q, p, q, values); + + hypre_TFree(values, HYPRE_MEMORY_HOST); + + *A_ptr = A; + + return (0); +} +/*---------------------------------------------------------------------- + * Build 27-point laplacian in 3D, + * Parameters given in command line. + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParLaplacian27pt( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_ParCSRMatrix *A_ptr ) +{ + HYPRE_Int nx, ny, nz; + HYPRE_Int P, Q, R; + + HYPRE_ParCSRMatrix A; + + HYPRE_Int num_procs, myid; + HYPRE_Int p, q, r; + HYPRE_Real *values; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Set defaults + *-----------------------------------------------------------*/ + + nx = 10; + ny = 10; + nz = 10; + + P = 1; + Q = num_procs; + R = 1; + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + arg_index = 0; + while (arg_index < argc) + { + if ( strcmp(argv[arg_index], "-n") == 0 ) + { + arg_index++; + nx = atoi(argv[arg_index++]); + ny = atoi(argv[arg_index++]); + nz = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-P") == 0 ) + { + arg_index++; + P = atoi(argv[arg_index++]); + Q = atoi(argv[arg_index++]); + R = atoi(argv[arg_index++]); + } + else + { + arg_index++; + } + } + + /*----------------------------------------------------------- + * Check a few things + *-----------------------------------------------------------*/ + + if ((P*Q*R) != num_procs) + { + hypre_printf("Error: Invalid number of processors or processor topology \n"); + exit(1); + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + hypre_printf(" Laplacian_27pt:\n"); + hypre_printf(" (nx, ny, nz) = (%d, %d, %d)\n", nx, ny, nz); + hypre_printf(" (Px, Py, Pz) = (%d, %d, %d)\n\n", P, Q, R); + } + + /*----------------------------------------------------------- + * Set up the grid structure + *-----------------------------------------------------------*/ + + /* compute p,q,r from P,Q,R and myid */ + p = myid % P; + q = (( myid - p)/P) % Q; + r = ( myid - p - P*q)/( P*Q ); + + /*----------------------------------------------------------- + * Generate the matrix + *-----------------------------------------------------------*/ + + values = hypre_CTAlloc(HYPRE_Real, 2, HYPRE_MEMORY_HOST); + + values[0] = 26.0; + if (nx == 1 || ny == 1 || nz == 1) + values[0] = 8.0; + if (nx*ny == 1 || nx*nz == 1 || ny*nz == 1) + values[0] = 2.0; + values[1] = -1.; + + A = (HYPRE_ParCSRMatrix) GenerateLaplacian27pt(hypre_MPI_COMM_WORLD, + nx, ny, nz, P, Q, R, p, q, r, values); + + hypre_TFree(values, HYPRE_MEMORY_HOST); + + *A_ptr = A; + + return (0); +} + + +/*---------------------------------------------------------------------- + * Build 7-point in 2D + * Parameters given in command line. + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParRotate7pt( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_ParCSRMatrix *A_ptr ) +{ + HYPRE_Int nx, ny; + HYPRE_Int P, Q; + + HYPRE_ParCSRMatrix A; + + HYPRE_Int num_procs, myid; + HYPRE_Int p, q; + HYPRE_Real eps, alpha; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Set defaults + *-----------------------------------------------------------*/ + + nx = 10; + ny = 10; + + P = 1; + Q = num_procs; + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + arg_index = 0; + while (arg_index < argc) + { + if ( strcmp(argv[arg_index], "-n") == 0 ) + { + arg_index++; + nx = atoi(argv[arg_index++]); + ny = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-P") == 0 ) + { + arg_index++; + P = atoi(argv[arg_index++]); + Q = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-alpha") == 0 ) + { + arg_index++; + alpha = atof(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-eps") == 0 ) + { + arg_index++; + eps = atof(argv[arg_index++]); + } + else + { + arg_index++; + } + } + + /*----------------------------------------------------------- + * Check a few things + *-----------------------------------------------------------*/ + + if ((P*Q) != num_procs) + { + hypre_printf("Error: Invalid number of processors or processor topology \n"); + exit(1); + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + hypre_printf(" Rotate 7pt:\n"); + hypre_printf(" alpha = %f, eps = %f\n", alpha,eps); + hypre_printf(" (nx, ny) = (%d, %d)\n", nx, ny); + hypre_printf(" (Px, Py) = (%d, %d)\n", P, Q); + } + + /*----------------------------------------------------------- + * Set up the grid structure + *-----------------------------------------------------------*/ + + /* compute p,q from P,Q and myid */ + p = myid % P; + q = ( myid - p)/P; + + /*----------------------------------------------------------- + * Generate the matrix + *-----------------------------------------------------------*/ + + A = (HYPRE_ParCSRMatrix) GenerateRotate7pt(hypre_MPI_COMM_WORLD, + nx, ny, P, Q, p, q, alpha, eps); + + *A_ptr = A; + + return (0); +} + +/*---------------------------------------------------------------------- + * Build standard 7-point difference operator using centered differences + * + * eps*(a(x,y,z) ux)x + (b(x,y,z) uy)y + (c(x,y,z) uz)z + * d(x,y,z) ux + e(x,y,z) uy + f(x,y,z) uz + g(x,y,z) u + * + * functions a,b,c,d,e,f,g need to be defined inside par_vardifconv.c + * + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParVarDifConv( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_ParCSRMatrix *A_ptr , + HYPRE_ParVector *rhs_ptr ) +{ + HYPRE_Int nx, ny, nz; + HYPRE_Int P, Q, R; + + HYPRE_ParCSRMatrix A; + HYPRE_ParVector rhs; + + HYPRE_Int num_procs, myid; + HYPRE_Int p, q, r; + HYPRE_Int type; + HYPRE_Real eps; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Set defaults + *-----------------------------------------------------------*/ + + nx = 10; + ny = 10; + nz = 10; + P = 1; + Q = num_procs; + R = 1; + eps = 1.0; + + /* type: 0 : default FD; + * 1-3 : FD and examples 1-3 in Ruge-Stuben paper */ + type = 0; + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + arg_index = 0; + while (arg_index < argc) + { + if ( strcmp(argv[arg_index], "-n") == 0 ) + { + arg_index++; + nx = atoi(argv[arg_index++]); + ny = atoi(argv[arg_index++]); + nz = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-P") == 0 ) + { + arg_index++; + P = atoi(argv[arg_index++]); + Q = atoi(argv[arg_index++]); + R = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-eps") == 0 ) + { + arg_index++; + eps = atof(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-vardifconvRS") == 0 ) + { + arg_index++; + type = atoi(argv[arg_index++]); + } + else + { + arg_index++; + } + } + + /*----------------------------------------------------------- + * Check a few things + *-----------------------------------------------------------*/ + + if ((P*Q*R) != num_procs) + { + hypre_printf("Error: Invalid number of processors or processor topology \n"); + exit(1); + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + hypre_printf(" ell PDE: eps = %f\n", eps); + hypre_printf(" Dx(aDxu) + Dy(bDyu) + Dz(cDzu) + d Dxu + e Dyu + f Dzu + g u= f\n"); + hypre_printf(" (nx, ny, nz) = (%d, %d, %d)\n", nx, ny, nz); + hypre_printf(" (Px, Py, Pz) = (%d, %d, %d)\n", P, Q, R); + } + /*----------------------------------------------------------- + * Set up the grid structure + *-----------------------------------------------------------*/ + + /* compute p,q,r from P,Q,R and myid */ + p = myid % P; + q = (( myid - p)/P) % Q; + r = ( myid - p - P*q)/( P*Q ); + + /*----------------------------------------------------------- + * Generate the matrix + *-----------------------------------------------------------*/ + + if (0 == type) + { + A = (HYPRE_ParCSRMatrix) GenerateVarDifConv(hypre_MPI_COMM_WORLD, + nx, ny, nz, P, Q, R, p, q, r, eps, &rhs); + } + else + { + A = (HYPRE_ParCSRMatrix) GenerateRSVarDifConv(hypre_MPI_COMM_WORLD, + nx, ny, nz, P, Q, R, p, q, r, eps, &rhs, + type); + } + + *A_ptr = A; + *rhs_ptr = rhs; + + return (0); +} + +/**************************************************************************/ + + +HYPRE_Int SetSysVcoefValues(HYPRE_Int num_fun, HYPRE_Int nx, HYPRE_Int ny, HYPRE_Int nz, HYPRE_Real vcx, + HYPRE_Real vcy, HYPRE_Real vcz, HYPRE_Int mtx_entry, HYPRE_Real *values) +{ + + + HYPRE_Int sz = num_fun*num_fun; + + values[1*sz + mtx_entry] = -vcx; + values[2*sz + mtx_entry] = -vcy; + values[3*sz + mtx_entry] = -vcz; + values[0*sz + mtx_entry] = 0.0; + + if (nx > 1) + { + values[0*sz + mtx_entry] += 2.0*vcx; + } + if (ny > 1) + { + values[0*sz + mtx_entry] += 2.0*vcy; + } + if (nz > 1) + { + values[0*sz + mtx_entry] += 2.0*vcz; + } + + return 0; + +} + +/*---------------------------------------------------------------------- + * Build coordinates for 1D/2D/3D + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParCoordinates( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_Int *coorddim_ptr, + float **coord_ptr ) +{ + HYPRE_Int nx, ny, nz; + HYPRE_Int P, Q, R; + + HYPRE_Int num_procs, myid; + HYPRE_Int p, q, r; + + HYPRE_Int coorddim; + float *coordinates; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Set defaults + *-----------------------------------------------------------*/ + + nx = 10; + ny = 10; + nz = 10; + + P = 1; + Q = num_procs; + R = 1; + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + arg_index = 0; + while (arg_index < argc) + { + if ( strcmp(argv[arg_index], "-n") == 0 ) + { + arg_index++; + nx = atoi(argv[arg_index++]); + ny = atoi(argv[arg_index++]); + nz = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-P") == 0 ) + { + arg_index++; + P = atoi(argv[arg_index++]); + Q = atoi(argv[arg_index++]); + R = atoi(argv[arg_index++]); + } + else + { + arg_index++; + } + } + + /* compute p,q,r from P,Q,R and myid */ + p = myid % P; + q = (( myid - p)/P) % Q; + r = ( myid - p - P*q)/( P*Q ); + + /*----------------------------------------------------------- + * Generate the coordinates + *-----------------------------------------------------------*/ + + coorddim = 3; + if (nx<2) coorddim--; + if (ny<2) coorddim--; + if (nz<2) coorddim--; + + if (coorddim>0) + coordinates = GenerateCoordinates (hypre_MPI_COMM_WORLD, + nx, ny, nz, P, Q, R, p, q, r, coorddim); + else + coordinates=NULL; + + *coorddim_ptr = coorddim; + *coord_ptr = coordinates; + return (0); +} + diff -Nru hypre-2.16.0/src/test/ij_mm.c hypre-2.18.2/src/test/ij_mm.c --- hypre-2.16.0/src/test/ij_mm.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/test/ij_mm.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,2251 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +/*-------------------------------------------------------------------------- + * Test driver for unstructured matrix interface (IJ_matrix interface). + * Do `driver -help' for usage info. + * This driver started from the driver for parcsr_linear_solvers, and it + * works by first building a parcsr matrix as before and then "copying" + * that matrix row-by-row into the IJMatrix interface. AJC 7/99. + *--------------------------------------------------------------------------*/ +#include +#include +#include + +#include "_hypre_utilities.h" +#include "HYPRE.h" +#include "HYPRE_parcsr_mv.h" + +#include "HYPRE_IJ_mv.h" +#include "HYPRE_parcsr_ls.h" +#include "_hypre_parcsr_ls.h" +#include "_hypre_parcsr_mv.h" +#include "HYPRE_krylov.h" + +#include "cuda_profiler_api.h" + +#ifdef __cplusplus +extern "C" { +#endif + + + +HYPRE_Int BuildParFromFile (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); +HYPRE_Int BuildParRhsFromFile (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParVector *b_ptr ); + +HYPRE_Int BuildParLaplacian (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); +HYPRE_Int BuildParSysLaplacian (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); +HYPRE_Int BuildParDifConv (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr); +HYPRE_Int BuildFuncsFromFiles (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix A , HYPRE_Int **dof_func_ptr ); +HYPRE_Int BuildFuncsFromOneFile (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix A , HYPRE_Int **dof_func_ptr ); +HYPRE_Int BuildParLaplacian9pt (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); +HYPRE_Int BuildParLaplacian27pt (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); +HYPRE_Int BuildParRotate7pt (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr ); +HYPRE_Int BuildParVarDifConv (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_ParCSRMatrix *A_ptr , HYPRE_ParVector *rhs_ptr ); +HYPRE_ParCSRMatrix GenerateSysLaplacian (MPI_Comm comm, HYPRE_Int nx, HYPRE_Int ny, HYPRE_Int nz, + HYPRE_Int P, HYPRE_Int Q, HYPRE_Int R, HYPRE_Int p, HYPRE_Int q, HYPRE_Int r, + HYPRE_Int num_fun, HYPRE_Real *mtrx, HYPRE_Real *value); +HYPRE_ParCSRMatrix GenerateSysLaplacianVCoef (MPI_Comm comm, HYPRE_Int nx, HYPRE_Int ny, HYPRE_Int nz, + HYPRE_Int P, HYPRE_Int Q, HYPRE_Int R, HYPRE_Int p, HYPRE_Int q, HYPRE_Int r, + HYPRE_Int num_fun, HYPRE_Real *mtrx, HYPRE_Real *value); +HYPRE_Int SetSysVcoefValues(HYPRE_Int num_fun, HYPRE_Int nx, HYPRE_Int ny, HYPRE_Int nz, HYPRE_Real vcx, HYPRE_Real vcy, HYPRE_Real vcz, HYPRE_Int mtx_entry, HYPRE_Real *values); + +HYPRE_Int BuildParCoordinates (HYPRE_Int argc , char *argv [], HYPRE_Int arg_index , HYPRE_Int *coorddim_ptr , float **coord_ptr ); + +#ifdef __cplusplus +} +#endif + +hypre_int +main( hypre_int argc, + char *argv[] ) +{ + HYPRE_Int arg_index; + HYPRE_Int print_usage; + HYPRE_Int build_matrix_type; + HYPRE_Int build_matrix_arg_index; + HYPRE_Int ierr = 0; + void *object; + + HYPRE_IJMatrix ij_A = NULL; + HYPRE_ParCSRMatrix parcsr_A = NULL; + HYPRE_ParCSRMatrix parcsr_S = NULL; + HYPRE_ParCSRMatrix parcsr_P = NULL; + HYPRE_ParCSRMatrix parcsr_Q = NULL; + HYPRE_ParCSRMatrix parcsr_AH = NULL; + + HYPRE_ParCSRMatrix parcsr_A_device = NULL; + HYPRE_ParCSRMatrix parcsr_P_device = NULL; + HYPRE_ParCSRMatrix parcsr_Q_device = NULL; + HYPRE_ParCSRMatrix parcsr_AH_device = NULL; + HYPRE_ParCSRMatrix parcsr_Q_2 = NULL; + HYPRE_ParCSRMatrix parcsr_AH_2 = NULL; + HYPRE_ParCSRMatrix parcsr_error = NULL; + + HYPRE_Int *CF_marker; + + HYPRE_Int errcode; + HYPRE_Int num_procs, myid; + HYPRE_Int time_index; + MPI_Comm comm = hypre_MPI_COMM_WORLD; + HYPRE_Int first_local_row, last_local_row, local_num_rows; + HYPRE_Int first_local_col, last_local_col, local_num_cols; + HYPRE_Int local_num_vars, *coarse_dof_func, *coarse_pnts_global, *col_offd_S_to_A; + + /* parameters for BoomerAMG */ + HYPRE_Real trunc_factor = 0.0; + HYPRE_Int P_max_elmts = 8; + HYPRE_Int cycle_type; + HYPRE_Int coarsen_type = 10; + HYPRE_Int measure_type = 0; + HYPRE_Int debug_flag = 0; + HYPRE_Int num_CR_relax_steps = 2; + HYPRE_Int rap2=0; + HYPRE_Int keepTranspose = 0; + HYPRE_Int num_functions = 1; + HYPRE_Real strong_threshold = 0.25; + HYPRE_Real max_row_sum = 1.0; + HYPRE_Real fnorm, rfnorm, fnorm0; + + /* interpolation */ + HYPRE_Int interp_type = 6; /* default value */ + HYPRE_Int post_interp_type = 0; /* default value */ + HYPRE_Int restri_type = 0; + + HYPRE_Int print_system = 0; + + HYPRE_Int mult_order = 0; + HYPRE_Int use_cusparse = 0; + HYPRE_Int rowest_mtd = 3; + HYPRE_Int rowest_nsamples = 32; + HYPRE_Real rowest_mult = 1.0; + char hash_type = 'L'; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + /* Initialize MPI */ + hypre_MPI_Init(&argc, &argv); + + hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /* Initialize Hypre */ + HYPRE_Init(argc, argv); + + //hypre_SetNumThreads(20); + hypre_printf("CPU #OMP THREADS %d\n", hypre_NumThreads()); + + /*----------------------------------------------------------- + * Set defaults + *-----------------------------------------------------------*/ + build_matrix_type = 2; + build_matrix_arg_index = argc; + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + + print_usage = 0; + arg_index = 1; + + while ( (arg_index < argc) && (!print_usage) ) + { + if ( strcmp(argv[arg_index], "-fromfile") == 0 ) + { + arg_index++; + build_matrix_type = -1; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-fromparcsrfile") == 0 ) + { + arg_index++; + build_matrix_type = 0; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-fromonecsrfile") == 0 ) + { + arg_index++; + build_matrix_type = 1; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-laplacian") == 0 ) + { + arg_index++; + build_matrix_type = 2; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-9pt") == 0 ) + { + arg_index++; + build_matrix_type = 3; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-27pt") == 0 ) + { + arg_index++; + build_matrix_type = 4; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-difconv") == 0 ) + { + arg_index++; + build_matrix_type = 5; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-vardifconv") == 0 ) + { + arg_index++; + build_matrix_type = 6; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-rotate") == 0 ) + { + arg_index++; + build_matrix_type = 7; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-concrete_parcsr") == 0 ) + { + arg_index++; + build_matrix_arg_index = arg_index; + } + else if ( strcmp(argv[arg_index], "-cljp") == 0 ) + { + arg_index++; + coarsen_type = 0; + } + else if ( strcmp(argv[arg_index], "-cljp1") == 0 ) + { + arg_index++; + coarsen_type = 7; + } + else if ( strcmp(argv[arg_index], "-pmis") == 0 ) + { + arg_index++; + coarsen_type = 8; + } + else if ( strcmp(argv[arg_index], "-pmis1") == 0 ) + { + arg_index++; + coarsen_type = 9; + } + else if ( strcmp(argv[arg_index], "-cr1") == 0 ) + { + arg_index++; + coarsen_type = 98; + } + else if ( strcmp(argv[arg_index], "-cr") == 0 ) + { + arg_index++; + coarsen_type = 99; + } + else if ( strcmp(argv[arg_index], "-hmis") == 0 ) + { + arg_index++; + coarsen_type = 10; + } + else if ( strcmp(argv[arg_index], "-ruge") == 0 ) + { + arg_index++; + coarsen_type = 1; + } + else if ( strcmp(argv[arg_index], "-ruge1p") == 0 ) + { + arg_index++; + coarsen_type = 11; + } + else if ( strcmp(argv[arg_index], "-ruge2b") == 0 ) + { + arg_index++; + coarsen_type = 2; + } + else if ( strcmp(argv[arg_index], "-ruge3") == 0 ) + { + arg_index++; + coarsen_type = 3; + } + else if ( strcmp(argv[arg_index], "-ruge3c") == 0 ) + { + arg_index++; + coarsen_type = 4; + } + else if ( strcmp(argv[arg_index], "-rugerlx") == 0 ) + { + arg_index++; + coarsen_type = 5; + } + else if ( strcmp(argv[arg_index], "-falgout") == 0 ) + { + arg_index++; + coarsen_type = 6; + } + else if ( strcmp(argv[arg_index], "-gm") == 0 ) + { + arg_index++; + measure_type = 1; + } + else if ( strcmp(argv[arg_index], "-restritype") == 0 ) + { + arg_index++; + restri_type = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-help") == 0 ) + { + print_usage = 1; + } + else if ( strcmp(argv[arg_index], "-tr") == 0 ) + { + arg_index++; + trunc_factor = atof(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-th") == 0 ) + { + arg_index++; + strong_threshold = atof(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-Pmx") == 0 ) + { + arg_index++; + P_max_elmts = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-interptype") == 0 ) + { + arg_index++; + interp_type = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-print") == 0 ) + { + arg_index++; + print_system = 1; + } + else if ( strcmp(argv[arg_index], "-order") == 0 ) + { + arg_index++; + mult_order = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-cusparse") == 0 ) + { + arg_index++; + use_cusparse = 1; + } + else if ( strcmp(argv[arg_index], "-rowest") == 0 ) + { + arg_index++; + rowest_mtd = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-rowestmult") == 0 ) + { + arg_index++; + rowest_mult = atof(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-rowestnsamples") == 0 ) + { + arg_index++; + rowest_nsamples = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-hash") == 0 ) + { + arg_index++; + hash_type = argv[arg_index++][0];; + } + else + { + arg_index++; + } + } + + + /*----------------------------------------------------------- + * Print usage info + *-----------------------------------------------------------*/ + + if ( print_usage ) + { + if ( myid == 0 ) + { + hypre_printf("\n"); + hypre_printf("Usage: %s []\n", argv[0]); + hypre_printf("\n"); + hypre_printf(" -fromfile : "); + hypre_printf("matrix read from multiple files (IJ format)\n"); + hypre_printf(" -fromparcsrfile : "); + hypre_printf("matrix read from multiple files (ParCSR format)\n"); + hypre_printf(" -fromonecsrfile : "); + hypre_printf("matrix read from a single file (CSR format)\n"); + hypre_printf("\n"); + hypre_printf(" -laplacian [] : build 5pt 2D laplacian problem (default) \n"); + hypre_printf(" -sysL : build SYSTEMS laplacian 7pt operator\n"); + hypre_printf(" -9pt [] : build 9pt 2D laplacian problem\n"); + hypre_printf(" -27pt [] : build 27pt 3D laplacian problem\n"); + hypre_printf(" -difconv [] : build convection-diffusion problem\n"); + hypre_printf(" -n : total problem size \n"); + hypre_printf(" -P : processor topology\n"); + hypre_printf(" -c : diffusion coefficients\n"); + hypre_printf(" -a : convection coefficients\n"); + hypre_printf(" -atype : FD scheme for convection \n"); + hypre_printf(" 0=Forward (default) 1=Backward\n"); + hypre_printf(" 2=Centered 3=Upwind\n"); + hypre_printf("\n"); + hypre_printf(" -exact_size : inserts immediately into ParCSR structure\n"); + hypre_printf(" -storage_low : allocates not enough storage for aux struct\n"); + hypre_printf(" -concrete_parcsr : use parcsr matrix type as concrete type\n"); + hypre_printf("\n"); + hypre_printf(" -cljp : CLJP coarsening \n"); + hypre_printf(" -cljp1 : CLJP coarsening, fixed random \n"); + hypre_printf(" -cgc : CGC coarsening \n"); + hypre_printf(" -cgce : CGC-E coarsening \n"); + hypre_printf(" -pmis : PMIS coarsening \n"); + hypre_printf(" -pmis1 : PMIS coarsening, fixed random \n"); + hypre_printf(" -hmis : HMIS coarsening (default)\n"); + hypre_printf(" -ruge : Ruge-Stueben coarsening (local)\n"); + hypre_printf(" -ruge1p : Ruge-Stueben coarsening 1st pass only(local)\n"); + hypre_printf(" -ruge3 : third pass on boundary\n"); + hypre_printf(" -ruge3c : third pass on boundary, keep c-points\n"); + hypre_printf(" -falgout : local Ruge_Stueben followed by CLJP\n"); + hypre_printf(" -gm : use global measures\n"); + hypre_printf("\n"); + hypre_printf(" -interptype : set interpolation type\n"); + hypre_printf(" 0=Classical modified interpolation \n"); + hypre_printf(" 1=least squares interpolation (for GSMG only) \n"); + hypre_printf(" 0=Classical modified interpolation for hyperbolic PDEs \n"); + hypre_printf(" 3=direct interpolation with separation of weights \n"); + hypre_printf(" 4=multipass interpolation \n"); + hypre_printf(" 5=multipass interpolation with separation of weights \n"); + hypre_printf(" 6=extended classical modified interpolation (default) \n"); + hypre_printf(" 7=extended (only if no common C neighbor) interpolation \n"); + hypre_printf(" 8=standard interpolation \n"); + hypre_printf(" 9=standard interpolation with separation of weights \n"); + hypre_printf(" 12=FF interpolation \n"); + hypre_printf(" 13=FF1 interpolation \n"); + + hypre_printf(" 16=use modified unknown interpolation for a system (w/unknown or hybrid approach) \n"); + hypre_printf(" 17=use non-systems interp = 6 for a system (w/unknown or hybrid approach) \n"); + hypre_printf(" 18=use non-systems interp = 8 for a system (w/unknown or hybrid approach) \n"); + hypre_printf(" 19=use non-systems interp = 0 for a system (w/unknown or hybrid approach) \n"); + + hypre_printf(" 10=classical block interpolation for nodal systems AMG\n"); + hypre_printf(" 11=classical block interpolation with diagonal blocks for nodal systems AMG\n"); + hypre_printf(" 20=same as 10, but don't add weak connect. to diag \n"); + hypre_printf(" 21=same as 11, but don't add weak connect. to diag \n"); + hypre_printf(" 22=classical block interpolation w/Ruge's variant for nodal systems AMG \n"); + hypre_printf(" 23=same as 22, but use row sums for diag scaling matrices,for nodal systems AMG \n"); + hypre_printf(" 24=direct block interpolation for nodal systems AMG\n"); + hypre_printf(" 100=One point interpolation [a Boolean matrix]\n"); + hypre_printf("\n"); + + hypre_printf(" -restritype : set restriction type\n"); + hypre_printf(" 0=transpose of the interpolation \n"); + hypre_printf(" 1=local approximate ideal restriction (AIR) \n"); + hypre_printf("\n"); + + hypre_printf(" -Pmx : set maximal no. of elmts per row for AMG interpolation (default: 4)\n"); + } + goto final; + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + } + + errcode = HYPRE_CSRMatrixDeviceSpGemmSetRownnzEstimateMethod(rowest_mtd); + hypre_assert(errcode == 0); + errcode = HYPRE_CSRMatrixDeviceSpGemmSetRownnzEstimateNSamples(rowest_nsamples); + hypre_assert(errcode == 0); + errcode = HYPRE_CSRMatrixDeviceSpGemmSetRownnzEstimateMultFactor(rowest_mult); + hypre_assert(errcode == 0); + errcode = HYPRE_CSRMatrixDeviceSpGemmSetHashType(hash_type); + hypre_assert(errcode == 0); + errcode = HYPRE_CSRMatrixDeviceSpGemmSetUseCusparse(use_cusparse); + hypre_assert(errcode == 0); + + /*----------------------------------------------------------- + * Set up matrix + *-----------------------------------------------------------*/ + time_index = hypre_InitializeTiming("Generate Matrix"); + hypre_BeginTiming(time_index); + if ( build_matrix_type == -1 ) + { + ierr = HYPRE_IJMatrixRead( argv[build_matrix_arg_index], comm, + HYPRE_PARCSR, &ij_A ); + if (ierr) + { + hypre_printf("ERROR: Problem reading in the system matrix!\n"); + exit(1); + } + } + else if ( build_matrix_type == 0 ) + { + BuildParFromFile(argc, argv, build_matrix_arg_index, &parcsr_A); + } + else if ( build_matrix_type == 2 ) + { + BuildParLaplacian(argc, argv, build_matrix_arg_index, &parcsr_A); + } + else if ( build_matrix_type == 3 ) + { + BuildParLaplacian9pt(argc, argv, build_matrix_arg_index, &parcsr_A); + } + else if ( build_matrix_type == 4 ) + { + BuildParLaplacian27pt(argc, argv, build_matrix_arg_index, &parcsr_A); + } + else if ( build_matrix_type == 5 ) + { + BuildParDifConv(argc, argv, build_matrix_arg_index, &parcsr_A); + } + else if ( build_matrix_type == 7 ) + { + BuildParRotate7pt(argc, argv, build_matrix_arg_index, &parcsr_A); + } + else + { + hypre_printf("You have asked for an unsupported problem with\n"); + hypre_printf("build_matrix_type = %d.\n", build_matrix_type); + return(-1); + } + + if (build_matrix_type < 0) + { + ierr = HYPRE_IJMatrixGetLocalRange( ij_A, + &first_local_row, &last_local_row , + &first_local_col, &last_local_col ); + + ierr += HYPRE_IJMatrixGetObject( ij_A, &object); + parcsr_A = (HYPRE_ParCSRMatrix) object; + } + else + { + /*----------------------------------------------------------- + * Copy the parcsr matrix into the IJMatrix through interface calls + *-----------------------------------------------------------*/ + ierr = HYPRE_ParCSRMatrixGetLocalRange( parcsr_A, + &first_local_row, &last_local_row , + &first_local_col, &last_local_col ); + + local_num_rows = last_local_row - first_local_row + 1; + local_num_cols = last_local_col - first_local_col + 1; + } + + /* generate P */ + + hypre_BoomerAMGCreateS(parcsr_A, strong_threshold, max_row_sum, + num_functions, NULL, &parcsr_S); + /* + hypre_BoomerAMGCreateSabs(parcsr_A, strong_threshold, max_row_sum, + num_functions, NULL, &parcsr_S); + */ + hypre_BoomerAMGCoarsenHMIS(parcsr_S, parcsr_A, measure_type, + debug_flag, &CF_marker); + + local_num_vars = hypre_CSRMatrixNumRows(hypre_ParCSRMatrixDiag(parcsr_A)); + coarse_dof_func = NULL; + coarse_pnts_global = NULL; + col_offd_S_to_A = NULL; + + hypre_BoomerAMGCoarseParms(hypre_ParCSRMatrixComm(parcsr_A), local_num_vars, num_functions, NULL, + CF_marker, &coarse_dof_func, &coarse_pnts_global); + + hypre_BoomerAMGBuildExtPIInterp(parcsr_A, CF_marker, parcsr_S, coarse_pnts_global, + num_functions, NULL, debug_flag, trunc_factor, P_max_elmts, + col_offd_S_to_A, &parcsr_P); + + if (myid == 0) + { + printf("A %d x %d\n", hypre_ParCSRMatrixGlobalNumRows(parcsr_A), hypre_ParCSRMatrixGlobalNumCols(parcsr_A)); + printf("P %d x %d\n", hypre_ParCSRMatrixGlobalNumRows(parcsr_P), hypre_ParCSRMatrixGlobalNumCols(parcsr_P)); + } + + hypre_EndTiming(time_index); + hypre_PrintTiming("Generate Matrix", hypre_MPI_COMM_WORLD); + hypre_FinalizeTiming(time_index); + hypre_ClearTiming(); + + /*----------------------------------------------------------- + * Matrix-by-Matrix on host + *-----------------------------------------------------------*/ + time_index = hypre_InitializeTiming("Host Parcsr Matrix-by-Matrix, RAP2"); + hypre_BeginTiming(time_index); + + if (mult_order == 0) + { + parcsr_Q = hypre_ParCSRMatMat(parcsr_A, parcsr_P); + parcsr_AH = hypre_ParCSRTMatMatKT(parcsr_P, parcsr_Q, keepTranspose); + } + else + { + parcsr_Q = hypre_ParCSRTMatMatKT(parcsr_P, parcsr_A, keepTranspose); + parcsr_AH = hypre_ParCSRMatMat(parcsr_Q, parcsr_P); + } + hypre_EndTiming(time_index); + hypre_PrintTiming("Host Parcsr Matrix-by-Matrix, RAP2", hypre_MPI_COMM_WORLD); + hypre_FinalizeTiming(time_index); + hypre_ClearTiming(); + + /*----------------------------------------------------------- + * Print out the matrices + *-----------------------------------------------------------*/ + if (print_system) + { + /* + hypre_ParCSRMatrixPrintIJ(parcsr_A, 1, 1, "IJ.out.A"); + hypre_ParCSRMatrixPrintIJ(parcsr_P, 1, 1, "IJ.out.P"); + hypre_ParCSRMatrixPrintIJ(parcsr_Q, 1, 1, "IJ.out.Q"); + */ + hypre_CSRMatrixPrintMM(hypre_ParCSRMatrixDiag(parcsr_A), 1, 1, 0, "/p/gpfs1/li50/A.mtx"); + hypre_CSRMatrixPrintMM(hypre_ParCSRMatrixDiag(parcsr_P), 1, 1, 0, "/p/gpfs1/li50/P.mtx"); + /* + hypre_CSRMatrixPrintMM(hypre_ParCSRMatrixDiag(parcsr_Q), 1, 1, 0, "/p/gscratchr/li50/Q.mtx"); + hypre_CSRMatrixPrintMM(hypre_ParCSRMatrixDiag(parcsr_P), 1, 1, 1, "/p/gscratchr/li50/PT.mtx"); + */ + //hypre_CSRMatrixPrintMM(hypre_ParCSRMatrixDiag(parcsr_A), 1, 1, 0, "A.mtx"); + //hypre_CSRMatrixPrintMM(hypre_ParCSRMatrixDiag(parcsr_P), 1, 1, 0, "P.mtx"); + //hypre_CSRMatrixPrintMM(hypre_ParCSRMatrixDiag(parcsr_Q), 1, 1, 0, "Q.mtx"); + //hypre_CSRMatrixPrintMM(hypre_ParCSRMatrixDiag(parcsr_P), 1, 1, 1, "PT.mtx"); + } + + /*----------------------------------------------------------- + * Matrix-by-Matrix on device + *-----------------------------------------------------------*/ + parcsr_A_device = hypre_ParCSRMatrixClone_v2(parcsr_A, 1, HYPRE_MEMORY_DEVICE); + parcsr_P_device = hypre_ParCSRMatrixClone_v2(parcsr_P, 1, HYPRE_MEMORY_DEVICE); + + //printf("done clone to GPU\n"); + + hypre_MatvecCommPkgCreate(parcsr_A_device); + hypre_MatvecCommPkgCreate(parcsr_P_device); + + /* run for the first time without timing [some allocation is done] */ + if (mult_order == 0) + { + parcsr_Q_device = hypre_ParCSRMatMat(parcsr_A_device, parcsr_P_device); + parcsr_AH_device = hypre_ParCSRTMatMatKT(parcsr_P_device, parcsr_Q_device, keepTranspose); + } + else + { + parcsr_Q_device = hypre_ParCSRTMatMatKT(parcsr_P_device, parcsr_A_device, keepTranspose); + parcsr_AH_device = hypre_ParCSRMatMat(parcsr_Q_device, parcsr_P_device); + } + hypre_ParCSRMatrixDestroy(parcsr_Q_device); + hypre_ParCSRMatrixDestroy(parcsr_AH_device); + + //printf("done 1st GPU run\n"); + + time_index = hypre_InitializeTiming("Device Parcsr Matrix-by-Matrix, RAP2"); + hypre_BeginTiming(time_index); + + /* run for a second time for timing */ + //cudaProfilerStart(); + if (mult_order == 0) + { + parcsr_Q_device = hypre_ParCSRMatMat(parcsr_A_device, parcsr_P_device); + parcsr_AH_device = hypre_ParCSRTMatMatKT(parcsr_P_device, parcsr_Q_device, keepTranspose); + } + else + { + parcsr_Q_device = hypre_ParCSRTMatMatKT(parcsr_P_device, parcsr_A_device, keepTranspose); + parcsr_AH_device = hypre_ParCSRMatMat(parcsr_Q_device, parcsr_P_device); + } + //cudaProfilerStop(); + + hypre_EndTiming(time_index); + hypre_PrintTiming("Device Parcsr Matrix-by-Matrix, RAP2", hypre_MPI_COMM_WORLD); + hypre_FinalizeTiming(time_index); + hypre_ClearTiming(); + + /*----------------------------------------------------------- + * Verify results + *-----------------------------------------------------------*/ + //parcsr_Q_2 = hypre_ParCSRMatrixClone_v2(parcsr_Q_device, 1, HYPRE_MEMORY_HOST); + //hypre_ParCSRMatrixPrintIJ(parcsr_Q, 0, 0, "IJ.out.Q"); + //hypre_ParCSRMatrixPrintIJ(parcsr_Q_2, 0, 0, "IJ.out.Q_2"); + parcsr_AH_2 = hypre_ParCSRMatrixClone_v2(parcsr_AH_device, 1, HYPRE_MEMORY_HOST); + hypre_ParcsrAdd(1.0, parcsr_AH, -1.0, parcsr_AH_2, &parcsr_error); + fnorm = hypre_ParCSRMatrixFnorm(parcsr_error); + fnorm0 = hypre_ParCSRMatrixFnorm(parcsr_AH); + rfnorm = fnorm0 > 0 ? fnorm / fnorm0 : fnorm; + + hypre_ParCSRMatrixSetNumNonzeros(parcsr_AH_2); + + if (myid == 0) + { + printf("AH: %d x %d, nnz %d, CPU-GPU err %e\n", hypre_ParCSRMatrixGlobalNumRows(parcsr_AH_2), + hypre_ParCSRMatrixGlobalNumCols(parcsr_AH_2), + hypre_ParCSRMatrixNumNonzeros(parcsr_AH_2), + rfnorm); + } + + /* + hypre_ParCSRMatrixPrintIJ(parcsr_AH, 0, 0, "IJ.out.AH"); + hypre_ParCSRMatrixPrintIJ(parcsr_AH_2, 0, 0, "IJ.out.AH_2"); + */ + + hypre_ParCSRMatrixDestroy(parcsr_error); + + /*----------------------------------------------------------- + * Finalize things + *-----------------------------------------------------------*/ + + if (build_matrix_type == -1) + { + HYPRE_IJMatrixDestroy(ij_A); + } + else + { + HYPRE_ParCSRMatrixDestroy(parcsr_A); + } + + hypre_TFree(CF_marker, HYPRE_MEMORY_HOST); + hypre_TFree(coarse_dof_func, HYPRE_MEMORY_HOST); + + hypre_ParCSRMatrixDestroy(parcsr_S); + hypre_ParCSRMatrixDestroy(parcsr_P); + hypre_ParCSRMatrixDestroy(parcsr_Q); + hypre_ParCSRMatrixDestroy(parcsr_AH); + + hypre_ParCSRMatrixDestroy(parcsr_A_device); + hypre_ParCSRMatrixDestroy(parcsr_P_device); + hypre_ParCSRMatrixDestroy(parcsr_Q_device); + hypre_ParCSRMatrixDestroy(parcsr_AH_device); + + final: + + /* Finalize Hypre */ + HYPRE_Finalize(); + + /* Finalize MPI */ + hypre_MPI_Finalize(); + + return (0); +} + +/*---------------------------------------------------------------------- + * Build matrix from file. Expects three files on each processor. + * filename.D.n contains the diagonal part, filename.O.n contains + * the offdiagonal part and filename.INFO.n contains global row + * and column numbers, number of columns of offdiagonal matrix + * and the mapping of offdiagonal column numbers to global column numbers. + * Parameters given in command line. + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParFromFile( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_ParCSRMatrix *A_ptr ) +{ + char *filename; + + HYPRE_ParCSRMatrix A; + + HYPRE_Int myid; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + + if (arg_index < argc) + { + filename = argv[arg_index]; + } + else + { + hypre_printf("Error: No filename specified \n"); + exit(1); + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + hypre_printf(" FromFile: %s\n", filename); + } + + /*----------------------------------------------------------- + * Generate the matrix + *-----------------------------------------------------------*/ + + HYPRE_ParCSRMatrixRead(hypre_MPI_COMM_WORLD, filename,&A); + + *A_ptr = A; + + return (0); +} + + +/*---------------------------------------------------------------------- + * Build rhs from file. Expects two files on each processor. + * filename.n contains the data and + * and filename.INFO.n contains global row + * numbers + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParRhsFromFile( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_ParVector *b_ptr ) +{ + char *filename; + + HYPRE_ParVector b; + + HYPRE_Int myid; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + + if (arg_index < argc) + { + filename = argv[arg_index]; + } + else + { + hypre_printf("Error: No filename specified \n"); + exit(1); + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + hypre_printf(" RhsFromParFile: %s\n", filename); + } + + /*----------------------------------------------------------- + * Generate the matrix + *-----------------------------------------------------------*/ + + HYPRE_ParVectorRead(hypre_MPI_COMM_WORLD, filename,&b); + + *b_ptr = b; + + return (0); +} + + + + +/*---------------------------------------------------------------------- + * Build standard 7-point laplacian in 3D with grid and anisotropy. + * Parameters given in command line. + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParLaplacian( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_ParCSRMatrix *A_ptr ) +{ + HYPRE_Int nx, ny, nz; + HYPRE_Int P, Q, R; + HYPRE_Real cx, cy, cz; + + HYPRE_ParCSRMatrix A; + + HYPRE_Int num_procs, myid; + HYPRE_Int p, q, r; + HYPRE_Int num_fun = 1; + HYPRE_Real *values; + HYPRE_Real *mtrx; + + HYPRE_Real ep = .1; + + HYPRE_Int system_vcoef = 0; + HYPRE_Int sys_opt = 0; + HYPRE_Int vcoef_opt = 0; + + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Set defaults + *-----------------------------------------------------------*/ + + nx = 10; + ny = 10; + nz = 10; + + P = 1; + Q = num_procs; + R = 1; + + cx = 1.; + cy = 1.; + cz = 1.; + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + arg_index = 0; + while (arg_index < argc) + { + if ( strcmp(argv[arg_index], "-n") == 0 ) + { + arg_index++; + nx = atoi(argv[arg_index++]); + ny = atoi(argv[arg_index++]); + nz = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-P") == 0 ) + { + arg_index++; + P = atoi(argv[arg_index++]); + Q = atoi(argv[arg_index++]); + R = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-c") == 0 ) + { + arg_index++; + cx = atof(argv[arg_index++]); + cy = atof(argv[arg_index++]); + cz = atof(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-sysL") == 0 ) + { + arg_index++; + num_fun = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-sysL_opt") == 0 ) + { + arg_index++; + sys_opt = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-sys_vcoef") == 0 ) + { + /* have to use -sysL for this to */ + arg_index++; + system_vcoef = 1; + } + else if ( strcmp(argv[arg_index], "-sys_vcoef_opt") == 0 ) + { + arg_index++; + vcoef_opt = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-ep") == 0 ) + { + arg_index++; + ep = atof(argv[arg_index++]); + } + else + { + arg_index++; + } + } + + /*----------------------------------------------------------- + * Check a few things + *-----------------------------------------------------------*/ + + if ((P*Q*R) != num_procs) + { + hypre_printf("Error: Invalid number of processors or processor topology \n"); + exit(1); + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + hypre_printf(" Laplacian: num_fun = %d\n", num_fun); + hypre_printf(" (nx, ny, nz) = (%d, %d, %d)\n", nx, ny, nz); + hypre_printf(" (Px, Py, Pz) = (%d, %d, %d)\n", P, Q, R); + hypre_printf(" (cx, cy, cz) = (%f, %f, %f)\n\n", cx, cy, cz); + } + + /*----------------------------------------------------------- + * Set up the grid structure + *-----------------------------------------------------------*/ + + /* compute p,q,r from P,Q,R and myid */ + p = myid % P; + q = (( myid - p)/P) % Q; + r = ( myid - p - P*q)/( P*Q ); + + /*----------------------------------------------------------- + * Generate the matrix + *-----------------------------------------------------------*/ + + values = hypre_CTAlloc(HYPRE_Real, 4, HYPRE_MEMORY_HOST); + + values[1] = -cx; + values[2] = -cy; + values[3] = -cz; + + values[0] = 0.; + if (nx > 1) + { + values[0] += 2.0*cx; + } + if (ny > 1) + { + values[0] += 2.0*cy; + } + if (nz > 1) + { + values[0] += 2.0*cz; + } + + if (num_fun == 1) + A = (HYPRE_ParCSRMatrix) GenerateLaplacian(hypre_MPI_COMM_WORLD, + nx, ny, nz, P, Q, R, p, q, r, values); + else + { + mtrx = hypre_CTAlloc(HYPRE_Real, num_fun*num_fun, HYPRE_MEMORY_HOST); + + if (num_fun == 2) + { + if (sys_opt ==1) /* identity */ + { + mtrx[0] = 1.0; + mtrx[1] = 0.0; + mtrx[2] = 0.0; + mtrx[3] = 1.0; + } + else if (sys_opt ==2) + { + mtrx[0] = 1.0; + mtrx[1] = 0.0; + mtrx[2] = 0.0; + mtrx[3] = 20.0; + } + else if (sys_opt ==3) /* similar to barry's talk - ex1 */ + { + mtrx[0] = 1.0; + mtrx[1] = 2.0; + mtrx[2] = 2.0; + mtrx[3] = 1.0; + } + else if (sys_opt ==4) /* can use with vcoef to get barry's ex*/ + { + mtrx[0] = 1.0; + mtrx[1] = 1.0; + mtrx[2] = 1.0; + mtrx[3] = 1.0; + } + else if (sys_opt ==5) /* barry's talk - ex1 */ + { + mtrx[0] = 1.0; + mtrx[1] = 1.1; + mtrx[2] = 1.1; + mtrx[3] = 1.0; + } + else if (sys_opt ==6) /* */ + { + mtrx[0] = 1.1; + mtrx[1] = 1.0; + mtrx[2] = 1.0; + mtrx[3] = 1.1; + } + + else /* == 0 */ + { + mtrx[0] = 2; + mtrx[1] = 1; + mtrx[2] = 1; + mtrx[3] = 2; + } + } + else if (num_fun == 3) + { + if (sys_opt ==1) + { + mtrx[0] = 1.0; + mtrx[1] = 0.0; + mtrx[2] = 0.0; + mtrx[3] = 0.0; + mtrx[4] = 1.0; + mtrx[5] = 0.0; + mtrx[6] = 0.0; + mtrx[7] = 0.0; + mtrx[8] = 1.0; + } + else if (sys_opt ==2) + { + mtrx[0] = 1.0; + mtrx[1] = 0.0; + mtrx[2] = 0.0; + mtrx[3] = 0.0; + mtrx[4] = 20.0; + mtrx[5] = 0.0; + mtrx[6] = 0.0; + mtrx[7] = 0.0; + mtrx[8] =.01; + } + else if (sys_opt ==3) + { + mtrx[0] = 1.01; + mtrx[1] = 1; + mtrx[2] = 0.0; + mtrx[3] = 1; + mtrx[4] = 2; + mtrx[5] = 1; + mtrx[6] = 0.0; + mtrx[7] = 1; + mtrx[8] = 1.01; + } + else if (sys_opt ==4) /* barry ex4 */ + { + mtrx[0] = 3; + mtrx[1] = 1; + mtrx[2] = 0.0; + mtrx[3] = 1; + mtrx[4] = 4; + mtrx[5] = 2; + mtrx[6] = 0.0; + mtrx[7] = 2; + mtrx[8] = .25; + } + else /* == 0 */ + { + mtrx[0] = 2.0; + mtrx[1] = 1.0; + mtrx[2] = 0.0; + mtrx[3] = 1.0; + mtrx[4] = 2.0; + mtrx[5] = 1.0; + mtrx[6] = 0.0; + mtrx[7] = 1.0; + mtrx[8] = 2.0; + } + + } + else if (num_fun == 4) + { + mtrx[0] = 1.01; + mtrx[1] = 1; + mtrx[2] = 0.0; + mtrx[3] = 0.0; + mtrx[4] = 1; + mtrx[5] = 2; + mtrx[6] = 1; + mtrx[7] = 0.0; + mtrx[8] = 0.0; + mtrx[9] = 1; + mtrx[10] = 1.01; + mtrx[11] = 0.0; + mtrx[12] = 2; + mtrx[13] = 1; + mtrx[14] = 0.0; + mtrx[15] = 1; + } + + + + + if (!system_vcoef) + { + A = (HYPRE_ParCSRMatrix) GenerateSysLaplacian(hypre_MPI_COMM_WORLD, + nx, ny, nz, P, Q, + R, p, q, r, num_fun, mtrx, values); + } + else + { + + + HYPRE_Real *mtrx_values; + + mtrx_values = hypre_CTAlloc(HYPRE_Real, num_fun*num_fun*4, HYPRE_MEMORY_HOST); + + if (num_fun == 2) + { + if (vcoef_opt == 1) + { + /* Barry's talk * - must also have sys_opt = 4, all fail */ + mtrx[0] = 1.0; + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, .10, 1.0, 0, mtrx_values); + + mtrx[1] = 1.0; + SetSysVcoefValues(num_fun, nx, ny, nz, .1, 1.0, 1.0, 1, mtrx_values); + + mtrx[2] = 1.0; + SetSysVcoefValues(num_fun, nx, ny, nz, .01, 1.0, 1.0, 2, mtrx_values); + + mtrx[3] = 1.0; + SetSysVcoefValues(num_fun, nx, ny, nz, 2.0, .02, 1.0, 3, mtrx_values); + + } + else if (vcoef_opt == 2) + { + /* Barry's talk * - ex2 - if have sys-opt = 4*/ + mtrx[0] = 1.0; + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, .010, 1.0, 0, mtrx_values); + + mtrx[1] = 200.0; + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, 1.0, 1.0, 1, mtrx_values); + + mtrx[2] = 200.0; + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, 1.0, 1.0, 2, mtrx_values); + + mtrx[3] = 1.0; + SetSysVcoefValues(num_fun, nx, ny, nz, 2.0, .02, 1.0, 3, mtrx_values); + + } + else if (vcoef_opt == 3) /* use with default sys_opt - ulrike ex 3*/ + { + + /* mtrx[0] */ + SetSysVcoefValues(num_fun, nx, ny, nz, ep*1.0, 1.0, 1.0, 0, mtrx_values); + + /* mtrx[1] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, 1.0, 1.0, 1, mtrx_values); + + /* mtrx[2] */ + SetSysVcoefValues(num_fun, nx, ny, nz, ep*1.0, 1.0, 1.0, 2, mtrx_values); + + /* mtrx[3] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, 1.0, 1.0, 3, mtrx_values); + } + else if (vcoef_opt == 4) /* use with default sys_opt - ulrike ex 4*/ + { + HYPRE_Real ep2 = ep; + + /* mtrx[0] */ + SetSysVcoefValues(num_fun, nx, ny, nz, ep*1.0, 1.0, 1.0, 0, mtrx_values); + + /* mtrx[1] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, ep*1.0, 1.0, 1, mtrx_values); + + /* mtrx[2] */ + SetSysVcoefValues(num_fun, nx, ny, nz, ep*1.0, 1.0, 1.0, 2, mtrx_values); + + /* mtrx[3] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, ep2*1.0, 1.0, 3, mtrx_values); + } + else if (vcoef_opt == 5) /* use with default sys_opt - */ + { + HYPRE_Real alp, beta; + alp = .001; + beta = 10; + + /* mtrx[0] */ + SetSysVcoefValues(num_fun, nx, ny, nz, alp*1.0, 1.0, 1.0, 0, mtrx_values); + + /* mtrx[1] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, beta*1.0, 1.0, 1, mtrx_values); + + /* mtrx[2] */ + SetSysVcoefValues(num_fun, nx, ny, nz, alp*1.0, 1.0, 1.0, 2, mtrx_values); + + /* mtrx[3] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, beta*1.0, 1.0, 3, mtrx_values); + } + else /* = 0 */ + { + /* mtrx[0] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, 1.0, 1.0, 0, mtrx_values); + + /* mtrx[1] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, 2.0, 1.0, 1, mtrx_values); + + /* mtrx[2] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 2.0, 1.0, 0.0, 2, mtrx_values); + + /* mtrx[3] */ + SetSysVcoefValues(num_fun, nx, ny, nz, 1.0, 3.0, 1.0, 3, mtrx_values); + } + + } + else if (num_fun == 3) + { + mtrx[0] = 1; + SetSysVcoefValues(num_fun, nx, ny, nz, 1, .01, 1, 0, mtrx_values); + + mtrx[1] = 1; + SetSysVcoefValues(num_fun, nx, ny, nz, 1, 1, 1, 1, mtrx_values); + + mtrx[2] = 0.0; + SetSysVcoefValues(num_fun, nx, ny, nz, 1, 1, 1, 2, mtrx_values); + + mtrx[3] = 1; + SetSysVcoefValues(num_fun, nx, ny, nz, 1, 1, 1, 3, mtrx_values); + + mtrx[4] = 1; + SetSysVcoefValues(num_fun, nx, ny, nz, 2, .02, 1, 4, mtrx_values); + + mtrx[5] = 2; + SetSysVcoefValues(num_fun, nx, ny, nz, 1, 1, 1, 5, mtrx_values); + + mtrx[6] = 0.0; + SetSysVcoefValues(num_fun, nx, ny, nz, 1, 1, 1, 6, mtrx_values); + + mtrx[7] = 2; + SetSysVcoefValues(num_fun, nx, ny, nz, 1, 1, 1, 7, mtrx_values); + + mtrx[8] = 1; + SetSysVcoefValues(num_fun, nx, ny, nz, 1.5, .04, 1, 8, mtrx_values); + + } + + A = (HYPRE_ParCSRMatrix) GenerateSysLaplacianVCoef(hypre_MPI_COMM_WORLD, + nx, ny, nz, P, Q, + R, p, q, r, num_fun, mtrx, mtrx_values); + + + + + + hypre_TFree(mtrx_values, HYPRE_MEMORY_HOST); + } + + hypre_TFree(mtrx, HYPRE_MEMORY_HOST); + } + + hypre_TFree(values, HYPRE_MEMORY_HOST); + + *A_ptr = A; + + return (0); +} + +/*---------------------------------------------------------------------- + * returns the sign of a real number + * 1 : positive + * 0 : zero + * -1 : negative + *----------------------------------------------------------------------*/ +static inline HYPRE_Int sign_double(HYPRE_Real a) +{ + return ( (0.0 < a) - (0.0 > a) ); +} + +/*---------------------------------------------------------------------- + * Build standard 7-point convection-diffusion operator + * Parameters given in command line. + * Operator: + * + * -cx Dxx - cy Dyy - cz Dzz + ax Dx + ay Dy + az Dz = f + * + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParDifConv( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_ParCSRMatrix *A_ptr) +{ + HYPRE_Int nx, ny, nz; + HYPRE_Int P, Q, R; + HYPRE_Real cx, cy, cz; + HYPRE_Real ax, ay, az, atype; + HYPRE_Real hinx,hiny,hinz; + HYPRE_Int sign_prod; + + HYPRE_ParCSRMatrix A; + + HYPRE_Int num_procs, myid; + HYPRE_Int p, q, r; + HYPRE_Real *values; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Set defaults + *-----------------------------------------------------------*/ + + nx = 10; + ny = 10; + nz = 10; + + P = 1; + Q = num_procs; + R = 1; + + cx = 1.; + cy = 1.; + cz = 1.; + + ax = 1.; + ay = 1.; + az = 1.; + + atype = 0; + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + arg_index = 0; + while (arg_index < argc) + { + if ( strcmp(argv[arg_index], "-n") == 0 ) + { + arg_index++; + nx = atoi(argv[arg_index++]); + ny = atoi(argv[arg_index++]); + nz = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-P") == 0 ) + { + arg_index++; + P = atoi(argv[arg_index++]); + Q = atoi(argv[arg_index++]); + R = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-c") == 0 ) + { + arg_index++; + cx = atof(argv[arg_index++]); + cy = atof(argv[arg_index++]); + cz = atof(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-a") == 0 ) + { + arg_index++; + ax = atof(argv[arg_index++]); + ay = atof(argv[arg_index++]); + az = atof(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-atype") == 0 ) + { + arg_index++; + atype = atoi(argv[arg_index++]); + } + else + { + arg_index++; + } + } + + /*----------------------------------------------------------- + * Check a few things + *-----------------------------------------------------------*/ + + if ((P*Q*R) != num_procs) + { + hypre_printf("Error: Invalid number of processors or processor topology \n"); + exit(1); + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + hypre_printf(" Convection-Diffusion: \n"); + hypre_printf(" -cx Dxx - cy Dyy - cz Dzz + ax Dx + ay Dy + az Dz = f\n"); + hypre_printf(" (nx, ny, nz) = (%d, %d, %d)\n", nx, ny, nz); + hypre_printf(" (Px, Py, Pz) = (%d, %d, %d)\n", P, Q, R); + hypre_printf(" (cx, cy, cz) = (%f, %f, %f)\n", cx, cy, cz); + hypre_printf(" (ax, ay, az) = (%f, %f, %f)\n\n", ax, ay, az); + } + + /*----------------------------------------------------------- + * Set up the grid structure + *-----------------------------------------------------------*/ + + /* compute p,q,r from P,Q,R and myid */ + p = myid % P; + q = (( myid - p)/P) % Q; + r = ( myid - p - P*q)/( P*Q ); + + hinx = 1./(nx+1); + hiny = 1./(ny+1); + hinz = 1./(nz+1); + + /*----------------------------------------------------------- + * Generate the matrix + *-----------------------------------------------------------*/ + /* values[7]: + * [0]: center + * [1]: X- + * [2]: Y- + * [3]: Z- + * [4]: X+ + * [5]: Y+ + * [6]: Z+ + */ + values = hypre_CTAlloc(HYPRE_Real, 7, HYPRE_MEMORY_HOST); + + values[0] = 0.; + + if (0 == atype) /* forward scheme for conv */ + { + values[1] = -cx/(hinx*hinx); + values[2] = -cy/(hiny*hiny); + values[3] = -cz/(hinz*hinz); + values[4] = -cx/(hinx*hinx) + ax/hinx; + values[5] = -cy/(hiny*hiny) + ay/hiny; + values[6] = -cz/(hinz*hinz) + az/hinz; + + if (nx > 1) + { + values[0] += 2.0*cx/(hinx*hinx) - 1.*ax/hinx; + } + if (ny > 1) + { + values[0] += 2.0*cy/(hiny*hiny) - 1.*ay/hiny; + } + if (nz > 1) + { + values[0] += 2.0*cz/(hinz*hinz) - 1.*az/hinz; + } + } + else if (1 == atype) /* backward scheme for conv */ + { + values[1] = -cx/(hinx*hinx) - ax/hinx; + values[2] = -cy/(hiny*hiny) - ay/hiny; + values[3] = -cz/(hinz*hinz) - az/hinz; + values[4] = -cx/(hinx*hinx); + values[5] = -cy/(hiny*hiny); + values[6] = -cz/(hinz*hinz); + + if (nx > 1) + { + values[0] += 2.0*cx/(hinx*hinx) + 1.*ax/hinx; + } + if (ny > 1) + { + values[0] += 2.0*cy/(hiny*hiny) + 1.*ay/hiny; + } + if (nz > 1) + { + values[0] += 2.0*cz/(hinz*hinz) + 1.*az/hinz; + } + } + else if (3 == atype) /* upwind scheme */ + { + sign_prod = sign_double(cx) * sign_double(ax); + if (sign_prod == 1) /* same sign use back scheme */ + { + values[1] = -cx/(hinx*hinx) - ax/hinx; + values[4] = -cx/(hinx*hinx); + if (nx > 1) + { + values[0] += 2.0*cx/(hinx*hinx) + 1.*ax/hinx; + } + } + else /* diff sign use forward scheme */ + { + values[1] = -cx/(hinx*hinx); + values[4] = -cx/(hinx*hinx) + ax/hinx; + if (nx > 1) + { + values[0] += 2.0*cx/(hinx*hinx) - 1.*ax/hinx; + } + } + + sign_prod = sign_double(cy) * sign_double(ay); + if (sign_prod == 1) /* same sign use back scheme */ + { + values[2] = -cy/(hiny*hiny) - ay/hiny; + values[5] = -cy/(hiny*hiny); + if (ny > 1) + { + values[0] += 2.0*cy/(hiny*hiny) + 1.*ay/hiny; + } + } + else /* diff sign use forward scheme */ + { + values[2] = -cy/(hiny*hiny); + values[5] = -cy/(hiny*hiny) + ay/hiny; + if (ny > 1) + { + values[0] += 2.0*cy/(hiny*hiny) - 1.*ay/hiny; + } + } + + sign_prod = sign_double(cz) * sign_double(az); + if (sign_prod == 1) /* same sign use back scheme */ + { + values[3] = -cz/(hinz*hinz) - az/hinz; + values[6] = -cz/(hinz*hinz); + if (nz > 1) + { + values[0] += 2.0*cz/(hinz*hinz) + 1.*az/hinz; + } + } + else /* diff sign use forward scheme */ + { + values[3] = -cz/(hinz*hinz); + values[6] = -cz/(hinz*hinz) + az/hinz; + if (nz > 1) + { + values[0] += 2.0*cz/(hinz*hinz) - 1.*az/hinz; + } + } + } + else /* centered difference scheme */ + { + values[1] = -cx/(hinx*hinx) - ax/(2.*hinx); + values[2] = -cy/(hiny*hiny) - ay/(2.*hiny); + values[3] = -cz/(hinz*hinz) - az/(2.*hinz); + values[4] = -cx/(hinx*hinx) + ax/(2.*hinx); + values[5] = -cy/(hiny*hiny) + ay/(2.*hiny); + values[6] = -cz/(hinz*hinz) + az/(2.*hinz); + + if (nx > 1) + { + values[0] += 2.0*cx/(hinx*hinx); + } + if (ny > 1) + { + values[0] += 2.0*cy/(hiny*hiny); + } + if (nz > 1) + { + values[0] += 2.0*cz/(hinz*hinz); + } + } + + A = (HYPRE_ParCSRMatrix) GenerateDifConv(hypre_MPI_COMM_WORLD, + nx, ny, nz, P, Q, R, p, q, r, values); + + hypre_TFree(values, HYPRE_MEMORY_HOST); + + *A_ptr = A; + + return (0); +} + +/*---------------------------------------------------------------------- + * Build standard 9-point laplacian in 2D with grid and anisotropy. + * Parameters given in command line. + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParLaplacian9pt( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_ParCSRMatrix *A_ptr ) +{ + HYPRE_Int nx, ny; + HYPRE_Int P, Q; + + HYPRE_ParCSRMatrix A; + + HYPRE_Int num_procs, myid; + HYPRE_Int p, q; + HYPRE_Real *values; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Set defaults + *-----------------------------------------------------------*/ + + nx = 10; + ny = 10; + + P = 1; + Q = num_procs; + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + arg_index = 0; + while (arg_index < argc) + { + if ( strcmp(argv[arg_index], "-n") == 0 ) + { + arg_index++; + nx = atoi(argv[arg_index++]); + ny = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-P") == 0 ) + { + arg_index++; + P = atoi(argv[arg_index++]); + Q = atoi(argv[arg_index++]); + } + else + { + arg_index++; + } + } + + /*----------------------------------------------------------- + * Check a few things + *-----------------------------------------------------------*/ + + if ((P*Q) != num_procs) + { + hypre_printf("Error: Invalid number of processors or processor topology \n"); + exit(1); + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + hypre_printf(" Laplacian 9pt:\n"); + hypre_printf(" (nx, ny) = (%d, %d)\n", nx, ny); + hypre_printf(" (Px, Py) = (%d, %d)\n\n", P, Q); + } + + /*----------------------------------------------------------- + * Set up the grid structure + *-----------------------------------------------------------*/ + + /* compute p,q from P,Q and myid */ + p = myid % P; + q = ( myid - p)/P; + + /*----------------------------------------------------------- + * Generate the matrix + *-----------------------------------------------------------*/ + + values = hypre_CTAlloc(HYPRE_Real, 2, HYPRE_MEMORY_HOST); + + values[1] = -1.; + + values[0] = 0.; + if (nx > 1) + { + values[0] += 2.0; + } + if (ny > 1) + { + values[0] += 2.0; + } + if (nx > 1 && ny > 1) + { + values[0] += 4.0; + } + + A = (HYPRE_ParCSRMatrix) GenerateLaplacian9pt(hypre_MPI_COMM_WORLD, + nx, ny, P, Q, p, q, values); + + hypre_TFree(values, HYPRE_MEMORY_HOST); + + *A_ptr = A; + + return (0); +} +/*---------------------------------------------------------------------- + * Build 27-point laplacian in 3D, + * Parameters given in command line. + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParLaplacian27pt( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_ParCSRMatrix *A_ptr ) +{ + HYPRE_Int nx, ny, nz; + HYPRE_Int P, Q, R; + + HYPRE_ParCSRMatrix A; + + HYPRE_Int num_procs, myid; + HYPRE_Int p, q, r; + HYPRE_Real *values; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Set defaults + *-----------------------------------------------------------*/ + + nx = 10; + ny = 10; + nz = 10; + + P = 1; + Q = num_procs; + R = 1; + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + arg_index = 0; + while (arg_index < argc) + { + if ( strcmp(argv[arg_index], "-n") == 0 ) + { + arg_index++; + nx = atoi(argv[arg_index++]); + ny = atoi(argv[arg_index++]); + nz = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-P") == 0 ) + { + arg_index++; + P = atoi(argv[arg_index++]); + Q = atoi(argv[arg_index++]); + R = atoi(argv[arg_index++]); + } + else + { + arg_index++; + } + } + + /*----------------------------------------------------------- + * Check a few things + *-----------------------------------------------------------*/ + + if ((P*Q*R) != num_procs) + { + hypre_printf("Error: Invalid number of processors or processor topology \n"); + exit(1); + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + hypre_printf(" Laplacian_27pt:\n"); + hypre_printf(" (nx, ny, nz) = (%d, %d, %d)\n", nx, ny, nz); + hypre_printf(" (Px, Py, Pz) = (%d, %d, %d)\n\n", P, Q, R); + } + + /*----------------------------------------------------------- + * Set up the grid structure + *-----------------------------------------------------------*/ + + /* compute p,q,r from P,Q,R and myid */ + p = myid % P; + q = (( myid - p)/P) % Q; + r = ( myid - p - P*q)/( P*Q ); + + /*----------------------------------------------------------- + * Generate the matrix + *-----------------------------------------------------------*/ + + values = hypre_CTAlloc(HYPRE_Real, 2, HYPRE_MEMORY_HOST); + + values[0] = 26.0; + if (nx == 1 || ny == 1 || nz == 1) + values[0] = 8.0; + if (nx*ny == 1 || nx*nz == 1 || ny*nz == 1) + values[0] = 2.0; + values[1] = -1.; + + A = (HYPRE_ParCSRMatrix) GenerateLaplacian27pt(hypre_MPI_COMM_WORLD, + nx, ny, nz, P, Q, R, p, q, r, values); + + hypre_TFree(values, HYPRE_MEMORY_HOST); + + *A_ptr = A; + + return (0); +} + + +/*---------------------------------------------------------------------- + * Build 7-point in 2D + * Parameters given in command line. + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParRotate7pt( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_ParCSRMatrix *A_ptr ) +{ + HYPRE_Int nx, ny; + HYPRE_Int P, Q; + + HYPRE_ParCSRMatrix A; + + HYPRE_Int num_procs, myid; + HYPRE_Int p, q; + HYPRE_Real eps, alpha; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Set defaults + *-----------------------------------------------------------*/ + + nx = 10; + ny = 10; + + P = 1; + Q = num_procs; + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + arg_index = 0; + while (arg_index < argc) + { + if ( strcmp(argv[arg_index], "-n") == 0 ) + { + arg_index++; + nx = atoi(argv[arg_index++]); + ny = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-P") == 0 ) + { + arg_index++; + P = atoi(argv[arg_index++]); + Q = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-alpha") == 0 ) + { + arg_index++; + alpha = atof(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-eps") == 0 ) + { + arg_index++; + eps = atof(argv[arg_index++]); + } + else + { + arg_index++; + } + } + + /*----------------------------------------------------------- + * Check a few things + *-----------------------------------------------------------*/ + + if ((P*Q) != num_procs) + { + hypre_printf("Error: Invalid number of processors or processor topology \n"); + exit(1); + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + hypre_printf(" Rotate 7pt:\n"); + hypre_printf(" alpha = %f, eps = %f\n", alpha,eps); + hypre_printf(" (nx, ny) = (%d, %d)\n", nx, ny); + hypre_printf(" (Px, Py) = (%d, %d)\n", P, Q); + } + + /*----------------------------------------------------------- + * Set up the grid structure + *-----------------------------------------------------------*/ + + /* compute p,q from P,Q and myid */ + p = myid % P; + q = ( myid - p)/P; + + /*----------------------------------------------------------- + * Generate the matrix + *-----------------------------------------------------------*/ + + A = (HYPRE_ParCSRMatrix) GenerateRotate7pt(hypre_MPI_COMM_WORLD, + nx, ny, P, Q, p, q, alpha, eps); + + *A_ptr = A; + + return (0); +} + +/*---------------------------------------------------------------------- + * Build standard 7-point difference operator using centered differences + * + * eps*(a(x,y,z) ux)x + (b(x,y,z) uy)y + (c(x,y,z) uz)z + * d(x,y,z) ux + e(x,y,z) uy + f(x,y,z) uz + g(x,y,z) u + * + * functions a,b,c,d,e,f,g need to be defined inside par_vardifconv.c + * + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParVarDifConv( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_ParCSRMatrix *A_ptr , + HYPRE_ParVector *rhs_ptr ) +{ + HYPRE_Int nx, ny, nz; + HYPRE_Int P, Q, R; + + HYPRE_ParCSRMatrix A; + HYPRE_ParVector rhs; + + HYPRE_Int num_procs, myid; + HYPRE_Int p, q, r; + HYPRE_Int type; + HYPRE_Real eps; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Set defaults + *-----------------------------------------------------------*/ + + nx = 10; + ny = 10; + nz = 10; + P = 1; + Q = num_procs; + R = 1; + eps = 1.0; + + /* type: 0 : default FD; + * 1-3 : FD and examples 1-3 in Ruge-Stuben paper */ + type = 0; + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + arg_index = 0; + while (arg_index < argc) + { + if ( strcmp(argv[arg_index], "-n") == 0 ) + { + arg_index++; + nx = atoi(argv[arg_index++]); + ny = atoi(argv[arg_index++]); + nz = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-P") == 0 ) + { + arg_index++; + P = atoi(argv[arg_index++]); + Q = atoi(argv[arg_index++]); + R = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-eps") == 0 ) + { + arg_index++; + eps = atof(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-vardifconvRS") == 0 ) + { + arg_index++; + type = atoi(argv[arg_index++]); + } + else + { + arg_index++; + } + } + + /*----------------------------------------------------------- + * Check a few things + *-----------------------------------------------------------*/ + + if ((P*Q*R) != num_procs) + { + hypre_printf("Error: Invalid number of processors or processor topology \n"); + exit(1); + } + + /*----------------------------------------------------------- + * Print driver parameters + *-----------------------------------------------------------*/ + + if (myid == 0) + { + hypre_printf(" ell PDE: eps = %f\n", eps); + hypre_printf(" Dx(aDxu) + Dy(bDyu) + Dz(cDzu) + d Dxu + e Dyu + f Dzu + g u= f\n"); + hypre_printf(" (nx, ny, nz) = (%d, %d, %d)\n", nx, ny, nz); + hypre_printf(" (Px, Py, Pz) = (%d, %d, %d)\n", P, Q, R); + } + /*----------------------------------------------------------- + * Set up the grid structure + *-----------------------------------------------------------*/ + + /* compute p,q,r from P,Q,R and myid */ + p = myid % P; + q = (( myid - p)/P) % Q; + r = ( myid - p - P*q)/( P*Q ); + + /*----------------------------------------------------------- + * Generate the matrix + *-----------------------------------------------------------*/ + + if (0 == type) + { + A = (HYPRE_ParCSRMatrix) GenerateVarDifConv(hypre_MPI_COMM_WORLD, + nx, ny, nz, P, Q, R, p, q, r, eps, &rhs); + } + else + { + A = (HYPRE_ParCSRMatrix) GenerateRSVarDifConv(hypre_MPI_COMM_WORLD, + nx, ny, nz, P, Q, R, p, q, r, eps, &rhs, + type); + } + + *A_ptr = A; + *rhs_ptr = rhs; + + return (0); +} + +/**************************************************************************/ + + +HYPRE_Int SetSysVcoefValues(HYPRE_Int num_fun, HYPRE_Int nx, HYPRE_Int ny, HYPRE_Int nz, HYPRE_Real vcx, + HYPRE_Real vcy, HYPRE_Real vcz, HYPRE_Int mtx_entry, HYPRE_Real *values) +{ + + + HYPRE_Int sz = num_fun*num_fun; + + values[1*sz + mtx_entry] = -vcx; + values[2*sz + mtx_entry] = -vcy; + values[3*sz + mtx_entry] = -vcz; + values[0*sz + mtx_entry] = 0.0; + + if (nx > 1) + { + values[0*sz + mtx_entry] += 2.0*vcx; + } + if (ny > 1) + { + values[0*sz + mtx_entry] += 2.0*vcy; + } + if (nz > 1) + { + values[0*sz + mtx_entry] += 2.0*vcz; + } + + return 0; + +} + +/*---------------------------------------------------------------------- + * Build coordinates for 1D/2D/3D + *----------------------------------------------------------------------*/ + +HYPRE_Int +BuildParCoordinates( HYPRE_Int argc, + char *argv[], + HYPRE_Int arg_index, + HYPRE_Int *coorddim_ptr, + float **coord_ptr ) +{ + HYPRE_Int nx, ny, nz; + HYPRE_Int P, Q, R; + + HYPRE_Int num_procs, myid; + HYPRE_Int p, q, r; + + HYPRE_Int coorddim; + float *coordinates; + + /*----------------------------------------------------------- + * Initialize some stuff + *-----------------------------------------------------------*/ + + hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs ); + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); + + /*----------------------------------------------------------- + * Set defaults + *-----------------------------------------------------------*/ + + nx = 10; + ny = 10; + nz = 10; + + P = 1; + Q = num_procs; + R = 1; + + /*----------------------------------------------------------- + * Parse command line + *-----------------------------------------------------------*/ + arg_index = 0; + while (arg_index < argc) + { + if ( strcmp(argv[arg_index], "-n") == 0 ) + { + arg_index++; + nx = atoi(argv[arg_index++]); + ny = atoi(argv[arg_index++]); + nz = atoi(argv[arg_index++]); + } + else if ( strcmp(argv[arg_index], "-P") == 0 ) + { + arg_index++; + P = atoi(argv[arg_index++]); + Q = atoi(argv[arg_index++]); + R = atoi(argv[arg_index++]); + } + else + { + arg_index++; + } + } + + /* compute p,q,r from P,Q,R and myid */ + p = myid % P; + q = (( myid - p)/P) % Q; + r = ( myid - p - P*q)/( P*Q ); + + /*----------------------------------------------------------- + * Generate the coordinates + *-----------------------------------------------------------*/ + + coorddim = 3; + if (nx<2) coorddim--; + if (ny<2) coorddim--; + if (nz<2) coorddim--; + + if (coorddim>0) + coordinates = GenerateCoordinates (hypre_MPI_COMM_WORLD, + nx, ny, nz, P, Q, R, p, q, r, coorddim); + else + coordinates=NULL; + + *coorddim_ptr = coorddim; + *coord_ptr = coordinates; + return (0); +} + diff -Nru hypre-2.16.0/src/test/ij_mv.c hypre-2.18.2/src/test/ij_mv.c --- hypre-2.16.0/src/test/ij_mv.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/ij_mv.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*-------------------------------------------------------------------------- * Test driver for unstructured matrix-vector interface. diff -Nru hypre-2.16.0/src/test/Makefile hypre-2.18.2/src/test/Makefile --- hypre-2.16.0/src/test/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) default:all @@ -81,7 +74,6 @@ zboxloop.c HYPRE_DRIVERS_CXX =\ - fei.cxx\ cxx_ij.cxx\ cxx_sstruct.cxx\ cxx_struct.cxx @@ -172,6 +164,14 @@ @echo "Building" $@ "... " ${LINK_CC} -o $@ $@.o ${LFLAGS} +ij_device: ij_device.o + @echo "Building" $@ "... " + ${LINK_CC} -o $@ $@.o ${LFLAGS} + +ij_mm: ij_mm.o + @echo "Building" $@ "... " + ${LINK_CC} -o $@ $@.o ${LFLAGS} + zboxloop: zboxloop.o @echo "Building" $@ "... " ${LINK_CC} -o $@ $@.o ${LFLAGS} diff -Nru hypre-2.16.0/src/test/maxwell_unscaled.c hypre-2.18.2/src/test/maxwell_unscaled.c --- hypre-2.16.0/src/test/maxwell_unscaled.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/maxwell_unscaled.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/test/new_ij.c hypre-2.18.2/src/test/new_ij.c --- hypre-2.16.0/src/test/new_ij.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/new_ij.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*-------------------------------------------------------------------------- * Test driver for unstructured matrix interface (IJ_matrix interface). diff -Nru hypre-2.16.0/src/test/runcheck.sh hypre-2.18.2/src/test/runcheck.sh --- hypre-2.16.0/src/test/runcheck.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/runcheck.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + # example call # ./runcheck.sh fname.out fname.saved 1.0e-6 1.0e-6 diff -Nru hypre-2.16.0/src/test/runtest.sh hypre-2.18.2/src/test/runtest.sh --- hypre-2.16.0/src/test/runtest.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/runtest.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + # global variables BatchMode=0 diff -Nru hypre-2.16.0/src/test/sstruct.c hypre-2.18.2/src/test/sstruct.c --- hypre-2.16.0/src/test/sstruct.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/sstruct.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include @@ -2213,7 +2208,7 @@ hypre_printf(" 78 - Flexible GMRES with diagonal scaling\n"); hypre_printf(" 80 - Flexible GMRES with BoomerAMG precond\n"); hypre_printf(" 90 - LGMRES with BoomerAMG precond\n"); - hypre_printf(" 120- PCG with hybrid precond\n"); + hypre_printf(" 120- ParCSRHybrid with DSCG/BoomerAMG precond\n"); hypre_printf(" 150- AMS solver\n"); hypre_printf(" 200- Struct SMG\n"); hypre_printf(" 201- Struct PFMG\n"); @@ -2247,6 +2242,11 @@ hypre_printf(" -rhsfromcosine : solution is cosine function (default)\n"); hypre_printf(" -rhsone : rhs is vector with unit components\n"); hypre_printf(" -tol : convergence tolerance (default 1e-6)\n"); + hypre_printf(" -solver_type : Solver type for Hybrid\n"); + hypre_printf(" 1 - PCG (default)\n"); + hypre_printf(" 2 - GMRES\n"); + hypre_printf(" 3 - BiCGSTAB (only ParCSRHybrid)\n"); + hypre_printf(" -recompute : Recompute residual in PCG?\n"); hypre_printf(" -v : SysPFMG and Struct- # of pre and post relax\n"); hypre_printf(" -skip : SysPFMG and Struct- skip relaxation (0 or 1)\n"); hypre_printf(" -rap : Struct- coarse grid operator type\n"); @@ -2260,9 +2260,6 @@ hypre_printf(" 3 - R/B Gauss-Seidel (nonsymmetric)\n"); hypre_printf(" -w : jacobi weight\n"); hypre_printf(" -jump : Struct- num levels to jump in SparseMSG\n"); - hypre_printf(" -solver_type : Struct- solver type for Hybrid\n"); - hypre_printf(" 1 - PCG (default)\n"); - hypre_printf(" 2 - GMRES\n"); hypre_printf(" -cf : Struct- convergence factor for Hybrid\n"); hypre_printf(" -crtdim : Struct- cyclic reduction tdim\n"); hypre_printf(" -cri : Struct- cyclic reduction base_index\n"); @@ -2376,6 +2373,7 @@ HYPRE_Int usr_jacobi_weight; HYPRE_Int jump; HYPRE_Int solver_type; + HYPRE_Int recompute_res; HYPRE_Real cf_tol; @@ -2485,6 +2483,7 @@ usr_jacobi_weight= 0; jump = 0; solver_type = 1; + recompute_res = 0; /* What should be the default here? */ cf_tol = 0.90; nparts = global_data.nparts; @@ -2656,6 +2655,11 @@ arg_index++; solver_type = atoi(argv[arg_index++]); } + else if ( strcmp(argv[arg_index], "-recompute") == 0 ) + { + arg_index++; + recompute_res = atoi(argv[arg_index++]); + } else if ( strcmp(argv[arg_index], "-cf") == 0 ) { arg_index++; @@ -3749,6 +3753,7 @@ HYPRE_PCGSetTwoNorm( (HYPRE_Solver) solver, 1 ); HYPRE_PCGSetRelChange( (HYPRE_Solver) solver, 0 ); HYPRE_PCGSetPrintLevel( (HYPRE_Solver) solver, 1 ); + HYPRE_PCGSetRecomputeResidual( (HYPRE_Solver) solver, recompute_res); if ((solver_id == 10) || (solver_id == 11)) { @@ -4230,6 +4235,7 @@ HYPRE_PCGSetTwoNorm( par_solver, 1 ); HYPRE_PCGSetRelChange( par_solver, 0 ); HYPRE_PCGSetPrintLevel( par_solver, 1 ); + HYPRE_PCGSetRecomputeResidual( (HYPRE_Solver) par_solver, recompute_res); if (solver_id == 20) { @@ -4859,6 +4865,8 @@ HYPRE_ParCSRHybridSetRelChange(par_solver, 0); HYPRE_ParCSRHybridSetPrintLevel(par_solver,1); HYPRE_ParCSRHybridSetLogging(par_solver,1); + HYPRE_ParCSRHybridSetSolverType(par_solver, solver_type); + HYPRE_ParCSRHybridSetRecomputeResidual(par_solver, recompute_res); HYPRE_ParCSRHybridSetup(par_solver,par_A,par_b,par_x); hypre_EndTiming(time_index); @@ -5111,6 +5119,7 @@ HYPRE_PCGSetTwoNorm( (HYPRE_Solver)struct_solver, 1 ); HYPRE_PCGSetRelChange( (HYPRE_Solver)struct_solver, 0 ); HYPRE_PCGSetPrintLevel( (HYPRE_Solver)struct_solver, 1 ); + HYPRE_PCGSetRecomputeResidual( (HYPRE_Solver)struct_solver, recompute_res); if (solver_id == 210) { @@ -5269,6 +5278,7 @@ HYPRE_StructHybridSetPrintLevel(struct_solver, 1); HYPRE_StructHybridSetLogging(struct_solver, 1); HYPRE_StructHybridSetSolverType(struct_solver, solver_type); + HYPRE_StructHybridSetRecomputeResidual(struct_solver, recompute_res); if (solver_id == 220) { @@ -5727,6 +5737,80 @@ } /*----------------------------------------------------------- + * Verify GetBoxValues() + *-----------------------------------------------------------*/ + +#if 0 + { + HYPRE_SStructVector xnew; + HYPRE_ParVector par_xnew; + HYPRE_StructVector sxnew; + HYPRE_Real rnorm, bnorm; + + HYPRE_SStructVectorCreate(hypre_MPI_COMM_WORLD, grid, &xnew); + HYPRE_SStructVectorSetObjectType(xnew, object_type); + HYPRE_SStructVectorInitialize(xnew); + + /* get/set replicated shared data */ + values = hypre_TAlloc(HYPRE_Real, data.max_boxsize, HYPRE_MEMORY_HOST); + for (part = 0; part < data.nparts; part++) + { + pdata = data.pdata[part]; + for (var = 0; var < pdata.nvars; var++) + { + for (box = 0; box < pdata.nboxes; box++) + { + GetVariableBox(pdata.ilowers[box], pdata.iuppers[box], + pdata.vartypes[var], ilower, iupper); + HYPRE_SStructVectorGetBoxValues(x, part, ilower, iupper, + var, values); + HYPRE_SStructVectorSetBoxValues(xnew, part, ilower, iupper, + var, values); + } + } + } + hypre_TFree(values, HYPRE_MEMORY_HOST); + + HYPRE_SStructVectorAssemble(xnew); + + /* Compute residual norm - this if/else is due to a bug in SStructMatvec */ + if (object_type == HYPRE_SSTRUCT) + { + HYPRE_SStructInnerProd(b, b, &bnorm); + hypre_SStructMatvec(-1.0, A, xnew, 1.0, b); + HYPRE_SStructInnerProd(b, b, &rnorm); + } + else if (object_type == HYPRE_PARCSR) + { + bnorm = hypre_ParVectorInnerProd(par_b, par_b); + HYPRE_SStructVectorGetObject(xnew, (void **) &par_xnew); + HYPRE_ParCSRMatrixMatvec(-1.0, par_A, par_xnew, 1.0, par_b ); + rnorm = hypre_ParVectorInnerProd(par_b, par_b); + } + else if (object_type == HYPRE_STRUCT) + { + bnorm = hypre_StructInnerProd(sb, sb); + HYPRE_SStructVectorGetObject(xnew, (void **) &sxnew); + hypre_StructMatvec(-1.0, sA, sxnew, 1.0, sb); + rnorm = hypre_StructInnerProd(sb, sb); + } + bnorm = sqrt(bnorm); + rnorm = sqrt(rnorm); + + if (myid == 0) + { + hypre_printf("\n"); + hypre_printf("solver relnorm = %16.14e\n", final_res_norm); + hypre_printf("check relnorm = %16.14e, bnorm = %16.14e, rnorm = %16.14e\n", + (rnorm/bnorm), bnorm, rnorm); + hypre_printf("\n"); + } + + HYPRE_SStructVectorDestroy(xnew); + } +#endif + + /*----------------------------------------------------------- * Finalize things *-----------------------------------------------------------*/ diff -Nru hypre-2.16.0/src/test/sstruct_fac.c hypre-2.18.2/src/test/sstruct_fac.c --- hypre-2.16.0/src/test/sstruct_fac.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/sstruct_fac.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/test/sstruct.in.README hypre-2.18.2/src/test/sstruct.in.README --- hypre-2.16.0/src/test/sstruct.in.README 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/sstruct.in.README 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ############################################################################## # diff -Nru hypre-2.16.0/src/test/struct.c hypre-2.18.2/src/test/struct.c --- hypre-2.16.0/src/test/struct.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/struct.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include @@ -82,6 +77,7 @@ HYPRE_Real conx, cony, conz; HYPRE_Int solver_id; HYPRE_Int solver_type; + HYPRE_Int recompute_res; /*HYPRE_Real dxyz[3];*/ @@ -236,6 +232,7 @@ solver_id = 0; solver_type = 1; + recompute_res = 0; /* What should be the default here? */ istart[0] = -3; istart[1] = -3; @@ -405,6 +402,11 @@ arg_index++; solver_type = atoi(argv[arg_index++]); } + else if ( strcmp(argv[arg_index], "-recompute") == 0 ) + { + arg_index++; + recompute_res = atoi(argv[arg_index++]); + } else if ( strcmp(argv[arg_index], "-cf") == 0 ) { arg_index++; @@ -583,6 +585,7 @@ hypre_printf(" -solver_type : solver type for Hybrid\n"); hypre_printf(" 1 - PCG (default)\n"); hypre_printf(" 2 - GMRES\n"); + hypre_printf(" -recompute : Recompute residual in PCG?\n"); hypre_printf(" -cf : convergence factor for Hybrid\n"); hypre_printf("\n"); @@ -2206,6 +2209,7 @@ HYPRE_StructHybridSetPrintLevel(solver, 1); HYPRE_StructHybridSetLogging(solver, 1); HYPRE_StructHybridSetSolverType(solver, solver_type); + HYPRE_StructHybridSetRecomputeResidual(solver, recompute_res); if (solver_id == 20) { diff -Nru hypre-2.16.0/src/test/struct_migrate.c hypre-2.18.2/src/test/struct_migrate.c --- hypre-2.16.0/src/test/struct_migrate.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/struct_migrate.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/test/struct_newboxloop.c hypre-2.18.2/src/test/struct_newboxloop.c --- hypre-2.16.0/src/test/struct_newboxloop.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/struct_newboxloop.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/test/TEST_ams/solvers.jobs hypre-2.18.2/src/test/TEST_ams/solvers.jobs --- hypre-2.16.0/src/test/TEST_ams/solvers.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ams/solvers.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # ams: Run through solvers diff -Nru hypre-2.16.0/src/test/TEST_ams/solvers.saved hypre-2.18.2/src/test/TEST_ams/solvers.saved --- hypre-2.16.0/src/test/TEST_ams/solvers.saved 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ams/solvers.saved 2019-10-28 22:30:04.000000000 +0000 @@ -57,7 +57,7 @@ # Output file: solvers.out.12 Iterations = 18 -Final Relative Residual Norm = 3.850011e-03 +Final Relative Residual Norm = 4.223622e-03 # Output file: solvers.out.8 diff -Nru hypre-2.16.0/src/test/TEST_ams/solvers.sh hypre-2.18.2/src/test/TEST_ams/solvers.sh --- hypre-2.16.0/src/test/TEST_ams/solvers.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ams/solvers.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_examples/bigint.jobs hypre-2.18.2/src/test/TEST_examples/bigint.jobs --- hypre-2.16.0/src/test/TEST_examples/bigint.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_examples/bigint.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # Run bigint examples diff -Nru hypre-2.16.0/src/test/TEST_examples/bigint.saved hypre-2.18.2/src/test/TEST_examples/bigint.saved --- hypre-2.16.0/src/test/TEST_examples/bigint.saved 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_examples/bigint.saved 2019-10-28 22:30:04.000000000 +0000 @@ -2,45 +2,45 @@ Operator Matrix Information: - nonzero entries per row row sums -lev rows entries sparse min max avg min max -=================================================================== - 0 1089 5313 0.004 3 5 4.9 0.000e+00 2.000e+00 - 1 545 4641 0.016 4 9 8.5 0.000e+00 2.500e+00 - 2 157 1535 0.062 4 14 9.8 -4.233e-16 3.020e+00 - 3 57 773 0.238 4 21 13.6 7.589e-17 3.294e+00 - 4 19 251 0.695 8 18 13.2 9.852e-02 2.814e+00 - 5 6 36 1.000 6 6 6.0 1.232e+00 1.875e+00 + nonzero entries/row row sums +lev rows entries sparse min max avg min max +====================================================================== + 0 1089 5313 0.004 3 5 4.9 0.000e+00 2.000e+00 + 1 545 4641 0.016 4 9 8.5 0.000e+00 2.500e+00 + 2 157 1535 0.062 4 14 9.8 -4.233e-16 3.020e+00 + 3 57 773 0.238 4 21 13.6 7.589e-17 3.294e+00 + 4 19 251 0.695 8 18 13.2 9.852e-02 2.814e+00 + 5 6 36 1.000 6 6 6.0 1.232e+00 1.875e+00 Interpolation Matrix Information: - entries/row min max row sums -lev rows cols min max weight weight min max -================================================================= - 0 1089 x 545 1 4 2.500e-01 2.500e-01 7.500e-01 1.000e+00 - 1 545 x 157 1 4 7.143e-02 5.000e-01 2.857e-01 1.000e+00 - 2 157 x 57 1 6 2.767e-02 5.489e-01 2.630e-01 1.000e+00 - 3 57 x 19 0 5 1.892e-02 7.312e-01 0.000e+00 1.000e+00 - 4 19 x 6 0 4 2.675e-02 4.155e-01 0.000e+00 1.000e+00 + entries/row min max row sums +lev rows x cols min max avgW weight weight min max +================================================================================ + 0 1089 x 545 1 4 3.9 2.500e-01 2.500e-01 7.500e-01 1.000e+00 + 1 545 x 157 1 4 2.8 7.143e-02 5.000e-01 2.857e-01 1.000e+00 + 2 157 x 57 1 6 3.1 2.767e-02 5.489e-01 2.630e-01 1.000e+00 + 3 57 x 19 0 5 2.4 1.892e-02 7.312e-01 0.000e+00 1.000e+00 + 4 19 x 6 0 4 2.2 2.675e-02 4.155e-01 0.000e+00 1.000e+00 Complexity: grid = 1.719927 operator = 2.361942 - memory = 3.194052 + memory = 3.194052 BoomerAMG SOLVER PARAMETERS: - Maximum number of cycles: 20 - Stopping Tolerance: 1.000000e-07 + Maximum number of cycles: 20 + Stopping Tolerance: 1.000000e-07 Cycle type (1 = V, 2 = W, etc.): 1 Relaxation Parameters: Visiting Grid: down up coarse - Number of sweeps: 1 1 1 - Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: 3 3 9 + Number of sweeps: 1 1 1 + Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: 3 3 9 Point types, partial sweeps (1=C, -1=F): Pre-CG relaxation (down): 1 -1 Post-CG relaxation (up): -1 1 @@ -50,20 +50,20 @@ BoomerAMG SOLVER PARAMETERS: - Maximum number of cycles: 20 - Stopping Tolerance: 1.000000e-07 + Maximum number of cycles: 20 + Stopping Tolerance: 1.000000e-07 Cycle type (1 = V, 2 = W, etc.): 1 Relaxation Parameters: Visiting Grid: down up coarse - Number of sweeps: 1 1 1 - Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: 3 3 9 + Number of sweeps: 1 1 1 + Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: 3 3 9 Point types, partial sweeps (1=C, -1=F): Pre-CG relaxation (down): 1 -1 Post-CG relaxation (up): -1 1 Coarsest grid: 0 - Output flag (print_level): 3 + Output flag (print_level): 3 AMG SOLUTION INFO: @@ -71,13 +71,13 @@ residual factor residual -------- ------ -------- Initial 2.854671e-02 1.000000e+00 - Cycle 1 2.995663e-03 0.104939 1.049390e-01 - Cycle 2 1.941234e-04 0.064801 6.800200e-03 - Cycle 3 1.245674e-05 0.064169 4.363634e-04 - Cycle 4 7.816537e-07 0.062749 2.738157e-05 - Cycle 5 4.829130e-08 0.061781 1.691659e-06 - Cycle 6 2.956748e-09 0.061227 1.035758e-07 - Cycle 7 1.801266e-10 0.060921 6.309890e-09 + Cycle 1 2.995663e-03 0.104939 1.049390e-01 + Cycle 2 1.941234e-04 0.064801 6.800200e-03 + Cycle 3 1.245674e-05 0.064169 4.363634e-04 + Cycle 4 7.816537e-07 0.062749 2.738157e-05 + Cycle 5 4.829130e-08 0.061781 1.691659e-06 + Cycle 6 2.956748e-09 0.061227 1.035758e-07 + Cycle 7 1.801266e-10 0.060921 6.309890e-09 Average Convergence Factor = 0.067387 @@ -117,7 +117,7 @@ Iters ||r||_C conv.rate ||r||_C/||b||_C ------ ------------ --------- ------------ +----- ------------ --------- ------------ 1 2.820328e-02 0.097467 9.746663e-02 2 1.245772e-03 0.044171 4.305215e-03 3 9.147965e-05 0.073432 3.161410e-04 diff -Nru hypre-2.16.0/src/test/TEST_examples/bigint.sh hypre-2.18.2/src/test/TEST_examples/bigint.sh --- hypre-2.16.0/src/test/TEST_examples/bigint.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_examples/bigint.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` diff -Nru hypre-2.16.0/src/test/TEST_examples/complex.jobs hypre-2.18.2/src/test/TEST_examples/complex.jobs --- hypre-2.16.0/src/test/TEST_examples/complex.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_examples/complex.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # Run complex examples diff -Nru hypre-2.16.0/src/test/TEST_examples/complex.sh hypre-2.18.2/src/test/TEST_examples/complex.sh --- hypre-2.16.0/src/test/TEST_examples/complex.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_examples/complex.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # EXAMPLES: Compare ex*.base files with complex.out.* files from current runs diff -Nru hypre-2.16.0/src/test/TEST_examples/default.jobs hypre-2.18.2/src/test/TEST_examples/default.jobs --- hypre-2.16.0/src/test/TEST_examples/default.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_examples/default.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # Run each example @@ -35,8 +28,6 @@ mpirun -np 16 ./ex9 -n 33 -solver 0 -v 1 1 > default.out.9 -mpirun -np 4 ./ex10 -n 120 -solver 2 > default.out.10 - mpirun -np 4 ./ex11 > default.out.11 mpirun -np 2 ./ex12 -pfmg > default.out.12 diff -Nru hypre-2.16.0/src/test/TEST_examples/default.saved hypre-2.18.2/src/test/TEST_examples/default.saved --- hypre-2.16.0/src/test/TEST_examples/default.saved 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_examples/default.saved 2019-10-28 22:30:04.000000000 +0000 @@ -3,7 +3,7 @@ Iters ||r||_C conv.rate ||r||_C/||b||_C ------ ------------ --------- ------------ +----- ------------ --------- ------------ 1 2.509980e+00 0.591608 5.916080e-01 2 9.888265e-01 0.393958 2.330686e-01 3 4.572262e-01 0.462393 1.077693e-01 @@ -24,7 +24,7 @@ Iters ||r||_C conv.rate ||r||_C/||b||_C ------ ------------ --------- ------------ +----- ------------ --------- ------------ 1 3.503257e-02 0.004729 4.728807e-03 2 1.386843e-04 0.003959 1.872005e-05 3 8.429961e-07 0.006079 1.137903e-07 @@ -35,7 +35,7 @@ Iters ||r||_2 conv.rate ||r||_2/||b||_2 ------ ------------ --------- ------------ +----- ------------ --------- ------------ 1 2.168867e-03 0.290645 2.906446e-01 2 8.424332e-05 0.038842 1.128924e-02 3 1.941992e-06 0.023052 2.602417e-04 @@ -61,7 +61,7 @@ Iters ||r||_2 conv.rate ||r||_2/||b||_2 ------ ------------ --------- ------------ +----- ------------ --------- ------------ 1 2.449562e-03 0.323361 3.233611e-01 2 1.589475e-04 0.064888 2.098229e-02 3 6.225562e-06 0.039167 8.218220e-04 @@ -87,45 +87,45 @@ Operator Matrix Information: - nonzero entries per row row sums -lev rows entries sparse min max avg min max -=================================================================== - 0 1089 5313 0.004 3 5 4.9 0.000e+00 2.000e+00 - 1 545 4641 0.016 4 9 8.5 0.000e+00 2.500e+00 - 2 157 1535 0.062 4 14 9.8 -4.233e-16 3.020e+00 - 3 57 773 0.238 4 21 13.6 7.589e-17 3.294e+00 - 4 19 251 0.695 8 18 13.2 9.852e-02 2.814e+00 - 5 6 36 1.000 6 6 6.0 1.232e+00 1.875e+00 + nonzero entries/row row sums +lev rows entries sparse min max avg min max +====================================================================== + 0 1089 5313 0.004 3 5 4.9 0.000e+00 2.000e+00 + 1 545 4641 0.016 4 9 8.5 0.000e+00 2.500e+00 + 2 157 1535 0.062 4 14 9.8 -4.233e-16 3.020e+00 + 3 57 773 0.238 4 21 13.6 7.589e-17 3.294e+00 + 4 19 251 0.695 8 18 13.2 9.852e-02 2.814e+00 + 5 6 36 1.000 6 6 6.0 1.232e+00 1.875e+00 Interpolation Matrix Information: - entries/row min max row sums -lev rows cols min max weight weight min max -================================================================= - 0 1089 x 545 1 4 2.500e-01 2.500e-01 7.500e-01 1.000e+00 - 1 545 x 157 1 4 7.143e-02 5.000e-01 2.857e-01 1.000e+00 - 2 157 x 57 1 6 2.767e-02 5.489e-01 2.630e-01 1.000e+00 - 3 57 x 19 0 5 1.892e-02 7.312e-01 0.000e+00 1.000e+00 - 4 19 x 6 0 4 2.675e-02 4.155e-01 0.000e+00 1.000e+00 + entries/row min max row sums +lev rows x cols min max avgW weight weight min max +================================================================================ + 0 1089 x 545 1 4 3.9 2.500e-01 2.500e-01 7.500e-01 1.000e+00 + 1 545 x 157 1 4 2.8 7.143e-02 5.000e-01 2.857e-01 1.000e+00 + 2 157 x 57 1 6 3.1 2.767e-02 5.489e-01 2.630e-01 1.000e+00 + 3 57 x 19 0 5 2.4 1.892e-02 7.312e-01 0.000e+00 1.000e+00 + 4 19 x 6 0 4 2.2 2.675e-02 4.155e-01 0.000e+00 1.000e+00 Complexity: grid = 1.719927 operator = 2.361942 - memory = 3.194052 + memory = 3.194052 BoomerAMG SOLVER PARAMETERS: - Maximum number of cycles: 20 - Stopping Tolerance: 1.000000e-07 + Maximum number of cycles: 20 + Stopping Tolerance: 1.000000e-07 Cycle type (1 = V, 2 = W, etc.): 1 Relaxation Parameters: Visiting Grid: down up coarse - Number of sweeps: 1 1 1 - Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: 3 3 9 + Number of sweeps: 1 1 1 + Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: 3 3 9 Point types, partial sweeps (1=C, -1=F): Pre-CG relaxation (down): 1 -1 Post-CG relaxation (up): -1 1 @@ -135,20 +135,20 @@ BoomerAMG SOLVER PARAMETERS: - Maximum number of cycles: 20 - Stopping Tolerance: 1.000000e-07 + Maximum number of cycles: 20 + Stopping Tolerance: 1.000000e-07 Cycle type (1 = V, 2 = W, etc.): 1 Relaxation Parameters: Visiting Grid: down up coarse - Number of sweeps: 1 1 1 - Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: 3 3 9 + Number of sweeps: 1 1 1 + Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: 3 3 9 Point types, partial sweeps (1=C, -1=F): Pre-CG relaxation (down): 1 -1 Post-CG relaxation (up): -1 1 Coarsest grid: 0 - Output flag (print_level): 3 + Output flag (print_level): 3 AMG SOLUTION INFO: @@ -156,13 +156,13 @@ residual factor residual -------- ------ -------- Initial 2.854671e-02 1.000000e+00 - Cycle 1 2.995663e-03 0.104939 1.049390e-01 - Cycle 2 1.941234e-04 0.064801 6.800200e-03 - Cycle 3 1.245674e-05 0.064169 4.363634e-04 - Cycle 4 7.816537e-07 0.062749 2.738157e-05 - Cycle 5 4.829130e-08 0.061781 1.691659e-06 - Cycle 6 2.956748e-09 0.061227 1.035758e-07 - Cycle 7 1.801266e-10 0.060921 6.309890e-09 + Cycle 1 2.995663e-03 0.104939 1.049390e-01 + Cycle 2 1.941234e-04 0.064801 6.800200e-03 + Cycle 3 1.245674e-05 0.064169 4.363634e-04 + Cycle 4 7.816537e-07 0.062749 2.738157e-05 + Cycle 5 4.829130e-08 0.061781 1.691659e-06 + Cycle 6 2.956748e-09 0.061227 1.035758e-07 + Cycle 7 1.801266e-10 0.060921 6.309890e-09 Average Convergence Factor = 0.067387 @@ -181,45 +181,45 @@ Operator Matrix Information: - nonzero entries per row row sums -lev rows entries sparse min max avg min max -=================================================================== - 0 1089 5313 0.004 3 5 4.9 0.000e+00 2.000e+00 - 1 545 4641 0.016 4 9 8.5 0.000e+00 2.500e+00 - 2 157 1535 0.062 4 14 9.8 -4.233e-16 3.020e+00 - 3 57 773 0.238 4 21 13.6 7.589e-17 3.294e+00 - 4 19 251 0.695 8 18 13.2 9.852e-02 2.814e+00 - 5 6 36 1.000 6 6 6.0 1.232e+00 1.875e+00 + nonzero entries/row row sums +lev rows entries sparse min max avg min max +====================================================================== + 0 1089 5313 0.004 3 5 4.9 0.000e+00 2.000e+00 + 1 545 4641 0.016 4 9 8.5 0.000e+00 2.500e+00 + 2 157 1535 0.062 4 14 9.8 -4.233e-16 3.020e+00 + 3 57 773 0.238 4 21 13.6 7.589e-17 3.294e+00 + 4 19 251 0.695 8 18 13.2 9.852e-02 2.814e+00 + 5 6 36 1.000 6 6 6.0 1.232e+00 1.875e+00 Interpolation Matrix Information: - entries/row min max row sums -lev rows cols min max weight weight min max -================================================================= - 0 1089 x 545 1 4 2.500e-01 2.500e-01 7.500e-01 1.000e+00 - 1 545 x 157 1 4 7.143e-02 5.000e-01 2.857e-01 1.000e+00 - 2 157 x 57 1 6 2.767e-02 5.489e-01 2.630e-01 1.000e+00 - 3 57 x 19 0 5 1.892e-02 7.312e-01 0.000e+00 1.000e+00 - 4 19 x 6 0 4 2.675e-02 4.155e-01 0.000e+00 1.000e+00 + entries/row min max row sums +lev rows x cols min max avgW weight weight min max +================================================================================ + 0 1089 x 545 1 4 3.9 2.500e-01 2.500e-01 7.500e-01 1.000e+00 + 1 545 x 157 1 4 2.8 7.143e-02 5.000e-01 2.857e-01 1.000e+00 + 2 157 x 57 1 6 3.1 2.767e-02 5.489e-01 2.630e-01 1.000e+00 + 3 57 x 19 0 5 2.4 1.892e-02 7.312e-01 0.000e+00 1.000e+00 + 4 19 x 6 0 4 2.2 2.675e-02 4.155e-01 0.000e+00 1.000e+00 Complexity: grid = 1.719927 operator = 2.361942 - memory = 3.194052 + memory = 3.194052 BoomerAMG SOLVER PARAMETERS: - Maximum number of cycles: 20 - Stopping Tolerance: 1.000000e-07 + Maximum number of cycles: 20 + Stopping Tolerance: 1.000000e-07 Cycle type (1 = V, 2 = W, etc.): 1 Relaxation Parameters: Visiting Grid: down up coarse - Number of sweeps: 1 1 1 - Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: 3 3 9 + Number of sweeps: 1 1 1 + Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: 3 3 9 Point types, partial sweeps (1=C, -1=F): Pre-CG relaxation (down): 1 -1 Post-CG relaxation (up): -1 1 @@ -229,20 +229,20 @@ BoomerAMG SOLVER PARAMETERS: - Maximum number of cycles: 20 - Stopping Tolerance: 1.000000e-07 + Maximum number of cycles: 20 + Stopping Tolerance: 1.000000e-07 Cycle type (1 = V, 2 = W, etc.): 1 Relaxation Parameters: Visiting Grid: down up coarse - Number of sweeps: 1 1 1 - Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: 3 3 9 + Number of sweeps: 1 1 1 + Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: 3 3 9 Point types, partial sweeps (1=C, -1=F): Pre-CG relaxation (down): 1 -1 Post-CG relaxation (up): -1 1 Coarsest grid: 0 - Output flag (print_level): 3 + Output flag (print_level): 3 AMG SOLUTION INFO: @@ -250,13 +250,13 @@ residual factor residual -------- ------ -------- Initial 2.854671e-02 1.000000e+00 - Cycle 1 2.995663e-03 0.104939 1.049390e-01 - Cycle 2 1.941234e-04 0.064801 6.800200e-03 - Cycle 3 1.245674e-05 0.064169 4.363634e-04 - Cycle 4 7.816537e-07 0.062749 2.738157e-05 - Cycle 5 4.829130e-08 0.061781 1.691659e-06 - Cycle 6 2.956748e-09 0.061227 1.035758e-07 - Cycle 7 1.801266e-10 0.060921 6.309890e-09 + Cycle 1 2.995663e-03 0.104939 1.049390e-01 + Cycle 2 1.941234e-04 0.064801 6.800200e-03 + Cycle 3 1.245674e-05 0.064169 4.363634e-04 + Cycle 4 7.816537e-07 0.062749 2.738157e-05 + Cycle 5 4.829130e-08 0.061781 1.691659e-06 + Cycle 6 2.956748e-09 0.061227 1.035758e-07 + Cycle 7 1.801266e-10 0.060921 6.309890e-09 Average Convergence Factor = 0.067387 @@ -276,7 +276,7 @@ Iters ||r||_C conv.rate ||r||_C/||b||_C ------ ------------ --------- ------------ +----- ------------ --------- ------------ 1 3.503257e-02 0.004729 4.728807e-03 2 1.386843e-04 0.003959 1.872005e-05 3 8.429961e-07 0.006079 1.137903e-07 @@ -296,7 +296,7 @@ Iters ||r||_2 conv.rate ||r||_2/||b||_2 ------ ------------ --------- ------------ +----- ------------ --------- ------------ 1 2.449562e-03 0.323361 3.233611e-01 2 1.589475e-04 0.064888 2.098229e-02 3 6.225562e-06 0.039167 8.218220e-04 @@ -323,7 +323,7 @@ Iters ||r||_C conv.rate ||r||_C/||b||_C ------ ------------ --------- ------------ +----- ------------ --------- ------------ 1 2.197899e+00 0.373165 3.731645e-01 2 4.545887e-01 0.206829 7.718115e-02 3 1.058488e-01 0.232845 1.797126e-02 @@ -361,76 +361,28 @@ Iterations = 9 Final Relative Residual Norm = 6.57147e-07 -# Output file: default.out.10 -*************************************************** -* Preconditioned Conjugate Gradient solver -* maximum no. of iterations = 100 -* convergence tolerance = 1.000000e-06 -*-------------------------------------------------- -AMG max levels = 30 -AMG coarsen type = 10 -AMG measure type = 0 -AMG threshold = 2.500000e-01 -AMG numsweeps = 1 -AMG relax type = 6 -AMG relax weight = 1.000000e+00 -AMG relax omega = 1.000000e+00 -AMG system size = 1 -AMG smooth type = 0 -AMG smooth numlevels = 0 -AMG smooth numsweeps = 1 -AMG Schwarz variant = 0 -AMG Schwarz overlap = 1 -AMG Schwarz domain type = 2 -AMG Schwarz relax weight = 1.000000e+00 -*************************************************** -: 6.829186e-05 - - -Iters ||r||_2 conv.rate ||r||_2/||b||_2 ------ ------------ --------- ------------ - 1 6.568705e-03 0.794868 7.948685e-01 - 2 2.229023e-03 0.339340 2.697305e-01 - 3 4.395103e-04 0.197176 5.318444e-02 - 4 6.154722e-05 0.140036 7.447730e-03 - 5 9.106693e-06 0.147963 1.101986e-03 - 6 1.448916e-06 0.159105 1.753310e-04 - 7 2.542814e-07 0.175498 3.077019e-05 - 8 3.559798e-08 0.139994 4.307655e-06 - 9 5.739829e-09 0.161240 6.945675e-07 - - -*************************************************** -* Solver Statistics * -*-------------------------------------------------* -** HYPRE preconditioner setup time = 1.199627e-02 -** HYPRE solution time = 1.896429e-02 -** HYPRE total time = 3.096056e-02 -** HYPRE number of iterations = 9 -** HYPRE final residual norm = 5.739829e-09 -*************************************************** # Output file: default.out.11 - 2 132 x 29 0 4 5.687e-03 5.328e-01 0.000e+00 1.000e+00 - 3 29 x 4 1 4 6.881e-03 4.675e-01 7.079e-02 1.000e+00 + 2 132 x 29 0 4 3.5 5.687e-03 5.328e-01 0.000e+00 1.000e+00 + 3 29 x 4 1 4 2.7 6.881e-03 4.675e-01 7.079e-02 1.000e+00 Complexity: grid = 1.651974 operator = 2.383776 - memory = 3.295125 + memory = 3.295125 BoomerAMG SOLVER PARAMETERS: - Maximum number of cycles: 1 - Stopping Tolerance: 0.000000e+00 + Maximum number of cycles: 1 + Stopping Tolerance: 0.000000e+00 Cycle type (1 = V, 2 = W, etc.): 1 Relaxation Parameters: Visiting Grid: down up coarse - Number of sweeps: 2 2 1 - Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: 13 14 9 + Number of sweeps: 2 2 1 + Type 0=Jac, 3=hGS, 6=hSGS, 9=GE: 13 14 9 Point types, partial sweeps (1=C, -1=F): Pre-CG relaxation (down): 0 0 Post-CG relaxation (up): 0 0 @@ -508,7 +460,7 @@ Iters ||r||_C conv.rate ||r||_C/||b||_C ------ ------------ --------- ------------ +----- ------------ --------- ------------ 1 2.267211e-01 0.040016 4.001582e-02 2 3.255341e-03 0.014358 5.745609e-04 3 6.649011e-05 0.020425 1.173537e-05 @@ -520,7 +472,7 @@ Iters ||r||_C conv.rate ||r||_C/||b||_C ------ ------------ --------- ------------ +----- ------------ --------- ------------ 1 2.267211e-01 0.040016 4.001582e-02 2 3.255341e-03 0.014358 5.745609e-04 3 6.649011e-05 0.020425 1.173537e-05 @@ -535,14 +487,14 @@ residual factor residual -------- ------ -------- Initial 2.334657e-01 1.000000e+00 - Cycle 1 3.447912e-02 0.147684 1.476839e-01 - Cycle 2 5.073235e-03 0.147139 2.173011e-02 - Cycle 3 7.530408e-04 0.148434 3.225487e-03 - Cycle 4 1.131421e-04 0.150247 4.846199e-04 - Cycle 5 1.713572e-05 0.151453 7.339717e-05 - Cycle 6 2.620347e-06 0.152917 1.122369e-05 - Cycle 7 4.055800e-07 0.154781 1.737214e-06 - Cycle 8 6.362639e-08 0.156878 2.725299e-07 + Cycle 1 3.447912e-02 0.147684 1.476839e-01 + Cycle 2 5.073235e-03 0.147139 2.173011e-02 + Cycle 3 7.530408e-04 0.148434 3.225487e-03 + Cycle 4 1.131421e-04 0.150247 4.846199e-04 + Cycle 5 1.713572e-05 0.151453 7.339717e-05 + Cycle 6 2.620347e-06 0.152917 1.122369e-05 + Cycle 7 4.055800e-07 0.154781 1.737214e-06 + Cycle 8 6.362639e-08 0.156878 2.725299e-07 Average Convergence Factor = 0.151156 @@ -565,14 +517,14 @@ residual factor residual -------- ------ -------- Initial 2.334657e-01 1.000000e+00 - Cycle 1 3.447912e-02 0.147684 1.476839e-01 - Cycle 2 5.073235e-03 0.147139 2.173011e-02 - Cycle 3 7.530408e-04 0.148434 3.225487e-03 - Cycle 4 1.131421e-04 0.150247 4.846199e-04 - Cycle 5 1.713572e-05 0.151453 7.339717e-05 - Cycle 6 2.620347e-06 0.152917 1.122369e-05 - Cycle 7 4.055800e-07 0.154781 1.737214e-06 - Cycle 8 6.362639e-08 0.156878 2.725299e-07 + Cycle 1 3.447912e-02 0.147684 1.476839e-01 + Cycle 2 5.073235e-03 0.147139 2.173011e-02 + Cycle 3 7.530408e-04 0.148434 3.225487e-03 + Cycle 4 1.131421e-04 0.150247 4.846199e-04 + Cycle 5 1.713572e-05 0.151453 7.339717e-05 + Cycle 6 2.620347e-06 0.152917 1.122369e-05 + Cycle 7 4.055800e-07 0.154781 1.737214e-06 + Cycle 8 6.362639e-08 0.156878 2.725299e-07 Average Convergence Factor = 0.151156 @@ -612,7 +564,7 @@ Iters ||r||_C conv.rate ||r||_C/||b||_C ------ ------------ --------- ------------ +----- ------------ --------- ------------ 1 2.820328e-02 0.097467 9.746663e-02 2 1.245772e-03 0.044171 4.305215e-03 3 9.147965e-05 0.073432 3.161410e-04 diff -Nru hypre-2.16.0/src/test/TEST_examples/default.sh hypre-2.18.2/src/test/TEST_examples/default.sh --- hypre-2.16.0/src/test/TEST_examples/default.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_examples/default.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` @@ -28,7 +21,6 @@ ${TNAME}.out.7\ ${TNAME}.out.8\ ${TNAME}.out.9\ - ${TNAME}.out.10\ ${TNAME}.out.11\ ${TNAME}.out.12\ ${TNAME}.out.12f\ diff -Nru hypre-2.16.0/src/test/TEST_examples/fortran_examples.jobs hypre-2.18.2/src/test/TEST_examples/fortran_examples.jobs --- hypre-2.16.0/src/test/TEST_examples/fortran_examples.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_examples/fortran_examples.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # Run each example diff -Nru hypre-2.16.0/src/test/TEST_examples/fortran_examples.sh hypre-2.18.2/src/test/TEST_examples/fortran_examples.sh --- hypre-2.16.0/src/test/TEST_examples/fortran_examples.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_examples/fortran_examples.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,20 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # FORTRAN_EXAMPLES: compare fortran_examples.out.* with ex*.base files diff -Nru hypre-2.16.0/src/test/TEST_examples/maxdim.jobs hypre-2.18.2/src/test/TEST_examples/maxdim.jobs --- hypre-2.16.0/src/test/TEST_examples/maxdim.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_examples/maxdim.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # Run maxdim examples diff -Nru hypre-2.16.0/src/test/TEST_examples/maxdim.sh hypre-2.18.2/src/test/TEST_examples/maxdim.sh --- hypre-2.16.0/src/test/TEST_examples/maxdim.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_examples/maxdim.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # EXAMPLES: Compare ex*.base files with maxdim.out.* files from current runs diff -Nru hypre-2.16.0/src/test/TEST_fac/3lev.in hypre-2.18.2/src/test/TEST_fac/3lev.in --- hypre-2.16.0/src/test/TEST_fac/3lev.in 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_fac/3lev.in 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ###################################################### diff -Nru hypre-2.16.0/src/test/TEST_fac/3lev_multibox.in hypre-2.18.2/src/test/TEST_fac/3lev_multibox.in --- hypre-2.16.0/src/test/TEST_fac/3lev_multibox.in 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_fac/3lev_multibox.in 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ###################################################### diff -Nru hypre-2.16.0/src/test/TEST_fac/4lev.in hypre-2.18.2/src/test/TEST_fac/4lev.in --- hypre-2.16.0/src/test/TEST_fac/4lev.in 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_fac/4lev.in 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ###################################################### diff -Nru hypre-2.16.0/src/test/TEST_fac/5lev.in hypre-2.18.2/src/test/TEST_fac/5lev.in --- hypre-2.16.0/src/test/TEST_fac/5lev.in 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_fac/5lev.in 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ###################################################### diff -Nru hypre-2.16.0/src/test/TEST_fac/6lev.in hypre-2.18.2/src/test/TEST_fac/6lev.in --- hypre-2.16.0/src/test/TEST_fac/6lev.in 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_fac/6lev.in 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ###################################################### diff -Nru hypre-2.16.0/src/test/TEST_fac/7lev.in hypre-2.18.2/src/test/TEST_fac/7lev.in --- hypre-2.16.0/src/test/TEST_fac/7lev.in 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_fac/7lev.in 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ###################################################### diff -Nru hypre-2.16.0/src/test/TEST_fac/sstruct_fac.jobs hypre-2.18.2/src/test/TEST_fac/sstruct_fac.jobs --- hypre-2.16.0/src/test/TEST_fac/sstruct_fac.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_fac/sstruct_fac.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + #============================================================================= # sstruct_fac: test suites for FAC solver. #============================================================================= diff -Nru hypre-2.16.0/src/test/TEST_fac/sstruct_fac.sh hypre-2.18.2/src/test/TEST_fac/sstruct_fac.sh --- hypre-2.16.0/src/test/TEST_fac/sstruct_fac.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_fac/sstruct_fac.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + TNAME=`basename $0 .sh` diff -Nru hypre-2.16.0/src/test/TEST_fei/solvers.jobs hypre-2.18.2/src/test/TEST_fei/solvers.jobs --- hypre-2.16.0/src/test/TEST_fei/solvers.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_fei/solvers.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # fei: Run through solvers diff -Nru hypre-2.16.0/src/test/TEST_fei/solvers.sh hypre-2.18.2/src/test/TEST_fei/solvers.sh --- hypre-2.16.0/src/test/TEST_fei/solvers.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_fei/solvers.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # no tests diff -Nru hypre-2.16.0/src/test/TEST_ij/agg_interp.jobs hypre-2.18.2/src/test/TEST_ij/agg_interp.jobs --- hypre-2.16.0/src/test/TEST_ij/agg_interp.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ij/agg_interp.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # ij: Test aggressive coarsening interpolation options diff -Nru hypre-2.16.0/src/test/TEST_ij/agg_interp.sh hypre-2.18.2/src/test/TEST_ij/agg_interp.sh --- hypre-2.16.0/src/test/TEST_ij/agg_interp.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ij/agg_interp.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_ij/coarsening.jobs hypre-2.18.2/src/test/TEST_ij/coarsening.jobs --- hypre-2.16.0/src/test/TEST_ij/coarsening.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ij/coarsening.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # ij: Run default case with different coarsenings, hybrid GS, diff -Nru hypre-2.16.0/src/test/TEST_ij/coarsening.sh hypre-2.18.2/src/test/TEST_ij/coarsening.sh --- hypre-2.16.0/src/test/TEST_ij/coarsening.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ij/coarsening.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_ij/default.jobs hypre-2.18.2/src/test/TEST_ij/default.jobs --- hypre-2.16.0/src/test/TEST_ij/default.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ij/default.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # ij: Run default case (first old, then new), CF Jacobi, BoomerAMG diff -Nru hypre-2.16.0/src/test/TEST_ij/default.sh hypre-2.18.2/src/test/TEST_ij/default.sh --- hypre-2.16.0/src/test/TEST_ij/default.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ij/default.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_ij/elast.jobs hypre-2.18.2/src/test/TEST_ij/elast.jobs --- hypre-2.16.0/src/test/TEST_ij/elast.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ij/elast.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # ij: Run 2D elasticity problem with different interpolation operators diff -Nru hypre-2.16.0/src/test/TEST_ij/elast.sh hypre-2.18.2/src/test/TEST_ij/elast.sh --- hypre-2.16.0/src/test/TEST_ij/elast.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ij/elast.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_ij/interp.jobs hypre-2.18.2/src/test/TEST_ij/interp.jobs --- hypre-2.16.0/src/test/TEST_ij/interp.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ij/interp.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # ij: Run default case with different interpolation operators diff -Nru hypre-2.16.0/src/test/TEST_ij/interp.sh hypre-2.18.2/src/test/TEST_ij/interp.sh --- hypre-2.16.0/src/test/TEST_ij/interp.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ij/interp.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_ij/matrix.jobs hypre-2.18.2/src/test/TEST_ij/matrix.jobs --- hypre-2.16.0/src/test/TEST_ij/matrix.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ij/matrix.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # ij -falgout -interptype 0 -Pmx 0: tests different ways of generating IJMatrix diff -Nru hypre-2.16.0/src/test/TEST_ij/matrix.sh hypre-2.18.2/src/test/TEST_ij/matrix.sh --- hypre-2.16.0/src/test/TEST_ij/matrix.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ij/matrix.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_ij/smoother.jobs hypre-2.18.2/src/test/TEST_ij/smoother.jobs --- hypre-2.16.0/src/test/TEST_ij/smoother.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ij/smoother.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # ij: Run default case with different smoothers diff -Nru hypre-2.16.0/src/test/TEST_ij/smoother.sh hypre-2.18.2/src/test/TEST_ij/smoother.sh --- hypre-2.16.0/src/test/TEST_ij/smoother.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ij/smoother.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_ij/solvers.jobs hypre-2.18.2/src/test/TEST_ij/solvers.jobs --- hypre-2.16.0/src/test/TEST_ij/solvers.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ij/solvers.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # ij: Run default case with different solvers diff -Nru hypre-2.16.0/src/test/TEST_ij/solvers.sh hypre-2.18.2/src/test/TEST_ij/solvers.sh --- hypre-2.16.0/src/test/TEST_ij/solvers.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_ij/solvers.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/test_ij.c hypre-2.18.2/src/test/test_ij.c --- hypre-2.16.0/src/test/test_ij.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/test_ij.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*-------------------------------------------------------------------------- * Test driver for unstructured matrix interface (IJ_matrix interface). diff -Nru hypre-2.16.0/src/test/TEST_lobpcg/ijdefault.jobs hypre-2.18.2/src/test/TEST_lobpcg/ijdefault.jobs --- hypre-2.16.0/src/test/TEST_lobpcg/ijdefault.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_lobpcg/ijdefault.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # ij: LOBPCG cases diff -Nru hypre-2.16.0/src/test/TEST_lobpcg/ijdefault.sh hypre-2.18.2/src/test/TEST_lobpcg/ijdefault.sh --- hypre-2.16.0/src/test/TEST_lobpcg/ijdefault.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_lobpcg/ijdefault.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_lobpcg/ijoptions.jobs hypre-2.18.2/src/test/TEST_lobpcg/ijoptions.jobs --- hypre-2.16.0/src/test/TEST_lobpcg/ijoptions.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_lobpcg/ijoptions.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # ij driver for eigenvalue solvers: diff -Nru hypre-2.16.0/src/test/TEST_lobpcg/ijoptions.sh hypre-2.18.2/src/test/TEST_lobpcg/ijoptions.sh --- hypre-2.16.0/src/test/TEST_lobpcg/ijoptions.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_lobpcg/ijoptions.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_lobpcg/sstruct.in.default hypre-2.18.2/src/test/TEST_lobpcg/sstruct.in.default --- hypre-2.16.0/src/test/TEST_lobpcg/sstruct.in.default 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_lobpcg/sstruct.in.default 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_lobpcg/sstruct.jobs hypre-2.18.2/src/test/TEST_lobpcg/sstruct.jobs --- hypre-2.16.0/src/test/TEST_lobpcg/sstruct.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_lobpcg/sstruct.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # Run default case with all available PCG preconditioners (solvers): diff -Nru hypre-2.16.0/src/test/TEST_lobpcg/sstruct.sh hypre-2.18.2/src/test/TEST_lobpcg/sstruct.sh --- hypre-2.16.0/src/test/TEST_lobpcg/sstruct.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_lobpcg/sstruct.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_lobpcg/struct.jobs hypre-2.18.2/src/test/TEST_lobpcg/struct.jobs --- hypre-2.16.0/src/test/TEST_lobpcg/struct.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_lobpcg/struct.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # Run default case with all available PCG preconditioners (solvers): diff -Nru hypre-2.16.0/src/test/TEST_lobpcg/struct.sh hypre-2.18.2/src/test/TEST_lobpcg/struct.sh --- hypre-2.16.0/src/test/TEST_lobpcg/struct.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_lobpcg/struct.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_longdouble/solvers_ij.jobs hypre-2.18.2/src/test/TEST_longdouble/solvers_ij.jobs --- hypre-2.16.0/src/test/TEST_longdouble/solvers_ij.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_longdouble/solvers_ij.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # ij: Run default case with different solvers diff -Nru hypre-2.16.0/src/test/TEST_longdouble/solvers_ij.sh hypre-2.18.2/src/test/TEST_longdouble/solvers_ij.sh --- hypre-2.16.0/src/test/TEST_longdouble/solvers_ij.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_longdouble/solvers_ij.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` CONVTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_longdouble/solvers_struct.jobs hypre-2.18.2/src/test/TEST_longdouble/solvers_struct.jobs --- hypre-2.16.0/src/test/TEST_longdouble/solvers_struct.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_longdouble/solvers_struct.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Run SMG-CG, PFMG-CG, DSCG, CG, and Hybrid. diff -Nru hypre-2.16.0/src/test/TEST_longdouble/solvers_struct.sh hypre-2.18.2/src/test/TEST_longdouble/solvers_struct.sh --- hypre-2.16.0/src/test/TEST_longdouble/solvers_struct.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_longdouble/solvers_struct.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,19 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` CONVTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_single/solvers_ij.jobs hypre-2.18.2/src/test/TEST_single/solvers_ij.jobs --- hypre-2.16.0/src/test/TEST_single/solvers_ij.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_single/solvers_ij.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # ij: Run default case with different solvers diff -Nru hypre-2.16.0/src/test/TEST_single/solvers_ij.sh hypre-2.18.2/src/test/TEST_single/solvers_ij.sh --- hypre-2.16.0/src/test/TEST_single/solvers_ij.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_single/solvers_ij.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` CONVTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_single/solvers_struct.jobs hypre-2.18.2/src/test/TEST_single/solvers_struct.jobs --- hypre-2.16.0/src/test/TEST_single/solvers_struct.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_single/solvers_struct.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Run SMG-CG, PFMG-CG, DSCG, CG, and Hybrid. diff -Nru hypre-2.16.0/src/test/TEST_single/solvers_struct.sh hypre-2.18.2/src/test/TEST_single/solvers_struct.sh --- hypre-2.16.0/src/test/TEST_single/solvers_struct.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_single/solvers_struct.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,19 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` CONVTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/addtovalues.jobs hypre-2.18.2/src/test/TEST_sstruct/addtovalues.jobs --- hypre-2.16.0/src/test/TEST_sstruct/addtovalues.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/addtovalues.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + #============================================================================= # runs same solver for a direct setup of a matrix and an addtovalue setup # of the same matrix diff -Nru hypre-2.16.0/src/test/TEST_sstruct/addtovalues.sh hypre-2.18.2/src/test/TEST_sstruct/addtovalues.sh --- hypre-2.16.0/src/test/TEST_sstruct/addtovalues.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/addtovalues.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/amr2d.jobs hypre-2.18.2/src/test/TEST_sstruct/amr2d.jobs --- hypre-2.16.0/src/test/TEST_sstruct/amr2d.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/amr2d.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= #============================================================================= diff -Nru hypre-2.16.0/src/test/TEST_sstruct/amr2d.sh hypre-2.18.2/src/test/TEST_sstruct/amr2d.sh --- hypre-2.16.0/src/test/TEST_sstruct/amr2d.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/amr2d.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/cube.jobs hypre-2.18.2/src/test/TEST_sstruct/cube.jobs --- hypre-2.16.0/src/test/TEST_sstruct/cube.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/cube.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) mpirun -np 1 ./sstruct -in sstruct.in.cube -r 10 10 10 -rhsone -solver 28 \ > cube.out.0 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/cube.sh hypre-2.18.2/src/test/TEST_sstruct/cube.sh --- hypre-2.16.0/src/test/TEST_sstruct/cube.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/cube.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/cycred.jobs hypre-2.18.2/src/test/TEST_sstruct/cycred.jobs --- hypre-2.16.0/src/test/TEST_sstruct/cycred.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/cycred.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + #============================================================================= # 3D diff -Nru hypre-2.16.0/src/test/TEST_sstruct/cycred.sh hypre-2.18.2/src/test/TEST_sstruct/cycred.sh --- hypre-2.16.0/src/test/TEST_sstruct/cycred.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/cycred.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/default2d.jobs hypre-2.18.2/src/test/TEST_sstruct/default2d.jobs --- hypre-2.16.0/src/test/TEST_sstruct/default2d.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/default2d.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # sstruct: Run base 2d case diff -Nru hypre-2.16.0/src/test/TEST_sstruct/default2d.sh hypre-2.18.2/src/test/TEST_sstruct/default2d.sh --- hypre-2.16.0/src/test/TEST_sstruct/default2d.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/default2d.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/default3d.jobs hypre-2.18.2/src/test/TEST_sstruct/default3d.jobs --- hypre-2.16.0/src/test/TEST_sstruct/default3d.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/default3d.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # sstruct: Run base 3d case diff -Nru hypre-2.16.0/src/test/TEST_sstruct/default3d.sh hypre-2.18.2/src/test/TEST_sstruct/default3d.sh --- hypre-2.16.0/src/test/TEST_sstruct/default3d.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/default3d.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/emptyProc.jobs hypre-2.18.2/src/test/TEST_sstruct/emptyProc.jobs --- hypre-2.16.0/src/test/TEST_sstruct/emptyProc.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/emptyProc.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + #============================================================================= # sstruct: Run 3d problem with one proc empty. Two types of tests: # struct solvers and sys_pfmg require the first part to be full diff -Nru hypre-2.16.0/src/test/TEST_sstruct/emptyProc.sh hypre-2.18.2/src/test/TEST_sstruct/emptyProc.sh --- hypre-2.16.0/src/test/TEST_sstruct/emptyProc.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/emptyProc.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/maxwell.jobs hypre-2.18.2/src/test/TEST_sstruct/maxwell.jobs --- hypre-2.16.0/src/test/TEST_sstruct/maxwell.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/maxwell.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + #============================================================================= # no test comparison at this time #============================================================================= diff -Nru hypre-2.16.0/src/test/TEST_sstruct/maxwell.sh hypre-2.18.2/src/test/TEST_sstruct/maxwell.sh --- hypre-2.16.0/src/test/TEST_sstruct/maxwell.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/maxwell.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/miller.jobs hypre-2.18.2/src/test/TEST_sstruct/miller.jobs --- hypre-2.16.0/src/test/TEST_sstruct/miller.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/miller.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # sstruct: Run all of the solvers diff -Nru hypre-2.16.0/src/test/TEST_sstruct/miller.sh hypre-2.18.2/src/test/TEST_sstruct/miller.sh --- hypre-2.16.0/src/test/TEST_sstruct/miller.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/miller.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/neighborpart.jobs hypre-2.18.2/src/test/TEST_sstruct/neighborpart.jobs --- hypre-2.16.0/src/test/TEST_sstruct/neighborpart.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/neighborpart.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) mpirun -np 1 ./sstruct -in sstruct.in.fe_node1_2D -solver 8 -rhsone \ > neighborpart.out.0 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/neighborpart.sh hypre-2.18.2/src/test/TEST_sstruct/neighborpart.sh --- hypre-2.16.0/src/test/TEST_sstruct/neighborpart.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/neighborpart.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/neumann.jobs hypre-2.18.2/src/test/TEST_sstruct/neumann.jobs --- hypre-2.16.0/src/test/TEST_sstruct/neumann.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/neumann.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # sstruct: Run base 3d cases diff -Nru hypre-2.16.0/src/test/TEST_sstruct/neumann.sh hypre-2.18.2/src/test/TEST_sstruct/neumann.sh --- hypre-2.16.0/src/test/TEST_sstruct/neumann.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/neumann.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/periodic.jobs hypre-2.18.2/src/test/TEST_sstruct/periodic.jobs --- hypre-2.16.0/src/test/TEST_sstruct/periodic.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/periodic.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # Check SetNeighborBox for periodic problems (2D) diff -Nru hypre-2.16.0/src/test/TEST_sstruct/periodic.sh hypre-2.18.2/src/test/TEST_sstruct/periodic.sh --- hypre-2.16.0/src/test/TEST_sstruct/periodic.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/periodic.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sharedpart.jobs hypre-2.18.2/src/test/TEST_sstruct/sharedpart.jobs --- hypre-2.16.0/src/test/TEST_sstruct/sharedpart.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sharedpart.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) # These produce the same rel residual mpirun -np 1 ./sstruct -in sstruct.in.reduced3D -solver 28 \ diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sharedpart.sh hypre-2.18.2/src/test/TEST_sstruct/sharedpart.sh --- hypre-2.16.0/src/test/TEST_sstruct/sharedpart.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sharedpart.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/solvers.jobs hypre-2.18.2/src/test/TEST_sstruct/solvers.jobs --- hypre-2.16.0/src/test/TEST_sstruct/solvers.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/solvers.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # sstruct: Run all of the solvers diff -Nru hypre-2.16.0/src/test/TEST_sstruct/solvers.sh hypre-2.18.2/src/test/TEST_sstruct/solvers.sh --- hypre-2.16.0/src/test/TEST_sstruct/solvers.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/solvers.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.19aniso hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.19aniso --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.19aniso 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.19aniso 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.19iso hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.19iso --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.19iso 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.19iso 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.7aniso hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.7aniso --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.7aniso 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.7aniso 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.7iso hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.7iso --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.7iso 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.7iso 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.addtoval_cellcentre hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.addtoval_cellcentre --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.addtoval_cellcentre 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.addtoval_cellcentre 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.addtoval_edges hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.addtoval_edges --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.addtoval_edges 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.addtoval_edges 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.amr.2D hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.amr.2D --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.amr.2D 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.amr.2D 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.amr.2Db hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.amr.2Db --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.amr.2Db 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.amr.2Db 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.amr.2Dc hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.amr.2Dc --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.amr.2Dc 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.amr.2Dc 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.amr.2De hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.amr.2De --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.amr.2De 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.amr.2De 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + #this is for testing the AP portion of GraphAddEntries #(if you do not redo the BoxManagers, then this will not #work) diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.amr.graphadd hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.amr.graphadd --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.amr.graphadd 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.amr.graphadd 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ############################################################################## # diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.bcube hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.bcube --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.bcube 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.bcube 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.bcube-fem hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.bcube-fem --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.bcube-fem 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.bcube-fem 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.block hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.block --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.block 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.block 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.cube hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.cube --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.cube 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.cube 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.cube21 hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.cube21 --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.cube21 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.cube21 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.cycred-1Dx hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.cycred-1Dx --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.cycred-1Dx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.cycred-1Dx 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.cycred-2Dx hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.cycred-2Dx --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.cycred-2Dx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.cycred-2Dx 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.cycred-2Dy hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.cycred-2Dy --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.cycred-2Dy 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.cycred-2Dy 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.cycred-3Dx hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.cycred-3Dx --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.cycred-3Dx 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.cycred-3Dx 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.cycred-3Dy hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.cycred-3Dy --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.cycred-3Dy 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.cycred-3Dy 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.cycred-3Dz hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.cycred-3Dz --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.cycred-3Dz 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.cycred-3Dz 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.default hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.default --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.default 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.default 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.default_2D hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.default_2D --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.default_2D 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.default_2D 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.dirichlet hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.dirichlet --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.dirichlet 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.dirichlet 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.emptyProc1 hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.emptyProc1 --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.emptyProc1 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.emptyProc1 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.emptyProc2 hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.emptyProc2 --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.emptyProc2 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.emptyProc2 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.emptyProc3 hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.emptyProc3 --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.emptyProc3 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.emptyProc3 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.enhanced3D hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.enhanced3D --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.enhanced3D 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.enhanced3D 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # This example came from Rob Rieben and has both reduced and enhanced diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_all2_2D hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_all2_2D --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_all2_2D 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_all2_2D 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # In this example, the x/y coordinates are as follows diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_all2_2D_coord hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_all2_2D_coord --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_all2_2D_coord 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_all2_2D_coord 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # In this example, the x/y coordinates are as follows diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_all2_2Ds hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_all2_2Ds --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_all2_2Ds 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_all2_2Ds 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # In this example, the x/y coordinates are as follows diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_all2_2Dss hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_all2_2Dss --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_all2_2Dss 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_all2_2Dss 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # In this example, the x/y coordinates are as follows diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_all2_3D hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_all2_3D --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_all2_3D 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_all2_3D 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # In this example, the x/y/z coordinates are as follows diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_all2_3D_coord hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_all2_3D_coord --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_all2_3D_coord 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_all2_3D_coord 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # In this example, the x/y/z coordinates are as follows diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_all3_3D hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_all3_3D --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_all3_3D 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_all3_3D 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # In this example, the x/y/z coordinates are as follows diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_all3_3D_coord hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_all3_3D_coord --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_all3_3D_coord 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_all3_3D_coord 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # In this example, the x/y/z coordinates are as follows diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_node1_2D hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_node1_2D --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_node1_2D 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_node1_2D 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # In this example, the x/y coordinates are as follows diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_node2_2D hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_node2_2D --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_node2_2D 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_node2_2D 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # In this example, the x/y coordinates are as follows diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_node2_2D_coord hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_node2_2D_coord --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_node2_2D_coord 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_node2_2D_coord 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # In this example, the x/y coordinates are as follows diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_rhombus5 hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_rhombus5 --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.fe_rhombus5 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.fe_rhombus5 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.laps hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.laps --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.laps 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.laps 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.laps.periodic hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.laps.periodic --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.laps.periodic 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.laps.periodic 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.marinak hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.marinak --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.marinak 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.marinak 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.maxwell3d_unscaled hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.maxwell3d_unscaled --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.maxwell3d_unscaled 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.maxwell3d_unscaled 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.miller_2blk hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.miller_2blk --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.miller_2blk 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.miller_2blk 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.miller_2blk1 hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.miller_2blk1 --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.miller_2blk1 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.miller_2blk1 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.miller_2stk hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.miller_2stk --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.miller_2stk 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.miller_2stk 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.miller_3blk hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.miller_3blk --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.miller_3blk 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.miller_3blk 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # # -------------------------------- diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.miller_diag hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.miller_diag --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.miller_diag 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.miller_diag 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.neumann hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.neumann --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.neumann 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.neumann 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.neumann-yz hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.neumann-yz --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.neumann-yz 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.neumann-yz 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.noaddtoval_cellcentre hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.noaddtoval_cellcentre --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.noaddtoval_cellcentre 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.noaddtoval_cellcentre 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.noaddtoval_edges hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.noaddtoval_edges --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.noaddtoval_edges 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.noaddtoval_edges 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.p19aniso hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.p19aniso --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.p19aniso 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.p19aniso 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.p19iso hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.p19iso --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.p19iso 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.p19iso 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.p7aniso hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.p7aniso --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.p7aniso 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.p7aniso 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.p7iso hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.p7iso --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.p7iso 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.p7iso 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.pcube hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.pcube --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.pcube 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.pcube 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic.2D hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic.2D --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic.2D 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic.2D 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic.add hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic.add --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic.add 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic.add 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic.bigA hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic.bigA --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic.bigA 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic.bigA 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic.bigB hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic.bigB --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic.bigB 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic.bigB 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic.cellA hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic.cellA --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic.cellA 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic.cellA 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic.cellB hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic.cellB --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic.cellB 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic.cellB 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic.nodeA hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic.nodeA --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic.nodeA 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic.nodeA 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic.nodeB hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic.nodeB --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.periodic.nodeB 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.periodic.nodeB 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.reduced3D hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.reduced3D --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.reduced3D 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.reduced3D 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # This example came from Rob Rieben and has one reduced connectivity point. diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.reduced3D-4 hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.reduced3D-4 --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.reduced3D-4 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.reduced3D-4 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### # This example came from Rob Rieben and has one reduced connectivity point. diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.struct hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.struct --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.struct 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.struct 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.symm0 hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.symm0 --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.symm0 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.symm0 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.symm0.2D hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.symm0.2D --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.symm0.2D 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.symm0.2D 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.symm1 hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.symm1 --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.symm1 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.symm1 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.symm1.2D hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.symm1.2D --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.symm1.2D 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.symm1.2D 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.symm2 hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.symm2 --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.symm2 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.symm2 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.symm2.2D hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.symm2.2D --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.symm2.2D 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.symm2.2D 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.symm3 hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.symm3 --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.symm3 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.symm3 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.symm3.2D hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.symm3.2D --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.symm3.2D 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.symm3.2D 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.wide.2D hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.wide.2D --- hypre-2.16.0/src/test/TEST_sstruct/sstruct.in.wide.2D 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct.in.wide.2D 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct_struct.jobs hypre-2.18.2/src/test/TEST_sstruct/sstruct_struct.jobs --- hypre-2.16.0/src/test/TEST_sstruct/sstruct_struct.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct_struct.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + #============================================================================= # Compare the struct solvers called from sstruct & struct interfaces diff -Nru hypre-2.16.0/src/test/TEST_sstruct/sstruct_struct.sh hypre-2.18.2/src/test/TEST_sstruct/sstruct_struct.sh --- hypre-2.16.0/src/test/TEST_sstruct/sstruct_struct.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/sstruct_struct.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/symm.jobs hypre-2.18.2/src/test/TEST_sstruct/symm.jobs --- hypre-2.16.0/src/test/TEST_sstruct/symm.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/symm.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # sstruct: Check SetSymmetric for HYPRE_SSTRUCT data type (2D) diff -Nru hypre-2.16.0/src/test/TEST_sstruct/symm.sh hypre-2.18.2/src/test/TEST_sstruct/symm.sh --- hypre-2.16.0/src/test/TEST_sstruct/symm.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/symm.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/wide.jobs hypre-2.18.2/src/test/TEST_sstruct/wide.jobs --- hypre-2.16.0/src/test/TEST_sstruct/wide.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/wide.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) mpirun -np 1 ./sstruct -in sstruct.in.wide.2D -r 10 10 1 -P 1 1 1 -solver 239 > wide.out.1 mpirun -np 4 ./sstruct -in sstruct.in.wide.2D -r 5 5 1 -P 2 2 1 -solver 239 > wide.out.4 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/wide.sh hypre-2.18.2/src/test/TEST_sstruct/wide.sh --- hypre-2.16.0/src/test/TEST_sstruct/wide.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/wide.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/zcube.jobs hypre-2.18.2/src/test/TEST_sstruct/zcube.jobs --- hypre-2.16.0/src/test/TEST_sstruct/zcube.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/zcube.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) mpirun -np 1 ./sstruct -in zsstruct.in.cube -r 10 10 10 -rhsone -solver 28 \ > zcube.out.0 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/zcube.sh hypre-2.18.2/src/test/TEST_sstruct/zcube.sh --- hypre-2.16.0/src/test/TEST_sstruct/zcube.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/zcube.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_sstruct/zsstruct.in.bcube hypre-2.18.2/src/test/TEST_sstruct/zsstruct.in.bcube --- hypre-2.16.0/src/test/TEST_sstruct/zsstruct.in.bcube 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/zsstruct.in.bcube 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_sstruct/zsstruct.in.cube hypre-2.18.2/src/test/TEST_sstruct/zsstruct.in.cube --- hypre-2.16.0/src/test/TEST_sstruct/zsstruct.in.cube 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_sstruct/zsstruct.in.cube 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,8 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + ########################################################### diff -Nru hypre-2.16.0/src/test/TEST_struct/cgpfmg3d.jobs hypre-2.18.2/src/test/TEST_struct/cgpfmg3d.jobs --- hypre-2.16.0/src/test/TEST_struct/cgpfmg3d.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/cgpfmg3d.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Run CG+PFMG with skip base 3d case diff -Nru hypre-2.16.0/src/test/TEST_struct/cgpfmg3d.sh hypre-2.18.2/src/test/TEST_struct/cgpfmg3d.sh --- hypre-2.16.0/src/test/TEST_struct/cgpfmg3d.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/cgpfmg3d.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/emptyproc.jobs hypre-2.18.2/src/test/TEST_struct/emptyproc.jobs --- hypre-2.16.0/src/test/TEST_struct/emptyproc.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/emptyproc.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # Test solvers with some processors having no data diff -Nru hypre-2.16.0/src/test/TEST_struct/emptyproc.sh hypre-2.18.2/src/test/TEST_struct/emptyproc.sh --- hypre-2.16.0/src/test/TEST_struct/emptyproc.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/emptyproc.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/hybrid.jobs hypre-2.18.2/src/test/TEST_struct/hybrid.jobs --- hypre-2.16.0/src/test/TEST_struct/hybrid.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/hybrid.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Run Hybrid without the switch diff -Nru hypre-2.16.0/src/test/TEST_struct/hybrid.sh hypre-2.18.2/src/test/TEST_struct/hybrid.sh --- hypre-2.16.0/src/test/TEST_struct/hybrid.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/hybrid.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/hybridswitch.jobs hypre-2.18.2/src/test/TEST_struct/hybridswitch.jobs --- hypre-2.16.0/src/test/TEST_struct/hybridswitch.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/hybridswitch.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,4 +1,9 @@ #!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + #============================================================================= diff -Nru hypre-2.16.0/src/test/TEST_struct/hybridswitch.sh hypre-2.18.2/src/test/TEST_struct/hybridswitch.sh --- hypre-2.16.0/src/test/TEST_struct/hybridswitch.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/hybridswitch.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/migrate.jobs hypre-2.18.2/src/test/TEST_struct/migrate.jobs --- hypre-2.16.0/src/test/TEST_struct/migrate.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/migrate.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) # 1D mpirun -np 4 ./struct_migrate -d 1 -P 4 1 1 > migrate.out.10 diff -Nru hypre-2.16.0/src/test/TEST_struct/migrate.sh hypre-2.18.2/src/test/TEST_struct/migrate.sh --- hypre-2.16.0/src/test/TEST_struct/migrate.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/migrate.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/parflow.jobs hypre-2.18.2/src/test/TEST_struct/parflow.jobs --- hypre-2.16.0/src/test/TEST_struct/parflow.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/parflow.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Run base 3d case diff -Nru hypre-2.16.0/src/test/TEST_struct/parflow.sh hypre-2.18.2/src/test/TEST_struct/parflow.sh --- hypre-2.16.0/src/test/TEST_struct/parflow.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/parflow.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/periodic.jobs hypre-2.18.2/src/test/TEST_struct/periodic.jobs --- hypre-2.16.0/src/test/TEST_struct/periodic.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/periodic.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # Check PFMG for power-of-two and non-power-of-two systems diff -Nru hypre-2.16.0/src/test/TEST_struct/periodic.sh hypre-2.18.2/src/test/TEST_struct/periodic.sh --- hypre-2.16.0/src/test/TEST_struct/periodic.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/periodic.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/pfmgbase1d.jobs hypre-2.18.2/src/test/TEST_struct/pfmgbase1d.jobs --- hypre-2.16.0/src/test/TEST_struct/pfmgbase1d.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/pfmgbase1d.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Run PFMG 1d run as 2d and 3d diff -Nru hypre-2.16.0/src/test/TEST_struct/pfmgbase1d.sh hypre-2.18.2/src/test/TEST_struct/pfmgbase1d.sh --- hypre-2.16.0/src/test/TEST_struct/pfmgbase1d.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/pfmgbase1d.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/pfmgbase2d.jobs hypre-2.18.2/src/test/TEST_struct/pfmgbase2d.jobs --- hypre-2.16.0/src/test/TEST_struct/pfmgbase2d.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/pfmgbase2d.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Run PFMG base "true" 2d case diff -Nru hypre-2.16.0/src/test/TEST_struct/pfmgbase2d.sh hypre-2.18.2/src/test/TEST_struct/pfmgbase2d.sh --- hypre-2.16.0/src/test/TEST_struct/pfmgbase2d.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/pfmgbase2d.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/pfmgbase3d.jobs hypre-2.18.2/src/test/TEST_struct/pfmgbase3d.jobs --- hypre-2.16.0/src/test/TEST_struct/pfmgbase3d.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/pfmgbase3d.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Run PFMG base 3d case diff -Nru hypre-2.16.0/src/test/TEST_struct/pfmgbase3d.sh hypre-2.18.2/src/test/TEST_struct/pfmgbase3d.sh --- hypre-2.16.0/src/test/TEST_struct/pfmgbase3d.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/pfmgbase3d.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/pfmgconstcoeffmp.jobs hypre-2.18.2/src/test/TEST_struct/pfmgconstcoeffmp.jobs --- hypre-2.16.0/src/test/TEST_struct/pfmgconstcoeffmp.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/pfmgconstcoeffmp.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # Make sure that the constant case and variable diag case give the same results diff -Nru hypre-2.16.0/src/test/TEST_struct/pfmgconstcoeffmp.sh hypre-2.18.2/src/test/TEST_struct/pfmgconstcoeffmp.sh --- hypre-2.16.0/src/test/TEST_struct/pfmgconstcoeffmp.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/pfmgconstcoeffmp.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/pfmgorient.jobs hypre-2.18.2/src/test/TEST_struct/pfmgorient.jobs --- hypre-2.16.0/src/test/TEST_struct/pfmgorient.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/pfmgorient.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Run PFMG 1d solve of the same problem in different orientations diff -Nru hypre-2.16.0/src/test/TEST_struct/pfmgorient.sh hypre-2.18.2/src/test/TEST_struct/pfmgorient.sh --- hypre-2.16.0/src/test/TEST_struct/pfmgorient.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/pfmgorient.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/pfmgtest1d.jobs hypre-2.18.2/src/test/TEST_struct/pfmgtest1d.jobs --- hypre-2.16.0/src/test/TEST_struct/pfmgtest1d.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/pfmgtest1d.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Run PFMG 1d run as 2d and 3d in different configurations. diff -Nru hypre-2.16.0/src/test/TEST_struct/pfmgtest1d.sh hypre-2.18.2/src/test/TEST_struct/pfmgtest1d.sh --- hypre-2.16.0/src/test/TEST_struct/pfmgtest1d.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/pfmgtest1d.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/pfmgvcycle.jobs hypre-2.18.2/src/test/TEST_struct/pfmgvcycle.jobs --- hypre-2.16.0/src/test/TEST_struct/pfmgvcycle.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/pfmgvcycle.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Run PFMG V(1,0) and V(0,1) cycles. diff -Nru hypre-2.16.0/src/test/TEST_struct/pfmgvcycle.sh hypre-2.18.2/src/test/TEST_struct/pfmgvcycle.sh --- hypre-2.16.0/src/test/TEST_struct/pfmgvcycle.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/pfmgvcycle.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/psmgbase3d.jobs hypre-2.18.2/src/test/TEST_struct/psmgbase3d.jobs --- hypre-2.16.0/src/test/TEST_struct/psmgbase3d.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/psmgbase3d.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Run Periodic SMG base 3d case diff -Nru hypre-2.16.0/src/test/TEST_struct/psmgbase3d.sh hypre-2.18.2/src/test/TEST_struct/psmgbase3d.sh --- hypre-2.16.0/src/test/TEST_struct/psmgbase3d.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/psmgbase3d.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/psmgtest3d.jobs hypre-2.18.2/src/test/TEST_struct/psmgtest3d.jobs --- hypre-2.16.0/src/test/TEST_struct/psmgtest3d.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/psmgtest3d.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Run Periodic SMG base 3d case (periodic in x), test parallel diff -Nru hypre-2.16.0/src/test/TEST_struct/psmgtest3d.sh hypre-2.18.2/src/test/TEST_struct/psmgtest3d.sh --- hypre-2.16.0/src/test/TEST_struct/psmgtest3d.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/psmgtest3d.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/smgbase1d.jobs hypre-2.18.2/src/test/TEST_struct/smgbase1d.jobs --- hypre-2.16.0/src/test/TEST_struct/smgbase1d.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/smgbase1d.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Test 1d run as 2d and 3d diff -Nru hypre-2.16.0/src/test/TEST_struct/smgbase1d.sh hypre-2.18.2/src/test/TEST_struct/smgbase1d.sh --- hypre-2.16.0/src/test/TEST_struct/smgbase1d.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/smgbase1d.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/smgbase2d.jobs hypre-2.18.2/src/test/TEST_struct/smgbase2d.jobs --- hypre-2.16.0/src/test/TEST_struct/smgbase2d.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/smgbase2d.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Run base "true" 2d case diff -Nru hypre-2.16.0/src/test/TEST_struct/smgbase2d.sh hypre-2.18.2/src/test/TEST_struct/smgbase2d.sh --- hypre-2.16.0/src/test/TEST_struct/smgbase2d.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/smgbase2d.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/smgbase3d.jobs hypre-2.18.2/src/test/TEST_struct/smgbase3d.jobs --- hypre-2.16.0/src/test/TEST_struct/smgbase3d.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/smgbase3d.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Run base 3d case diff -Nru hypre-2.16.0/src/test/TEST_struct/smgbase3d.sh hypre-2.18.2/src/test/TEST_struct/smgbase3d.sh --- hypre-2.16.0/src/test/TEST_struct/smgbase3d.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/smgbase3d.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/smgtest1d.jobs hypre-2.18.2/src/test/TEST_struct/smgtest1d.jobs --- hypre-2.16.0/src/test/TEST_struct/smgtest1d.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/smgtest1d.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Test 1d run as 2d and 3d in different configurations. diff -Nru hypre-2.16.0/src/test/TEST_struct/smgtest1d.sh hypre-2.18.2/src/test/TEST_struct/smgtest1d.sh --- hypre-2.16.0/src/test/TEST_struct/smgtest1d.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/smgtest1d.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/smgvcycle.jobs hypre-2.18.2/src/test/TEST_struct/smgvcycle.jobs --- hypre-2.16.0/src/test/TEST_struct/smgvcycle.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/smgvcycle.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Test V(1,0) cycle. diff -Nru hypre-2.16.0/src/test/TEST_struct/smgvcycle.sh hypre-2.18.2/src/test/TEST_struct/smgvcycle.sh --- hypre-2.16.0/src/test/TEST_struct/smgvcycle.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/smgvcycle.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/solvers.jobs hypre-2.18.2/src/test/TEST_struct/solvers.jobs --- hypre-2.16.0/src/test/TEST_struct/solvers.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/solvers.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: Run SMG-CG, PFMG-CG, DSCG, CG, and Hybrid. diff -Nru hypre-2.16.0/src/test/TEST_struct/solvers.sh hypre-2.18.2/src/test/TEST_struct/solvers.sh --- hypre-2.16.0/src/test/TEST_struct/solvers.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/solvers.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/vcpfmgRedBlackGS.jobs hypre-2.18.2/src/test/TEST_struct/vcpfmgRedBlackGS.jobs --- hypre-2.16.0/src/test/TEST_struct/vcpfmgRedBlackGS.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/vcpfmgRedBlackGS.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,9 @@ +#!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + #============================================================================= # struct: Run PFMG RedBlack Gauss-Seidel tests. Nonsymmetric GS. #============================================================================= diff -Nru hypre-2.16.0/src/test/TEST_struct/vcpfmgRedBlackGS.sh hypre-2.18.2/src/test/TEST_struct/vcpfmgRedBlackGS.sh --- hypre-2.16.0/src/test/TEST_struct/vcpfmgRedBlackGS.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/vcpfmgRedBlackGS.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_struct/vdpfmgRedBlackGS.jobs hypre-2.18.2/src/test/TEST_struct/vdpfmgRedBlackGS.jobs --- hypre-2.16.0/src/test/TEST_struct/vdpfmgRedBlackGS.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/vdpfmgRedBlackGS.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,9 @@ +#!/bin/sh +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + #============================================================================= # struct: Run variable diag. PFMG RedBlack Gauss-Seidel tests. Nonsymmetric GS. #============================================================================= diff -Nru hypre-2.16.0/src/test/TEST_struct/vdpfmgRedBlackGS.sh hypre-2.18.2/src/test/TEST_struct/vdpfmgRedBlackGS.sh --- hypre-2.16.0/src/test/TEST_struct/vdpfmgRedBlackGS.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_struct/vdpfmgRedBlackGS.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` RTOL=$1 diff -Nru hypre-2.16.0/src/test/TEST_superlu/sludist.jobs hypre-2.18.2/src/test/TEST_superlu/sludist.jobs --- hypre-2.16.0/src/test/TEST_superlu/sludist.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_superlu/sludist.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # ij: Run various cases using SuperLU_Dist as a coarse grid solve diff -Nru hypre-2.16.0/src/test/TEST_superlu/sludist.sh hypre-2.18.2/src/test/TEST_superlu/sludist.sh --- hypre-2.16.0/src/test/TEST_superlu/sludist.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_superlu/sludist.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) TNAME=`basename $0 .sh` diff -Nru hypre-2.16.0/src/test/TEST_timing/efficiency.jobs hypre-2.18.2/src/test/TEST_timing/efficiency.jobs --- hypre-2.16.0/src/test/TEST_timing/efficiency.jobs 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_timing/efficiency.jobs 2019-10-28 22:30:04.000000000 +0000 @@ -1,21 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: timing and parallel scaling efficiency test diff -Nru hypre-2.16.0/src/test/TEST_timing/efficiency.sh hypre-2.18.2/src/test/TEST_timing/efficiency.sh --- hypre-2.16.0/src/test/TEST_timing/efficiency.sh 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/TEST_timing/efficiency.sh 2019-10-28 22:30:04.000000000 +0000 @@ -1,19 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # struct: timing and parallel scaling efficiency test diff -Nru hypre-2.16.0/src/test/zboxloop.c hypre-2.18.2/src/test/zboxloop.c --- hypre-2.16.0/src/test/zboxloop.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/test/zboxloop.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/utilities/amg_linklist.c hypre-2.18.2/src/utilities/amg_linklist.c --- hypre-2.16.0/src/utilities/amg_linklist.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/amg_linklist.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /*************************************************************************** * @@ -34,7 +27,7 @@ **************************************************************/ void hypre_dispose_elt ( hypre_LinkList element_ptr ) { - hypre_TFree ( element_ptr, HYPRE_MEMORY_HOST); + hypre_TFree(element_ptr, HYPRE_MEMORY_HOST); } @@ -46,30 +39,29 @@ ****************************************************************/ void hypre_remove_point(hypre_LinkList *LoL_head_ptr, - hypre_LinkList *LoL_tail_ptr, - HYPRE_Int measure, - HYPRE_Int index, - HYPRE_Int *lists, - HYPRE_Int *where) + hypre_LinkList *LoL_tail_ptr, + HYPRE_Int measure, + HYPRE_Int index, + HYPRE_Int *lists, + HYPRE_Int *where) { - hypre_LinkList LoL_head = *LoL_head_ptr; - hypre_LinkList LoL_tail = *LoL_tail_ptr; - hypre_LinkList list_ptr; + hypre_LinkList LoL_head = *LoL_head_ptr; + hypre_LinkList LoL_tail = *LoL_tail_ptr; + hypre_LinkList list_ptr; list_ptr = LoL_head; - do { if (measure == list_ptr->data) { - /* point to be removed is only point on list, - which must be destroyed */ + /* point to be removed is only point on list, + which must be destroyed */ if (list_ptr->head == index && list_ptr->tail == index) { - /* removing only list, so num_left better be 0! */ + /* removing only list, so num_left better be 0! */ if (list_ptr == LoL_head && list_ptr == LoL_tail) { LoL_head = NULL; @@ -85,7 +77,7 @@ list_ptr -> next_elt -> prev_elt = NULL; LoL_head = list_ptr->next_elt; hypre_dispose_elt(list_ptr); - + *LoL_head_ptr = LoL_head; *LoL_tail_ptr = LoL_tail; return; @@ -105,7 +97,7 @@ list_ptr -> next_elt -> prev_elt = list_ptr -> prev_elt; list_ptr -> prev_elt -> next_elt = list_ptr -> next_elt; hypre_dispose_elt(list_ptr); - + *LoL_head_ptr = LoL_head; *LoL_tail_ptr = LoL_tail; return; @@ -132,7 +124,9 @@ } list_ptr = list_ptr -> next_elt; } while (list_ptr != NULL); + hypre_error_w_msg(HYPRE_ERROR_GENERIC,"No such list!\n"); + return ; } @@ -143,43 +137,40 @@ *****************************************************************/ hypre_LinkList hypre_create_elt( HYPRE_Int Item ) { - hypre_LinkList new_elt_ptr; - - /* Allocate memory space for the new node. - * return with error if no space available - */ - - if ( (new_elt_ptr = hypre_TAlloc(hypre_ListElement, 1, HYPRE_MEMORY_HOST)) == NULL) - { - hypre_error_w_msg(HYPRE_ERROR_GENERIC,"\n create_elt: malloc failed \n\n"); - } - else - - /* new_elt_ptr = hypre_CTAlloc(hypre_LinkList, 1); */ - - { - new_elt_ptr -> data = Item; - new_elt_ptr -> next_elt = NULL; - new_elt_ptr -> prev_elt = NULL; - new_elt_ptr -> head = hypre_LIST_TAIL; - new_elt_ptr -> tail = hypre_LIST_HEAD; - } + hypre_LinkList new_elt_ptr; - return (new_elt_ptr); + /* Allocate memory space for the new node. + * return with error if no space available + */ + if ( (new_elt_ptr = hypre_TAlloc(hypre_ListElement, 1, HYPRE_MEMORY_HOST)) == NULL) + { + hypre_error_w_msg(HYPRE_ERROR_GENERIC,"\n create_elt: malloc failed \n\n"); + } + else + /* new_elt_ptr = hypre_CTAlloc(hypre_LinkList, 1); */ + { + new_elt_ptr -> data = Item; + new_elt_ptr -> next_elt = NULL; + new_elt_ptr -> prev_elt = NULL; + new_elt_ptr -> head = hypre_LIST_TAIL; + new_elt_ptr -> tail = hypre_LIST_HEAD; + } + + return (new_elt_ptr); } /***************************************************************** * - * enter_on_lists places point in new list + * enter_on_lists places point in new list * ****************************************************************/ void hypre_enter_on_lists(hypre_LinkList *LoL_head_ptr, - hypre_LinkList *LoL_tail_ptr, - HYPRE_Int measure, - HYPRE_Int index, - HYPRE_Int *lists, - HYPRE_Int *where) + hypre_LinkList *LoL_tail_ptr, + HYPRE_Int measure, + HYPRE_Int index, + HYPRE_Int *lists, + HYPRE_Int *where) { hypre_LinkList LoL_head = *LoL_head_ptr; hypre_LinkList LoL_tail = *LoL_tail_ptr; @@ -206,63 +197,63 @@ return; } else - { - do { - if (measure > list_ptr->data) + do { - new_ptr = hypre_create_elt(measure); - new_ptr->head = index; - new_ptr->tail = index; - lists[index] = hypre_LIST_TAIL; - where[index] = hypre_LIST_HEAD; - - if ( list_ptr->prev_elt != NULL) - { - new_ptr->prev_elt = list_ptr->prev_elt; - list_ptr->prev_elt->next_elt = new_ptr; - list_ptr->prev_elt = new_ptr; - new_ptr->next_elt = list_ptr; + if (measure > list_ptr->data) + { + new_ptr = hypre_create_elt(measure); + new_ptr->head = index; + new_ptr->tail = index; + lists[index] = hypre_LIST_TAIL; + where[index] = hypre_LIST_HEAD; + + if ( list_ptr->prev_elt != NULL) + { + new_ptr->prev_elt = list_ptr->prev_elt; + list_ptr->prev_elt->next_elt = new_ptr; + list_ptr->prev_elt = new_ptr; + new_ptr->next_elt = list_ptr; + } + else + { + new_ptr->next_elt = list_ptr; + list_ptr->prev_elt = new_ptr; + new_ptr->prev_elt = NULL; + LoL_head = new_ptr; + } + + *LoL_head_ptr = LoL_head; + *LoL_tail_ptr = LoL_tail; + return; } - else + else if (measure == list_ptr->data) { - new_ptr->next_elt = list_ptr; - list_ptr->prev_elt = new_ptr; - new_ptr->prev_elt = NULL; - LoL_head = new_ptr; + old_tail = list_ptr->tail; + lists[old_tail] = index; + where[index] = old_tail; + lists[index] = hypre_LIST_TAIL; + list_ptr->tail = index; + return; } - *LoL_head_ptr = LoL_head; - *LoL_tail_ptr = LoL_tail; - return; - } - else if (measure == list_ptr->data) - { - old_tail = list_ptr->tail; - lists[old_tail] = index; - where[index] = old_tail; - lists[index] = hypre_LIST_TAIL; - list_ptr->tail = index; - return; - } - - list_ptr = list_ptr->next_elt; - } while (list_ptr != NULL); + list_ptr = list_ptr->next_elt; + } while (list_ptr != NULL); - new_ptr = hypre_create_elt(measure); - new_ptr->head = index; - new_ptr->tail = index; - lists[index] = hypre_LIST_TAIL; - where[index] = hypre_LIST_HEAD; - LoL_tail->next_elt = new_ptr; - new_ptr->prev_elt = LoL_tail; - new_ptr->next_elt = NULL; - LoL_tail = new_ptr; - - *LoL_head_ptr = LoL_head; - *LoL_tail_ptr = LoL_tail; - return; - } -} + new_ptr = hypre_create_elt(measure); + new_ptr->head = index; + new_ptr->tail = index; + lists[index] = hypre_LIST_TAIL; + where[index] = hypre_LIST_HEAD; + LoL_tail->next_elt = new_ptr; + new_ptr->prev_elt = LoL_tail; + new_ptr->next_elt = NULL; + LoL_tail = new_ptr; + *LoL_head_ptr = LoL_head; + *LoL_tail_ptr = LoL_tail; + + return; + } +} diff -Nru hypre-2.16.0/src/utilities/amg_linklist.h hypre-2.18.2/src/utilities/amg_linklist.h --- hypre-2.16.0/src/utilities/amg_linklist.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/amg_linklist.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -29,15 +24,15 @@ struct double_linked_list { - HYPRE_Int data; - struct double_linked_list *next_elt; - struct double_linked_list *prev_elt; - HYPRE_Int head; - HYPRE_Int tail; + HYPRE_Int data; + struct double_linked_list *next_elt; + struct double_linked_list *prev_elt; + HYPRE_Int head; + HYPRE_Int tail; }; typedef struct double_linked_list hypre_ListElement; -typedef hypre_ListElement *hypre_LinkList; +typedef hypre_ListElement *hypre_LinkList; #ifdef __cplusplus } diff -Nru hypre-2.16.0/src/utilities/binsearch.c hypre-2.18.2/src/utilities/binsearch.c --- hypre-2.16.0/src/utilities/binsearch.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/binsearch.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,33 +1,26 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ - #include "_hypre_utilities.h" - + /*-------------------------------------------------------------------------- * hypre_BinarySearch * performs a binary search for value on array list where list needs * to contain ordered nonnegative numbers * the routine returns the location of the value or -1 *--------------------------------------------------------------------------*/ - + HYPRE_Int hypre_BinarySearch(HYPRE_Int *list, HYPRE_Int value, HYPRE_Int list_length) { HYPRE_Int low, high, m; HYPRE_Int not_found = 1; low = 0; - high = list_length-1; + high = list_length-1; while (not_found && low <= high) { m = (low + high) / 2; @@ -54,14 +47,14 @@ * to contain ordered nonnegative numbers * the routine returns the location of the value or -1 *--------------------------------------------------------------------------*/ - + HYPRE_Int hypre_BigBinarySearch(HYPRE_BigInt *list, HYPRE_BigInt value, HYPRE_Int list_length) { HYPRE_Int low, high, m; HYPRE_Int not_found = 1; low = 0; - high = list_length-1; + high = list_length-1; while (not_found && low <= high) { m = low + (high-low) / 2; @@ -86,21 +79,21 @@ * hypre_BinarySearch2 * this one is a bit more robust: * avoids overflow of m as can happen above when (low+high) overflows - * lets user specifiy high and low bounds for array (so a subset + * lets user specify high and low bounds for array (so a subset of array can be used) * if not found, then spot returns where is should be inserted *--------------------------------------------------------------------------*/ - -HYPRE_Int hypre_BinarySearch2(HYPRE_Int *list, HYPRE_Int value, HYPRE_Int low, HYPRE_Int high, HYPRE_Int *spot) + +HYPRE_Int hypre_BinarySearch2(HYPRE_Int *list, HYPRE_Int value, HYPRE_Int low, HYPRE_Int high, HYPRE_Int *spot) { - + HYPRE_Int m; - - while (low <= high) + + while (low <= high) { m = low + (high - low)/2; - + if (value < list[m]) high = m - 1; else if (value > list[m]) @@ -111,8 +104,9 @@ return m; } } + /* not found (high = low-1) - so insert at low */ - *spot = low; + *spot = low; return -1; } @@ -120,7 +114,7 @@ /*-------------------------------------------------------------------------- * Equivalent to C++ std::lower_bound *--------------------------------------------------------------------------*/ - + HYPRE_Int *hypre_LowerBound( HYPRE_Int *first, HYPRE_Int *last, HYPRE_Int value ) { HYPRE_Int *it; @@ -139,7 +133,7 @@ /*-------------------------------------------------------------------------- * Equivalent to C++ std::lower_bound *--------------------------------------------------------------------------*/ - + HYPRE_BigInt *hypre_BigLowerBound( HYPRE_BigInt *first, HYPRE_BigInt *last, HYPRE_BigInt value ) { HYPRE_BigInt *it; diff -Nru hypre-2.16.0/src/utilities/caliper_instrumentation.h hypre-2.18.2/src/utilities/caliper_instrumentation.h --- hypre-2.16.0/src/utilities/caliper_instrumentation.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/caliper_instrumentation.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/utilities/CMakeLists.txt hypre-2.18.2/src/utilities/CMakeLists.txt --- hypre-2.16.0/src/utilities/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/utilities/CMakeLists.txt 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,47 @@ +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +set(HDRS + HYPRE_utilities.h + _hypre_utilities.h + hypre_hopscotch_hash.h + HYPRE_error_f.h + fortran.h + fortran_matrix.h +) + +set(SRCS + HYPRE_version.c + amg_linklist.c + binsearch.c + exchange_data.c + F90_HYPRE_error.c + fortran_matrix.c + hypre_ap.c + hypre_complex.c + hypre_error.c + hypre_general.c + hypre_hopscotch_hash.c + hypre_memory.c + hypre_merge_sort.c + hypre_mpi_comm_f2c.c + hypre_prefix_sum.c + hypre_printf.c + hypre_qsort.c + mpistubs.c + qsplit.c + random.c + threading.c + timer.c + timing.c +) + +convert_filenames_to_full_paths(HDRS) +convert_filenames_to_full_paths(SRCS) + +set(HYPRE_HEADERS ${HYPRE_HEADERS} ${HDRS} PARENT_SCOPE) +set(HYPRE_SOURCES ${HYPRE_SOURCES} ${SRCS} PARENT_SCOPE) + + diff -Nru hypre-2.16.0/src/utilities/exchange_data.c hypre-2.18.2/src/utilities/exchange_data.c --- hypre-2.16.0/src/utilities/exchange_data.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/exchange_data.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* see exchange_data.README for additional information */ /* AHB 6/04 */ diff -Nru hypre-2.16.0/src/utilities/exchange_data.h hypre-2.18.2/src/utilities/exchange_data.h --- hypre-2.16.0/src/utilities/exchange_data.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/exchange_data.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_EXCHANGE_DATA_HEADER #define hypre_EXCHANGE_DATA_HEADER diff -Nru hypre-2.16.0/src/utilities/exchange_data.README hypre-2.18.2/src/utilities/exchange_data.README --- hypre-2.16.0/src/utilities/exchange_data.README 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/exchange_data.README 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) README for the hypre_DataExchangeList() function diff -Nru hypre-2.16.0/src/utilities/F90_HYPRE_error.c hypre-2.18.2/src/utilities/F90_HYPRE_error.c --- hypre-2.16.0/src/utilities/F90_HYPRE_error.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/F90_HYPRE_error.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_utilities.h" #include "fortran.h" diff -Nru hypre-2.16.0/src/utilities/fortran.h hypre-2.18.2/src/utilities/fortran.h --- hypre-2.16.0/src/utilities/fortran.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/fortran.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/utilities/fortran_matrix.c hypre-2.18.2/src/utilities/fortran_matrix.c --- hypre-2.16.0/src/utilities/fortran_matrix.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/fortran_matrix.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include diff -Nru hypre-2.16.0/src/utilities/fortran_matrix.h hypre-2.18.2/src/utilities/fortran_matrix.h --- hypre-2.16.0/src/utilities/fortran_matrix.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/fortran_matrix.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef FORTRAN_STYLE_MATRIX #define FORTRAN_STYLE_MATRIX diff -Nru hypre-2.16.0/src/utilities/general.h hypre-2.18.2/src/utilities/general.h --- hypre-2.16.0/src/utilities/general.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/general.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - -/****************************************************************************** - * - * General structures and values - * - *****************************************************************************/ - -#ifndef hypre_GENERAL_HEADER -#define hypre_GENERAL_HEADER - -/* This allows us to consistently avoid 'int' throughout hypre */ -typedef int hypre_int; -typedef long int hypre_longint; -typedef unsigned int hypre_uint; -typedef unsigned long int hypre_ulongint; - -/* This allows us to consistently avoid 'double' throughout hypre */ -typedef double hypre_double; - -/*-------------------------------------------------------------------------- - * Define various functions - *--------------------------------------------------------------------------*/ - -#ifndef hypre_max -#define hypre_max(a,b) (((a)<(b)) ? (b) : (a)) -#endif -#ifndef hypre_min -#define hypre_min(a,b) (((a)<(b)) ? (a) : (b)) -#endif - -#ifndef hypre_abs -#define hypre_abs(a) (((a)>0) ? (a) : -(a)) -#endif - -#ifndef hypre_round -#define hypre_round(x) ( ((x) < 0.0) ? ((HYPRE_Int)(x - 0.5)) : ((HYPRE_Int)(x + 0.5)) ) -#endif - -#ifndef hypre_pow2 -#define hypre_pow2(i) ( 1 << (i) ) -#endif - -#endif - diff -Nru hypre-2.16.0/src/utilities/gpuErrorCheck.c hypre-2.18.2/src/utilities/gpuErrorCheck.c --- hypre-2.16.0/src/utilities/gpuErrorCheck.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/gpuErrorCheck.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,195 +0,0 @@ -#include "_hypre_utilities.h" - - -#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) - -void CheckError(cudaError_t const err, const char* file, char const* const fun, const HYPRE_Int line) -{ - if (err) - { -#if HYPRE_ALLBIGINT - printf("CUDA Error Code[%d]: %s\n %s(%s) Line:%lld\n", err, cudaGetErrorString(err), file, fun, line); -#else - printf("CUDA Error Code[%d]: %s\n %s(%s) Line:%d\n", err, cudaGetErrorString(err), file, fun, line); -#endif - HYPRE_Int *p = NULL; *p = 1; - } -} - -/* -extern const char *cusparseErrorCheck(cusparseStatus_t error); -extern void gpuAssert(cudaError_t code, const char *file, int line); -extern void cusparseAssert(cusparseStatus_t code, const char *file, int line); -*/ - -/* - cudaSafeFree frees Managed memory allocated in hypre_MAlloc,hypre_CAlloc and hypre_ReAlloc - It checks if the memory is managed before freeing and emits a warning if it is not memory - allocated using the above routines. This behaviour can be changed by defining ABORT_ON_RAW_POINTER. - The core file can then be used to find the location of the anomalous hypre_Free. - */ -void cudaSafeFree(void *ptr,int padding) -{ - PUSH_RANGE("SAFE_FREE",3); - struct cudaPointerAttributes ptr_att; - size_t *sptr=(size_t*)ptr-padding; - cudaError_t err; - - err=cudaPointerGetAttributes(&ptr_att,ptr); - if (err!=cudaSuccess) - { - cudaGetLastError(); -#ifndef ABORT_ON_RAW_POINTER -#ifdef FULL_WARN - if (err==cudaErrorInvalidValue) - { - fprintf(stderr,"WARNING :: Raw pointer passed to cudaSafeFree %p\n",ptr); - } - else if (err==cudaErrorInvalidDevice) - { - fprintf(stderr,"WARNING :: cudaSafeFree :: INVALID DEVICE on ptr = %p\n",ptr); - } - else if (err==cudaErrorIncompatibleDriverContext) - { - fprintf(stderr,"WARNING :: cudaSafeFree :: Incompatible Driver Context on ptr = %p\n",ptr); - } - else - { - fprintf(stderr,"Point Attrib check error is %d \n",err); - } - //PrintPointerAttributes(ptr); -#endif /* FULL_WARN */ -#else - fprintf(stderr,"ERROR:: cudaSafeFree Aborting on raw unmanaged pointer %p\n",ptr); - raise(SIGABRT); -#endif /* ABORT_ON_RAW_POINTER */ - free(ptr); /* Free the nonManaged pointer */ - return; - } - - if (ptr_att.isManaged) - { -#if defined(HYPRE_MEASURE_GPU_HWM) - size_t mfree,mtotal; - hypre_CheckErrorDevice(cudaMemGetInfo(&mfree,&mtotal)); - HYPRE_GPU_HWM = hypre_max((mtotal-mfree),HYPRE_GPU_HWM); -#endif - /* Code below for handling managed memory pointers not allocated using hypre_CTAlloc oir hypre_TAlooc */ - if (PointerAttributes(ptr)!=PointerAttributes(sptr)){ - //fprintf(stderr,"ERROR IN Pointer for freeing %p %p\n",ptr,sptr); - hypre_CheckErrorDevice(cudaFree(ptr)); - return; - } - hypre_CheckErrorDevice(cudaFree(sptr)); - } - else - { - /* It is a pinned memory pointer */ - //printf("ERROR:: NON-managed pointer passed to cudaSafeFree\n"); - if (ptr_att.memoryType==cudaMemoryTypeHost) - { - hypre_CheckErrorDevice(cudaFreeHost(sptr)); - } - else if (ptr_att.memoryType==cudaMemoryTypeDevice) - { - hypre_CheckErrorDevice(cudaFree(sptr)); - } - } - POP_RANGE; - - return; -} - -hypre_int PrintPointerAttributes(const void *ptr){ - struct cudaPointerAttributes ptr_att; -#if defined(TRACK_MEMORY_ALLOCATIONS) - pattr_t *ss = patpush(ptr,NULL); - if (ss!=NULL) fprintf(stderr,"Pointer %p from line %d of %s TYPE = %d \n",ptr,ss->line,ss->file,ss->type); -#endif /* TRACK_MEMORY_ALLOCATIONS */ - if (cudaPointerGetAttributes(&ptr_att,ptr)!=cudaSuccess){ - cudaGetLastError(); // Required to reset error flag on device - fprintf(stderr,"PrintPointerAttributes:: Raw pointer %p\n",ptr); - return HYPRE_HOST_POINTER; - } - if (ptr_att.isManaged){ - fprintf(stderr,"PrintPointerAttributes:: Managed pointer\n"); - fprintf(stderr,"Host address = %p, Device Address = %p\n",ptr_att.hostPointer, ptr_att.devicePointer); - if (ptr_att.memoryType==cudaMemoryTypeHost) fprintf(stderr,"Memory is located on host\n"); - if (ptr_att.memoryType==cudaMemoryTypeDevice) fprintf(stderr,"Memory is located on device\n"); - fprintf(stderr,"Device associated with this pointer is %d\n",ptr_att.device); - return HYPRE_MANAGED_POINTER; - } - else { - fprintf(stderr,"PrintPointerAttributes:: Non-Managed & non-raw pointer\n Probably pinned host pointer\n"); - if (ptr_att.memoryType==cudaMemoryTypeHost) { - fprintf(stderr,"Memory is located on host\n"); - return HYPRE_PINNED_POINTER; - } - if (ptr_att.memoryType==cudaMemoryTypeDevice) { - fprintf(stderr,"Memory is located on device\n"); - return HYPRE_DEVICE_POINTER ; - } - return HYPRE_UNDEFINED_POINTER1; - } -} -hypre_int PointerAttributes(const void *ptr){ - struct cudaPointerAttributes ptr_att; - if (cudaPointerGetAttributes(&ptr_att,ptr)!=cudaSuccess){ - cudaGetLastError(); // Required to reset error flag on device - return HYPRE_HOST_POINTER; - } - if (ptr_att.isManaged){ - return HYPRE_MANAGED_POINTER; - } - else { - if (ptr_att.memoryType==cudaMemoryTypeHost) return HYPRE_PINNED_POINTER; /* Host pointer from cudaMallocHost */ - if (ptr_att.memoryType==cudaMemoryTypeDevice) return HYPRE_DEVICE_POINTER ; /* cudadevice pointer */ - return HYPRE_UNDEFINED_POINTER1; /* Shouldn't happen */ - } -} - -#if defined(TRACK_MEMORY_ALLOCATIONS) -void assert_check(void *ptr, char *file, int line){ - if (ptr==NULL) return; - pattr_t *ss = patpush(ptr,NULL); - if (ss!=NULL) - { - if (ss->type!=HYPRE_MEMORY_SHARED) - { - fprintf(stderr,"ASSERT_MANAGED FAILURE in line %d of file %s type = %d pomitrt = %p\n",line,file,ss->type,ptr); - fprintf(stderr,"ASSERT_MANAGED failed on allocation from line %d of %s \n",ss->line,ss->file); - } - } - else - { - if ( PointerAttributes(ptr)!=HYPRE_MANAGED_POINTER){ - fprintf(stderr,"ASSERT_MANAGED FAILURE in line %d of file %s \n NO ALLOCATION INFO\n",line,file); - PrintPointerAttributes(ptr); - } - } - -} -void assert_check_host(void *ptr, char *file, int line){ - if (ptr==NULL) return; - pattr_t *ss = patpush(ptr,NULL); - if (ss!=NULL) - { - if (ss->type!=HYPRE_MEMORY_HOST) - { - fprintf(stderr,"ASSERT_HOST FAILURE in line %d of file %s type = %d pomitrt = %p\n",line,file,ss->type,ptr); - fprintf(stderr,"ASSERT_HOST failed on allocation from line %d of %s of size %d bytes \n",ss->line,ss->file,ss->size); - } - } - else - { - //printf("Address not in map\n Calling PrintPointerAttributes\n"); - if ( PointerAttributes(ptr)!=HYPRE_HOST_POINTER){ - fprintf(stderr,"ASSERT_HOST FAILURE in line %d of file %s \n NO ALLOCATION INFO\n",line,file); - } - } - -} - -#endif /* TRACK_MEMORY_ALLOCATIONS */ - -#endif diff -Nru hypre-2.16.0/src/utilities/gpuErrorCheck.h hypre-2.18.2/src/utilities/gpuErrorCheck.h --- hypre-2.16.0/src/utilities/gpuErrorCheck.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/gpuErrorCheck.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,154 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - -#ifndef hypre_GPU_ERROR_HEADER -#define hypre_GPU_ERROR_HEADER - -#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) - -//#include -#ifdef __cplusplus -extern "C++" { -#endif -#include -#include -#ifdef __cplusplus -} -#endif - -#define hypre_CheckErrorDevice(err) CheckError(err,__FILE__, __FUNCTION__, __LINE__) -#define CUDAMEMATTACHTYPE cudaMemAttachGlobal -#define HYPRE_HOST_POINTER 0 -#define HYPRE_MANAGED_POINTER 1 -#define HYPRE_PINNED_POINTER 2 -#define HYPRE_DEVICE_POINTER 3 -#define HYPRE_UNDEFINED_POINTER1 4 -#define HYPRE_UNDEFINED_POINTER2 5 - -void CheckError(cudaError_t const err, const char* file, char const* const fun, const HYPRE_Int line); -void cudaSafeFree(void *ptr,int padding); -hypre_int PrintPointerAttributes(const void *ptr); -hypre_int PointerAttributes(const void *ptr); - -/* CUBLAS and CUSPARSE related */ -#ifndef __cusparseErrorCheck__ -#define __cusparseErrorCheck__ - -/* MUST HAVE " extern "C++" " for C++ header cusparse.h, and the headers therein */ -#ifdef __cplusplus -extern "C++" { -#endif -#include -#ifdef __cplusplus -} -#endif -#include -#include -inline const char *cusparseErrorCheck(cusparseStatus_t error) -{ - switch (error) - { - case CUSPARSE_STATUS_SUCCESS: - return "CUSPARSE_STATUS_SUCCESS"; - - case CUSPARSE_STATUS_NOT_INITIALIZED: - return "CUSPARSE_STATUS_NOT_INITIALIZED"; - - case CUSPARSE_STATUS_ALLOC_FAILED: - return "CUSPARSE_STATUS_ALLOC_FAILED"; - - case CUSPARSE_STATUS_INVALID_VALUE: - return "CUSPARSE_STATUS_INVALID_VALUE"; - - case CUSPARSE_STATUS_ARCH_MISMATCH: - return "CUSPARSE_STATUS_ARCH_MISMATCH"; - - case CUSPARSE_STATUS_MAPPING_ERROR: - return "CUSPARSE_STATUS_MAPPING_ERROR"; - - case CUSPARSE_STATUS_EXECUTION_FAILED: - return "CUSPARSE_STATUS_EXECUTION_FAILED"; - - case CUSPARSE_STATUS_INTERNAL_ERROR: - return "CUSPARSE_STATUS_INTERNAL_ERROR"; - - case CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED: - return "CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED"; - default: - return "Unknown error in cusparseErrorCheck"; - } - -} - -inline const char *cublasErrorCheck(cublasStatus_t error) -{ - switch (error) - { - case CUBLAS_STATUS_SUCCESS: - return "CUBLAS_STATUS_SUCCESS"; - - case CUBLAS_STATUS_NOT_INITIALIZED: - return "CUBLAS_STATUS_NOT_INITIALIZED"; - - case CUBLAS_STATUS_ALLOC_FAILED: - return "CUBLAS_STATUS_ALLOC_FAILED"; - - case CUBLAS_STATUS_INVALID_VALUE: - return "CUBLAS_STATUS_INVALID_VALUE"; - - case CUBLAS_STATUS_ARCH_MISMATCH: - return "CUBLAS_STATUS_ARCH_MISMATCH"; - - case CUBLAS_STATUS_MAPPING_ERROR: - return "CUBLAS_STATUS_MAPPING_ERROR"; - - case CUBLAS_STATUS_EXECUTION_FAILED: - return "CUBLAS_STATUS_EXECUTION_FAILED"; - - case CUBLAS_STATUS_INTERNAL_ERROR: - return "CUBLAS_STATUS_INTERNAL_ERROR"; - - case CUBLAS_STATUS_NOT_SUPPORTED: - return "CUBLAS_STATUS_NOT_SUPPORTED"; - case CUBLAS_STATUS_LICENSE_ERROR: - return "CUBLAS_STATUS_LICENSE_ERROR"; - default: - return "Unknown error in cublasErrorCheck"; - } -} - -#define cusparseErrchk(ans) { cusparseAssert((ans), __FILE__, __LINE__); } -inline void cusparseAssert(cusparseStatus_t code, const char *file, int line) -{ - if (code != CUSPARSE_STATUS_SUCCESS) - { - fprintf(stderr,"CUSPARSE ERROR ( Code = %d) IN CUDA CALL line %d of file %s\n",code,line,file); - fprintf(stderr,"CUSPARSE ERROR : %s \n", cusparseErrorCheck(code)); - } -} - -#define cublasErrchk(ans){ cublasAssert((ans), __FILE__, __LINE__); } -inline void cublasAssert(cublasStatus_t code, const char *file, int line) -{ - if (code != CUBLAS_STATUS_SUCCESS) - { - fprintf(stderr,"CUBLAS ERROR ( Code = %d) IN CUDA CALL line %d of file %s\n",code,line,file); - fprintf(stderr,"CUBLAS ERROR : %s \n", cublasErrorCheck(code)); - } -} - -#endif // __cusparseErrorCheck__ - -#endif // #if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) - -#endif // hypre_GPU_ERROR_HEADER - diff -Nru hypre-2.16.0/src/utilities/gpuMem.c hypre-2.18.2/src/utilities/gpuMem.c --- hypre-2.16.0/src/utilities/gpuMem.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/gpuMem.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,623 +0,0 @@ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif -#include "_hypre_utilities.h" - -#if defined(HYPRE_USING_UNIFIED_MEMORY) -size_t memsize(const void *ptr){ - return ((size_t*)ptr)[-HYPRE_MEM_PAD_LEN]; -} -#else -size_t memsize(const void *ptr){ - return 0; -} -#endif - -#if defined(HYPRE_USING_CUDA) -HYPRE_Int hypre_exec_policy = HYPRE_MEMORY_DEVICE; -#endif - -#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) - -hypre_int ggc(hypre_int id); - -/* Global struct that holds device,library handles etc */ -struct hypre__global_struct hypre__global_handle = {0, 0, 1, 0}; - -/* Initialize GPU branch of Hypre AMG */ -/* use_device =-1 */ -/* Application passes device number it is using or -1 to let Hypre decide on which device to use */ -void hypre_GPUInit(hypre_int use_device) -{ - char pciBusId[80]; - HYPRE_Int myid; - hypre_int nDevices; - //hypre_int device; -#if defined(TRACK_MEMORY_ALLOCATIONS) - hypre_printf("\n\n\n WARNING :: TRACK_MEMORY_ALLOCATIONS IS ON \n\n"); -#endif /* TRACK_MEMORY_ALLOCATIONS */ - - if (!HYPRE_GPU_HANDLE) - { - HYPRE_GPU_HANDLE=1; - HYPRE_DEVICE=0; - hypre_CheckErrorDevice(cudaGetDeviceCount(&nDevices)); - - /* XXX */ - nDevices = 1; /* DO NOT COMMENT ME OUT AGAIN! nDevices does NOT WORK !!!! */ - HYPRE_DEVICE_COUNT=nDevices; - - /* TODO cannot use nDevices to check if mpibind is used, need to rewrite - * E.g., NP=5 on 2 nodes, nDevices=1,1,1,1,4 */ - - if (use_device<0) - { - if (nDevices<4) - { - /* with mpibind each process will only see 1 GPU */ - HYPRE_DEVICE=0; - hypre_CheckErrorDevice(cudaSetDevice(HYPRE_DEVICE)); - cudaDeviceGetPCIBusId ( pciBusId, 80, HYPRE_DEVICE); - //hypre_printf("num Devices %d\n", nDevices); - } - else if (nDevices==4) - { - // THIS IS A HACK THAT WORKS ONLY AT LLNL - /* No mpibind or it is a single rank run */ - hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid ); - //affs(myid); - hypre_MPI_Comm node_comm; - hypre_MPI_Info info; - hypre_MPI_Info_create(&info); - hypre_MPI_Comm_split_type(hypre_MPI_COMM_WORLD, hypre_MPI_COMM_TYPE_SHARED, myid, info, &node_comm); - hypre_int round_robin=1; - HYPRE_Int myNodeid, NodeSize; - hypre_MPI_Comm_rank(node_comm, &myNodeid); - hypre_MPI_Comm_size(node_comm, &NodeSize); - if (round_robin) - { - /* Round robin allocation of GPUs. Does not account for affinities */ - HYPRE_DEVICE=myNodeid%nDevices; - hypre_CheckErrorDevice(cudaSetDevice(HYPRE_DEVICE)); - cudaDeviceGetPCIBusId ( pciBusId, 80, HYPRE_DEVICE); - //hypre_printf("WARNING:: Code running without mpibind\n"); - //hypre_printf("Global ID = %d , Node ID %d running on device %d of %d \n",myid,myNodeid,HYPRE_DEVICE,nDevices); - } - else - { - /* Try to set the GPU based on process binding */ - /* works correcly for all cases */ - hypre_MPI_Comm numa_comm; - hypre_MPI_Comm_split(node_comm,getnuma(),myNodeid,&numa_comm); - HYPRE_Int myNumaId,NumaSize; - hypre_MPI_Comm_rank(numa_comm, &myNumaId); - hypre_MPI_Comm_size(numa_comm, &NumaSize); - hypre_int domain_devices=nDevices/2; /* Again hardwired for 2 NUMA domains */ - HYPRE_DEVICE = getnuma()*2+myNumaId%domain_devices; - hypre_CheckErrorDevice(cudaSetDevice(HYPRE_DEVICE)); - //hypre_printf("WARNING:: Code running without mpibind\n"); - //hypre_printf("NUMA %d GID %d , NodeID %d NumaID %d running on device %d (RR=%d) of %d \n",getnuma(),myid,myNodeid,myNumaId,HYPRE_DEVICE,myNodeid%nDevices,nDevices); - - } - hypre_MPI_Info_free(&info); - } - else - { - /* No device found */ - hypre_error_w_msg(HYPRE_ERROR_GENERIC,"ERROR:: NO GPUS found \n"); - exit(2); - } - } - else - { - HYPRE_DEVICE = use_device; - hypre_CheckErrorDevice(cudaSetDevice(HYPRE_DEVICE)); - } - -#if defined(HYPRE_USING_OPENMP_OFFLOAD) || defined(HYPRE_USING_MAPPED_OPENMP_OFFLOAD) - omp_set_default_device(HYPRE_DEVICE); - //printf("Set OMP Default device to %d \n",HYPRE_DEVICE); -#endif - - /* Create NVTX domain for all the nvtx calls in HYPRE */ - HYPRE_DOMAIN=nvtxDomainCreateA("Hypre"); - - /* Initialize streams */ - hypre_int jj; - for(jj=0;jj0){ - PrintPointerAttributes(ptr); - hypre_CheckErrorDevice(cudaMemPrefetchAsync(ptr,size,device,stream)); - hypre_CheckErrorDevice(cudaStreamSynchronize(stream)); - POP_RANGE; - return; - } - return; -} - - -void MemPrefetchForce(const void *ptr,hypre_int device,cudaStream_t stream){ - if (ptr==NULL) return; - size_t size=memsize(ptr); - PUSH_RANGE_PAYLOAD("MemPreFetchForce",4,size); - hypre_CheckErrorDevice(cudaMemPrefetchAsync(ptr,size,device,stream)); - POP_RANGE; - return; -} - -void MemPrefetchSized(const void *ptr,size_t size,hypre_int device,cudaStream_t stream){ - if (ptr==NULL) return; - PUSH_RANGE_DOMAIN("MemPreFetchSized",4,0); - /* Do a prefetch every time until a possible UM bug is fixed */ - if (size>0){ - hypre_CheckErrorDevice(cudaMemPrefetchAsync(ptr,size,device,stream)); - POP_RANGE_DOMAIN(0); - return; - } - return; -} - - -/* Returns the same cublas handle with every call */ -cublasHandle_t getCublasHandle(){ - cublasStatus_t stat; - static cublasHandle_t handle; - static hypre_int firstcall=1; - if (firstcall){ - firstcall=0; - stat = cublasCreate(&handle); - if (stat!=CUBLAS_STATUS_SUCCESS) { - hypre_error_w_msg(HYPRE_ERROR_GENERIC,"ERROR:: CUBLAS Library initialization failed\n"); - handle=0; - exit(2); - } - cublasErrchk(cublasSetStream(handle,HYPRE_STREAM(4))); - } else return handle; - return handle; -} - -/* Returns the same cusparse handle with every call */ -cusparseHandle_t getCusparseHandle(){ - cusparseStatus_t status; - static cusparseHandle_t handle; - static hypre_int firstcall=1; - if (firstcall){ - firstcall=0; - status= cusparseCreate(&handle); - if (status != CUSPARSE_STATUS_SUCCESS) { - hypre_error_w_msg(HYPRE_ERROR_GENERIC,"ERROR:: CUSPARSE Library initialization failed\n"); - handle=0; - exit(2); - } - cusparseErrchk(cusparseSetStream(handle,HYPRE_STREAM(4))); - } else return handle; - return handle; -} - - -cudaStream_t getstreamOlde(hypre_int i){ - static hypre_int firstcall=1; - const hypre_int MAXSTREAMS=10; - static cudaStream_t s[MAXSTREAMS]; - if (firstcall){ - hypre_int jj; - for(jj=0;jj -#include - -void affs(hypre_int myid){ - const hypre_int NCPUS=160; - cpu_set_t* mask = CPU_ALLOC(NCPUS); - size_t size = CPU_ALLOC_SIZE(NCPUS); - hypre_int cpus[NCPUS],i; - hypre_int retval=sched_getaffinity(0, size,mask); - if (!retval){ - for(i=0;isum1) return 0; - else return 1; - } else { - hypre_error_w_msg(HYPRE_ERROR_GENERIC,"sched_affinity failed\n"); - switch(errno){ - case EFAULT: - hypre_error_w_msg(HYPRE_ERROR_GENERIC,"INVALID MEMORY ADDRESS\n"); - break; - case EINVAL: - hypre_error_w_msg(HYPRE_ERROR_GENERIC,"EINVAL:: NO VALID CPUS\n"); - break; - default: - hypre_error_w_msg(HYPRE_ERROR_GENERIC,"something else\n"); - } - } - return hypre_error_flag; - //CPU_FREE(mask); - -} -hypre_int checkDeviceProps(){ - struct cudaDeviceProp prop; - hypre_CheckErrorDevice(cudaGetDeviceProperties(&prop, HYPRE_DEVICE)); - HYPRE_GPU_CMA=prop.concurrentManagedAccess; - return HYPRE_GPU_CMA; -} -hypre_int pointerIsManaged(const void *ptr){ - struct cudaPointerAttributes ptr_att; - if (cudaPointerGetAttributes(&ptr_att,ptr)!=cudaSuccess) { - cudaGetLastError(); - return 0; - } - return ptr_att.isManaged; -} - -/* C version of mempush using linked lists */ - -size_t mempush(const void *ptr, size_t size, hypre_int action){ - static node* head=NULL; - static hypre_int nc=0; - node *found=NULL; - if (!head){ - if ((size<=0)||(action==1)) { - fprintf(stderr,"mempush can start only with an insertion or a size call \n"); - return 0; - } - head = hypre_TAlloc(node, 1, HYPRE_MEMORY_HOST); - head->ptr=ptr; - head->size=size; - head->next=NULL; - nc++; - return size; - } else { - // Purge an address - if (action==1){ - found=memfind(head,ptr); - if (found){ - memdel(&head, found); - nc--; - return 0; - } else { -#ifdef FULL_WARN - fprintf(stderr,"ERROR :: Pointer for deletion not found in linked list %p\n",ptr); -#endif - return 0; - } - } // End purge - - // Insertion - if (size>0){ - found=memfind(head,ptr); - if (found){ -#ifdef FULL_WARN - fprintf(stderr,"ERROR :: Pointer for insertion already in use in linked list %p\n",ptr); - //printlist(head,nc); -#endif - return 0; - } else { - nc++; - meminsert(&head,ptr,size); - return 0; - } - } - - // Getting allocation size - found=memfind(head,ptr); - if (found){ - return found->size; - } else{ -#ifdef FULL_WARN - fprintf(stderr,"ERROR :: Pointer for size check NOT found in linked list\n"); -#endif - return 0; - } - } -} - -node *memfind(node *head, const void *ptr){ - node *next; - next=head; - while(next!=NULL){ - if (next->ptr==ptr) return next; - next=next->next; - } - return NULL; -} - -void memdel(node **head, node *found){ - node *next; - if (found==*head){ - next=(*head)->next; - free(*head); - *head=next; - return; - } - next=*head; - while(next->next!=found){ - next=next->next; - } - next->next=next->next->next; - free(found); - return; -} -void meminsert(node **head, const void *ptr,size_t size){ - node *nhead; - nhead = hypre_TAlloc(node, 1, HYPRE_MEMORY_HOST); - nhead->ptr=ptr; - nhead->size=size; - nhead->next=*head; - *head=nhead; - return; -} - -void printlist(node *head,hypre_int nc){ - node *next; - next=head; - printf("Node count %d \n",nc); - while(next!=NULL){ - printf("Address %p of size %zu \n",next->ptr,next->size); - next=next->next; - } -} - -#endif /* #if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) */ - -#if defined(HYPRE_USING_DEVICE_OPENMP) - -#include - -/* num: number of bytes */ -HYPRE_Int HYPRE_OMPOffload(HYPRE_Int device, void *ptr, size_t num, - const char *type1, const char *type2) { - hypre_omp45_offload(device, ptr, char, 0, num, type1, type2); - - return 0; -} - -HYPRE_Int HYPRE_OMPPtrIsMapped(void *p, HYPRE_Int device_num) -{ - if (hypre__global_offload && !omp_target_is_present(p, device_num)) { - printf("HYPRE mapping error: %p has not been mapped to device %d!\n", p, device_num); - return 1; - } - return 0; -} - -/* OMP offloading switch */ -HYPRE_Int HYPRE_OMPOffloadOn() -{ - hypre__global_offload = 1; - hypre__offload_device_num = omp_get_default_device(); - hypre__offload_host_num = omp_get_initial_device(); - hypre_fprintf(stdout, "Hypre OMP 4.5 offloading has been turned on. Device %d\n", - hypre__offload_device_num); - - return 0; -} - -HYPRE_Int HYPRE_OMPOffloadOff() -{ - fprintf(stdout, "Hypre OMP 4.5 offloading has been turned off\n"); - hypre__global_offload = 0; - hypre__offload_device_num = omp_get_initial_device(); - hypre__offload_host_num = omp_get_initial_device(); - - return 0; -} - -HYPRE_Int HYPRE_OMPOffloadStatPrint() { - hypre_printf("Hypre OMP target memory stats:\n" - " ALLOC %ld bytes, %ld counts\n" - " FREE %ld bytes, %ld counts\n" - " HTOD %ld bytes, %ld counts\n" - " DTOH %ld bytes, %ld counts\n", - hypre__target_allc_bytes, hypre__target_allc_count, - hypre__target_free_bytes, hypre__target_free_count, - hypre__target_htod_bytes, hypre__target_htod_count, - hypre__target_dtoh_bytes, hypre__target_dtoh_count); - - return 0; -} - -#endif /* #if defined(HYPRE_USING_DEVICE_OPENMP) */ - diff -Nru hypre-2.16.0/src/utilities/gpuMem.h hypre-2.18.2/src/utilities/gpuMem.h --- hypre-2.16.0/src/utilities/gpuMem.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/gpuMem.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,132 +0,0 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ -#ifndef __GPUMEM_H__ -#define __GPUMEM_H__ - -#if defined(HYPRE_USING_CUDA) -#define HYPRE_MIN_GPU_SIZE (131072) -extern HYPRE_Int hypre_exec_policy; -#define hypre_SetDeviceOn() hypre_exec_policy = HYPRE_MEMORY_DEVICE -#define hypre_SetDeviceOff() hypre_exec_policy = HYPRE_MEMORY_HOST -#endif /* #if defined(HYPRE_USING_CUDA) */ - -#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) - -#define HYPRE_USE_MANAGED_SCALABLE 1 -#define HYPRE_GPU_USE_PINNED 1 - -#include -void hypre_GPUInit(hypre_int use_device); -void hypre_GPUFinalize(); -int VecScaleScalar(double *u, const double alpha, int num_rows,cudaStream_t s); -void VecCopy(double* tgt, const double* src, int size,cudaStream_t s); -void VecSet(double* tgt, int size, double value, cudaStream_t s); -void VecScale(double *u, double *v, double *l1_norm, int num_rows,cudaStream_t s); -void VecScaleSplit(double *u, double *v, double *l1_norm, int num_rows,cudaStream_t s); -void CudaCompileFlagCheck(); -void BigToSmallCopy (hypre_int* tgt, const HYPRE_Int *src, hypre_int size, cudaStream_t s); -cudaStream_t getstreamOlde(hypre_int i); -nvtxDomainHandle_t getdomain(hypre_int i); -cudaEvent_t getevent(hypre_int i); -void MemAdviseReadOnly(const void *ptr, hypre_int device); -void MemAdviseUnSetReadOnly(const void *ptr, hypre_int device); -void MemAdviseSetPrefLocDevice(const void *ptr, hypre_int device); -void MemAdviseSetPrefLocHost(const void *ptr); -void MemPrefetch(const void *ptr,hypre_int device,cudaStream_t stream); -void MemPrefetchSized(const void *ptr,size_t size,hypre_int device,cudaStream_t stream); -void MemPrefetchForce(const void *ptr,hypre_int device,cudaStream_t stream); -cublasHandle_t getCublasHandle(); -cusparseHandle_t getCusparseHandle(); -hypre_int getsetasyncmode(hypre_int mode, hypre_int action); -void SetAsyncMode(hypre_int mode); -hypre_int GetAsyncMode(); -void branchStream(hypre_int i, hypre_int j); -void joinStreams(hypre_int i, hypre_int j, hypre_int k); -void affs(hypre_int myid); -hypre_int getcore(); -hypre_int getnuma(); -hypre_int checkDeviceProps(); -hypre_int pointerIsManaged(const void *ptr); - -/* - * Global struct for keeping HYPRE GPU Init state - */ - -#define MAX_HGS_ELEMENTS 10 -struct hypre__global_struct -{ - hypre_int initd; - hypre_int device; - hypre_int device_count; - size_t memoryHWM; - cublasHandle_t cublas_handle; - cusparseHandle_t cusparse_handle; - cusparseMatDescr_t cusparse_mat_descr; - cudaStream_t streams[MAX_HGS_ELEMENTS]; - nvtxDomainHandle_t nvtx_domain; - hypre_int concurrent_managed_access; -}; - -extern struct hypre__global_struct hypre__global_handle ; - -/* - * Macros for accessing elements of the global handle - */ - -#define HYPRE_DOMAIN hypre__global_handle.nvtx_domain -#define HYPRE_STREAM(index) (hypre__global_handle.streams[index]) -#define HYPRE_GPU_HANDLE hypre__global_handle.initd -#define HYPRE_CUBLAS_HANDLE hypre__global_handle.cublas_handle -#define HYPRE_CUSPARSE_HANDLE hypre__global_handle.cusparse_handle -#define HYPRE_DEVICE hypre__global_handle.device -#define HYPRE_DEVICE_COUNT hypre__global_handle.device_count -#define HYPRE_CUSPARSE_MAT_DESCR hypre__global_handle.cusparse_mat_descr -#define HYPRE_GPU_CMA hypre__global_handle.concurrent_managed_access -#define HYPRE_GPU_HWM hypre__global_handle.memoryHWM - - -typedef struct node { - const void *ptr; - size_t size; - struct node *next; -} node; -size_t mempush(const void *ptr, size_t size, hypre_int action); -node *memfind(node *head, const void *ptr); -void memdel(node **head, node *found); -void meminsert(node **head, const void *ptr,size_t size); -void printlist(node *head,hypre_int nc); -size_t memsize(const void *ptr); - -#endif /* #if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) */ - - -#if defined(HYPRE_USING_DEVICE_OPENMP) -HYPRE_Int HYPRE_OMPOffload(HYPRE_Int device, void *ptr, size_t num, - const char *type1, const char *type2); - -HYPRE_Int HYPRE_OMPPtrIsMapped(void *p, HYPRE_Int device_num); - -HYPRE_Int HYPRE_OMPOffloadOn(); - -HYPRE_Int HYPRE_OMPOffloadOff(); - -HYPRE_Int HYPRE_OMPOffloadStatPrint(); - -#define HYPRE_MIN_GPU_SIZE (131072) - -#define hypre_SetDeviceOn() HYPRE_OMPOffloadOn() -#define hypre_SetDeviceOff() HYPRE_OMPOffloadOff() - -#endif /* #if defined(HYPRE_USING_DEVICE_OPENMP) */ - -#endif/* __GPUMEM_H__ */ - diff -Nru hypre-2.16.0/src/utilities/headers hypre-2.18.2/src/utilities/headers --- hypre-2.16.0/src/utilities/headers 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/headers 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) INTERNAL_HEADER=_hypre_utilities.h @@ -41,20 +34,21 @@ # Structures and prototypes #=========================================================================== -cat general.h >> $INTERNAL_HEADER +cat hypre_general.h >> $INTERNAL_HEADER cat mpistubs.h >> $INTERNAL_HEADER cat hypre_smp.h >> $INTERNAL_HEADER cat hypre_memory.h >> $INTERNAL_HEADER -cat threading.h >> $INTERNAL_HEADER +cat hypre_omp_device.h >> $INTERNAL_HEADER +cat threading.h >> $INTERNAL_HEADER cat timing.h >> $INTERNAL_HEADER cat amg_linklist.h >> $INTERNAL_HEADER cat exchange_data.h >> $INTERNAL_HEADER cat hypre_error.h >> $INTERNAL_HEADER cat caliper_instrumentation.h >> $INTERNAL_HEADER +cat hypre_cuda_utils.h >> $INTERNAL_HEADER +cat hypre_handle.h >> $INTERNAL_HEADER cat hypre_nvtx.h >> $INTERNAL_HEADER -cat gpuErrorCheck.h >> $INTERNAL_HEADER -cat gpuMem.h >> $INTERNAL_HEADER -cat hypre_reducesum.h >> $INTERNAL_HEADER +cat hypre_cuda_reducer.h >> $INTERNAL_HEADER cat protos.h >> $INTERNAL_HEADER #=========================================================================== diff -Nru hypre-2.16.0/src/utilities/hypre_ap.c hypre-2.18.2/src/utilities/hypre_ap.c --- hypre-2.16.0/src/utilities/hypre_ap.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_ap.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + #include "_hypre_utilities.h" diff -Nru hypre-2.16.0/src/utilities/hypre_complex.c hypre-2.18.2/src/utilities/hypre_complex.c --- hypre-2.16.0/src/utilities/hypre_complex.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_complex.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_utilities.h" diff -Nru hypre-2.16.0/src/utilities/hypre_cuda_reducer.h hypre-2.18.2/src/utilities/hypre_cuda_reducer.h --- hypre-2.16.0/src/utilities/hypre_cuda_reducer.h 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_cuda_reducer.h 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,279 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +/* CUDA reducer class */ + +#ifndef HYPRE_CUDA_REDUCER_H +#define HYPRE_CUDA_REDUCER_H + +#if defined(HYPRE_USING_CUDA) +#if !defined(HYPRE_USING_RAJA) && !defined(HYPRE_USING_KOKKOS) + +#ifdef __cplusplus +extern "C++" { +#endif + +template void OneBlockReduce(T *d_arr, HYPRE_Int N, T *h_out); + +struct HYPRE_double4 +{ + HYPRE_Real x,y,z,w; + + __host__ __device__ + HYPRE_double4() {} + + __host__ __device__ + HYPRE_double4(HYPRE_Real x1, HYPRE_Real x2, HYPRE_Real x3, HYPRE_Real x4) + { + x = x1; + y = x2; + z = x3; + w = x4; + } + + __host__ __device__ + void operator=(HYPRE_Real val) + { + x = y = z = w = val; + } + + __host__ __device__ + void operator+=(HYPRE_double4 rhs) + { + x += rhs.x; + y += rhs.y; + z += rhs.z; + w += rhs.w; + } + +}; + +struct HYPRE_double6 +{ + HYPRE_Real x,y,z,w,u,v; + + __host__ __device__ + HYPRE_double6() {} + + __host__ __device__ + HYPRE_double6(HYPRE_Real x1, HYPRE_Real x2, HYPRE_Real x3, HYPRE_Real x4, + HYPRE_Real x5, HYPRE_Real x6) + { + x = x1; + y = x2; + z = x3; + w = x4; + u = x5; + v = x6; + } + + __host__ __device__ + void operator=(HYPRE_Real val) + { + x = y = z = w = u = v = val; + } + + __host__ __device__ + void operator+=(HYPRE_double6 rhs) + { + x += rhs.x; + y += rhs.y; + z += rhs.z; + w += rhs.w; + u += rhs.u; + v += rhs.v; + } + +}; + +/* reduction within a warp */ +__inline__ __host__ __device__ +HYPRE_Real warpReduceSum(HYPRE_Real val) +{ +#ifdef __CUDA_ARCH__ + for (HYPRE_Int offset = warpSize/2; offset > 0; offset /= 2) + { + val += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val, offset); + } +#endif + return val; +} + +__inline__ __host__ __device__ +HYPRE_double4 warpReduceSum(HYPRE_double4 val) { +#ifdef __CUDA_ARCH__ + for (HYPRE_Int offset = warpSize / 2; offset > 0; offset /= 2) + { + val.x += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.x, offset); + val.y += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.y, offset); + val.z += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.z, offset); + val.w += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.w, offset); + } +#endif + return val; +} + +__inline__ __host__ __device__ +HYPRE_double6 warpReduceSum(HYPRE_double6 val) { +#ifdef __CUDA_ARCH__ + for (HYPRE_Int offset = warpSize / 2; offset > 0; offset /= 2) + { + val.x += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.x, offset); + val.y += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.y, offset); + val.z += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.z, offset); + val.w += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.w, offset); + val.u += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.u, offset); + val.v += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.v, offset); + } +#endif + return val; +} + +/* reduction within a block */ +template +__inline__ __host__ __device__ +T blockReduceSum(T val) +{ +#ifdef __CUDA_ARCH__ + //static __shared__ T shared[32]; // Shared mem for 32 partial sums + __shared__ T shared[32]; // Shared mem for 32 partial sums + //HYPRE_Int lane = threadIdx.x % warpSize; + //HYPRE_Int wid = threadIdx.x / warpSize; + HYPRE_Int lane = threadIdx.x & (warpSize - 1); + HYPRE_Int wid = threadIdx.x >> 5; + + val = warpReduceSum(val); // Each warp performs partial reduction + + if (lane == 0) + { + shared[wid] = val; // Write reduced value to shared memory + } + + __syncthreads(); // Wait for all partial reductions + + //read from shared memory only if that warp existed + if (threadIdx.x < blockDim.x / warpSize) + { + val = shared[lane]; + } + else + { + val = 0.0; + } + + if (wid == 0) + { + val = warpReduceSum(val); //Final reduce within first warp + } + +#endif + return val; +} + +template +__global__ void +OneBlockReduceKernel(T *arr, HYPRE_Int N) +{ + T sum; + sum = 0.0; + if (threadIdx.x < N) + { + sum = arr[threadIdx.x]; + } + sum = blockReduceSum(sum); + if (threadIdx.x == 0) + { + arr[0] = sum; + } +} + +/* Reducer class */ +template +struct ReduceSum +{ + T init; /* initial value passed in */ + mutable T __thread_sum; /* place to hold local sum of a thread, + and partial sum of a block */ + T *d_buf; /* place to store partial sum within blocks + in the 1st round, used in the 2nd round */ + HYPRE_Int nblocks; /* number of blocks used in the 1st round */ + + /* constructor + * val is the initial value (added to the reduced sum) */ + __host__ + ReduceSum(T val) + { + init = val; + __thread_sum = 0.0; + nblocks = -1; + + if (hypre_handle->cuda_reduce_buffer == NULL) + { + /* allocate for the max size for reducing double6 type */ + hypre_handle->cuda_reduce_buffer = + hypre_TAlloc(HYPRE_double6, 1024, HYPRE_MEMORY_DEVICE); + } + + d_buf = (T*) hypre_handle->cuda_reduce_buffer; + } + + /* copy constructor */ + __host__ __device__ + ReduceSum(const ReduceSum& other) + { + *this = other; + } + + /* reduction within blocks */ + __host__ __device__ + void BlockReduce() const + { +#ifdef __CUDA_ARCH__ + __thread_sum = blockReduceSum(__thread_sum); + if (threadIdx.x == 0) + { + d_buf[blockIdx.x] = __thread_sum; + } +#endif + } + + __host__ __device__ + void operator+=(T val) const + { + __thread_sum += val; + } + + /* invoke the 2nd reduction at the time want the sum from the reducer */ + __host__ + operator T() + { + T val; + /* 2nd reduction with only *one* block */ + assert(nblocks >= 0 && nblocks <= 1024); + const dim3 gDim(1), bDim(1024); + HYPRE_CUDA_LAUNCH( OneBlockReduceKernel, gDim, bDim, d_buf, nblocks ); + hypre_TMemcpy(&val, d_buf, T, 1, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); + val += init; + + return val; + } + + /* destructor */ + __host__ __device__ + ~ReduceSum() + { + } +}; + +#ifdef __cplusplus +} +#endif + +#endif /* #if !defined(HYPRE_USING_RAJA) && !defined(HYPRE_USING_KOKKOS) */ +#endif /* #if defined(HYPRE_USING_CUDA) */ +#endif /* #ifndef HYPRE_CUDA_REDUCER_H */ + diff -Nru hypre-2.16.0/src/utilities/hypre_cuda_utils.c hypre-2.18.2/src/utilities/hypre_cuda_utils.c --- hypre-2.16.0/src/utilities/hypre_cuda_utils.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_cuda_utils.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,585 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#include "_hypre_utilities.h" + +#if defined(HYPRE_USING_CUDA) + +/* for struct solvers */ +HYPRE_Int hypre_exec_policy = HYPRE_MEMORY_DEVICE; + +__global__ void +hypreCUDAKernel_CompileFlagSafetyCheck(HYPRE_Int *cuda_arch) +{ +#ifdef __CUDA_ARCH__ + cuda_arch[0] = __CUDA_ARCH__; +#endif +} + +void hypre_CudaCompileFlagCheck() +{ + HYPRE_Int device = hypre_HandleCudaDevice(hypre_handle); + + struct cudaDeviceProp props; + cudaGetDeviceProperties(&props, device); + HYPRE_Int cuda_arch_actual = props.major*100 + props.minor*10; + + HYPRE_Int *cuda_arch = hypre_TAlloc(HYPRE_Int, 1, HYPRE_MEMORY_DEVICE); + HYPRE_Int h_cuda_arch; + + dim3 gDim(1,1,1), bDim(1,1,1); + HYPRE_CUDA_LAUNCH( hypreCUDAKernel_CompileFlagSafetyCheck, gDim, bDim, cuda_arch ); + + hypre_TMemcpy(&h_cuda_arch, cuda_arch, HYPRE_Int, 1, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); + + if (h_cuda_arch != cuda_arch_actual) + { + hypre_printf("ERROR: Compile arch flags %d does not match actual device arch = sm_%d\n", h_cuda_arch, cuda_arch_actual); + } + + HYPRE_CUDA_CALL(cudaDeviceSynchronize()); + + hypre_TFree(cuda_arch, HYPRE_MEMORY_DEVICE); +} + +dim3 +hypre_GetDefaultCUDABlockDimension() +{ + dim3 bDim(512, 1, 1); + + return bDim; +} + +dim3 +hypre_GetDefaultCUDAGridDimension( HYPRE_Int n, + const char *granularity, + dim3 bDim ) +{ + HYPRE_Int num_blocks = 0; + HYPRE_Int num_threads_per_block = bDim.x * bDim.y * bDim.z; + + if (granularity[0] == 't') + { + num_blocks = (n + num_threads_per_block - 1) / num_threads_per_block; + } + else if (granularity[0] == 'w') + { + HYPRE_Int num_warps_per_block = num_threads_per_block >> 5; + + assert(num_warps_per_block * 32 == num_threads_per_block); + + num_blocks = (n + num_warps_per_block - 1) / num_warps_per_block; + } + else + { + hypre_printf("Error %s %d: Unknown granularity !\n", __FILE__, __LINE__); + assert(0); + } + + dim3 gDim(num_blocks, 1, 1); + + return gDim; +} + +/** + * Get NNZ of each row in d_row_indices and stored the results in d_rownnz + * All pointers are device pointers. + * d_rownnz can be the same as d_row_indices + */ +__global__ void +hypreCUDAKernel_GetRowNnz(HYPRE_Int nrows, HYPRE_Int *d_row_indices, HYPRE_Int *d_diag_ia, HYPRE_Int *d_offd_ia, + HYPRE_Int *d_rownnz) +{ + const HYPRE_Int global_thread_id = blockIdx.x * blockDim.x + threadIdx.x; + //const HYPRE_Int total_num_threads = gridDim.x * blockDim.x; + + if (global_thread_id < nrows) + { + HYPRE_Int i; + + if (d_row_indices) + { + i = read_only_load(&d_row_indices[global_thread_id]); + } + else + { + i = global_thread_id; + } + + d_rownnz[global_thread_id] = read_only_load(&d_diag_ia[i+1]) - read_only_load(&d_diag_ia[i]) + + read_only_load(&d_offd_ia[i+1]) - read_only_load(&d_offd_ia[i]); + } +} + +/* special case: if d_row_indices == NULL, it means d_row_indices=[0,1,...,nrows-1] */ +HYPRE_Int +hypreDevice_GetRowNnz(HYPRE_Int nrows, HYPRE_Int *d_row_indices, HYPRE_Int *d_diag_ia, HYPRE_Int *d_offd_ia, + HYPRE_Int *d_rownnz) +{ + const dim3 bDim = hypre_GetDefaultCUDABlockDimension(); + const dim3 gDim = hypre_GetDefaultCUDAGridDimension(nrows, "thread", bDim); + + /* trivial case */ + if (nrows <= 0) + { + return hypre_error_flag; + } + + HYPRE_CUDA_LAUNCH( hypreCUDAKernel_GetRowNnz, gDim, bDim, nrows, d_row_indices, d_diag_ia, d_offd_ia, d_rownnz ); + + return hypre_error_flag; +} + +__global__ void +hypreCUDAKernel_CopyParCSRRows(HYPRE_Int nrows, HYPRE_Int *d_row_indices, HYPRE_Int has_offd, + HYPRE_Int first_col, HYPRE_Int *d_col_map_offd_A, + HYPRE_Int *d_diag_i, HYPRE_Int *d_diag_j, HYPRE_Complex *d_diag_a, + HYPRE_Int *d_offd_i, HYPRE_Int *d_offd_j, HYPRE_Complex *d_offd_a, + HYPRE_Int *d_ib, HYPRE_BigInt *d_jb, HYPRE_Complex *d_ab) +{ + HYPRE_Int global_warp_id = blockIdx.x * blockDim.y + threadIdx.y; + + if (global_warp_id >= nrows) + { + return; + } + /* lane id inside the warp */ + HYPRE_Int lane_id = threadIdx.x; + HYPRE_Int i, j, k, p, row, istart, iend, bstart; + + /* diag part */ + if (lane_id < 2) + { + /* row index to work on */ + if (d_row_indices) + { + row = read_only_load(d_row_indices + global_warp_id); + } + else + { + row = global_warp_id; + } + /* start/end position of the row */ + j = read_only_load(d_diag_i + row + lane_id); + /* start position of b */ + k = read_only_load(d_ib + global_warp_id); + } + istart = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 0); + iend = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 1); + bstart = __shfl_sync(HYPRE_WARP_FULL_MASK, k, 0); + + p = bstart - istart; + for (i = istart + lane_id; i < iend; i += HYPRE_WARP_SIZE) + { + d_jb[p+i] = read_only_load(d_diag_j + i) + first_col; + if (d_ab) + { + d_ab[p+i] = read_only_load(d_diag_a + i); + } + } + + if (!has_offd) + { + return; + } + + /* offd part */ + if (lane_id < 2) + { + j = read_only_load(d_offd_i + row + lane_id); + } + bstart += iend - istart; + istart = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 0); + iend = __shfl_sync(HYPRE_WARP_FULL_MASK, j, 1); + + p = bstart - istart; + for (i = istart + lane_id; i < iend; i += HYPRE_WARP_SIZE) + { + if (d_col_map_offd_A) + { + d_jb[p+i] = d_col_map_offd_A[read_only_load(d_offd_j + i)]; + } + else + { + d_jb[p+i] = -1 - read_only_load(d_offd_j + i); + } + + if (d_ab) + { + d_ab[p+i] = read_only_load(d_offd_a + i); + } + } + +} + +/* B = A(row_indices, :) */ +/* d_ib is input that contains row ptrs, of length (nrows + 1) or nrow (without the last entry, nnz) */ +/* special case: if d_row_indices == NULL, it means d_row_indices=[0,1,...,nrows-1] + * if col_map_offd_A == NULL, use (-1 - d_offd_j) as column id*/ +HYPRE_Int +hypreDevice_CopyParCSRRows(HYPRE_Int nrows, HYPRE_Int *d_row_indices, HYPRE_Int job, HYPRE_Int has_offd, + HYPRE_BigInt first_col, HYPRE_BigInt *d_col_map_offd_A, + HYPRE_Int *d_diag_i, HYPRE_Int *d_diag_j, HYPRE_Complex *d_diag_a, + HYPRE_Int *d_offd_i, HYPRE_Int *d_offd_j, HYPRE_Complex *d_offd_a, + HYPRE_Int *d_ib, HYPRE_BigInt *d_jb, HYPRE_Complex *d_ab) +{ + /* trivial case */ + if (nrows <= 0) + { + return hypre_error_flag; + } + + HYPRE_Int num_warps_per_block = 16; + const dim3 bDim(HYPRE_WARP_SIZE, num_warps_per_block); + const dim3 gDim((nrows + num_warps_per_block - 1) / num_warps_per_block); + + /* + if (job == 2) + { + } + */ + + HYPRE_CUDA_LAUNCH( hypreCUDAKernel_CopyParCSRRows, gDim, bDim, + nrows, d_row_indices, has_offd, first_col, d_col_map_offd_A, + d_diag_i, d_diag_j, d_diag_a, + d_offd_i, d_offd_j, d_offd_a, + d_ib, d_jb, d_ab ); + + return hypre_error_flag; +} + +HYPRE_Int +hypreDevice_IntegerReduceSum(HYPRE_Int n, HYPRE_Int *d_i) +{ + return HYPRE_THRUST_CALL(reduce, d_i, d_i + n); +} + +HYPRE_Int +hypreDevice_IntegerInclusiveScan(HYPRE_Int n, HYPRE_Int *d_i) +{ + HYPRE_THRUST_CALL(inclusive_scan, d_i, d_i + n, d_i); + + return hypre_error_flag; +} + +HYPRE_Int +hypreDevice_IntegerExclusiveScan(HYPRE_Int n, HYPRE_Int *d_i) +{ + HYPRE_THRUST_CALL(exclusive_scan, d_i, d_i + n, d_i); + + return hypre_error_flag; +} + +__global__ void +hypreCUDAKernel_CsrRowPtrsToIndices(HYPRE_Int n, HYPRE_Int *ptr, HYPRE_Int *num, HYPRE_Int *idx) +{ + /* warp id in the grid */ + HYPRE_Int global_warp_id = blockIdx.x * blockDim.y + threadIdx.y; + /* lane id inside the warp */ + HYPRE_Int lane_id = threadIdx.x; + + if (global_warp_id < n) + { + HYPRE_Int istart, iend, k; + + if (lane_id < 2) + { + k = read_only_load(ptr + global_warp_id + lane_id); + } + istart = __shfl_sync(HYPRE_WARP_FULL_MASK, k, 0); + iend = __shfl_sync(HYPRE_WARP_FULL_MASK, k, 1); + + HYPRE_Int i; + for (i = istart + lane_id; i < iend; i += HYPRE_WARP_SIZE) + { + HYPRE_Int j; + if (num == NULL) + { + j = global_warp_id; + } + else + { + j = read_only_load(num + global_warp_id); + } + idx[i] = j; + } + } +} + +HYPRE_Int* +hypreDevice_CsrRowPtrsToIndices(HYPRE_Int nrows, HYPRE_Int nnz, HYPRE_Int *d_row_ptr) +{ + /* trivial case */ + if (nrows <= 0) + { + return NULL; + } + + HYPRE_Int *d_row_ind = hypre_TAlloc(HYPRE_Int, nnz, HYPRE_MEMORY_DEVICE); + + HYPRE_Int num_warps_per_block = 16; + const dim3 bDim(HYPRE_WARP_SIZE, num_warps_per_block); + const dim3 gDim((nrows + num_warps_per_block - 1) / num_warps_per_block); + + HYPRE_CUDA_LAUNCH( hypreCUDAKernel_CsrRowPtrsToIndices, gDim, bDim, + nrows, d_row_ptr, NULL, d_row_ind ); + + return d_row_ind; +} + +HYPRE_Int +hypreDevice_CsrRowPtrsToIndices_v2(HYPRE_Int nrows, HYPRE_Int *d_row_ptr, HYPRE_Int *d_row_ind) +{ + /* trivial case */ + if (nrows <= 0) + { + return hypre_error_flag; + } + + HYPRE_Int num_warps_per_block = 16; + const dim3 bDim(HYPRE_WARP_SIZE, num_warps_per_block); + const dim3 gDim((nrows + num_warps_per_block - 1) / num_warps_per_block); + + HYPRE_CUDA_LAUNCH( hypreCUDAKernel_CsrRowPtrsToIndices, gDim, bDim, + nrows, d_row_ptr, NULL, d_row_ind ); + + return hypre_error_flag; +} + +HYPRE_Int +hypreDevice_CsrRowPtrsToIndicesWithRowNum(HYPRE_Int nrows, HYPRE_Int *d_row_ptr, HYPRE_Int *d_row_num, HYPRE_Int *d_row_ind) +{ + /* trivial case */ + if (nrows <= 0) + { + return hypre_error_flag; + } + + HYPRE_Int num_warps_per_block = 16; + const dim3 bDim(HYPRE_WARP_SIZE, num_warps_per_block); + const dim3 gDim((nrows + num_warps_per_block - 1) / num_warps_per_block); + + HYPRE_CUDA_LAUNCH( hypreCUDAKernel_CsrRowPtrsToIndices, gDim, bDim, + nrows, d_row_ptr, d_row_num, d_row_ind ); + + return hypre_error_flag; +} + +HYPRE_Int* +hypreDevice_CsrRowIndicesToPtrs(HYPRE_Int nrows, HYPRE_Int nnz, HYPRE_Int *d_row_ind) +{ + HYPRE_Int *d_row_ptr = hypre_TAlloc(HYPRE_Int, nrows+1, HYPRE_MEMORY_DEVICE); + + HYPRE_THRUST_CALL( lower_bound, + d_row_ind, d_row_ind + nnz, + thrust::counting_iterator(0), + thrust::counting_iterator(nrows+1), + d_row_ptr); + + return d_row_ptr; +} + +HYPRE_Int +hypreDevice_CsrRowIndicesToPtrs_v2(HYPRE_Int nrows, HYPRE_Int nnz, HYPRE_Int *d_row_ind, HYPRE_Int *d_row_ptr) +{ + HYPRE_THRUST_CALL( lower_bound, + d_row_ind, d_row_ind + nnz, + thrust::counting_iterator(0), + thrust::counting_iterator(nrows+1), + d_row_ptr); + + return hypre_error_flag; +} + +/* x[map[i]] += y[i] */ +__global__ void +hypreCUDAKernel_ScatterAdd(HYPRE_Int n, HYPRE_Real *x, HYPRE_Int *map, HYPRE_Real *y) +{ + HYPRE_Int global_thread_id = hypre_cuda_get_grid_thread_id<1,1>(); + + if (global_thread_id < n) + { + x[map[global_thread_id]] += y[global_thread_id]; + } +} + +/* Generalized x[map[i]] += y[i] where the same index may appear more + * than once in map + * Note: content in y will be destroyed */ +HYPRE_Int +hypreDevice_GenScatterAdd(HYPRE_Real *x, HYPRE_Int ny, HYPRE_Int *map, HYPRE_Real *y) +{ + HYPRE_Int *map2 = hypre_TAlloc(HYPRE_Int, ny, HYPRE_MEMORY_DEVICE); + HYPRE_Int *reduced_map = hypre_TAlloc(HYPRE_Int, ny, HYPRE_MEMORY_DEVICE); + HYPRE_Real *reduced_y = hypre_TAlloc(HYPRE_Real, ny, HYPRE_MEMORY_DEVICE); + + hypre_TMemcpy(map2, map, HYPRE_Int, ny, HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_DEVICE); + + HYPRE_THRUST_CALL(sort_by_key, map2, map2+ny, y); + + thrust::pair new_end = + HYPRE_THRUST_CALL(reduce_by_key, map2, map2+ny, y, reduced_map, reduced_y); + + HYPRE_Int reduced_n = new_end.first - reduced_map; + + hypre_assert(reduced_n == new_end.second - reduced_y); + + dim3 bDim = hypre_GetDefaultCUDABlockDimension(); + dim3 gDim = hypre_GetDefaultCUDAGridDimension(reduced_n, "thread", bDim); + + HYPRE_CUDA_LAUNCH( hypreCUDAKernel_ScatterAdd, gDim, bDim, + reduced_n, x, reduced_map, reduced_y ); + + hypre_TFree(map2, HYPRE_MEMORY_DEVICE); + hypre_TFree(reduced_map, HYPRE_MEMORY_DEVICE); + hypre_TFree(reduced_y, HYPRE_MEMORY_DEVICE); + + return hypre_error_flag; +} + +/* x[map[i]] = v */ +__global__ void +hypreCUDAKernel_ScatterConstant(HYPRE_Int *x, HYPRE_Int n, HYPRE_Int *map, HYPRE_Int v) +{ + HYPRE_Int global_thread_id = hypre_cuda_get_grid_thread_id<1,1>(); + + if (global_thread_id < n) + { + x[map[global_thread_id]] = v; + } +} + +/* x[map[i]] = v + * TODO: thrust? */ +HYPRE_Int +hypreDevice_ScatterConstant(HYPRE_Int *x, HYPRE_Int n, HYPRE_Int *map, HYPRE_Int v) +{ + /* trivial case */ + if (n <= 0) + { + return hypre_error_flag; + } + + dim3 bDim = hypre_GetDefaultCUDABlockDimension(); + dim3 gDim = hypre_GetDefaultCUDAGridDimension(n, "thread", bDim); + + HYPRE_CUDA_LAUNCH( hypreCUDAKernel_ScatterConstant, gDim, bDim, x, n, map, v ); + + return hypre_error_flag; +} + +__global__ void +hypreCUDAKernel_IVAXPY(HYPRE_Int n, HYPRE_Complex *a, HYPRE_Complex *x, HYPRE_Complex *y) +{ + HYPRE_Int i = hypre_cuda_get_grid_thread_id<1,1>(); + + if (i < n) + { + y[i] += x[i] / a[i]; + } +} + +/* Inverse Vector AXPY: y[i] = x[i] / a[i] + y[i] */ +HYPRE_Int +hypreDevice_IVAXPY(HYPRE_Int n, HYPRE_Complex *a, HYPRE_Complex *x, HYPRE_Complex *y) +{ + /* trivial case */ + if (n <= 0) + { + return hypre_error_flag; + } + + dim3 bDim = hypre_GetDefaultCUDABlockDimension(); + dim3 gDim = hypre_GetDefaultCUDAGridDimension(n, "thread", bDim); + + HYPRE_CUDA_LAUNCH( hypreCUDAKernel_IVAXPY, gDim, bDim, n, a, x, y ); + + return hypre_error_flag; +} + +__global__ void +hypreCUDAKernel_DiagScaleVector(HYPRE_Int n, HYPRE_Int *A_i, HYPRE_Complex *A_data, HYPRE_Complex *x, HYPRE_Complex *y) +{ + HYPRE_Int i = hypre_cuda_get_grid_thread_id<1,1>(); + + if (i < n) + { + y[i] = x[i] / A_data[A_i[i]]; + } +} + +/* y = diag(A) \ x. A_i[i] points to the ith diagonal entry of A */ +HYPRE_Int +hypreDevice_DiagScaleVector(HYPRE_Int n, HYPRE_Int *A_i, HYPRE_Complex *A_data, HYPRE_Complex *x, HYPRE_Complex *y) +{ + /* trivial case */ + if (n <= 0) + { + return hypre_error_flag; + } + + dim3 bDim = hypre_GetDefaultCUDABlockDimension(); + dim3 gDim = hypre_GetDefaultCUDAGridDimension(n, "thread", bDim); + + HYPRE_CUDA_LAUNCH( hypreCUDAKernel_DiagScaleVector, gDim, bDim, n, A_i, A_data, x, y ); + + return hypre_error_flag; +} + +__global__ void +hypreCUDAKernel_BigToSmallCopy( HYPRE_Int* __restrict__ tgt, + const HYPRE_BigInt* __restrict__ src, + HYPRE_Int size) +{ + HYPRE_Int i = hypre_cuda_get_grid_thread_id<1,1>(); + + if (i < size) + { + tgt[i] = src[i]; + } +} + +HYPRE_Int +hypreDevice_BigToSmallCopy(HYPRE_Int *tgt, const HYPRE_BigInt *src, HYPRE_Int size) +{ + dim3 bDim = hypre_GetDefaultCUDABlockDimension(); + dim3 gDim = hypre_GetDefaultCUDAGridDimension(size, "thread", bDim); + + HYPRE_CUDA_LAUNCH( hypreCUDAKernel_BigToSmallCopy, gDim, bDim, tgt, src, size); + + return hypre_error_flag; +} + + +/* https://github.com/OrangeOwlSolutions/Thrust/blob/master/Sort_by_key_with_tuple_key.cu */ +/* opt: 0, (a,b) <= (a',b') if and only if a < a' or (a = a' and b <= b') + * 1, (a,b) <= (a',b') if and only if a < a' or (a = a' and |b| >= |b'|) + */ +template +HYPRE_Int +hypreDevice_StableSortByTupleKey(HYPRE_Int N, T1 *keys1, T2 *keys2, T3 *vals, HYPRE_Int opt) +{ + auto begin_keys = thrust::make_zip_iterator(thrust::make_tuple(keys1, keys2)); + auto end_keys = thrust::make_zip_iterator(thrust::make_tuple(keys1 + N, keys2 + N)); + + if (opt == 0) + { + HYPRE_THRUST_CALL(stable_sort_by_key, begin_keys, end_keys, vals, TupleComp1()); + } + else if (opt == 1) + { + HYPRE_THRUST_CALL(stable_sort_by_key, begin_keys, end_keys, vals, TupleComp2()); + } + + return hypre_error_flag; +} + +template HYPRE_Int hypreDevice_StableSortByTupleKey(HYPRE_Int N, HYPRE_Int *keys1, HYPRE_Int *keys2, HYPRE_Int *vals, HYPRE_Int opt); +template HYPRE_Int hypreDevice_StableSortByTupleKey(HYPRE_Int N, HYPRE_Int *keys1, HYPRE_Real *keys2, HYPRE_Int *vals, HYPRE_Int opt); + +#endif // #if defined(HYPRE_USING_CUDA) + diff -Nru hypre-2.16.0/src/utilities/hypre_cuda_utils.h hypre-2.18.2/src/utilities/hypre_cuda_utils.h --- hypre-2.16.0/src/utilities/hypre_cuda_utils.h 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_cuda_utils.h 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,553 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#ifndef HYPRE_CUDA_UTILS_H +#define HYPRE_CUDA_UTILS_H + +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + +HYPRE_Int hypre_printf( const char *format , ... ); + +#ifdef __cplusplus +extern "C++" { +#endif + +#include +#include +#include +#include +#include +#include + +#ifndef CUDART_VERSION +#error CUDART_VERSION Undefined! +#endif + +#ifndef CUDA_VERSION +#error CUDA_VERSION Undefined! +#endif + +#if defined(HYPRE_USING_CUDA) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +using namespace thrust::placeholders; +#endif // #if defined(HYPRE_USING_CUDA) + +#define HYPRE_WARP_SIZE 32 +#define HYPRE_WARP_FULL_MASK 0xFFFFFFFF +#define HYPRE_MAX_NUM_WARPS (64 * 64 * 32) +#define HYPRE_FLT_LARGE 1e30 +#define HYPRE_1D_BLOCK_SIZE 512 +#define HYPRE_MAX_NUM_STREAMS 10 + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * macro for launching CUDA kernels, CUDA, Thrust, Cusparse, Curand calls + * NOTE: IN HYPRE'S DEFAULT STREAM + * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + */ + +#define HYPRE_CUDA_LAUNCH(kernel_name, gridsize, blocksize, ...) \ +{ \ + if ( gridsize.x == 0 || gridsize.y == 0 || gridsize.z == 0 || \ + blocksize.x == 0 || blocksize.y == 0 || blocksize.z == 0 ) \ + { \ + /* hypre_printf("Warning %s %d: Zero CUDA grid/block (%d %d %d) (%d %d %d)\n", \ + __FILE__, __LINE__, \ + gridsize.x, gridsize.y, gridsize.z, blocksize.x, blocksize.y, blocksize.z); */ \ + } \ + else \ + { \ + (kernel_name) <<< (gridsize), (blocksize), 0, hypre_HandleCudaComputeStream(hypre_handle) >>> (__VA_ARGS__); \ + } \ +} + + +#define HYPRE_THRUST_CALL(func_name, ...) \ + thrust::func_name( \ + thrust::cuda::par.on(hypre_HandleCudaComputeStream(hypre_handle)), __VA_ARGS__); \ + +#define HYPRE_CUBLAS_CALL(call) do { \ + cublasStatus_t err = call; \ + if (CUBLAS_STATUS_SUCCESS != err) { \ + hypre_printf("CUBLAS ERROR (code = %d, %d) at %s:%d\n", \ + err, err == CUBLAS_STATUS_EXECUTION_FAILED, __FILE__, __LINE__); \ + exit(1); \ + } } while(0) + +#define HYPRE_CUSPARSE_CALL(call) do { \ + cusparseStatus_t err = call; \ + if (CUSPARSE_STATUS_SUCCESS != err) { \ + hypre_printf("CUSPARSE ERROR (code = %d, %d) at %s:%d\n", \ + err, err == CUSPARSE_STATUS_EXECUTION_FAILED, __FILE__, __LINE__); \ + exit(1); \ + } } while(0) + + +#define HYPRE_CURAND_CALL(call) do { \ + curandStatus_t err = call; \ + if (CURAND_STATUS_SUCCESS != err) { \ + hypre_printf("CURAND ERROR (code = %d) at %s:%d\n", \ + err, __FILE__, __LINE__); \ + exit(1); \ + } } while(0) + + +#define HYPRE_CUDA_CALL(call) do { \ + cudaError_t err = call; \ + if (cudaSuccess != err) { \ + hypre_printf("CUDA ERROR (code = %d, %s) at %s:%d\n", err, cudaGetErrorString(err), __FILE__, __LINE__); \ + exit(1); \ + } } while(0) + +#if defined(HYPRE_USING_CUDA) +/* return the number of threads in block */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_num_threads() +{ + switch (dim) + { + case 1: + return (blockDim.x); + case 2: + return (blockDim.x * blockDim.y); + case 3: + return (blockDim.x * blockDim.y * blockDim.z); + } + + return -1; +} + +/* return the flattened thread id in block */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_thread_id() +{ + switch (dim) + { + case 1: + return (threadIdx.x); + case 2: + return (threadIdx.y * blockDim.x + threadIdx.x); + case 3: + return (threadIdx.z * blockDim.x * blockDim.y + threadIdx.y * blockDim.x + + threadIdx.x); + } + + return -1; +} + +/* return the number of warps in block */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_num_warps() +{ + return hypre_cuda_get_num_threads() >> 5; +} + +/* return the warp id in block */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_warp_id() +{ + return hypre_cuda_get_thread_id() >> 5; +} + +/* return the thread lane id in warp */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_lane_id() +{ + return hypre_cuda_get_thread_id() & (HYPRE_WARP_SIZE-1); +} + +/* return the num of blocks in grid */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_num_blocks() +{ + switch (dim) + { + case 1: + return (gridDim.x); + case 2: + return (gridDim.x * gridDim.y); + case 3: + return (gridDim.x * gridDim.y * gridDim.z); + } + + return -1; +} + +/* return the flattened block id in grid */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_block_id() +{ + switch (dim) + { + case 1: + return (blockIdx.x); + case 2: + return (blockIdx.y * gridDim.x + blockIdx.x); + case 3: + return (blockIdx.z * gridDim.x * gridDim.y + blockIdx.y * gridDim.x + + blockIdx.x); + } + + return -1; +} + +/* return the number of threads in grid */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_grid_num_threads() +{ + return hypre_cuda_get_num_blocks() * hypre_cuda_get_num_threads(); +} + +/* return the flattened thread id in grid */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_grid_thread_id() +{ + return hypre_cuda_get_block_id() * hypre_cuda_get_num_threads() + + hypre_cuda_get_thread_id(); +} + +/* return the number of warps in grid */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_grid_num_warps() +{ + return hypre_cuda_get_num_blocks() * hypre_cuda_get_num_warps(); +} + +/* return the flattened warp id in grid */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_grid_warp_id() +{ + return hypre_cuda_get_block_id() * hypre_cuda_get_num_warps() + + hypre_cuda_get_warp_id(); +} + +#if CUDA_VERSION < 9000 + +template +static __device__ __forceinline__ +T __shfl_sync(unsigned mask, T val, hypre_int src_line, hypre_int width=32) +{ + return __shfl(val, src_line, width); +} + +template +static __device__ __forceinline__ +T __shfl_down_sync(unsigned mask, T val, unsigned delta, hypre_int width=32) +{ + return __shfl_down(val, delta, width); +} + +template +static __device__ __forceinline__ +T __shfl_xor_sync(unsigned mask, T val, unsigned lanemask, hypre_int width=32) +{ + return __shfl_xor(val, lanemask, width); +} + +template +static __device__ __forceinline__ +T __shfl_up_sync(unsigned mask, T val, unsigned delta, hypre_int width=32) +{ + return __shfl_up(val, delta, width); +} + +static __device__ __forceinline__ +void __syncwarp() +{ +} + +#endif + +template +static __device__ __forceinline__ +T read_only_load( const T *ptr ) +{ + return __ldg( ptr ); +} + +template +static __device__ __forceinline__ +T warp_prefix_sum(hypre_int lane_id, T in, T &all_sum) +{ +#pragma unroll + for (hypre_int d = 2; d <= 32; d <<= 1) + { + T t = __shfl_up_sync(HYPRE_WARP_FULL_MASK, in, d >> 1); + if ( (lane_id & (d - 1)) == d - 1 ) + { + in += t; + } + } + + all_sum = __shfl_sync(HYPRE_WARP_FULL_MASK, in, 31); + + if (lane_id == 31) + { + in = 0; + } + +#pragma unroll + for (hypre_int d = 16; d > 0; d >>= 1) + { + T t = __shfl_xor_sync(HYPRE_WARP_FULL_MASK, in, d); + + if ( (lane_id & (d - 1)) == d - 1) + { + if ( (lane_id & (d << 1 - 1)) == (d << 1 - 1) ) + { + in += t; + } + else + { + in = t; + } + } + } + return in; +} + +template +static __device__ __forceinline__ +T warp_reduce_sum(T in) +{ +#pragma unroll + for (hypre_int d = 16; d > 0; d >>= 1) + { + in += __shfl_down_sync(HYPRE_WARP_FULL_MASK, in, d); + } + return in; +} + +template +static __device__ __forceinline__ +T warp_allreduce_sum(T in) +{ +#pragma unroll + for (hypre_int d = 16; d > 0; d >>= 1) + { + in += __shfl_xor_sync(HYPRE_WARP_FULL_MASK, in, d); + } + return in; +} + +template +static __device__ __forceinline__ +T warp_reduce_max(T in) +{ +#pragma unroll + for (hypre_int d = 16; d > 0; d >>= 1) + { + in = max(in, __shfl_down_sync(HYPRE_WARP_FULL_MASK, in, d)); + } + return in; +} + +template +static __device__ __forceinline__ +T warp_allreduce_max(T in) +{ +#pragma unroll + for (hypre_int d = 16; d > 0; d >>= 1) + { + in = max(in, __shfl_xor_sync(HYPRE_WARP_FULL_MASK, in, d)); + } + return in; +} + +template +static __device__ __forceinline__ +T warp_reduce_min(T in) +{ +#pragma unroll + for (hypre_int d = 16; d > 0; d >>= 1) + { + in = min(in, __shfl_down_sync(HYPRE_WARP_FULL_MASK, in, d)); + } + return in; +} + +template +static __device__ __forceinline__ +T warp_allreduce_min(T in) +{ +#pragma unroll + for (hypre_int d = 16; d > 0; d >>= 1) + { + in = min(in, __shfl_xor_sync(HYPRE_WARP_FULL_MASK, in, d)); + } + return in; +} + +static __device__ __forceinline__ +hypre_int next_power_of_2(hypre_int n) +{ + if (n <= 0) + { + return 0; + } + + /* if n is power of 2, return itself */ + if ( (n & (n - 1)) == 0 ) + { + return n; + } + + n |= (n >> 1); + n |= (n >> 2); + n |= (n >> 4); + n |= (n >> 8); + n |= (n >> 16); + n ^= (n >> 1); + n = (n << 1); + + return n; +} + +template +struct absolute_value : public thrust::unary_function +{ + __host__ __device__ T operator()(const T &x) const + { + return x < T(0) ? -x : x; + } +}; + + +template +struct TupleComp1 +{ + typedef thrust::tuple Tuple; + + __host__ __device__ bool operator()(const Tuple& t1, const Tuple& t2) + { + if (thrust::get<0>(t1) < thrust::get<0>(t2)) + { + return true; + } + if (thrust::get<0>(t1) > thrust::get<0>(t2)) + { + return false; + } + return thrust::get<1>(t1) < thrust::get<1>(t2); + } +}; + + +template +struct TupleComp2 +{ + typedef thrust::tuple Tuple; + + __host__ __device__ bool operator()(const Tuple& t1, const Tuple& t2) + { + if (thrust::get<0>(t1) < thrust::get<0>(t2)) + { + return true; + } + if (thrust::get<0>(t1) > thrust::get<0>(t2)) + { + return false; + } + return hypre_abs(thrust::get<1>(t1)) > hypre_abs(thrust::get<1>(t2)); + } +}; + +#endif // #if defined(HYPRE_USING_CUDA) + +#ifdef __cplusplus +} +#endif + +struct is_negative +{ + __host__ __device__ bool operator()(const HYPRE_Int &x) + { + return (x < 0); + } +}; + +struct is_nonnegative +{ + __host__ __device__ bool operator()(const HYPRE_Int &x) + { + return (x >= 0); + } +}; + +struct in_range +{ + HYPRE_Int low, up; + + in_range(HYPRE_Int low_, HYPRE_Int up_) { low = low_; up = up_; } + + __host__ __device__ bool operator()(const HYPRE_Int &x) + { + return (x >= low && x <= up); + } +}; + +struct out_of_range +{ + HYPRE_Int low, up; + + out_of_range(HYPRE_Int low_, HYPRE_Int up_) { low = low_; up = up_; } + + __host__ __device__ bool operator()(const HYPRE_Int &x) + { + return (x < low || x > up); + } +}; + +struct less_than +{ + HYPRE_Int val; + + less_than(HYPRE_Int val_) { val = val_; } + + __host__ __device__ bool operator()(const HYPRE_Int &x) + { + return (x < val); + } +}; + + +#if defined(HYPRE_USING_CUDA) +/* for struct solvers */ +#define HYPRE_MIN_GPU_SIZE (131072) +extern HYPRE_Int hypre_exec_policy; +#define hypre_SetDeviceOn() hypre_exec_policy = HYPRE_MEMORY_DEVICE +#define hypre_SetDeviceOff() hypre_exec_policy = HYPRE_MEMORY_HOST +#endif + +#endif /* HYPRE_USING_CUDA */ +#endif /* #ifndef HYPRE_CUDA_UTILS_H */ + diff -Nru hypre-2.16.0/src/utilities/hypre_error.c hypre-2.18.2/src/utilities/hypre_error.c --- hypre-2.16.0/src/utilities/hypre_error.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_error.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_utilities.h" diff -Nru hypre-2.16.0/src/utilities/HYPRE_error_f.h hypre-2.18.2/src/utilities/HYPRE_error_f.h --- hypre-2.16.0/src/utilities/HYPRE_error_f.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/HYPRE_error_f.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -cBHEADER********************************************************************** -c Copyright (c) 2008, Lawrence Livermore National Security, LLC. -c Produced at the Lawrence Livermore National Laboratory. -c This file is part of HYPRE. See file COPYRIGHT for details. -c -c HYPRE is free software; you can redistribute it and/or modify it under the -c terms of the GNU Lesser General Public License (as published by the Free -c Software Foundation) version 2.1 dated February 1999. -c -c $Revision$ -cEHEADER********************************************************************** +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ integer HYPRE_ERROR_GENERIC integer HYPRE_ERROR_MEMORY diff -Nru hypre-2.16.0/src/utilities/hypre_error.h hypre-2.18.2/src/utilities/hypre_error.h --- hypre-2.16.0/src/utilities/hypre_error.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_error.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_ERROR_HEADER #define hypre_ERROR_HEADER diff -Nru hypre-2.16.0/src/utilities/hypre_general.c hypre-2.18.2/src/utilities/hypre_general.c --- hypre-2.16.0/src/utilities/hypre_general.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_general.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_utilities.h" @@ -16,43 +11,271 @@ #include #endif +void hypre_SetExecPolicy( HYPRE_Int policy ) +{ +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + if ( policy == HYPRE_EXEC_HOST || policy == HYPRE_EXEC_DEVICE) + { + hypre_HandleDefaultExecPolicy(hypre_handle) = policy; + } +#endif +} + +/*--------------------------------------------------- + * hypre_GetExecPolicy + * Return execution policy based on memory locations + *---------------------------------------------------*/ +/* for unary operation */ +HYPRE_Int +hypre_GetExecPolicy1(HYPRE_Int location) +{ + HYPRE_Int exec = HYPRE_EXEC_UNSET; + + location = hypre_GetActualMemLocation(location); + + switch (location) + { + case HYPRE_MEMORY_HOST : + exec = HYPRE_EXEC_HOST; + break; + case HYPRE_MEMORY_HOST_PINNED : + exec = HYPRE_EXEC_HOST; + break; + case HYPRE_MEMORY_DEVICE : + exec = HYPRE_EXEC_DEVICE; + break; +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + case HYPRE_MEMORY_SHARED : + exec = hypre_HandleDefaultExecPolicy(hypre_handle); + break; +#endif + } + + return exec; +} + +/* for binary operation */ +HYPRE_Int +hypre_GetExecPolicy2(HYPRE_Int location1, + HYPRE_Int location2) +{ + location1 = hypre_GetActualMemLocation(location1); + location2 = hypre_GetActualMemLocation(location2); + + /* HOST_PINNED has the same exec policy as HOST */ + if (location1 == HYPRE_MEMORY_HOST_PINNED) + { + location1 = HYPRE_MEMORY_HOST; + } + + if (location2 == HYPRE_MEMORY_HOST_PINNED) + { + location2 = HYPRE_MEMORY_HOST; + } + + /* no policy for these combinations */ + if ( (location1 == HYPRE_MEMORY_HOST && location2 == HYPRE_MEMORY_DEVICE) || + (location2 == HYPRE_MEMORY_HOST && location1 == HYPRE_MEMORY_DEVICE) ) + { + return HYPRE_EXEC_UNSET; + } + +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + /* policy for S-S can be HOST or DEVICE. Choose HOST by default */ + if (location1 == HYPRE_MEMORY_SHARED && location2 == HYPRE_MEMORY_SHARED) + { + return hypre_HandleDefaultExecPolicy(hypre_handle); + } +#endif + + if (location1 == HYPRE_MEMORY_HOST || location2 == HYPRE_MEMORY_HOST) + { + return HYPRE_EXEC_HOST; + } + + if (location1 == HYPRE_MEMORY_DEVICE || location2 == HYPRE_MEMORY_DEVICE) + { + return HYPRE_EXEC_DEVICE; + } + + return HYPRE_EXEC_UNSET; +} + +hypre_Handle *hypre_handle = NULL; + +hypre_Handle* +hypre_HandleCreate() +{ + hypre_Handle *handle = hypre_CTAlloc(hypre_Handle, 1, HYPRE_MEMORY_HOST); + + /* set default options */ +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + hypre_HandleDefaultExecPolicy(handle) = HYPRE_EXEC_HOST; + hypre_HandleCudaDevice(handle) = 0; + hypre_HandleCudaComputeStreamNum(handle) = 0; + hypre_HandleCudaPrefetchStreamNum(handle) = 1; + hypre_HandleCudaComputeStreamSyncDefault(handle) = 1; + handle->spgemm_use_cusparse = 0; // TODO: accessor func #ifdef + handle->spgemm_num_passes = 3; + /* 1: naive overestimate, 2: naive underestimate, 3: Cohen's algorithm */ + handle->spgemm_rownnz_estimate_method = 3; + handle->spgemm_rownnz_estimate_nsamples = 32; + handle->spgemm_rownnz_estimate_mult_factor = 1.5; + handle->spgemm_hash_type = 'L'; + + hypre_HandleCudaComputeStreamSync(handle).clear(); + hypre_HandleCudaComputeStreamSyncPush( handle, hypre_HandleCudaComputeStreamSyncDefault(handle) ); +#endif // #if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + + return handle; +} + +HYPRE_Int +hypre_HandleDestroy(hypre_Handle *hypre_handle_) +{ +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + HYPRE_Int i; + + hypre_TFree(hypre_handle_->cuda_reduce_buffer, HYPRE_MEMORY_DEVICE); + +#if defined(HYPRE_USING_CURAND) + if (hypre_handle_->curand_gen) + { + HYPRE_CURAND_CALL( curandDestroyGenerator(hypre_handle_->curand_gen) ); + } +#endif + +#if defined(HYPRE_USING_CUBLAS) + if (hypre_handle_->cublas_handle) + { + HYPRE_CUBLAS_CALL( cublasDestroy(hypre_handle_->cublas_handle) ); + } +#endif + +#if defined(HYPRE_USING_CUSPARSE) + if (hypre_handle_->cusparse_handle) + { + HYPRE_CUSPARSE_CALL( cusparseDestroy(hypre_handle_->cusparse_handle) ); + } + + if (hypre_handle_->cusparse_mat_descr) + { + HYPRE_CUSPARSE_CALL( cusparseDestroyMatDescr(hypre_handle_->cusparse_mat_descr) ); + } +#endif + + for (i = 0; i < HYPRE_MAX_NUM_STREAMS; i++) + { + if (hypre_handle_->cuda_streams[i]) + { + HYPRE_CUDA_CALL( cudaStreamDestroy(hypre_handle_->cuda_streams[i]) ); + } + } +#endif + + hypre_TFree(hypre_handle_, HYPRE_MEMORY_HOST); + + return hypre_error_flag; +} + +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) +/* use_device == -1 to let Hypre decide on which device to use */ +HYPRE_Int +hypre_SetDevice(HYPRE_Int use_device, hypre_Handle *hypre_handle_) +{ + HYPRE_Int myid, nproc, myNodeid, NodeSize; + HYPRE_Int device_id; + hypre_MPI_Comm node_comm; + + // TODO should not use COMM_WORLD + hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid); + hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &nproc); + + hypre_MPI_Comm_split_type(hypre_MPI_COMM_WORLD, hypre_MPI_COMM_TYPE_SHARED, + myid, hypre_MPI_INFO_NULL, &node_comm); + hypre_MPI_Comm_rank(node_comm, &myNodeid); + hypre_MPI_Comm_size(node_comm, &NodeSize); + hypre_MPI_Comm_free(&node_comm); + + HYPRE_Int nDevices; +#if defined(HYPRE_USING_CUDA) + HYPRE_CUDA_CALL( cudaGetDeviceCount(&nDevices) ); +#else + nDevices = omp_get_num_devices(); +#endif + + if (use_device < 0) + { + device_id = myNodeid % nDevices; + } + else + { + device_id = use_device; + } + +#if defined(HYPRE_USING_CUDA) + HYPRE_CUDA_CALL( cudaSetDevice(device_id) ); +#else + omp_set_default_device(device_id); +#endif + + hypre_HandleCudaDevice(hypre_handle_) = device_id; + + hypre_printf("Proc [global %d/%d, local %d/%d] can see %d GPUs and is running on %d\n", + myid, nproc, myNodeid, NodeSize, nDevices, device_id); + + return hypre_error_flag; +} + +#endif //#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + /****************************************************************************** * * hypre initialization * *****************************************************************************/ -void +HYPRE_Int HYPRE_Init( hypre_int argc, char *argv[] ) { - /* - HYPRE_Int num_procs, myid; + hypre_handle = hypre_HandleCreate(); + +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + hypre_SetDevice(-1, hypre_handle); + + /* To include the cost of creating streams/cudahandles in HYPRE_Init */ + /* If not here, will be done at the first use */ + hypre_HandleCudaComputeStream(hypre_handle); + hypre_HandleCudaPrefetchStream(hypre_handle); +#endif + +#if defined(HYPRE_USING_CUBLAS) + hypre_HandleCublasHandle(hypre_handle); +#endif + +#if defined(HYPRE_USING_CUSPARSE) + hypre_HandleCusparseHandle(hypre_handle); + hypre_HandleCusparseMatDescr(hypre_handle); +#endif + +#if defined(HYPRE_USING_CURAND) + hypre_HandleCurandGenerator(hypre_handle); +#endif - hypre_MPI_Comm_size(hypre_MPI_COMM_WORLD, &num_procs); - hypre_MPI_Comm_rank(hypre_MPI_COMM_WORLD, &myid); - */ #if defined(HYPRE_USING_KOKKOS) - /* - Kokkos::InitArguments args; - args.num_threads = 10; - Kokkos::initialize (args); - */ Kokkos::initialize (argc, argv); #endif -#if defined(HYPRE_USING_UNIFIED_MEMORY) - hypre_GPUInit(-1); + /* Check if cuda arch flags in compiling match the device */ +#if defined(HYPRE_USING_CUDA) + hypre_CudaCompileFlagCheck(); #endif - /* hypre_InitMemoryDebug(myid); */ - #if defined(HYPRE_USING_DEVICE_OPENMP) - /* - hypre__offload_device_num = omp_get_initial_device(); - hypre__offload_host_num = omp_get_initial_device(); - */ HYPRE_OMPOffloadOn(); #endif + + return hypre_error_flag; } /****************************************************************************** @@ -65,28 +288,24 @@ extern HYPRE_Complex *global_recv_buffer, *global_send_buffer; extern HYPRE_Int global_recv_size, global_send_size; -void +HYPRE_Int HYPRE_Finalize() { -#if defined(HYPRE_USING_UNIFIED_MEMORY) - hypre_GPUFinalize(); -#endif + hypre_HandleDestroy(hypre_handle); #if defined(HYPRE_USING_KOKKOS) Kokkos::finalize (); #endif -#if !defined(HYPRE_USING_RAJA) && !defined(HYPRE_USING_KOKKOS) && defined(HYPRE_USING_CUDA) - hypre_TFree(cuda_reduce_buffer, HYPRE_MEMORY_DEVICE); + hypre_TFree(global_send_buffer, HYPRE_MEMORY_DEVICE); + hypre_TFree(global_recv_buffer, HYPRE_MEMORY_DEVICE); + + //if (cudaSuccess == cudaPeekAtLastError() ) hypre_printf("OK...\n"); + +#if defined(HYPRE_USING_CUDA) + HYPRE_CUDA_CALL( cudaGetLastError() ); #endif - if (global_send_buffer) - { - hypre_TFree(global_send_buffer, HYPRE_MEMORY_DEVICE); - } - if (global_recv_buffer) - { - hypre_TFree(global_recv_buffer, HYPRE_MEMORY_DEVICE); - } + return hypre_error_flag; } diff -Nru hypre-2.16.0/src/utilities/hypre_general.h hypre-2.18.2/src/utilities/hypre_general.h --- hypre-2.16.0/src/utilities/hypre_general.h 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_general.h 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,50 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +/****************************************************************************** + * + * General structures and values + * + *****************************************************************************/ + +#ifndef hypre_GENERAL_HEADER +#define hypre_GENERAL_HEADER + +/* This allows us to consistently avoid 'int' throughout hypre */ +typedef int hypre_int; +typedef long int hypre_longint; +typedef unsigned int hypre_uint; +typedef unsigned long int hypre_ulongint; + +/* This allows us to consistently avoid 'double' throughout hypre */ +typedef double hypre_double; + +/*-------------------------------------------------------------------------- + * Define various functions + *--------------------------------------------------------------------------*/ + +#ifndef hypre_max +#define hypre_max(a,b) (((a)<(b)) ? (b) : (a)) +#endif +#ifndef hypre_min +#define hypre_min(a,b) (((a)<(b)) ? (a) : (b)) +#endif + +#ifndef hypre_abs +#define hypre_abs(a) (((a)>0) ? (a) : -(a)) +#endif + +#ifndef hypre_round +#define hypre_round(x) ( ((x) < 0.0) ? ((HYPRE_Int)(x - 0.5)) : ((HYPRE_Int)(x + 0.5)) ) +#endif + +#ifndef hypre_pow2 +#define hypre_pow2(i) ( 1 << (i) ) +#endif + +#endif /* hypre_GENERAL_HEADER */ + diff -Nru hypre-2.16.0/src/utilities/hypre_handle.h hypre-2.18.2/src/utilities/hypre_handle.h --- hypre-2.16.0/src/utilities/hypre_handle.h 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_handle.h 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,256 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +/****************************************************************************** + * + * General structures and values + * + *****************************************************************************/ + +#ifndef HYPRE_HANDLE_H +#define HYPRE_HANDLE_H + +#ifdef __cplusplus +extern "C++" { +#endif + +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) +#include +#endif + +typedef struct +{ + HYPRE_Int hypre_error; +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + HYPRE_Int default_exec_policy; + HYPRE_Int cuda_device; + /* by default, hypre puts GPU computations in this stream + * Do not be confused with the default (null) CUDA stream */ + HYPRE_Int cuda_compute_stream_num; + HYPRE_Int cuda_prefetch_stream_num; + HYPRE_Int cuda_compute_stream_sync_default; + std::vector cuda_compute_stream_sync; + curandGenerator_t curand_gen; + cublasHandle_t cublas_handle; + cusparseHandle_t cusparse_handle; + cusparseMatDescr_t cusparse_mat_descr; + cudaStream_t cuda_streams[HYPRE_MAX_NUM_STREAMS]; + /* work space for hypre's CUDA reducer */ + void* cuda_reduce_buffer; + /* device spgemm options */ + HYPRE_Int spgemm_use_cusparse; + HYPRE_Int spgemm_num_passes; + HYPRE_Int spgemm_rownnz_estimate_method; + HYPRE_Int spgemm_rownnz_estimate_nsamples; + float spgemm_rownnz_estimate_mult_factor; + char spgemm_hash_type; +#endif +} hypre_Handle; + +extern hypre_Handle *hypre_handle; + +hypre_Handle* hypre_HandleCreate(); +HYPRE_Int hypre_HandleDestroy(hypre_Handle *hypre_handle_); + +/* accessor inline function to hypre_device_csr_handle */ + +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) +static inline HYPRE_Int & +hypre_HandleDefaultExecPolicy(hypre_Handle *hypre_handle_) +{ + return hypre_handle_->default_exec_policy; +} + +static inline HYPRE_Int & +hypre_HandleCudaDevice(hypre_Handle *hypre_handle_) +{ + return hypre_handle_->cuda_device; +} + +static inline HYPRE_Int & +hypre_HandleCudaComputeStreamNum(hypre_Handle *hypre_handle_) +{ + return hypre_handle_->cuda_compute_stream_num; +} + +static inline HYPRE_Int & +hypre_HandleCudaPrefetchStreamNum(hypre_Handle *hypre_handle_) +{ + return hypre_handle_->cuda_prefetch_stream_num; +} + +static inline HYPRE_Int & +hypre_HandleCudaComputeStreamSyncDefault(hypre_Handle *hypre_handle_) +{ + return hypre_handle_->cuda_compute_stream_sync_default; +} + +static inline std::vector & +hypre_HandleCudaComputeStreamSync(hypre_Handle *hypre_handle_) +{ + return hypre_handle_->cuda_compute_stream_sync; +} + +static inline cudaStream_t +hypre_HandleCudaStream(hypre_Handle *hypre_handle_, HYPRE_Int i) +{ + cudaStream_t stream = 0; +#if defined(HYPRE_USING_CUDA_STREAMS) + if (i >= HYPRE_MAX_NUM_STREAMS) + { + /* return the default stream, i.e., the NULL stream */ + /* + hypre_printf("CUDA stream %d exceeds the max number %d\n", + i, HYPRE_MAX_NUM_STREAMS); + */ + return NULL; + } + + if (hypre_handle_->cuda_streams[i]) + { + return hypre_handle_->cuda_streams[i]; + } + + //HYPRE_CUDA_CALL(cudaStreamCreateWithFlags(&stream,cudaStreamNonBlocking)); + HYPRE_CUDA_CALL(cudaStreamCreateWithFlags(&stream, cudaStreamDefault)); + + hypre_handle_->cuda_streams[i] = stream; +#endif + + return stream; +} + +static inline cudaStream_t +hypre_HandleCudaComputeStream(hypre_Handle *hypre_handle_) +{ + return hypre_HandleCudaStream(hypre_handle_, + hypre_HandleCudaComputeStreamNum(hypre_handle_)); +} + +static inline cudaStream_t +hypre_HandleCudaPrefetchStream(hypre_Handle *hypre_handle_) +{ + return hypre_HandleCudaStream(hypre_handle_, + hypre_HandleCudaPrefetchStreamNum(hypre_handle_)); +} + +static inline curandGenerator_t +hypre_HandleCurandGenerator(hypre_Handle *hypre_handle_) +{ + if (hypre_handle_->curand_gen) + { + return hypre_handle_->curand_gen; + } + + curandGenerator_t gen; + HYPRE_CURAND_CALL( curandCreateGenerator(&gen, CURAND_RNG_PSEUDO_DEFAULT) ); + HYPRE_CURAND_CALL( curandSetPseudoRandomGeneratorSeed(gen, 1234ULL) ); + HYPRE_CURAND_CALL( curandSetStream(gen, hypre_HandleCudaComputeStream(hypre_handle_)) ); + + hypre_handle_->curand_gen = gen; + + return gen; +} + +static inline cublasHandle_t +hypre_HandleCublasHandle(hypre_Handle *hypre_handle_) +{ + if (hypre_handle_->cublas_handle) + { + return hypre_handle_->cublas_handle; + } + + cublasHandle_t handle; + HYPRE_CUBLAS_CALL( cublasCreate(&handle) ); + + HYPRE_CUBLAS_CALL( cublasSetStream(handle, hypre_HandleCudaComputeStream(hypre_handle_)) ); + + hypre_handle_->cublas_handle = handle; + + return handle; +} + +static inline cusparseHandle_t +hypre_HandleCusparseHandle(hypre_Handle *hypre_handle_) +{ + if (hypre_handle_->cusparse_handle) + { + return hypre_handle_->cusparse_handle; + } + + cusparseHandle_t handle; + HYPRE_CUSPARSE_CALL( cusparseCreate(&handle) ); + + HYPRE_CUSPARSE_CALL( cusparseSetStream(handle, hypre_HandleCudaComputeStream(hypre_handle_)) ); + + hypre_handle_->cusparse_handle = handle; + + return handle; +} + +static inline cusparseMatDescr_t +hypre_HandleCusparseMatDescr(hypre_Handle *hypre_handle_) +{ + if (hypre_handle_->cusparse_mat_descr) + { + return hypre_handle_->cusparse_mat_descr; + } + + cusparseMatDescr_t mat_descr; + HYPRE_CUSPARSE_CALL( cusparseCreateMatDescr(&mat_descr) ); + HYPRE_CUSPARSE_CALL( cusparseSetMatType(mat_descr, CUSPARSE_MATRIX_TYPE_GENERAL) ); + HYPRE_CUSPARSE_CALL( cusparseSetMatIndexBase(mat_descr, CUSPARSE_INDEX_BASE_ZERO) ); + + hypre_handle_->cusparse_mat_descr = mat_descr; + + return mat_descr; +} + +#endif /* defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) */ + +static inline void +hypre_HandleCudaComputeStreamSyncPush(hypre_Handle *hypre_handle_, HYPRE_Int sync) +{ +#if defined(HYPRE_USING_CUDA) && defined(HYPRE_USING_UNIFIED_MEMORY) + hypre_HandleCudaComputeStreamSync(hypre_handle_).push_back(sync); +#endif +} + +static inline void +hypre_HandleCudaComputeStreamSyncPop(hypre_Handle *hypre_handle_) +{ +#if defined(HYPRE_USING_CUDA) && defined(HYPRE_USING_UNIFIED_MEMORY) + hypre_HandleCudaComputeStreamSync(hypre_handle_).pop_back(); +#endif +} + +/* synchronize the default stream */ +static inline HYPRE_Int +hypre_SyncCudaComputeStream(hypre_Handle *hypre_handle_) +{ +#if defined(HYPRE_USING_UNIFIED_MEMORY) +#if defined(HYPRE_USING_CUDA) + assert(!hypre_HandleCudaComputeStreamSync(hypre_handle_).empty()); + + if ( hypre_HandleCudaComputeStreamSync(hypre_handle_).back() ) + { + HYPRE_CUDA_CALL( cudaStreamSynchronize(hypre_HandleCudaComputeStream(hypre_handle_)) ); + } +#endif +#if defined(HYPRE_USING_DEVICE_OPENMP) + HYPRE_CUDA_CALL( cudaDeviceSynchronize() ); +#endif +#endif /* #if defined(HYPRE_USING_UNIFIED_MEMORY) */ + return hypre_error_flag; +} + +#ifdef __cplusplus +} +#endif + +#endif + diff -Nru hypre-2.16.0/src/utilities/hypre_hopscotch_hash.c hypre-2.18.2/src/utilities/hypre_hopscotch_hash.c --- hypre-2.16.0/src/utilities/hypre_hopscotch_hash.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_hopscotch_hash.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + #include "hypre_hopscotch_hash.h" static HYPRE_Int NearestPowerOfTwo( HYPRE_Int value ) diff -Nru hypre-2.16.0/src/utilities/hypre_hopscotch_hash.h hypre-2.18.2/src/utilities/hypre_hopscotch_hash.h --- hypre-2.16.0/src/utilities/hypre_hopscotch_hash.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_hopscotch_hash.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /** * Hopscotch hash is modified from the code downloaded from @@ -48,6 +43,7 @@ #ifndef hypre_HOPSCOTCH_HASH_HEADER #define hypre_HOPSCOTCH_HASH_HEADER +#include #include #include #include @@ -60,7 +56,6 @@ #include "_hypre_utilities.h" // Potentially architecture specific features used here: -// __builtin_ffs // __sync_val_compare_and_swap #ifdef __cplusplus @@ -133,8 +128,7 @@ #ifdef HYPRE_CONCURRENT_HOPSCOTCH static inline HYPRE_Int first_lsb_bit_indx(hypre_uint x) { - if (0 == x) return -1; - return __builtin_ffs(x) - 1; + return ffs(x) - 1; } #endif /** diff -Nru hypre-2.16.0/src/utilities/hypre_memory.c hypre-2.18.2/src/utilities/hypre_memory.c --- hypre-2.16.0/src/utilities/hypre_memory.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_memory.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -18,60 +13,16 @@ #include "_hypre_utilities.h" #include "../struct_mv/_hypre_struct_mv.h" + #ifdef HYPRE_USE_UMALLOC #undef HYPRE_USE_UMALLOC #endif -/* global variables for device OpenMP */ -#if defined(HYPRE_USING_DEVICE_OPENMP) -HYPRE_Int hypre__global_offload = 0; -HYPRE_Int hypre__offload_device_num; -HYPRE_Int hypre__offload_host_num; -/* stats */ -size_t hypre__target_allc_count = 0; -size_t hypre__target_free_count = 0; -size_t hypre__target_allc_bytes = 0; -size_t hypre__target_free_bytes = 0; - -size_t hypre__target_htod_count = 0; -size_t hypre__target_dtoh_count = 0; -size_t hypre__target_htod_bytes = 0; -size_t hypre__target_dtoh_bytes = 0; -#endif - /****************************************************************************** * * Helper routines * *****************************************************************************/ -/*-------------------------------------------------------------------------- - * hypre_RedefMemLocation - * Redefine location based on the selected memory model in hypre_memory.h - *--------------------------------------------------------------------------*/ -static inline HYPRE_Int hypre_RedefMemLocation(HYPRE_Int location) -{ - if (location == HYPRE_MEMORY_HOST) - { - return HYPRE_MEMORY_HOST_ACT; - } - - if (location == HYPRE_MEMORY_DEVICE) - { - return HYPRE_MEMORY_DEVICE_ACT; - } - - if (location == HYPRE_MEMORY_SHARED) - { - return HYPRE_MEMORY_SHARED_ACT; - } - - if (location == HYPRE_MEMORY_HOST_PINNED) - { - return HYPRE_MEMORY_HOST_PINNED_ACT; - } - - return HYPRE_MEMORY_UNSET; -} /*-------------------------------------------------------------------------- * hypre_OutOfMemory @@ -97,7 +48,7 @@ static inline size_t hypre_GetPadMemsize(void *ptr, HYPRE_Int location) { - location = hypre_RedefMemLocation(location); + location = hypre_GetActualMemLocation(location); /* no stored size for host memory */ if (location == HYPRE_MEMORY_HOST) @@ -187,8 +138,8 @@ HYPRE_OMPOffload(hypre__offload_device_num, ptr, size, "enter", "alloc"); #elif defined(HYPRE_USING_CUDA) /* cudaMalloc */ - hypre_CheckErrorDevice( cudaMalloc(&ptr, size + sizeof(size_t)*HYPRE_MEM_PAD_LEN) ); - hypre_CheckErrorDevice( cudaDeviceSynchronize() ); + HYPRE_CUDA_CALL( cudaMalloc(&ptr, size + sizeof(size_t)*HYPRE_MEM_PAD_LEN) ); + HYPRE_CUDA_CALL( cudaDeviceSynchronize() ); hypre_Memcpy(ptr, &size, sizeof(size_t), HYPRE_MEMORY_DEVICE, HYPRE_MEMORY_HOST); size_t *sp = (size_t*) ptr; ptr = (void*) (&sp[HYPRE_MEM_PAD_LEN]); @@ -211,8 +162,9 @@ #if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) size_t count = size + sizeof(size_t)*HYPRE_MEM_PAD_LEN; /* with UM, managed memory alloc */ - hypre_CheckErrorDevice( cudaMallocManaged(&ptr, count, CUDAMEMATTACHTYPE) ); - hypre_CheckErrorDevice( cudaMemAdvise(ptr, count, cudaMemAdviseSetPreferredLocation, HYPRE_DEVICE) ); + HYPRE_CUDA_CALL( cudaMallocManaged(&ptr, count, cudaMemAttachGlobal) ); + HYPRE_Int device = hypre_HandleCudaDevice(hypre_handle); + HYPRE_CUDA_CALL( cudaMemAdvise(ptr, count, cudaMemAdviseSetPreferredLocation, device) ); size_t *sp = (size_t*) ptr; sp[0] = size; ptr = (void*) (&sp[HYPRE_MEM_PAD_LEN]); @@ -234,9 +186,9 @@ #if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) /* TODO which one of the following two? */ - /* hypre_CheckErrorDevice( cudaHostAlloc(&ptr,size + sizeof(size_t)*HYPRE_MEM_PAD_LEN, + /* HYPRE_CUDA_CALL( cudaHostAlloc(&ptr,size + sizeof(size_t)*HYPRE_MEM_PAD_LEN, cudaHostAllocMapped)); */ - hypre_CheckErrorDevice( cudaMallocHost(&ptr, size + sizeof(size_t)*HYPRE_MEM_PAD_LEN) ); + HYPRE_CUDA_CALL( cudaMallocHost(&ptr, size + sizeof(size_t)*HYPRE_MEM_PAD_LEN) ); size_t *sp = (size_t*) ptr; sp[0] = size; ptr = (void*) (&sp[HYPRE_MEM_PAD_LEN]); @@ -261,7 +213,7 @@ void *ptr = NULL; - location = hypre_RedefMemLocation(location); + location = hypre_GetActualMemLocation(location); switch (location) { @@ -330,8 +282,8 @@ size_t size = ((size_t *) ptr)[-HYPRE_MEM_PAD_LEN]; HYPRE_OMPOffload(hypre__offload_device_num, ptr, size, "exit", "delete"); #elif defined(HYPRE_USING_CUDA) - /* cudaFree((size_t *) ptr - HYPRE_MEM_PAD_LEN); */ - cudaSafeFree(ptr, HYPRE_MEM_PAD_LEN); + HYPRE_CUDA_CALL( cudaFree((size_t *) ptr - HYPRE_MEM_PAD_LEN) ); + //cudaSafeFree(ptr, HYPRE_MEM_PAD_LEN); #endif } @@ -340,8 +292,9 @@ { #if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) /* with UM, managed memory free */ - /* cudaFree((size_t *) ptr - HYPRE_MEM_PAD_LEN); */ - cudaSafeFree(ptr, HYPRE_MEM_PAD_LEN); + //HYPRE_CUDA_CALL( cudaFree((size_t *) ptr - HYPRE_MEM_PAD_LEN) ); + cudaFree((size_t *) ptr - HYPRE_MEM_PAD_LEN); + //cudaSafeFree(ptr, HYPRE_MEM_PAD_LEN); #endif } @@ -350,8 +303,8 @@ { #if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) /* page-locked memory on the host */ - /* cudaFreeHost((size_t *) ptr - HYPRE_MEM_PAD_LEN); */ - cudaSafeFree(ptr, HYPRE_MEM_PAD_LEN); + HYPRE_CUDA_CALL( cudaFreeHost((size_t *) ptr - HYPRE_MEM_PAD_LEN) ); + //cudaSafeFree(ptr, HYPRE_MEM_PAD_LEN); #endif } @@ -363,7 +316,7 @@ return; } - location = hypre_RedefMemLocation(location); + location = hypre_GetActualMemLocation(location); switch (location) { @@ -414,7 +367,7 @@ void * hypre_ReAlloc(void *ptr, size_t size, HYPRE_Int location) { - location = hypre_RedefMemLocation(location); + location = hypre_GetActualMemLocation(location); if (size == 0) { @@ -462,11 +415,42 @@ { if (dst == NULL || src == NULL) { + if (size) + { + hypre_printf("hypre_Memcpy warning: copy %ld bytes from %p to %p !\n", size, src, dst); + } + return; } - loc_dst = hypre_RedefMemLocation(loc_dst); - loc_src = hypre_RedefMemLocation(loc_src); + loc_dst = hypre_GetActualMemLocation(loc_dst); + loc_src = hypre_GetActualMemLocation(loc_src); + + /* special uses for GPU shared memory prefetch */ +#if defined(HYPRE_USING_UNIFIED_MEMORY) + if ( dst == src && loc_src == HYPRE_MEMORY_SHARED && (loc_dst == HYPRE_MEMORY_DEVICE || loc_dst == HYPRE_MEMORY_HOST) ) + { + /* src (== dst) must point to cuda unified memory */ + if (loc_dst == HYPRE_MEMORY_DEVICE) + { + HYPRE_CUDA_CALL( + cudaMemPrefetchAsync(src, size, hypre_HandleCudaDevice(hypre_handle), + hypre_HandleCudaPrefetchStream(hypre_handle)) + ); + } + else if (loc_dst == HYPRE_MEMORY_HOST) + { + HYPRE_CUDA_CALL( + cudaMemPrefetchAsync(src, size, cudaCpuDeviceId, + hypre_HandleCudaPrefetchStream(hypre_handle)) + ); + } + + /* HYPRE_CUDA_CALL( cudaStreamSynchronize(hypre_HandleCudaPrefetchStream(hypre_handle)) ); */ + + return; + } +#endif /* 4 x 4 = 16 cases = 9 + 2 + 2 + 2 + 1 */ /* 9: Host <-- Host, Host <-- Shared, Host <-- Pinned, @@ -484,7 +468,7 @@ if (loc_dst == HYPRE_MEMORY_SHARED || loc_src == HYPRE_MEMORY_SHARED) { #if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) - cudaMemcpy(dst, src, size, cudaMemcpyDeviceToDevice); + HYPRE_CUDA_CALL( cudaMemcpy(dst, src, size, cudaMemcpyDeviceToDevice) ); #endif return; } @@ -498,7 +482,7 @@ memcpy(dst, src, size); HYPRE_OMPOffload(hypre__offload_device_num, dst, size, "update", "to"); #elif defined(HYPRE_USING_CUDA) - cudaMemcpy(dst, src, size, cudaMemcpyHostToDevice); + HYPRE_CUDA_CALL( cudaMemcpy(dst, src, size, cudaMemcpyHostToDevice) ); #endif return; } @@ -513,7 +497,7 @@ HYPRE_OMPOffload(hypre__offload_device_num, src, size, "update", "from"); memcpy(dst, src, size); #elif defined(HYPRE_USING_CUDA) - cudaMemcpy( dst, src, size, cudaMemcpyDeviceToHost); + HYPRE_CUDA_CALL( cudaMemcpy( dst, src, size, cudaMemcpyDeviceToHost) ); #endif return; } @@ -529,7 +513,7 @@ memcpy(dst, src, size); HYPRE_OMPOffload(hypre__offload_device_num, dst, size, "update", "to"); #elif defined(HYPRE_USING_CUDA) - cudaMemcpy(dst, src, size, cudaMemcpyDeviceToDevice); + HYPRE_CUDA_CALL( cudaMemcpy(dst, src, size, cudaMemcpyDeviceToDevice) ); #endif return; } @@ -541,16 +525,26 @@ * hypre_Memset * "Sets the first num bytes of the block of memory pointed by ptr to the specified value * (*** interpreted as an unsigned char ***)" + * http://www.cplusplus.com/reference/cstring/memset/ *--------------------------------------------------------------------------*/ void * hypre_Memset(void *ptr, HYPRE_Int value, size_t num, HYPRE_Int location) { - if (ptr == NULL || num == 0) + if (num == 0) + { + return ptr; + } + + if (ptr == NULL) { + if (num) + { + hypre_printf("hypre_Memset warning: set values for %ld bytes at %p !\n", num, ptr); + } return ptr; } - location = hypre_RedefMemLocation(location); + location = hypre_GetActualMemLocation(location); #if defined(HYPRE_DEVICE_OPENMP_ALLOC) unsigned char *ucptr = (unsigned char *) ptr; @@ -579,7 +573,7 @@ memset(ptr, value, num); HYPRE_OMPOffload(hypre__offload_device_num, ptr, num, "update", "to"); #elif defined(HYPRE_USING_CUDA) - cudaMemset(ptr, value, num); + HYPRE_CUDA_CALL( cudaMemset(ptr, value, num) ); #endif break; case HYPRE_MEMORY_SHARED : @@ -594,3 +588,65 @@ return ptr; } +HYPRE_Int +hypre_GetMemoryLocation(const void *ptr, HYPRE_Int *memory_location) +{ + HYPRE_Int ierr = 0; + +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + struct cudaPointerAttributes attr; + *memory_location = HYPRE_MEMORY_UNSET; + +#if (CUDART_VERSION >= 10000) + HYPRE_CUDA_CALL( cudaPointerGetAttributes(&attr, ptr) ); + if (attr.type == cudaMemoryTypeUnregistered) + { + *memory_location = HYPRE_MEMORY_HOST; + } + else if (attr.type == cudaMemoryTypeHost) + { + *memory_location = HYPRE_MEMORY_HOST_PINNED; + } + else if (attr.type == cudaMemoryTypeDevice) + { + *memory_location = HYPRE_MEMORY_DEVICE; + } + else if (attr.type == cudaMemoryTypeManaged) + { + *memory_location = HYPRE_MEMORY_SHARED; + } +#else + cudaError_t err = cudaPointerGetAttributes(&attr, ptr); + if (err != cudaSuccess) + { + ierr = 1; + + /* clear the error */ + cudaGetLastError(); + + if (err == cudaErrorInvalidValue) + { + *memory_location = HYPRE_MEMORY_HOST; + } + } + else if (attr.isManaged) + { + *memory_location = HYPRE_MEMORY_SHARED; + } + else if (attr.memoryType == cudaMemoryTypeDevice) + { + *memory_location = HYPRE_MEMORY_DEVICE; + } + else if (attr.memoryType == cudaMemoryTypeHost) + { + *memory_location = HYPRE_MEMORY_HOST_PINNED; + } +#endif + +#else /* #if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) */ + *memory_location = HYPRE_MEMORY_HOST; +#endif + + return ierr; +} + diff -Nru hypre-2.16.0/src/utilities/hypre_memory.h hypre-2.18.2/src/utilities/hypre_memory.h --- hypre-2.16.0/src/utilities/hypre_memory.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_memory.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -80,6 +75,14 @@ #include #include +/* stringification: + * _Pragma(string-literal), so we need to cast argument to a string + * The three dots as last argument of the macro tells compiler that this is a variadic macro. + * I.e. this is a macro that receives variable number of arguments. + */ +#define HYPRE_STR(...) #__VA_ARGS__ +#define HYPRE_XSTR(...) HYPRE_STR(__VA_ARGS__) + #ifdef __cplusplus extern "C" { #endif @@ -90,6 +93,10 @@ #define HYPRE_MEMORY_SHARED ( 2) #define HYPRE_MEMORY_HOST_PINNED ( 3) +#define HYPRE_EXEC_UNSET (-1) +#define HYPRE_EXEC_DEVICE ( 0) +#define HYPRE_EXEC_HOST ( 1) + /*================================================================== * default def of memory location selected based memory env * +-------------------------------------------------------------+ @@ -126,6 +133,7 @@ #define HYPRE_MEMORY_HOST_ACT HYPRE_MEMORY_HOST #define HYPRE_MEMORY_DEVICE_ACT HYPRE_MEMORY_DEVICE #define HYPRE_MEMORY_SHARED_ACT HYPRE_MEMORY_SHARED +//#define HYPRE_MEMORY_SHARED_ACT HYPRE_MEMORY_HOST #define HYPRE_MEMORY_HOST_PINNED_ACT HYPRE_MEMORY_HOST_PINNED #else @@ -138,7 +146,9 @@ #endif -/* the above definitions might be overridden to customize a memory location */ +/* the above definitions might be overridden to customize + * memory locations */ + /* #undef HYPRE_MEMORY_HOST_ACT */ /* #undef HYPRE_MEMORY_DEVICE_ACT */ /* #undef HYPRE_MEMORY_SHARED_ACT */ @@ -148,184 +158,70 @@ /* #define HYPRE_MEMORY_SHARED_ACT HYPRE_MEMORY_? */ /* #define HYPRE_MEMORY_PINNED_ACT HYPRE_MEMORY_? */ -#define HYPRE_MEM_PAD_LEN 1 - -/* -#if defined(HYPRE_USING_CUDA) -#define HYPRE_CUDA_GLOBAL __host__ __device__ -#else -#define HYPRE_CUDA_GLOBAL -#endif -*/ - -/* OpenMP 4.5 */ -#if defined(HYPRE_USING_DEVICE_OPENMP) - -#include "omp.h" +/*------------------------------------------------------- + * hypre_GetActualMemLocation + * return actual location based on the selected memory model + *-------------------------------------------------------*/ +static inline HYPRE_Int +hypre_GetActualMemLocation(HYPRE_Int location) +{ + if (location == HYPRE_MEMORY_HOST) + { + return HYPRE_MEMORY_HOST_ACT; + } + + if (location == HYPRE_MEMORY_DEVICE) + { + return HYPRE_MEMORY_DEVICE_ACT; + } + + if (location == HYPRE_MEMORY_SHARED) + { + return HYPRE_MEMORY_SHARED_ACT; + } + + if (location == HYPRE_MEMORY_HOST_PINNED) + { + return HYPRE_MEMORY_HOST_PINNED_ACT; + } -/* stringification: - * _Pragma(string-literal), so we need to cast argument to a string - * The three dots as last argument of the macro tells compiler that this is a variadic macro. - * I.e. this is a macro that receives variable number of arguments. - */ -#define HYPRE_STR(s...) #s -#define HYPRE_XSTR(s...) HYPRE_STR(s) - -/* OpenMP 4.5 device memory management */ -extern HYPRE_Int hypre__global_offload; -extern HYPRE_Int hypre__offload_device_num; -extern HYPRE_Int hypre__offload_host_num; - -/* stats */ -extern size_t hypre__target_allc_count; -extern size_t hypre__target_free_count; -extern size_t hypre__target_allc_bytes; -extern size_t hypre__target_free_bytes; -extern size_t hypre__target_htod_count; -extern size_t hypre__target_dtoh_count; -extern size_t hypre__target_htod_bytes; -extern size_t hypre__target_dtoh_bytes; - -/* DEBUG MODE: check if offloading has effect - * (it is turned on when configured with --enable-debug) */ - -#ifdef HYPRE_OMP45_DEBUG -/* if we ``enter'' an address, it should not exist in device [o.w NO EFFECT] - if we ``exit'' or ''update'' an address, it should exist in device [o.w ERROR] -hypre__offload_flag: 0 == OK; 1 == WRONG - */ -#define HYPRE_OFFLOAD_FLAG(devnum, hptr, type) \ - HYPRE_Int hypre__offload_flag = (type[1] == 'n') == omp_target_is_present(hptr, devnum); -#else -#define HYPRE_OFFLOAD_FLAG(...) \ - HYPRE_Int hypre__offload_flag = 0; /* non-debug mode, always OK */ -#endif - -/* OMP 4.5 offloading macro */ -#define hypre_omp45_offload(devnum, hptr, datatype, offset, count, type1, type2) \ -{\ - /* devnum: device number \ - * hptr: host poiter \ - * datatype \ - * type1: ``e(n)ter'', ''e(x)it'', or ``u(p)date'' \ - * type2: ``(a)lloc'', ``(t)o'', ``(d)elete'', ''(f)rom'' \ - */ \ - datatype *hypre__offload_hptr = (datatype *) hptr; \ - /* if hypre__global_offload == 0, or - * hptr (host pointer) == NULL, - * this offload will be IGNORED */ \ - if (hypre__global_offload && hypre__offload_hptr != NULL) { \ - /* offloading offset and size (in datatype) */ \ - size_t hypre__offload_offset = offset, hypre__offload_size = count; \ - /* in HYPRE_OMP45_DEBUG mode, we test if this offload has effect */ \ - HYPRE_OFFLOAD_FLAG(devnum, hypre__offload_hptr, type1) \ - if (hypre__offload_flag) { \ - printf("[!NO Effect! %s %d] device %d target: %6s %6s, data %p, [%ld:%ld]\n", __FILE__, __LINE__, devnum, type1, type2, (void *)hypre__offload_hptr, hypre__offload_offset, hypre__offload_size); exit(0); \ - } else { \ - size_t offload_bytes = count * sizeof(datatype); \ - /* printf("[ %s %d] device %d target: %6s %6s, data %p, [%d:%d]\n", __FILE__, __LINE__, devnum, type1, type2, (void *)hypre__offload_hptr, hypre__offload_offset, hypre__offload_size); */ \ - if (type1[1] == 'n' && type2[0] == 't') { \ - /* enter to */\ - hypre__target_allc_count ++; \ - hypre__target_allc_bytes += offload_bytes; \ - hypre__target_htod_count ++; \ - hypre__target_htod_bytes += offload_bytes; \ - _Pragma (HYPRE_XSTR(omp target enter data map(to:hypre__offload_hptr[hypre__offload_offset:hypre__offload_size]))) \ - } else if (type1[1] == 'n' && type2[0] == 'a') { \ - /* enter alloc */ \ - hypre__target_allc_count ++; \ - hypre__target_allc_bytes += offload_bytes; \ - _Pragma (HYPRE_XSTR(omp target enter data map(alloc:hypre__offload_hptr[hypre__offload_offset:hypre__offload_size]))) \ - } else if (type1[1] == 'x' && type2[0] == 'd') { \ - /* exit delete */\ - hypre__target_free_count ++; \ - hypre__target_free_bytes += offload_bytes; \ - _Pragma (HYPRE_XSTR(omp target exit data map(delete:hypre__offload_hptr[hypre__offload_offset:hypre__offload_size]))) \ - } else if (type1[1] == 'x' && type2[0] == 'f') {\ - /* exit from */ \ - hypre__target_free_count ++; \ - hypre__target_free_bytes += offload_bytes; \ - hypre__target_dtoh_count ++; \ - hypre__target_dtoh_bytes += offload_bytes; \ - _Pragma (HYPRE_XSTR(omp target exit data map(from:hypre__offload_hptr[hypre__offload_offset:hypre__offload_size]))) \ - } else if (type1[1] == 'p' && type2[0] == 't') { \ - /* update to */ \ - hypre__target_htod_count ++; \ - hypre__target_htod_bytes += offload_bytes; \ - _Pragma (HYPRE_XSTR(omp target update to(hypre__offload_hptr[hypre__offload_offset:hypre__offload_size]))) \ - } else if (type1[1] == 'p' && type2[0] == 'f') {\ - /* update from */ \ - hypre__target_dtoh_count ++; \ - hypre__target_dtoh_bytes += offload_bytes; \ - _Pragma (HYPRE_XSTR(omp target update from(hypre__offload_hptr[hypre__offload_offset:hypre__offload_size]))) \ - } else {\ - printf("error: unrecognized offloading type combination!\n"); exit(-1); \ - } \ - } \ - } \ + return HYPRE_MEMORY_UNSET; } -#endif /* #if defined(HYPRE_USING_DEVICE_OPENMP) */ - -/* -#define hypre_InitMemoryDebug(id) -#define hypre_FinalizeMemoryDebug() -*/ -//#define TRACK_MEMORY_ALLOCATIONS -#if defined(TRACK_MEMORY_ALLOCATIONS) - -typedef struct { - char *file; - size_t size; - void *end; - HYPRE_Int line; - HYPRE_Int type;} pattr_t; - -pattr_t *patpush(void *ptr, pattr_t *ss); - -#define hypre_TAlloc(type, count, location) \ - ( (type *)hypre_MAllocIns((size_t)(sizeof(type) * (count)), location,__FILE__,__LINE__) ) - -#define hypre_CTAlloc(type, count, location) \ - ( (type *)hypre_CAllocIns((size_t)(count), (size_t)sizeof(type), location,__FILE__,__LINE__) ) - -#define hypre_TReAlloc(ptr, type, count, location) \ - ( (type *)hypre_ReAllocIns((char *)ptr, (size_t)(sizeof(type) * (count)), location,__FILE__,__LINE__) ) - -void assert_check(void *ptr, char *file, HYPRE_Int line); - -void assert_check_host(void *ptr, char *file, HYPRE_Int line); - - -#define ASSERT_MANAGED(ptr)\ - ( assert_check((ptr),__FILE__,__LINE__)) - -#define ASSERT_HOST(ptr)\ - ( assert_check_host((ptr),__FILE__,__LINE__)) - -#else +#define HYPRE_MEM_PAD_LEN 1 #if 0 - /* These Allocs are with printfs, for debug */ #define hypre_TAlloc(type, count, location) \ (\ - /*printf("[%s:%d] MALLOC %ld B\n", __FILE__,__LINE__, (size_t)(sizeof(type) * (count))) ,*/ \ - (type *) hypre_MAlloc((size_t)(sizeof(type) * (count)), location) \ +{\ + if (location == HYPRE_MEMORY_DEVICE) printf("[%s:%d] TALLOC %.3f MB\n", __FILE__,__LINE__, (size_t)(sizeof(type) * (count))/1024.0/1024.0); \ + (type *) hypre_MAlloc((size_t)(sizeof(type) * (count)), location); \ +}\ ) #define hypre_CTAlloc(type, count, location) \ (\ {\ - /* if (location == HYPRE_MEMORY_DEVICE) printf("[%s:%d] CTALLOC %.3f MB\n", __FILE__,__LINE__, (size_t)(sizeof(type) * (count))/1024.0/1024.0); */ \ + if (location == HYPRE_MEMORY_DEVICE) printf("[%s:%d] CTALLOC %.3f MB\n", __FILE__,__LINE__, (size_t)(sizeof(type) * (count))/1024.0/1024.0); \ (type *) hypre_CAlloc((size_t)(count), (size_t)sizeof(type), location); \ }\ ) #define hypre_TReAlloc(ptr, type, count, location) \ (\ - /* printf("[%s:%d] TReALLOC %ld B\n", __FILE__,__LINE__, (size_t)(sizeof(type) * (count))) , */ \ - (type *)hypre_ReAlloc((char *)ptr, (size_t)(sizeof(type) * (count)), location) \ +{\ + if (location == HYPRE_MEMORY_DEVICE) printf("[%s:%d] TReALLOC %p, %.3f MB\n", __FILE__,__LINE__, ptr, (size_t)(sizeof(type) * (count))/1024.0/1024.0); \ + (type *)hypre_ReAlloc((char *)ptr, (size_t)(sizeof(type) * (count)), location); \ +}\ +) + +#define hypre_TMemcpy(dst, src, type, count, locdst, locsrc) \ +( \ +{ \ + printf("[%s:%d] TMemcpy %d to %d %.3f MB\n", __FILE__,__LINE__, locsrc, locdst, (size_t)(sizeof(type) * (count))/1024.0/1024.0); \ + hypre_Memcpy((void *)(dst), (void *)(src), (size_t)(sizeof(type) * (count)), locdst, locsrc); \ +} \ ) #else @@ -339,46 +235,26 @@ #define hypre_TReAlloc(ptr, type, count, location) \ ( (type *) hypre_ReAlloc((char *)ptr, (size_t)(sizeof(type) * (count)), location) ) -#endif +#define hypre_TMemcpy(dst, src, type, count, locdst, locsrc) \ +(hypre_Memcpy((void *)(dst), (void *)(src), (size_t)(sizeof(type) * (count)), locdst, locsrc)) #endif -#define hypre_TFree(ptr,location) \ -( hypre_Free((char *)ptr, location), ptr = NULL ) - -#define hypre_TMemcpy(dst, src, type, count, locdst, locsrc) \ -(hypre_Memcpy((char *)(dst),(char *)(src),(size_t)(sizeof(type) * (count)),locdst, locsrc)) +#define hypre_TFree(ptr, location) \ +( hypre_Free((void *)ptr, location), ptr = NULL ) /*-------------------------------------------------------------------------- * Prototypes *--------------------------------------------------------------------------*/ /* hypre_memory.c */ -#if 0 -char *hypre_CAllocIns( size_t count , size_t elt_size , HYPRE_Int location,char *file, HYPRE_Int line); -char *hypre_ReAllocIns( char *ptr , size_t size , HYPRE_Int location,char *file, HYPRE_Int line); -char *hypre_MAllocIns( size_t size , HYPRE_Int location,char *file,HYPRE_Int line); -char *hypre_MAllocPinned( size_t size ); -#else void * hypre_MAlloc(size_t size, HYPRE_Int location); void * hypre_CAlloc( size_t count, size_t elt_size, HYPRE_Int location); void * hypre_ReAlloc(void *ptr, size_t size, HYPRE_Int location); void hypre_Memcpy(void *dst, void *src, size_t size, HYPRE_Int loc_dst, HYPRE_Int loc_src); void * hypre_Memset(void *ptr, HYPRE_Int value, size_t num, HYPRE_Int location); void hypre_Free(void *ptr, HYPRE_Int location); -#endif -/* -char *hypre_CAllocHost( size_t count,size_t elt_size ); -char *hypre_MAllocHost( size_t size ); -char *hypre_ReAllocHost( char *ptr,size_t size ); -void hypre_FreeHost( char *ptr ); -char *hypre_SharedMAlloc ( size_t size ); -char *hypre_SharedCAlloc ( size_t count , size_t elt_size ); -char *hypre_SharedReAlloc ( char *ptr , size_t size ); -void hypre_SharedFree ( char *ptr ); -void hypre_MemcpyAsync( char *dst, char *src, size_t size, HYPRE_Int locdst, HYPRE_Int locsrc ); -HYPRE_Real *hypre_IncrementSharedDataPtr ( HYPRE_Real *ptr , size_t size ); -*/ +HYPRE_Int hypre_GetMemoryLocation(const void *ptr, HYPRE_Int *memory_location); /* memory_dmalloc.c */ HYPRE_Int hypre_InitMemoryDebugDML( HYPRE_Int id ); diff -Nru hypre-2.16.0/src/utilities/hypre_merge_sort.c hypre-2.18.2/src/utilities/hypre_merge_sort.c --- hypre-2.16.0/src/utilities/hypre_merge_sort.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_merge_sort.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + #include "_hypre_utilities.h" #include "hypre_hopscotch_hash.h" #include "../seq_mv/HYPRE_seq_mv.h" diff -Nru hypre-2.16.0/src/utilities/hypre_mpi_comm_f2c.c hypre-2.18.2/src/utilities/hypre_mpi_comm_f2c.c --- hypre-2.16.0/src/utilities/hypre_mpi_comm_f2c.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_mpi_comm_f2c.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include "fortran.h" diff -Nru hypre-2.16.0/src/utilities/hypre_nvtx.h hypre-2.18.2/src/utilities/hypre_nvtx.h --- hypre-2.16.0/src/utilities/hypre_nvtx.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_nvtx.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,24 +1,23 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#ifndef HYPRE_NVTX_H +#define HYPRE_NVTX_H + +#ifdef HYPRE_USING_NVTX -#ifdef USE_NVTX #include "nvToolsExt.h" #include "nvToolsExtCudaRt.h" static const uint32_t colors[] = { 0x0000ff00, 0x000000ff, 0x00ffff00, 0x00ff00ff, 0x0000ffff, 0x00ff0000, 0x00ffffff }; -static const int num_colors = sizeof(colors)/sizeof(uint32_t); +static const hypre_int num_colors = sizeof(colors)/sizeof(uint32_t); #define PUSH_RANGE(name,cid) { \ - int color_id = cid; \ + hypre_int color_id = cid; \ color_id = color_id%num_colors;\ nvtxEventAttributes_t eventAttrib = {0}; \ eventAttrib.version = NVTX_VERSION; \ @@ -27,46 +26,16 @@ eventAttrib.color = colors[color_id]; \ eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; \ eventAttrib.message.ascii = name; \ - nvtxDomainRangePushEx(HYPRE_DOMAIN,&eventAttrib); \ + nvtxRangePushEx(&eventAttrib); \ } -#define PUSH_RANGE_PAYLOAD(name,cid,load) { \ - int color_id = cid; \ - color_id = color_id%num_colors;\ - nvtxEventAttributes_t eventAttrib = {0}; \ - eventAttrib.version = NVTX_VERSION; \ - eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; \ - eventAttrib.colorType = NVTX_COLOR_ARGB; \ - eventAttrib.color = colors[color_id]; \ - eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; \ - eventAttrib.message.ascii = name; \ - eventAttrib.payloadType = NVTX_PAYLOAD_TYPE_INT64; \ - eventAttrib.payload.llValue = load; \ - eventAttrib.category=1; \ - nvtxDomainRangePushEx(HYPRE_DOMAIN,&eventAttrib); \ -} +#define POP_RANGE nvtxRangePop(); -#define PUSH_RANGE_DOMAIN(name,cid,dId) { \ - int color_id = cid; \ - color_id = color_id%num_colors;\ - nvtxEventAttributes_t eventAttrib = {0}; \ - eventAttrib.version = NVTX_VERSION; \ - eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; \ - eventAttrib.colorType = NVTX_COLOR_ARGB; \ - eventAttrib.color = colors[color_id]; \ - eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; \ - eventAttrib.message.ascii = name; \ - nvtxDomainRangePushEx(getdomain(dId),&eventAttrib); \ -} +#else /* HYPRE_USING_NVTX */ -#define POP_RANGE nvtxDomainRangePop(HYPRE_DOMAIN); -#define POP_RANGE_DOMAIN(dId) { \ - nvtxDomainRangePop(getdomain(dId)); \ - } -#else #define PUSH_RANGE(name,cid) #define POP_RANGE -#define PUSH_RANGE_PAYLOAD(name,cid,load) -#define PUSH_RANGE_DOMAIN(name,cid,domainName) -#endif +#endif /* HYPRE_USING_NVTX */ + +#endif /* HYPRE_NVTX_H */ diff -Nru hypre-2.16.0/src/utilities/hypre_omp_device.c hypre-2.18.2/src/utilities/hypre_omp_device.c --- hypre-2.16.0/src/utilities/hypre_omp_device.c 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_omp_device.c 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,83 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#include "_hypre_utilities.h" + +#if defined(HYPRE_USING_DEVICE_OPENMP) + +/* global variables for device OpenMP */ +HYPRE_Int hypre__global_offload = 0; +HYPRE_Int hypre__offload_device_num; +HYPRE_Int hypre__offload_host_num; + +/* stats */ +size_t hypre__target_allc_count = 0; +size_t hypre__target_free_count = 0; +size_t hypre__target_allc_bytes = 0; +size_t hypre__target_free_bytes = 0; + +size_t hypre__target_htod_count = 0; +size_t hypre__target_dtoh_count = 0; +size_t hypre__target_htod_bytes = 0; +size_t hypre__target_dtoh_bytes = 0; + +/* num: number of bytes */ +HYPRE_Int HYPRE_OMPOffload(HYPRE_Int device, void *ptr, size_t num, + const char *type1, const char *type2) { + hypre_omp45_offload(device, ptr, char, 0, num, type1, type2); + + return 0; +} + +HYPRE_Int HYPRE_OMPPtrIsMapped(void *p, HYPRE_Int device_num) +{ + if (hypre__global_offload && !omp_target_is_present(p, device_num)) { + printf("HYPRE mapping error: %p has not been mapped to device %d!\n", p, device_num); + return 1; + } + return 0; +} + +/* OMP offloading switch */ +HYPRE_Int HYPRE_OMPOffloadOn() +{ + hypre__global_offload = 1; + hypre__offload_device_num = omp_get_default_device(); + hypre__offload_host_num = omp_get_initial_device(); + hypre_fprintf(stdout, "Hypre OMP 4.5 offloading has been turned on. Device %d\n", + hypre__offload_device_num); + + return 0; +} + +HYPRE_Int HYPRE_OMPOffloadOff() +{ + fprintf(stdout, "Hypre OMP 4.5 offloading has been turned off\n"); + hypre__global_offload = 0; + hypre__offload_device_num = omp_get_initial_device(); + hypre__offload_host_num = omp_get_initial_device(); + + return 0; +} + +HYPRE_Int HYPRE_OMPOffloadStatPrint() +{ + hypre_printf("Hypre OMP target memory stats:\n" + " ALLOC %ld bytes, %ld counts\n" + " FREE %ld bytes, %ld counts\n" + " HTOD %ld bytes, %ld counts\n" + " DTOH %ld bytes, %ld counts\n", + hypre__target_allc_bytes, hypre__target_allc_count, + hypre__target_free_bytes, hypre__target_free_count, + hypre__target_htod_bytes, hypre__target_htod_count, + hypre__target_dtoh_bytes, hypre__target_dtoh_count); + + return 0; +} + +#endif /* #if defined(HYPRE_USING_DEVICE_OPENMP) */ + diff -Nru hypre-2.16.0/src/utilities/hypre_omp_device.h hypre-2.18.2/src/utilities/hypre_omp_device.h --- hypre-2.16.0/src/utilities/hypre_omp_device.h 1970-01-01 00:00:00.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_omp_device.h 2019-10-28 22:30:04.000000000 +0000 @@ -0,0 +1,118 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#ifndef HYPRE_OMP_DEVICE_H +#define HYPRE_OMP_DEVICE_H + +#if defined(HYPRE_USING_DEVICE_OPENMP) + +#include "omp.h" + +/* OpenMP 4.5 device memory management */ +extern HYPRE_Int hypre__global_offload; +extern HYPRE_Int hypre__offload_device_num; +extern HYPRE_Int hypre__offload_host_num; + +/* stats */ +extern size_t hypre__target_allc_count; +extern size_t hypre__target_free_count; +extern size_t hypre__target_allc_bytes; +extern size_t hypre__target_free_bytes; +extern size_t hypre__target_htod_count; +extern size_t hypre__target_dtoh_count; +extern size_t hypre__target_htod_bytes; +extern size_t hypre__target_dtoh_bytes; + +/* CHECK MODE: check if offloading has effect (turned on when configured with --enable-debug) + * if we ``enter'' an address, it should not exist in device [o.w NO EFFECT] + * if we ``exit'' or ''update'' an address, it should exist in device [o.w ERROR] + * hypre__offload_flag: 0 == OK; 1 == WRONG + */ +#ifdef HYPRE_DEVICE_OPENMP_CHECK +#define HYPRE_OFFLOAD_FLAG(devnum, hptr, type) HYPRE_Int hypre__offload_flag = (type[1] == 'n') == omp_target_is_present(hptr, devnum); +#else +#define HYPRE_OFFLOAD_FLAG(...) HYPRE_Int hypre__offload_flag = 0; /* non-debug mode, always OK */ +#endif + +/* OMP 4.5 offloading macro */ +#define hypre_omp45_offload(devnum, hptr, datatype, offset, count, type1, type2) \ +{\ + /* devnum: device number \ + * hptr: host poiter \ + * datatype \ + * type1: ``e(n)ter'', ''e(x)it'', or ``u(p)date'' \ + * type2: ``(a)lloc'', ``(t)o'', ``(d)elete'', ''(f)rom'' \ + */ \ + datatype *hypre__offload_hptr = (datatype *) hptr; \ + /* if hypre__global_offload == 0, or + * hptr (host pointer) == NULL, + * this offload will be IGNORED */ \ + if (hypre__global_offload && hypre__offload_hptr != NULL) { \ + /* offloading offset and size (in datatype) */ \ + size_t hypre__offload_offset = offset, hypre__offload_size = count; \ + /* in the CHECK mode, we test if this offload has effect */ \ + HYPRE_OFFLOAD_FLAG(devnum, hypre__offload_hptr, type1) \ + if (hypre__offload_flag) { \ + printf("[!NO Effect! %s %d] device %d target: %6s %6s, data %p, [%ld:%ld]\n", __FILE__, __LINE__, devnum, type1, type2, (void *)hypre__offload_hptr, hypre__offload_offset, hypre__offload_size); exit(0); \ + } else { \ + size_t offload_bytes = count * sizeof(datatype); \ + /* printf("[ %s %d] device %d target: %6s %6s, data %p, [%d:%d]\n", __FILE__, __LINE__, devnum, type1, type2, (void *)hypre__offload_hptr, hypre__offload_offset, hypre__offload_size); */ \ + if (type1[1] == 'n' && type2[0] == 't') { \ + /* enter to */\ + hypre__target_allc_count ++; \ + hypre__target_allc_bytes += offload_bytes; \ + hypre__target_htod_count ++; \ + hypre__target_htod_bytes += offload_bytes; \ + _Pragma (HYPRE_XSTR(omp target enter data map(to:hypre__offload_hptr[hypre__offload_offset:hypre__offload_size]))) \ + } else if (type1[1] == 'n' && type2[0] == 'a') { \ + /* enter alloc */ \ + hypre__target_allc_count ++; \ + hypre__target_allc_bytes += offload_bytes; \ + _Pragma (HYPRE_XSTR(omp target enter data map(alloc:hypre__offload_hptr[hypre__offload_offset:hypre__offload_size]))) \ + } else if (type1[1] == 'x' && type2[0] == 'd') { \ + /* exit delete */\ + hypre__target_free_count ++; \ + hypre__target_free_bytes += offload_bytes; \ + _Pragma (HYPRE_XSTR(omp target exit data map(delete:hypre__offload_hptr[hypre__offload_offset:hypre__offload_size]))) \ + } else if (type1[1] == 'x' && type2[0] == 'f') {\ + /* exit from */ \ + hypre__target_free_count ++; \ + hypre__target_free_bytes += offload_bytes; \ + hypre__target_dtoh_count ++; \ + hypre__target_dtoh_bytes += offload_bytes; \ + _Pragma (HYPRE_XSTR(omp target exit data map(from:hypre__offload_hptr[hypre__offload_offset:hypre__offload_size]))) \ + } else if (type1[1] == 'p' && type2[0] == 't') { \ + /* update to */ \ + hypre__target_htod_count ++; \ + hypre__target_htod_bytes += offload_bytes; \ + _Pragma (HYPRE_XSTR(omp target update to(hypre__offload_hptr[hypre__offload_offset:hypre__offload_size]))) \ + } else if (type1[1] == 'p' && type2[0] == 'f') {\ + /* update from */ \ + hypre__target_dtoh_count ++; \ + hypre__target_dtoh_bytes += offload_bytes; \ + _Pragma (HYPRE_XSTR(omp target update from(hypre__offload_hptr[hypre__offload_offset:hypre__offload_size]))) \ + } else {\ + printf("error: unrecognized offloading type combination!\n"); exit(-1); \ + } \ + } \ + } \ +} + +HYPRE_Int HYPRE_OMPOffload(HYPRE_Int device, void *ptr, size_t num, const char *type1, const char *type2); +HYPRE_Int HYPRE_OMPPtrIsMapped(void *p, HYPRE_Int device_num); +HYPRE_Int HYPRE_OMPOffloadOn(); +HYPRE_Int HYPRE_OMPOffloadOff(); +HYPRE_Int HYPRE_OMPOffloadStatPrint(); + +#define HYPRE_MIN_GPU_SIZE (131072) + +#define hypre_SetDeviceOn() HYPRE_OMPOffloadOn() +#define hypre_SetDeviceOff() HYPRE_OMPOffloadOff() + +#endif /* HYPRE_USING_DEVICE_OPENMP */ +#endif /* HYPRE_OMP_DEVICE_H */ + diff -Nru hypre-2.16.0/src/utilities/hypre_prefix_sum.c hypre-2.18.2/src/utilities/hypre_prefix_sum.c --- hypre-2.16.0/src/utilities/hypre_prefix_sum.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_prefix_sum.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,3 +1,10 @@ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + #include "_hypre_utilities.h" void hypre_prefix_sum(HYPRE_Int *in_out, HYPRE_Int *sum, HYPRE_Int *workspace) diff -Nru hypre-2.16.0/src/utilities/hypre_printf.c hypre-2.18.2/src/utilities/hypre_printf.c --- hypre-2.16.0/src/utilities/hypre_printf.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_printf.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_utilities.h" #include @@ -116,6 +111,20 @@ return 0; } +HYPRE_Int +hypre_ndigits( HYPRE_BigInt number ) +{ + HYPRE_Int ndigits = 0; + + while(number) + { + number /= 10; + ndigits++; + } + + return ndigits; +} + /* printf functions */ HYPRE_Int diff -Nru hypre-2.16.0/src/utilities/hypre_qsort.c hypre-2.18.2/src/utilities/hypre_qsort.c --- hypre-2.16.0/src/utilities/hypre_qsort.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_qsort.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include "_hypre_utilities.h" @@ -121,7 +115,7 @@ { HYPRE_Int temp; HYPRE_Real temp_d; - + temp_d = v[i]; v[i] = v[j]; @@ -140,14 +134,14 @@ void hypre_BigSwap4_d(HYPRE_Real *v, HYPRE_BigInt *w, HYPRE_Int *z, - HYPRE_Int *y, + HYPRE_Int *y, HYPRE_Int i, HYPRE_Int j ) { HYPRE_Int temp; HYPRE_BigInt big_temp; HYPRE_Real temp_d; - + temp_d = v[i]; v[i] = v[j]; @@ -204,10 +198,10 @@ /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ -void hypre_qsort1( HYPRE_Int *v, - HYPRE_Real *w, - HYPRE_Int left, - HYPRE_Int right ) +void hypre_qsort1( HYPRE_Int *v, + HYPRE_Real *w, + HYPRE_Int left, + HYPRE_Int right ) { HYPRE_Int i, last; @@ -282,23 +276,26 @@ /* sort on w (HYPRE_Real), move v (AB 11/04) */ - void hypre_qsort2( HYPRE_Int *v, - HYPRE_Real *w, - HYPRE_Int left, - HYPRE_Int right ) + HYPRE_Real *w, + HYPRE_Int left, + HYPRE_Int right ) { HYPRE_Int i, last; if (left >= right) + { return; + } hypre_swap2( v, w, left, (left+right)/2); last = left; for (i = left+1; i <= right; i++) + { if (w[i] < w[left]) { hypre_swap2(v, w, ++last, i); } + } hypre_swap2(v, w, left, last); hypre_qsort2(v, w, left, last-1); hypre_qsort2(v, w, last+1, right); @@ -306,6 +303,33 @@ /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ +/* sort both v and w, in place, but based only on entries in w */ +void hypre_qsort2abs( HYPRE_Int *v, + HYPRE_Real *w, + HYPRE_Int left, + HYPRE_Int right ) +{ + HYPRE_Int i, last; + if (left >= right) + { + return; + } + hypre_swap2( v, w, left, (left+right)/2); + last = left; + for (i = left+1; i <= right; i++) + { + if (fabs(w[i]) > fabs(w[left])) + { + hypre_swap2(v, w, ++last, i); + } + } + hypre_swap2(v, w, left, last); + hypre_qsort2abs(v, w, left, last-1); + hypre_qsort2abs(v, w, last+1, right); +} + +/*-------------------------------------------------------------------------- + *--------------------------------------------------------------------------*/ /* sort on v, move w and z (AB 11/04) */ @@ -413,8 +437,6 @@ } - - /*-------------------------------------------------------------------------- *--------------------------------------------------------------------------*/ @@ -596,3 +618,127 @@ hypre_BigQsort0(v, last+1, right); } +// Recursive DFS search. +static void hypre_search_row(HYPRE_Int row, + const HYPRE_Int *row_ptr, + const HYPRE_Int *col_inds, + const HYPRE_Complex *data, + HYPRE_Int *visited, + HYPRE_Int *ordering, + HYPRE_Int *order_ind) +{ + // If this row has not been visited, call recursive DFS on nonzero + // column entries + if (!visited[row]) + { + HYPRE_Int j; + visited[row] = 1; + for (j=row_ptr[row]; j 1e-14) + { + hypre_dense_search_row(col, L, visited, ordering, order_ind, n, is_col_major); + } + } + // Add node to ordering *after* it has been searched + ordering[*order_ind] = row; + *order_ind += 1; + } +} + + +// Find topological ordering of acyclic dense matrix in column major +// format. That is, find ordering of matrix to be triangular. +// +// INPUT +// ----- +// - L[] : dense nxn matrix in column major format +// - ordering[] should be empty array of length n +// - row is the row to start the search from +void hypre_dense_topo_sort(const HYPRE_Complex *L, + HYPRE_Int *ordering, + HYPRE_Int n, + HYPRE_Int is_col_major) +{ + HYPRE_Int *visited = hypre_CTAlloc(HYPRE_Int, n, HYPRE_MEMORY_HOST); + HYPRE_Int order_ind = 0; + HYPRE_Int temp_row = 0; + while (order_ind < n) + { + hypre_dense_search_row(temp_row, L, visited, ordering, &order_ind, n, is_col_major); + temp_row += 1; + if (temp_row == n) + { + temp_row = 0; + } + } + hypre_TFree(visited, HYPRE_MEMORY_HOST); +} + diff -Nru hypre-2.16.0/src/utilities/hypre_reducesum.c hypre-2.18.2/src/utilities/hypre_reducesum.c --- hypre-2.16.0/src/utilities/hypre_reducesum.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_reducesum.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -#include "_hypre_utilities.h" - -#if !defined(HYPRE_USING_RAJA) && !defined(HYPRE_USING_KOKKOS) && defined(HYPRE_USING_CUDA) - -void *cuda_reduce_buffer = NULL; - -extern "C++" { - -template -__global__ void OneBlockReduceKernel(T *arr, HYPRE_Int N) -{ - T sum; - sum = 0.0; - if (threadIdx.x < N) - { - sum = arr[threadIdx.x]; - } - sum = blockReduceSum(sum); - if (threadIdx.x == 0) - { - arr[0] = sum; - } -} - -template -void OneBlockReduce(T *d_arr, HYPRE_Int N, T *h_out) -{ - hypre_assert(N <= 1024); - //printf("OneBlockReduce N = %d\n", N); - //cudaDeviceSynchronize(); -#if 1 - OneBlockReduceKernel<<<1, 1024>>>(d_arr, N); - hypre_TMemcpy(h_out, d_arr, T, 1, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); -#else - T tmp[1024]; - hypre_TMemcpy(tmp, d_arr, T, N, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); - *h_out = 0.0; - for (HYPRE_Int i=0; i (HYPRE_Real *d_arr, HYPRE_Int N, HYPRE_Real *h_out); -template void OneBlockReduce(HYPRE_double4 *d_arr, HYPRE_Int N, HYPRE_double4 *h_out); -template void OneBlockReduce(HYPRE_double6 *d_arr, HYPRE_Int N, HYPRE_double6 *h_out); - -} /* extern "C++" { */ - -#endif - diff -Nru hypre-2.16.0/src/utilities/hypre_reducesum.h hypre-2.18.2/src/utilities/hypre_reducesum.h --- hypre-2.16.0/src/utilities/hypre_reducesum.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_reducesum.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,245 +0,0 @@ -#if !defined(HYPRE_USING_RAJA) && !defined(HYPRE_USING_KOKKOS) && defined(HYPRE_USING_CUDA) - -#ifndef CUDART_VERSION -#error CUDART_VERSION Undefined! -#elif (CUDART_VERSION >= 9000) -#define WARP_SHFL_DOWN(mask, var, delta) __shfl_down_sync(mask, var, delta) -#elif (CUDART_VERSION <= 8000) -#define WARP_SHFL_DOWN(mask, var, delta) __shfl_down(var, delta); -#endif - -extern "C++" { - -extern void *cuda_reduce_buffer; - -template void OneBlockReduce(T *d_arr, HYPRE_Int N, T *h_out); - -struct HYPRE_double4 -{ - HYPRE_Real x,y,z,w; - - __host__ __device__ - HYPRE_double4() {} - - __host__ __device__ - HYPRE_double4(HYPRE_Real x1, HYPRE_Real x2, HYPRE_Real x3, HYPRE_Real x4) - { - x = x1; - y = x2; - z = x3; - w = x4; - } - - __host__ __device__ - void operator=(HYPRE_Real val) - { - x = y = z = w = val; - } - - __host__ __device__ - void operator+=(HYPRE_double4 rhs) - { - x += rhs.x; - y += rhs.y; - z += rhs.z; - w += rhs.w; - } - -}; - -struct HYPRE_double6 -{ - HYPRE_Real x,y,z,w,u,v; - - __host__ __device__ - HYPRE_double6() {} - - __host__ __device__ - HYPRE_double6(HYPRE_Real x1, HYPRE_Real x2, HYPRE_Real x3, HYPRE_Real x4, - HYPRE_Real x5, HYPRE_Real x6) - { - x = x1; - y = x2; - z = x3; - w = x4; - u = x5; - v = x6; - } - - __host__ __device__ - void operator=(HYPRE_Real val) - { - x = y = z = w = u = v = val; - } - - __host__ __device__ - void operator+=(HYPRE_double6 rhs) - { - x += rhs.x; - y += rhs.y; - z += rhs.z; - w += rhs.w; - u += rhs.u; - v += rhs.v; - } - -}; - -/* reduction within a warp */ -__inline__ __host__ __device__ -HYPRE_Real warpReduceSum(HYPRE_Real val) -{ -#ifdef __CUDA_ARCH__ - for (HYPRE_Int offset = warpSize/2; offset > 0; offset /= 2) - { - val += WARP_SHFL_DOWN(0xFFFFFFFF, val, offset); - } -#endif - return val; -} - -__inline__ __host__ __device__ -HYPRE_double4 warpReduceSum(HYPRE_double4 val) { -#ifdef __CUDA_ARCH__ - for (HYPRE_Int offset = warpSize / 2; offset > 0; offset /= 2) - { - val.x += WARP_SHFL_DOWN(0xFFFFFFFF, val.x, offset); - val.y += WARP_SHFL_DOWN(0xFFFFFFFF, val.y, offset); - val.z += WARP_SHFL_DOWN(0xFFFFFFFF, val.z, offset); - val.w += WARP_SHFL_DOWN(0xFFFFFFFF, val.w, offset); - } -#endif - return val; -} - -__inline__ __host__ __device__ -HYPRE_double6 warpReduceSum(HYPRE_double6 val) { -#ifdef __CUDA_ARCH__ - for (HYPRE_Int offset = warpSize / 2; offset > 0; offset /= 2) - { - val.x += WARP_SHFL_DOWN(0xFFFFFFFF, val.x, offset); - val.y += WARP_SHFL_DOWN(0xFFFFFFFF, val.y, offset); - val.z += WARP_SHFL_DOWN(0xFFFFFFFF, val.z, offset); - val.w += WARP_SHFL_DOWN(0xFFFFFFFF, val.w, offset); - val.u += WARP_SHFL_DOWN(0xFFFFFFFF, val.u, offset); - val.v += WARP_SHFL_DOWN(0xFFFFFFFF, val.v, offset); - } -#endif - return val; -} - -/* reduction within a block */ -template -__inline__ __host__ __device__ -T blockReduceSum(T val) -{ -#ifdef __CUDA_ARCH__ - //static __shared__ T shared[32]; // Shared mem for 32 partial sums - __shared__ T shared[32]; // Shared mem for 32 partial sums - HYPRE_Int lane = threadIdx.x % warpSize; - HYPRE_Int wid = threadIdx.x / warpSize; - - val = warpReduceSum(val); // Each warp performs partial reduction - - if (lane == 0) - { - shared[wid] = val; // Write reduced value to shared memory - } - - __syncthreads(); // Wait for all partial reductions - - //read from shared memory only if that warp existed - if (threadIdx.x < blockDim.x / warpSize) - { - val = shared[lane]; - } - else - { - val = 0.0; - } - - if (wid == 0) - { - val = warpReduceSum(val); //Final reduce within first warp - } - -#endif - return val; -} - -/* Reducer class */ -template -struct ReduceSum -{ - T init; /* initial value passed in */ - mutable T __thread_sum; /* place to hold local sum of a thread, - and partial sum of a block */ - T *d_buf; /* place to store partial sum of a block */ - HYPRE_Int nblocks; /* number of blocks used in the first round */ - - /* constructor. - * val is the initial value (added to the reduced sum) */ - __host__ - ReduceSum(T val) - { - init = val; - __thread_sum = 0.0; - - if (cuda_reduce_buffer == NULL) - { - /* allocate for the max size for reducing double6 type */ - cuda_reduce_buffer = hypre_TAlloc(HYPRE_double6, 1024, HYPRE_MEMORY_DEVICE); - } - - d_buf = (T*) cuda_reduce_buffer; - } - - /* copy constructor */ - __host__ __device__ - ReduceSum(const ReduceSum& other) - { - *this = other; - } - - __host__ __device__ - void BlockReduce() const - { -#ifdef __CUDA_ARCH__ - __thread_sum = blockReduceSum(__thread_sum); - if (threadIdx.x == 0) - { - d_buf[blockIdx.x] = __thread_sum; - } -#endif - } - - __host__ __device__ - void operator+=(T val) const - { - __thread_sum += val; - } - - /* we invoke the 2nd reduction at the time we want the sum from the reducer - * class */ - __host__ - operator T() - { - T val; - /* 2nd reduction with only *one* block */ - OneBlockReduce(d_buf, nblocks, &val); - val += init; - //hypre_TFree(d_buf, HYPRE_MEMORY_DEVICE); - return val; - } - - /* destructor */ - __host__ __device__ - ~ReduceSum() - { - } -}; - -} // extern "C++" - -#endif - diff -Nru hypre-2.16.0/src/utilities/hypre_smp.h hypre-2.18.2/src/utilities/hypre_smp.h --- hypre-2.16.0/src/utilities/hypre_smp.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/hypre_smp.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef HYPRE_SMP_HEADER #define HYPRE_SMP_HEADER diff -Nru hypre-2.16.0/src/utilities/_hypre_utilities.h hypre-2.18.2/src/utilities/_hypre_utilities.h --- hypre-2.16.0/src/utilities/_hypre_utilities.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/_hypre_utilities.h 2019-10-28 22:30:04.000000000 +0000 @@ -15,17 +15,12 @@ extern "C" { #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -68,19 +63,14 @@ #define hypre_pow2(i) ( 1 << (i) ) #endif -#endif +#endif /* hypre_GENERAL_HEADER */ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -125,83 +115,84 @@ #define MPI_BOTTOM hypre_MPI_BOTTOM #define MPI_FLOAT hypre_MPI_FLOAT -#define MPI_DOUBLE hypre_MPI_DOUBLE +#define MPI_DOUBLE hypre_MPI_DOUBLE #define MPI_LONG_DOUBLE hypre_MPI_LONG_DOUBLE -#define MPI_INT hypre_MPI_INT -#define MPI_LONG_LONG_INT hypre_MPI_INT -#define MPI_CHAR hypre_MPI_CHAR -#define MPI_LONG hypre_MPI_LONG -#define MPI_BYTE hypre_MPI_BYTE +#define MPI_INT hypre_MPI_INT +#define MPI_LONG_LONG_INT hypre_MPI_INT +#define MPI_CHAR hypre_MPI_CHAR +#define MPI_LONG hypre_MPI_LONG +#define MPI_BYTE hypre_MPI_BYTE #define MPI_C_DOUBLE_COMPLEX hypre_MPI_COMPLEX -#define MPI_SUM hypre_MPI_SUM -#define MPI_MIN hypre_MPI_MIN -#define MPI_MAX hypre_MPI_MAX -#define MPI_LOR hypre_MPI_LOR -#define MPI_LAND hypre_MPI_LAND +#define MPI_SUM hypre_MPI_SUM +#define MPI_MIN hypre_MPI_MIN +#define MPI_MAX hypre_MPI_MAX +#define MPI_LOR hypre_MPI_LOR +#define MPI_LAND hypre_MPI_LAND #define MPI_SUCCESS hypre_MPI_SUCCESS #define MPI_STATUSES_IGNORE hypre_MPI_STATUSES_IGNORE -#define MPI_UNDEFINED hypre_MPI_UNDEFINED -#define MPI_REQUEST_NULL hypre_MPI_REQUEST_NULL -#define MPI_ANY_SOURCE hypre_MPI_ANY_SOURCE +#define MPI_UNDEFINED hypre_MPI_UNDEFINED +#define MPI_REQUEST_NULL hypre_MPI_REQUEST_NULL +#define MPI_INFO_NULL hypre_MPI_INFO_NULL +#define MPI_ANY_SOURCE hypre_MPI_ANY_SOURCE #define MPI_ANY_TAG hypre_MPI_ANY_TAG #define MPI_SOURCE hypre_MPI_SOURCE #define MPI_TAG hypre_MPI_TAG -#define MPI_Init hypre_MPI_Init -#define MPI_Finalize hypre_MPI_Finalize -#define MPI_Abort hypre_MPI_Abort -#define MPI_Wtime hypre_MPI_Wtime -#define MPI_Wtick hypre_MPI_Wtick -#define MPI_Barrier hypre_MPI_Barrier -#define MPI_Comm_create hypre_MPI_Comm_create -#define MPI_Comm_dup hypre_MPI_Comm_dup +#define MPI_Init hypre_MPI_Init +#define MPI_Finalize hypre_MPI_Finalize +#define MPI_Abort hypre_MPI_Abort +#define MPI_Wtime hypre_MPI_Wtime +#define MPI_Wtick hypre_MPI_Wtick +#define MPI_Barrier hypre_MPI_Barrier +#define MPI_Comm_create hypre_MPI_Comm_create +#define MPI_Comm_dup hypre_MPI_Comm_dup #define MPI_Comm_f2c hypre_MPI_Comm_f2c -#define MPI_Comm_group hypre_MPI_Comm_group -#define MPI_Comm_size hypre_MPI_Comm_size -#define MPI_Comm_rank hypre_MPI_Comm_rank -#define MPI_Comm_free hypre_MPI_Comm_free -#define MPI_Comm_split hypre_MPI_Comm_split +#define MPI_Comm_group hypre_MPI_Comm_group +#define MPI_Comm_size hypre_MPI_Comm_size +#define MPI_Comm_rank hypre_MPI_Comm_rank +#define MPI_Comm_free hypre_MPI_Comm_free +#define MPI_Comm_split hypre_MPI_Comm_split #define MPI_Comm_split_type hypre_MPI_Comm_split_type -#define MPI_Group_incl hypre_MPI_Group_incl -#define MPI_Group_free hypre_MPI_Group_free -#define MPI_Address hypre_MPI_Address -#define MPI_Get_count hypre_MPI_Get_count -#define MPI_Alltoall hypre_MPI_Alltoall -#define MPI_Allgather hypre_MPI_Allgather -#define MPI_Allgatherv hypre_MPI_Allgatherv -#define MPI_Gather hypre_MPI_Gather -#define MPI_Gatherv hypre_MPI_Gatherv -#define MPI_Scatter hypre_MPI_Scatter -#define MPI_Scatterv hypre_MPI_Scatterv -#define MPI_Bcast hypre_MPI_Bcast -#define MPI_Send hypre_MPI_Send -#define MPI_Recv hypre_MPI_Recv -#define MPI_Isend hypre_MPI_Isend -#define MPI_Irecv hypre_MPI_Irecv -#define MPI_Send_init hypre_MPI_Send_init -#define MPI_Recv_init hypre_MPI_Recv_init -#define MPI_Irsend hypre_MPI_Irsend -#define MPI_Startall hypre_MPI_Startall -#define MPI_Probe hypre_MPI_Probe -#define MPI_Iprobe hypre_MPI_Iprobe -#define MPI_Test hypre_MPI_Test +#define MPI_Group_incl hypre_MPI_Group_incl +#define MPI_Group_free hypre_MPI_Group_free +#define MPI_Address hypre_MPI_Address +#define MPI_Get_count hypre_MPI_Get_count +#define MPI_Alltoall hypre_MPI_Alltoall +#define MPI_Allgather hypre_MPI_Allgather +#define MPI_Allgatherv hypre_MPI_Allgatherv +#define MPI_Gather hypre_MPI_Gather +#define MPI_Gatherv hypre_MPI_Gatherv +#define MPI_Scatter hypre_MPI_Scatter +#define MPI_Scatterv hypre_MPI_Scatterv +#define MPI_Bcast hypre_MPI_Bcast +#define MPI_Send hypre_MPI_Send +#define MPI_Recv hypre_MPI_Recv +#define MPI_Isend hypre_MPI_Isend +#define MPI_Irecv hypre_MPI_Irecv +#define MPI_Send_init hypre_MPI_Send_init +#define MPI_Recv_init hypre_MPI_Recv_init +#define MPI_Irsend hypre_MPI_Irsend +#define MPI_Startall hypre_MPI_Startall +#define MPI_Probe hypre_MPI_Probe +#define MPI_Iprobe hypre_MPI_Iprobe +#define MPI_Test hypre_MPI_Test #define MPI_Testall hypre_MPI_Testall -#define MPI_Wait hypre_MPI_Wait -#define MPI_Waitall hypre_MPI_Waitall -#define MPI_Waitany hypre_MPI_Waitany -#define MPI_Allreduce hypre_MPI_Allreduce -#define MPI_Reduce hypre_MPI_Reduce -#define MPI_Scan hypre_MPI_Scan -#define MPI_Request_free hypre_MPI_Request_free -#define MPI_Type_contiguous hypre_MPI_Type_contiguous -#define MPI_Type_vector hypre_MPI_Type_vector -#define MPI_Type_hvector hypre_MPI_Type_hvector -#define MPI_Type_struct hypre_MPI_Type_struct +#define MPI_Wait hypre_MPI_Wait +#define MPI_Waitall hypre_MPI_Waitall +#define MPI_Waitany hypre_MPI_Waitany +#define MPI_Allreduce hypre_MPI_Allreduce +#define MPI_Reduce hypre_MPI_Reduce +#define MPI_Scan hypre_MPI_Scan +#define MPI_Request_free hypre_MPI_Request_free +#define MPI_Type_contiguous hypre_MPI_Type_contiguous +#define MPI_Type_vector hypre_MPI_Type_vector +#define MPI_Type_hvector hypre_MPI_Type_hvector +#define MPI_Type_struct hypre_MPI_Type_struct #define MPI_Type_commit hypre_MPI_Type_commit -#define MPI_Type_free hypre_MPI_Type_free -#define MPI_Op_free hypre_MPI_Op_free +#define MPI_Type_free hypre_MPI_Type_free +#define MPI_Op_free hypre_MPI_Op_free #define MPI_Op_create hypre_MPI_Op_create #define MPI_User_function hypre_MPI_User_function #define MPI_Info_create hypre_MPI_Info_create @@ -255,6 +246,7 @@ #define hypre_MPI_UNDEFINED -9999 #define hypre_MPI_REQUEST_NULL 0 +#define hypre_MPI_INFO_NULL 0 #define hypre_MPI_ANY_SOURCE 1 #define hypre_MPI_ANY_TAG 1 @@ -278,7 +270,7 @@ #define hypre_MPI_COMM_NULL MPI_COMM_NULL #define hypre_MPI_BOTTOM MPI_BOTTOM #define hypre_MPI_COMM_SELF MPI_COMM_SELF -#define hypre_MPI_COMM_TYPE_SHARED MPI_COMM_TYPE_SHARED +#define hypre_MPI_COMM_TYPE_SHARED MPI_COMM_TYPE_SHARED #define hypre_MPI_FLOAT MPI_FLOAT #define hypre_MPI_DOUBLE MPI_DOUBLE @@ -300,9 +292,10 @@ #define hypre_MPI_SUCCESS MPI_SUCCESS #define hypre_MPI_STATUSES_IGNORE MPI_STATUSES_IGNORE -#define hypre_MPI_UNDEFINED MPI_UNDEFINED +#define hypre_MPI_UNDEFINED MPI_UNDEFINED #define hypre_MPI_REQUEST_NULL MPI_REQUEST_NULL -#define hypre_MPI_ANY_SOURCE MPI_ANY_SOURCE +#define hypre_MPI_INFO_NULL MPI_INFO_NULL +#define hypre_MPI_ANY_SOURCE MPI_ANY_SOURCE #define hypre_MPI_ANY_TAG MPI_ANY_TAG #define hypre_MPI_SOURCE MPI_SOURCE #define hypre_MPI_TAG MPI_TAG @@ -384,17 +377,12 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef HYPRE_SMP_HEADER #define HYPRE_SMP_HEADER @@ -402,17 +390,12 @@ #define HYPRE_SMP_SCHEDULE schedule(static) -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -484,6 +467,14 @@ #include #include +/* stringification: + * _Pragma(string-literal), so we need to cast argument to a string + * The three dots as last argument of the macro tells compiler that this is a variadic macro. + * I.e. this is a macro that receives variable number of arguments. + */ +#define HYPRE_STR(...) #__VA_ARGS__ +#define HYPRE_XSTR(...) HYPRE_STR(__VA_ARGS__) + #ifdef __cplusplus extern "C" { #endif @@ -494,6 +485,10 @@ #define HYPRE_MEMORY_SHARED ( 2) #define HYPRE_MEMORY_HOST_PINNED ( 3) +#define HYPRE_EXEC_UNSET (-1) +#define HYPRE_EXEC_DEVICE ( 0) +#define HYPRE_EXEC_HOST ( 1) + /*================================================================== * default def of memory location selected based memory env * +-------------------------------------------------------------+ @@ -530,6 +525,7 @@ #define HYPRE_MEMORY_HOST_ACT HYPRE_MEMORY_HOST #define HYPRE_MEMORY_DEVICE_ACT HYPRE_MEMORY_DEVICE #define HYPRE_MEMORY_SHARED_ACT HYPRE_MEMORY_SHARED +//#define HYPRE_MEMORY_SHARED_ACT HYPRE_MEMORY_HOST #define HYPRE_MEMORY_HOST_PINNED_ACT HYPRE_MEMORY_HOST_PINNED #else @@ -542,7 +538,9 @@ #endif -/* the above definitions might be overridden to customize a memory location */ +/* the above definitions might be overridden to customize + * memory locations */ + /* #undef HYPRE_MEMORY_HOST_ACT */ /* #undef HYPRE_MEMORY_DEVICE_ACT */ /* #undef HYPRE_MEMORY_SHARED_ACT */ @@ -552,29 +550,132 @@ /* #define HYPRE_MEMORY_SHARED_ACT HYPRE_MEMORY_? */ /* #define HYPRE_MEMORY_PINNED_ACT HYPRE_MEMORY_? */ +/*------------------------------------------------------- + * hypre_GetActualMemLocation + * return actual location based on the selected memory model + *-------------------------------------------------------*/ +static inline HYPRE_Int +hypre_GetActualMemLocation(HYPRE_Int location) +{ + if (location == HYPRE_MEMORY_HOST) + { + return HYPRE_MEMORY_HOST_ACT; + } + + if (location == HYPRE_MEMORY_DEVICE) + { + return HYPRE_MEMORY_DEVICE_ACT; + } + + if (location == HYPRE_MEMORY_SHARED) + { + return HYPRE_MEMORY_SHARED_ACT; + } + + if (location == HYPRE_MEMORY_HOST_PINNED) + { + return HYPRE_MEMORY_HOST_PINNED_ACT; + } + + return HYPRE_MEMORY_UNSET; +} + #define HYPRE_MEM_PAD_LEN 1 -/* -#if defined(HYPRE_USING_CUDA) -#define HYPRE_CUDA_GLOBAL __host__ __device__ +#if 0 +/* These Allocs are with printfs, for debug */ +#define hypre_TAlloc(type, count, location) \ +(\ +{\ + if (location == HYPRE_MEMORY_DEVICE) printf("[%s:%d] TALLOC %.3f MB\n", __FILE__,__LINE__, (size_t)(sizeof(type) * (count))/1024.0/1024.0); \ + (type *) hypre_MAlloc((size_t)(sizeof(type) * (count)), location); \ +}\ +) + +#define hypre_CTAlloc(type, count, location) \ +(\ +{\ + if (location == HYPRE_MEMORY_DEVICE) printf("[%s:%d] CTALLOC %.3f MB\n", __FILE__,__LINE__, (size_t)(sizeof(type) * (count))/1024.0/1024.0); \ + (type *) hypre_CAlloc((size_t)(count), (size_t)sizeof(type), location); \ +}\ +) + +#define hypre_TReAlloc(ptr, type, count, location) \ +(\ +{\ + if (location == HYPRE_MEMORY_DEVICE) printf("[%s:%d] TReALLOC %p, %.3f MB\n", __FILE__,__LINE__, ptr, (size_t)(sizeof(type) * (count))/1024.0/1024.0); \ + (type *)hypre_ReAlloc((char *)ptr, (size_t)(sizeof(type) * (count)), location); \ +}\ +) + +#define hypre_TMemcpy(dst, src, type, count, locdst, locsrc) \ +( \ +{ \ + printf("[%s:%d] TMemcpy %d to %d %.3f MB\n", __FILE__,__LINE__, locsrc, locdst, (size_t)(sizeof(type) * (count))/1024.0/1024.0); \ + hypre_Memcpy((void *)(dst), (void *)(src), (size_t)(sizeof(type) * (count)), locdst, locsrc); \ +} \ +) + #else -#define HYPRE_CUDA_GLOBAL + +#define hypre_TAlloc(type, count, location) \ +( (type *) hypre_MAlloc((size_t)(sizeof(type) * (count)), location) ) + +#define hypre_CTAlloc(type, count, location) \ +( (type *) hypre_CAlloc((size_t)(count), (size_t)sizeof(type), location) ) + +#define hypre_TReAlloc(ptr, type, count, location) \ +( (type *) hypre_ReAlloc((char *)ptr, (size_t)(sizeof(type) * (count)), location) ) + +#define hypre_TMemcpy(dst, src, type, count, locdst, locsrc) \ +(hypre_Memcpy((void *)(dst), (void *)(src), (size_t)(sizeof(type) * (count)), locdst, locsrc)) + +#endif + +#define hypre_TFree(ptr, location) \ +( hypre_Free((void *)ptr, location), ptr = NULL ) + +/*-------------------------------------------------------------------------- + * Prototypes + *--------------------------------------------------------------------------*/ + +/* hypre_memory.c */ +void * hypre_MAlloc(size_t size, HYPRE_Int location); +void * hypre_CAlloc( size_t count, size_t elt_size, HYPRE_Int location); +void * hypre_ReAlloc(void *ptr, size_t size, HYPRE_Int location); +void hypre_Memcpy(void *dst, void *src, size_t size, HYPRE_Int loc_dst, HYPRE_Int loc_src); +void * hypre_Memset(void *ptr, HYPRE_Int value, size_t num, HYPRE_Int location); +void hypre_Free(void *ptr, HYPRE_Int location); +HYPRE_Int hypre_GetMemoryLocation(const void *ptr, HYPRE_Int *memory_location); + +/* memory_dmalloc.c */ +HYPRE_Int hypre_InitMemoryDebugDML( HYPRE_Int id ); +HYPRE_Int hypre_FinalizeMemoryDebugDML( void ); +char *hypre_MAllocDML( HYPRE_Int size , char *file , HYPRE_Int line ); +char *hypre_CAllocDML( HYPRE_Int count , HYPRE_Int elt_size , char *file , HYPRE_Int line ); +char *hypre_ReAllocDML( char *ptr , HYPRE_Int size , char *file , HYPRE_Int line ); +void hypre_FreeDML( char *ptr , char *file , HYPRE_Int line ); + +#ifdef __cplusplus +} #endif -*/ -/* OpenMP 4.5 */ +#endif + +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#ifndef HYPRE_OMP_DEVICE_H +#define HYPRE_OMP_DEVICE_H + #if defined(HYPRE_USING_DEVICE_OPENMP) #include "omp.h" -/* stringification: - * _Pragma(string-literal), so we need to cast argument to a string - * The three dots as last argument of the macro tells compiler that this is a variadic macro. - * I.e. this is a macro that receives variable number of arguments. - */ -#define HYPRE_STR(s...) #s -#define HYPRE_XSTR(s...) HYPRE_STR(s) - /* OpenMP 4.5 device memory management */ extern HYPRE_Int hypre__global_offload; extern HYPRE_Int hypre__offload_device_num; @@ -590,19 +691,15 @@ extern size_t hypre__target_htod_bytes; extern size_t hypre__target_dtoh_bytes; -/* DEBUG MODE: check if offloading has effect - * (it is turned on when configured with --enable-debug) */ - -#ifdef HYPRE_OMP45_DEBUG -/* if we ``enter'' an address, it should not exist in device [o.w NO EFFECT] - if we ``exit'' or ''update'' an address, it should exist in device [o.w ERROR] -hypre__offload_flag: 0 == OK; 1 == WRONG +/* CHECK MODE: check if offloading has effect (turned on when configured with --enable-debug) + * if we ``enter'' an address, it should not exist in device [o.w NO EFFECT] + * if we ``exit'' or ''update'' an address, it should exist in device [o.w ERROR] + * hypre__offload_flag: 0 == OK; 1 == WRONG */ -#define HYPRE_OFFLOAD_FLAG(devnum, hptr, type) \ - HYPRE_Int hypre__offload_flag = (type[1] == 'n') == omp_target_is_present(hptr, devnum); +#ifdef HYPRE_DEVICE_OPENMP_CHECK +#define HYPRE_OFFLOAD_FLAG(devnum, hptr, type) HYPRE_Int hypre__offload_flag = (type[1] == 'n') == omp_target_is_present(hptr, devnum); #else -#define HYPRE_OFFLOAD_FLAG(...) \ - HYPRE_Int hypre__offload_flag = 0; /* non-debug mode, always OK */ +#define HYPRE_OFFLOAD_FLAG(...) HYPRE_Int hypre__offload_flag = 0; /* non-debug mode, always OK */ #endif /* OMP 4.5 offloading macro */ @@ -621,7 +718,7 @@ if (hypre__global_offload && hypre__offload_hptr != NULL) { \ /* offloading offset and size (in datatype) */ \ size_t hypre__offload_offset = offset, hypre__offload_size = count; \ - /* in HYPRE_OMP45_DEBUG mode, we test if this offload has effect */ \ + /* in the CHECK mode, we test if this offload has effect */ \ HYPRE_OFFLOAD_FLAG(devnum, hypre__offload_hptr, type1) \ if (hypre__offload_flag) { \ printf("[!NO Effect! %s %d] device %d target: %6s %6s, data %p, [%ld:%ld]\n", __FILE__, __LINE__, devnum, type1, type2, (void *)hypre__offload_hptr, hypre__offload_offset, hypre__offload_size); exit(0); \ @@ -669,146 +766,26 @@ } \ } -#endif /* #if defined(HYPRE_USING_DEVICE_OPENMP) */ - -/* -#define hypre_InitMemoryDebug(id) -#define hypre_FinalizeMemoryDebug() -*/ -//#define TRACK_MEMORY_ALLOCATIONS -#if defined(TRACK_MEMORY_ALLOCATIONS) - -typedef struct { - char *file; - size_t size; - void *end; - HYPRE_Int line; - HYPRE_Int type;} pattr_t; - -pattr_t *patpush(void *ptr, pattr_t *ss); - -#define hypre_TAlloc(type, count, location) \ - ( (type *)hypre_MAllocIns((size_t)(sizeof(type) * (count)), location,__FILE__,__LINE__) ) - -#define hypre_CTAlloc(type, count, location) \ - ( (type *)hypre_CAllocIns((size_t)(count), (size_t)sizeof(type), location,__FILE__,__LINE__) ) - -#define hypre_TReAlloc(ptr, type, count, location) \ - ( (type *)hypre_ReAllocIns((char *)ptr, (size_t)(sizeof(type) * (count)), location,__FILE__,__LINE__) ) - -void assert_check(void *ptr, char *file, HYPRE_Int line); - -void assert_check_host(void *ptr, char *file, HYPRE_Int line); - - -#define ASSERT_MANAGED(ptr)\ - ( assert_check((ptr),__FILE__,__LINE__)) - -#define ASSERT_HOST(ptr)\ - ( assert_check_host((ptr),__FILE__,__LINE__)) - -#else - -#if 0 - -/* These Allocs are with printfs, for debug */ -#define hypre_TAlloc(type, count, location) \ -(\ - /*printf("[%s:%d] MALLOC %ld B\n", __FILE__,__LINE__, (size_t)(sizeof(type) * (count))) ,*/ \ - (type *) hypre_MAlloc((size_t)(sizeof(type) * (count)), location) \ -) - -#define hypre_CTAlloc(type, count, location) \ -(\ -{\ - /* if (location == HYPRE_MEMORY_DEVICE) printf("[%s:%d] CTALLOC %.3f MB\n", __FILE__,__LINE__, (size_t)(sizeof(type) * (count))/1024.0/1024.0); */ \ - (type *) hypre_CAlloc((size_t)(count), (size_t)sizeof(type), location); \ -}\ -) - -#define hypre_TReAlloc(ptr, type, count, location) \ -(\ - /* printf("[%s:%d] TReALLOC %ld B\n", __FILE__,__LINE__, (size_t)(sizeof(type) * (count))) , */ \ - (type *)hypre_ReAlloc((char *)ptr, (size_t)(sizeof(type) * (count)), location) \ -) - -#else - -#define hypre_TAlloc(type, count, location) \ -( (type *) hypre_MAlloc((size_t)(sizeof(type) * (count)), location) ) - -#define hypre_CTAlloc(type, count, location) \ -( (type *) hypre_CAlloc((size_t)(count), (size_t)sizeof(type), location) ) - -#define hypre_TReAlloc(ptr, type, count, location) \ -( (type *) hypre_ReAlloc((char *)ptr, (size_t)(sizeof(type) * (count)), location) ) - -#endif - -#endif - -#define hypre_TFree(ptr,location) \ -( hypre_Free((char *)ptr, location), ptr = NULL ) - -#define hypre_TMemcpy(dst, src, type, count, locdst, locsrc) \ -(hypre_Memcpy((char *)(dst),(char *)(src),(size_t)(sizeof(type) * (count)),locdst, locsrc)) - -/*-------------------------------------------------------------------------- - * Prototypes - *--------------------------------------------------------------------------*/ - -/* hypre_memory.c */ -#if 0 -char *hypre_CAllocIns( size_t count , size_t elt_size , HYPRE_Int location,char *file, HYPRE_Int line); -char *hypre_ReAllocIns( char *ptr , size_t size , HYPRE_Int location,char *file, HYPRE_Int line); -char *hypre_MAllocIns( size_t size , HYPRE_Int location,char *file,HYPRE_Int line); -char *hypre_MAllocPinned( size_t size ); -#else -void * hypre_MAlloc(size_t size, HYPRE_Int location); -void * hypre_CAlloc( size_t count, size_t elt_size, HYPRE_Int location); -void * hypre_ReAlloc(void *ptr, size_t size, HYPRE_Int location); -void hypre_Memcpy(void *dst, void *src, size_t size, HYPRE_Int loc_dst, HYPRE_Int loc_src); -void * hypre_Memset(void *ptr, HYPRE_Int value, size_t num, HYPRE_Int location); -void hypre_Free(void *ptr, HYPRE_Int location); -#endif -/* -char *hypre_CAllocHost( size_t count,size_t elt_size ); -char *hypre_MAllocHost( size_t size ); -char *hypre_ReAllocHost( char *ptr,size_t size ); -void hypre_FreeHost( char *ptr ); -char *hypre_SharedMAlloc ( size_t size ); -char *hypre_SharedCAlloc ( size_t count , size_t elt_size ); -char *hypre_SharedReAlloc ( char *ptr , size_t size ); -void hypre_SharedFree ( char *ptr ); -void hypre_MemcpyAsync( char *dst, char *src, size_t size, HYPRE_Int locdst, HYPRE_Int locsrc ); -HYPRE_Real *hypre_IncrementSharedDataPtr ( HYPRE_Real *ptr , size_t size ); -*/ +HYPRE_Int HYPRE_OMPOffload(HYPRE_Int device, void *ptr, size_t num, const char *type1, const char *type2); +HYPRE_Int HYPRE_OMPPtrIsMapped(void *p, HYPRE_Int device_num); +HYPRE_Int HYPRE_OMPOffloadOn(); +HYPRE_Int HYPRE_OMPOffloadOff(); +HYPRE_Int HYPRE_OMPOffloadStatPrint(); -/* memory_dmalloc.c */ -HYPRE_Int hypre_InitMemoryDebugDML( HYPRE_Int id ); -HYPRE_Int hypre_FinalizeMemoryDebugDML( void ); -char *hypre_MAllocDML( HYPRE_Int size , char *file , HYPRE_Int line ); -char *hypre_CAllocDML( HYPRE_Int count , HYPRE_Int elt_size , char *file , HYPRE_Int line ); -char *hypre_ReAllocDML( char *ptr , HYPRE_Int size , char *file , HYPRE_Int line ); -void hypre_FreeDML( char *ptr , char *file , HYPRE_Int line ); +#define HYPRE_MIN_GPU_SIZE (131072) -#ifdef __cplusplus -} -#endif +#define hypre_SetDeviceOn() HYPRE_OMPOffloadOn() +#define hypre_SetDeviceOff() HYPRE_OMPOffloadOff() -#endif +#endif /* HYPRE_USING_DEVICE_OPENMP */ +#endif /* HYPRE_OMP_DEVICE_H */ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_THREADING_HEADER #define hypre_THREADING_HEADER @@ -818,12 +795,14 @@ HYPRE_Int hypre_NumThreads( void ); HYPRE_Int hypre_NumActiveThreads( void ); HYPRE_Int hypre_GetThreadNum( void ); +void hypre_SetNumThreads(HYPRE_Int nt); #else #define hypre_NumThreads() 1 #define hypre_NumActiveThreads() 1 #define hypre_GetThreadNum() 0 +#define hypre_SetNumThreads(x) #endif @@ -831,17 +810,12 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -953,17 +927,12 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -984,15 +953,15 @@ struct double_linked_list { - HYPRE_Int data; - struct double_linked_list *next_elt; - struct double_linked_list *prev_elt; - HYPRE_Int head; - HYPRE_Int tail; + HYPRE_Int data; + struct double_linked_list *next_elt; + struct double_linked_list *prev_elt; + HYPRE_Int head; + HYPRE_Int tail; }; typedef struct double_linked_list hypre_ListElement; -typedef hypre_ListElement *hypre_LinkList; +typedef hypre_ListElement *hypre_LinkList; #ifdef __cplusplus } @@ -1000,17 +969,12 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_EXCHANGE_DATA_HEADER #define hypre_EXCHANGE_DATA_HEADER @@ -1061,17 +1025,12 @@ #endif /* end of header */ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_ERROR_HEADER #define hypre_ERROR_HEADER @@ -1099,17 +1058,12 @@ #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -1138,377 +1092,874 @@ #endif /* CALIPER_INSTRUMENTATION_HEADER */ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - -#ifdef USE_NVTX -#include "nvToolsExt.h" -#include "nvToolsExtCudaRt.h" - -static const uint32_t colors[] = { 0x0000ff00, 0x000000ff, 0x00ffff00, 0x00ff00ff, 0x0000ffff, 0x00ff0000, 0x00ffffff }; -static const int num_colors = sizeof(colors)/sizeof(uint32_t); - -#define PUSH_RANGE(name,cid) { \ - int color_id = cid; \ - color_id = color_id%num_colors;\ - nvtxEventAttributes_t eventAttrib = {0}; \ - eventAttrib.version = NVTX_VERSION; \ - eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; \ - eventAttrib.colorType = NVTX_COLOR_ARGB; \ - eventAttrib.color = colors[color_id]; \ - eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; \ - eventAttrib.message.ascii = name; \ - nvtxDomainRangePushEx(HYPRE_DOMAIN,&eventAttrib); \ -} - -#define PUSH_RANGE_PAYLOAD(name,cid,load) { \ - int color_id = cid; \ - color_id = color_id%num_colors;\ - nvtxEventAttributes_t eventAttrib = {0}; \ - eventAttrib.version = NVTX_VERSION; \ - eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; \ - eventAttrib.colorType = NVTX_COLOR_ARGB; \ - eventAttrib.color = colors[color_id]; \ - eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; \ - eventAttrib.message.ascii = name; \ - eventAttrib.payloadType = NVTX_PAYLOAD_TYPE_INT64; \ - eventAttrib.payload.llValue = load; \ - eventAttrib.category=1; \ - nvtxDomainRangePushEx(HYPRE_DOMAIN,&eventAttrib); \ -} - -#define PUSH_RANGE_DOMAIN(name,cid,dId) { \ - int color_id = cid; \ - color_id = color_id%num_colors;\ - nvtxEventAttributes_t eventAttrib = {0}; \ - eventAttrib.version = NVTX_VERSION; \ - eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; \ - eventAttrib.colorType = NVTX_COLOR_ARGB; \ - eventAttrib.color = colors[color_id]; \ - eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; \ - eventAttrib.message.ascii = name; \ - nvtxDomainRangePushEx(getdomain(dId),&eventAttrib); \ -} - -#define POP_RANGE nvtxDomainRangePop(HYPRE_DOMAIN); -#define POP_RANGE_DOMAIN(dId) { \ - nvtxDomainRangePop(getdomain(dId)); \ - } -#else -#define PUSH_RANGE(name,cid) -#define POP_RANGE -#define PUSH_RANGE_PAYLOAD(name,cid,load) -#define PUSH_RANGE_DOMAIN(name,cid,domainName) -#endif - -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ -#ifndef hypre_GPU_ERROR_HEADER -#define hypre_GPU_ERROR_HEADER +#ifndef HYPRE_CUDA_UTILS_H +#define HYPRE_CUDA_UTILS_H #if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) -//#include +HYPRE_Int hypre_printf( const char *format , ... ); + #ifdef __cplusplus extern "C++" { #endif + #include #include -#ifdef __cplusplus -} -#endif +#include +#include +#include +#include -#define hypre_CheckErrorDevice(err) CheckError(err,__FILE__, __FUNCTION__, __LINE__) -#define CUDAMEMATTACHTYPE cudaMemAttachGlobal -#define HYPRE_HOST_POINTER 0 -#define HYPRE_MANAGED_POINTER 1 -#define HYPRE_PINNED_POINTER 2 -#define HYPRE_DEVICE_POINTER 3 -#define HYPRE_UNDEFINED_POINTER1 4 -#define HYPRE_UNDEFINED_POINTER2 5 - -void CheckError(cudaError_t const err, const char* file, char const* const fun, const HYPRE_Int line); -void cudaSafeFree(void *ptr,int padding); -hypre_int PrintPointerAttributes(const void *ptr); -hypre_int PointerAttributes(const void *ptr); - -/* CUBLAS and CUSPARSE related */ -#ifndef __cusparseErrorCheck__ -#define __cusparseErrorCheck__ +#ifndef CUDART_VERSION +#error CUDART_VERSION Undefined! +#endif -/* MUST HAVE " extern "C++" " for C++ header cusparse.h, and the headers therein */ -#ifdef __cplusplus -extern "C++" { +#ifndef CUDA_VERSION +#error CUDA_VERSION Undefined! #endif -#include -#ifdef __cplusplus + +#if defined(HYPRE_USING_CUDA) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +using namespace thrust::placeholders; +#endif // #if defined(HYPRE_USING_CUDA) + +#define HYPRE_WARP_SIZE 32 +#define HYPRE_WARP_FULL_MASK 0xFFFFFFFF +#define HYPRE_MAX_NUM_WARPS (64 * 64 * 32) +#define HYPRE_FLT_LARGE 1e30 +#define HYPRE_1D_BLOCK_SIZE 512 +#define HYPRE_MAX_NUM_STREAMS 10 + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * macro for launching CUDA kernels, CUDA, Thrust, Cusparse, Curand calls + * NOTE: IN HYPRE'S DEFAULT STREAM + * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + */ + +#define HYPRE_CUDA_LAUNCH(kernel_name, gridsize, blocksize, ...) \ +{ \ + if ( gridsize.x == 0 || gridsize.y == 0 || gridsize.z == 0 || \ + blocksize.x == 0 || blocksize.y == 0 || blocksize.z == 0 ) \ + { \ + /* hypre_printf("Warning %s %d: Zero CUDA grid/block (%d %d %d) (%d %d %d)\n", \ + __FILE__, __LINE__, \ + gridsize.x, gridsize.y, gridsize.z, blocksize.x, blocksize.y, blocksize.z); */ \ + } \ + else \ + { \ + (kernel_name) <<< (gridsize), (blocksize), 0, hypre_HandleCudaComputeStream(hypre_handle) >>> (__VA_ARGS__); \ + } \ } -#endif -#include -#include -inline const char *cusparseErrorCheck(cusparseStatus_t error) + + +#define HYPRE_THRUST_CALL(func_name, ...) \ + thrust::func_name( \ + thrust::cuda::par.on(hypre_HandleCudaComputeStream(hypre_handle)), __VA_ARGS__); \ + +#define HYPRE_CUBLAS_CALL(call) do { \ + cublasStatus_t err = call; \ + if (CUBLAS_STATUS_SUCCESS != err) { \ + hypre_printf("CUBLAS ERROR (code = %d, %d) at %s:%d\n", \ + err, err == CUBLAS_STATUS_EXECUTION_FAILED, __FILE__, __LINE__); \ + exit(1); \ + } } while(0) + +#define HYPRE_CUSPARSE_CALL(call) do { \ + cusparseStatus_t err = call; \ + if (CUSPARSE_STATUS_SUCCESS != err) { \ + hypre_printf("CUSPARSE ERROR (code = %d, %d) at %s:%d\n", \ + err, err == CUSPARSE_STATUS_EXECUTION_FAILED, __FILE__, __LINE__); \ + exit(1); \ + } } while(0) + + +#define HYPRE_CURAND_CALL(call) do { \ + curandStatus_t err = call; \ + if (CURAND_STATUS_SUCCESS != err) { \ + hypre_printf("CURAND ERROR (code = %d) at %s:%d\n", \ + err, __FILE__, __LINE__); \ + exit(1); \ + } } while(0) + + +#define HYPRE_CUDA_CALL(call) do { \ + cudaError_t err = call; \ + if (cudaSuccess != err) { \ + hypre_printf("CUDA ERROR (code = %d, %s) at %s:%d\n", err, cudaGetErrorString(err), __FILE__, __LINE__); \ + exit(1); \ + } } while(0) + +#if defined(HYPRE_USING_CUDA) +/* return the number of threads in block */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_num_threads() +{ + switch (dim) + { + case 1: + return (blockDim.x); + case 2: + return (blockDim.x * blockDim.y); + case 3: + return (blockDim.x * blockDim.y * blockDim.z); + } + + return -1; +} + +/* return the flattened thread id in block */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_thread_id() +{ + switch (dim) + { + case 1: + return (threadIdx.x); + case 2: + return (threadIdx.y * blockDim.x + threadIdx.x); + case 3: + return (threadIdx.z * blockDim.x * blockDim.y + threadIdx.y * blockDim.x + + threadIdx.x); + } + + return -1; +} + +/* return the number of warps in block */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_num_warps() { - switch (error) - { - case CUSPARSE_STATUS_SUCCESS: - return "CUSPARSE_STATUS_SUCCESS"; + return hypre_cuda_get_num_threads() >> 5; +} - case CUSPARSE_STATUS_NOT_INITIALIZED: - return "CUSPARSE_STATUS_NOT_INITIALIZED"; +/* return the warp id in block */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_warp_id() +{ + return hypre_cuda_get_thread_id() >> 5; +} - case CUSPARSE_STATUS_ALLOC_FAILED: - return "CUSPARSE_STATUS_ALLOC_FAILED"; +/* return the thread lane id in warp */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_lane_id() +{ + return hypre_cuda_get_thread_id() & (HYPRE_WARP_SIZE-1); +} - case CUSPARSE_STATUS_INVALID_VALUE: - return "CUSPARSE_STATUS_INVALID_VALUE"; +/* return the num of blocks in grid */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_num_blocks() +{ + switch (dim) + { + case 1: + return (gridDim.x); + case 2: + return (gridDim.x * gridDim.y); + case 3: + return (gridDim.x * gridDim.y * gridDim.z); + } - case CUSPARSE_STATUS_ARCH_MISMATCH: - return "CUSPARSE_STATUS_ARCH_MISMATCH"; + return -1; +} - case CUSPARSE_STATUS_MAPPING_ERROR: - return "CUSPARSE_STATUS_MAPPING_ERROR"; +/* return the flattened block id in grid */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_block_id() +{ + switch (dim) + { + case 1: + return (blockIdx.x); + case 2: + return (blockIdx.y * gridDim.x + blockIdx.x); + case 3: + return (blockIdx.z * gridDim.x * gridDim.y + blockIdx.y * gridDim.x + + blockIdx.x); + } - case CUSPARSE_STATUS_EXECUTION_FAILED: - return "CUSPARSE_STATUS_EXECUTION_FAILED"; + return -1; +} - case CUSPARSE_STATUS_INTERNAL_ERROR: - return "CUSPARSE_STATUS_INTERNAL_ERROR"; +/* return the number of threads in grid */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_grid_num_threads() +{ + return hypre_cuda_get_num_blocks() * hypre_cuda_get_num_threads(); +} - case CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED: - return "CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED"; - default: - return "Unknown error in cusparseErrorCheck"; - } - +/* return the flattened thread id in grid */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_grid_thread_id() +{ + return hypre_cuda_get_block_id() * hypre_cuda_get_num_threads() + + hypre_cuda_get_thread_id(); } -inline const char *cublasErrorCheck(cublasStatus_t error) +/* return the number of warps in grid */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_grid_num_warps() { - switch (error) - { - case CUBLAS_STATUS_SUCCESS: - return "CUBLAS_STATUS_SUCCESS"; + return hypre_cuda_get_num_blocks() * hypre_cuda_get_num_warps(); +} - case CUBLAS_STATUS_NOT_INITIALIZED: - return "CUBLAS_STATUS_NOT_INITIALIZED"; +/* return the flattened warp id in grid */ +template +static __device__ __forceinline__ +hypre_int hypre_cuda_get_grid_warp_id() +{ + return hypre_cuda_get_block_id() * hypre_cuda_get_num_warps() + + hypre_cuda_get_warp_id(); +} - case CUBLAS_STATUS_ALLOC_FAILED: - return "CUBLAS_STATUS_ALLOC_FAILED"; +#if CUDA_VERSION < 9000 - case CUBLAS_STATUS_INVALID_VALUE: - return "CUBLAS_STATUS_INVALID_VALUE"; +template +static __device__ __forceinline__ +T __shfl_sync(unsigned mask, T val, hypre_int src_line, hypre_int width=32) +{ + return __shfl(val, src_line, width); +} - case CUBLAS_STATUS_ARCH_MISMATCH: - return "CUBLAS_STATUS_ARCH_MISMATCH"; +template +static __device__ __forceinline__ +T __shfl_down_sync(unsigned mask, T val, unsigned delta, hypre_int width=32) +{ + return __shfl_down(val, delta, width); +} + +template +static __device__ __forceinline__ +T __shfl_xor_sync(unsigned mask, T val, unsigned lanemask, hypre_int width=32) +{ + return __shfl_xor(val, lanemask, width); +} + +template +static __device__ __forceinline__ +T __shfl_up_sync(unsigned mask, T val, unsigned delta, hypre_int width=32) +{ + return __shfl_up(val, delta, width); +} + +static __device__ __forceinline__ +void __syncwarp() +{ +} + +#endif + +template +static __device__ __forceinline__ +T read_only_load( const T *ptr ) +{ + return __ldg( ptr ); +} + +template +static __device__ __forceinline__ +T warp_prefix_sum(hypre_int lane_id, T in, T &all_sum) +{ +#pragma unroll + for (hypre_int d = 2; d <= 32; d <<= 1) + { + T t = __shfl_up_sync(HYPRE_WARP_FULL_MASK, in, d >> 1); + if ( (lane_id & (d - 1)) == d - 1 ) + { + in += t; + } + } + + all_sum = __shfl_sync(HYPRE_WARP_FULL_MASK, in, 31); + + if (lane_id == 31) + { + in = 0; + } + +#pragma unroll + for (hypre_int d = 16; d > 0; d >>= 1) + { + T t = __shfl_xor_sync(HYPRE_WARP_FULL_MASK, in, d); + + if ( (lane_id & (d - 1)) == d - 1) + { + if ( (lane_id & (d << 1 - 1)) == (d << 1 - 1) ) + { + in += t; + } + else + { + in = t; + } + } + } + return in; +} + +template +static __device__ __forceinline__ +T warp_reduce_sum(T in) +{ +#pragma unroll + for (hypre_int d = 16; d > 0; d >>= 1) + { + in += __shfl_down_sync(HYPRE_WARP_FULL_MASK, in, d); + } + return in; +} + +template +static __device__ __forceinline__ +T warp_allreduce_sum(T in) +{ +#pragma unroll + for (hypre_int d = 16; d > 0; d >>= 1) + { + in += __shfl_xor_sync(HYPRE_WARP_FULL_MASK, in, d); + } + return in; +} - case CUBLAS_STATUS_MAPPING_ERROR: - return "CUBLAS_STATUS_MAPPING_ERROR"; +template +static __device__ __forceinline__ +T warp_reduce_max(T in) +{ +#pragma unroll + for (hypre_int d = 16; d > 0; d >>= 1) + { + in = max(in, __shfl_down_sync(HYPRE_WARP_FULL_MASK, in, d)); + } + return in; +} - case CUBLAS_STATUS_EXECUTION_FAILED: - return "CUBLAS_STATUS_EXECUTION_FAILED"; +template +static __device__ __forceinline__ +T warp_allreduce_max(T in) +{ +#pragma unroll + for (hypre_int d = 16; d > 0; d >>= 1) + { + in = max(in, __shfl_xor_sync(HYPRE_WARP_FULL_MASK, in, d)); + } + return in; +} - case CUBLAS_STATUS_INTERNAL_ERROR: - return "CUBLAS_STATUS_INTERNAL_ERROR"; +template +static __device__ __forceinline__ +T warp_reduce_min(T in) +{ +#pragma unroll + for (hypre_int d = 16; d > 0; d >>= 1) + { + in = min(in, __shfl_down_sync(HYPRE_WARP_FULL_MASK, in, d)); + } + return in; +} - case CUBLAS_STATUS_NOT_SUPPORTED: - return "CUBLAS_STATUS_NOT_SUPPORTED"; - case CUBLAS_STATUS_LICENSE_ERROR: - return "CUBLAS_STATUS_LICENSE_ERROR"; - default: - return "Unknown error in cublasErrorCheck"; - } +template +static __device__ __forceinline__ +T warp_allreduce_min(T in) +{ +#pragma unroll + for (hypre_int d = 16; d > 0; d >>= 1) + { + in = min(in, __shfl_xor_sync(HYPRE_WARP_FULL_MASK, in, d)); + } + return in; } -#define cusparseErrchk(ans) { cusparseAssert((ans), __FILE__, __LINE__); } -inline void cusparseAssert(cusparseStatus_t code, const char *file, int line) +static __device__ __forceinline__ +hypre_int next_power_of_2(hypre_int n) { - if (code != CUSPARSE_STATUS_SUCCESS) + if (n <= 0) + { + return 0; + } + + /* if n is power of 2, return itself */ + if ( (n & (n - 1)) == 0 ) { - fprintf(stderr,"CUSPARSE ERROR ( Code = %d) IN CUDA CALL line %d of file %s\n",code,line,file); - fprintf(stderr,"CUSPARSE ERROR : %s \n", cusparseErrorCheck(code)); + return n; } + + n |= (n >> 1); + n |= (n >> 2); + n |= (n >> 4); + n |= (n >> 8); + n |= (n >> 16); + n ^= (n >> 1); + n = (n << 1); + + return n; } -#define cublasErrchk(ans){ cublasAssert((ans), __FILE__, __LINE__); } -inline void cublasAssert(cublasStatus_t code, const char *file, int line) +template +struct absolute_value : public thrust::unary_function +{ + __host__ __device__ T operator()(const T &x) const + { + return x < T(0) ? -x : x; + } +}; + + +template +struct TupleComp1 +{ + typedef thrust::tuple Tuple; + + __host__ __device__ bool operator()(const Tuple& t1, const Tuple& t2) + { + if (thrust::get<0>(t1) < thrust::get<0>(t2)) + { + return true; + } + if (thrust::get<0>(t1) > thrust::get<0>(t2)) + { + return false; + } + return thrust::get<1>(t1) < thrust::get<1>(t2); + } +}; + + +template +struct TupleComp2 { - if (code != CUBLAS_STATUS_SUCCESS) + typedef thrust::tuple Tuple; + + __host__ __device__ bool operator()(const Tuple& t1, const Tuple& t2) { - fprintf(stderr,"CUBLAS ERROR ( Code = %d) IN CUDA CALL line %d of file %s\n",code,line,file); - fprintf(stderr,"CUBLAS ERROR : %s \n", cublasErrorCheck(code)); + if (thrust::get<0>(t1) < thrust::get<0>(t2)) + { + return true; + } + if (thrust::get<0>(t1) > thrust::get<0>(t2)) + { + return false; + } + return hypre_abs(thrust::get<1>(t1)) > hypre_abs(thrust::get<1>(t2)); } +}; + +#endif // #if defined(HYPRE_USING_CUDA) + +#ifdef __cplusplus } +#endif + +struct is_negative +{ + __host__ __device__ bool operator()(const HYPRE_Int &x) + { + return (x < 0); + } +}; + +struct is_nonnegative +{ + __host__ __device__ bool operator()(const HYPRE_Int &x) + { + return (x >= 0); + } +}; + +struct in_range +{ + HYPRE_Int low, up; -#endif // __cusparseErrorCheck__ + in_range(HYPRE_Int low_, HYPRE_Int up_) { low = low_; up = up_; } -#endif // #if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + __host__ __device__ bool operator()(const HYPRE_Int &x) + { + return (x >= low && x <= up); + } +}; -#endif // hypre_GPU_ERROR_HEADER +struct out_of_range +{ + HYPRE_Int low, up; + + out_of_range(HYPRE_Int low_, HYPRE_Int up_) { low = low_; up = up_; } + + __host__ __device__ bool operator()(const HYPRE_Int &x) + { + return (x < low || x > up); + } +}; + +struct less_than +{ + HYPRE_Int val; + + less_than(HYPRE_Int val_) { val = val_; } + + __host__ __device__ bool operator()(const HYPRE_Int &x) + { + return (x < val); + } +}; -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ -#ifndef __GPUMEM_H__ -#define __GPUMEM_H__ #if defined(HYPRE_USING_CUDA) +/* for struct solvers */ #define HYPRE_MIN_GPU_SIZE (131072) extern HYPRE_Int hypre_exec_policy; #define hypre_SetDeviceOn() hypre_exec_policy = HYPRE_MEMORY_DEVICE #define hypre_SetDeviceOff() hypre_exec_policy = HYPRE_MEMORY_HOST -#endif /* #if defined(HYPRE_USING_CUDA) */ +#endif -#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) +#endif /* HYPRE_USING_CUDA */ +#endif /* #ifndef HYPRE_CUDA_UTILS_H */ -#define HYPRE_USE_MANAGED_SCALABLE 1 -#define HYPRE_GPU_USE_PINNED 1 +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ -#include -void hypre_GPUInit(hypre_int use_device); -void hypre_GPUFinalize(); -int VecScaleScalar(double *u, const double alpha, int num_rows,cudaStream_t s); -void VecCopy(double* tgt, const double* src, int size,cudaStream_t s); -void VecSet(double* tgt, int size, double value, cudaStream_t s); -void VecScale(double *u, double *v, double *l1_norm, int num_rows,cudaStream_t s); -void VecScaleSplit(double *u, double *v, double *l1_norm, int num_rows,cudaStream_t s); -void CudaCompileFlagCheck(); -void BigToSmallCopy (hypre_int* tgt, const HYPRE_Int *src, hypre_int size, cudaStream_t s); -cudaStream_t getstreamOlde(hypre_int i); -nvtxDomainHandle_t getdomain(hypre_int i); -cudaEvent_t getevent(hypre_int i); -void MemAdviseReadOnly(const void *ptr, hypre_int device); -void MemAdviseUnSetReadOnly(const void *ptr, hypre_int device); -void MemAdviseSetPrefLocDevice(const void *ptr, hypre_int device); -void MemAdviseSetPrefLocHost(const void *ptr); -void MemPrefetch(const void *ptr,hypre_int device,cudaStream_t stream); -void MemPrefetchSized(const void *ptr,size_t size,hypre_int device,cudaStream_t stream); -void MemPrefetchForce(const void *ptr,hypre_int device,cudaStream_t stream); -cublasHandle_t getCublasHandle(); -cusparseHandle_t getCusparseHandle(); -hypre_int getsetasyncmode(hypre_int mode, hypre_int action); -void SetAsyncMode(hypre_int mode); -hypre_int GetAsyncMode(); -void branchStream(hypre_int i, hypre_int j); -void joinStreams(hypre_int i, hypre_int j, hypre_int k); -void affs(hypre_int myid); -hypre_int getcore(); -hypre_int getnuma(); -hypre_int checkDeviceProps(); -hypre_int pointerIsManaged(const void *ptr); +/****************************************************************************** + * + * General structures and values + * + *****************************************************************************/ -/* - * Global struct for keeping HYPRE GPU Init state - */ +#ifndef HYPRE_HANDLE_H +#define HYPRE_HANDLE_H -#define MAX_HGS_ELEMENTS 10 -struct hypre__global_struct +#ifdef __cplusplus +extern "C++" { +#endif + +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) +#include +#endif + +typedef struct { - hypre_int initd; - hypre_int device; - hypre_int device_count; - size_t memoryHWM; + HYPRE_Int hypre_error; +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) + HYPRE_Int default_exec_policy; + HYPRE_Int cuda_device; + /* by default, hypre puts GPU computations in this stream + * Do not be confused with the default (null) CUDA stream */ + HYPRE_Int cuda_compute_stream_num; + HYPRE_Int cuda_prefetch_stream_num; + HYPRE_Int cuda_compute_stream_sync_default; + std::vector cuda_compute_stream_sync; + curandGenerator_t curand_gen; cublasHandle_t cublas_handle; cusparseHandle_t cusparse_handle; cusparseMatDescr_t cusparse_mat_descr; - cudaStream_t streams[MAX_HGS_ELEMENTS]; - nvtxDomainHandle_t nvtx_domain; - hypre_int concurrent_managed_access; -}; + cudaStream_t cuda_streams[HYPRE_MAX_NUM_STREAMS]; + /* work space for hypre's CUDA reducer */ + void* cuda_reduce_buffer; + /* device spgemm options */ + HYPRE_Int spgemm_use_cusparse; + HYPRE_Int spgemm_num_passes; + HYPRE_Int spgemm_rownnz_estimate_method; + HYPRE_Int spgemm_rownnz_estimate_nsamples; + float spgemm_rownnz_estimate_mult_factor; + char spgemm_hash_type; +#endif +} hypre_Handle; -extern struct hypre__global_struct hypre__global_handle ; +extern hypre_Handle *hypre_handle; -/* - * Macros for accessing elements of the global handle - */ +hypre_Handle* hypre_HandleCreate(); +HYPRE_Int hypre_HandleDestroy(hypre_Handle *hypre_handle_); -#define HYPRE_DOMAIN hypre__global_handle.nvtx_domain -#define HYPRE_STREAM(index) (hypre__global_handle.streams[index]) -#define HYPRE_GPU_HANDLE hypre__global_handle.initd -#define HYPRE_CUBLAS_HANDLE hypre__global_handle.cublas_handle -#define HYPRE_CUSPARSE_HANDLE hypre__global_handle.cusparse_handle -#define HYPRE_DEVICE hypre__global_handle.device -#define HYPRE_DEVICE_COUNT hypre__global_handle.device_count -#define HYPRE_CUSPARSE_MAT_DESCR hypre__global_handle.cusparse_mat_descr -#define HYPRE_GPU_CMA hypre__global_handle.concurrent_managed_access -#define HYPRE_GPU_HWM hypre__global_handle.memoryHWM - - -typedef struct node { - const void *ptr; - size_t size; - struct node *next; -} node; -size_t mempush(const void *ptr, size_t size, hypre_int action); -node *memfind(node *head, const void *ptr); -void memdel(node **head, node *found); -void meminsert(node **head, const void *ptr,size_t size); -void printlist(node *head,hypre_int nc); -size_t memsize(const void *ptr); +/* accessor inline function to hypre_device_csr_handle */ -#endif /* #if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) */ +#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) +static inline HYPRE_Int & +hypre_HandleDefaultExecPolicy(hypre_Handle *hypre_handle_) +{ + return hypre_handle_->default_exec_policy; +} +static inline HYPRE_Int & +hypre_HandleCudaDevice(hypre_Handle *hypre_handle_) +{ + return hypre_handle_->cuda_device; +} -#if defined(HYPRE_USING_DEVICE_OPENMP) -HYPRE_Int HYPRE_OMPOffload(HYPRE_Int device, void *ptr, size_t num, - const char *type1, const char *type2); +static inline HYPRE_Int & +hypre_HandleCudaComputeStreamNum(hypre_Handle *hypre_handle_) +{ + return hypre_handle_->cuda_compute_stream_num; +} -HYPRE_Int HYPRE_OMPPtrIsMapped(void *p, HYPRE_Int device_num); +static inline HYPRE_Int & +hypre_HandleCudaPrefetchStreamNum(hypre_Handle *hypre_handle_) +{ + return hypre_handle_->cuda_prefetch_stream_num; +} -HYPRE_Int HYPRE_OMPOffloadOn(); +static inline HYPRE_Int & +hypre_HandleCudaComputeStreamSyncDefault(hypre_Handle *hypre_handle_) +{ + return hypre_handle_->cuda_compute_stream_sync_default; +} -HYPRE_Int HYPRE_OMPOffloadOff(); +static inline std::vector & +hypre_HandleCudaComputeStreamSync(hypre_Handle *hypre_handle_) +{ + return hypre_handle_->cuda_compute_stream_sync; +} -HYPRE_Int HYPRE_OMPOffloadStatPrint(); +static inline cudaStream_t +hypre_HandleCudaStream(hypre_Handle *hypre_handle_, HYPRE_Int i) +{ + cudaStream_t stream = 0; +#if defined(HYPRE_USING_CUDA_STREAMS) + if (i >= HYPRE_MAX_NUM_STREAMS) + { + /* return the default stream, i.e., the NULL stream */ + /* + hypre_printf("CUDA stream %d exceeds the max number %d\n", + i, HYPRE_MAX_NUM_STREAMS); + */ + return NULL; + } -#define HYPRE_MIN_GPU_SIZE (131072) + if (hypre_handle_->cuda_streams[i]) + { + return hypre_handle_->cuda_streams[i]; + } -#define hypre_SetDeviceOn() HYPRE_OMPOffloadOn() -#define hypre_SetDeviceOff() HYPRE_OMPOffloadOff() + //HYPRE_CUDA_CALL(cudaStreamCreateWithFlags(&stream,cudaStreamNonBlocking)); + HYPRE_CUDA_CALL(cudaStreamCreateWithFlags(&stream, cudaStreamDefault)); -#endif /* #if defined(HYPRE_USING_DEVICE_OPENMP) */ + hypre_handle_->cuda_streams[i] = stream; +#endif -#endif/* __GPUMEM_H__ */ + return stream; +} -#if !defined(HYPRE_USING_RAJA) && !defined(HYPRE_USING_KOKKOS) && defined(HYPRE_USING_CUDA) +static inline cudaStream_t +hypre_HandleCudaComputeStream(hypre_Handle *hypre_handle_) +{ + return hypre_HandleCudaStream(hypre_handle_, + hypre_HandleCudaComputeStreamNum(hypre_handle_)); +} -#ifndef CUDART_VERSION -#error CUDART_VERSION Undefined! -#elif (CUDART_VERSION >= 9000) -#define WARP_SHFL_DOWN(mask, var, delta) __shfl_down_sync(mask, var, delta) -#elif (CUDART_VERSION <= 8000) -#define WARP_SHFL_DOWN(mask, var, delta) __shfl_down(var, delta); +static inline cudaStream_t +hypre_HandleCudaPrefetchStream(hypre_Handle *hypre_handle_) +{ + return hypre_HandleCudaStream(hypre_handle_, + hypre_HandleCudaPrefetchStreamNum(hypre_handle_)); +} + +static inline curandGenerator_t +hypre_HandleCurandGenerator(hypre_Handle *hypre_handle_) +{ + if (hypre_handle_->curand_gen) + { + return hypre_handle_->curand_gen; + } + + curandGenerator_t gen; + HYPRE_CURAND_CALL( curandCreateGenerator(&gen, CURAND_RNG_PSEUDO_DEFAULT) ); + HYPRE_CURAND_CALL( curandSetPseudoRandomGeneratorSeed(gen, 1234ULL) ); + HYPRE_CURAND_CALL( curandSetStream(gen, hypre_HandleCudaComputeStream(hypre_handle_)) ); + + hypre_handle_->curand_gen = gen; + + return gen; +} + +static inline cublasHandle_t +hypre_HandleCublasHandle(hypre_Handle *hypre_handle_) +{ + if (hypre_handle_->cublas_handle) + { + return hypre_handle_->cublas_handle; + } + + cublasHandle_t handle; + HYPRE_CUBLAS_CALL( cublasCreate(&handle) ); + + HYPRE_CUBLAS_CALL( cublasSetStream(handle, hypre_HandleCudaComputeStream(hypre_handle_)) ); + + hypre_handle_->cublas_handle = handle; + + return handle; +} + +static inline cusparseHandle_t +hypre_HandleCusparseHandle(hypre_Handle *hypre_handle_) +{ + if (hypre_handle_->cusparse_handle) + { + return hypre_handle_->cusparse_handle; + } + + cusparseHandle_t handle; + HYPRE_CUSPARSE_CALL( cusparseCreate(&handle) ); + + HYPRE_CUSPARSE_CALL( cusparseSetStream(handle, hypre_HandleCudaComputeStream(hypre_handle_)) ); + + hypre_handle_->cusparse_handle = handle; + + return handle; +} + +static inline cusparseMatDescr_t +hypre_HandleCusparseMatDescr(hypre_Handle *hypre_handle_) +{ + if (hypre_handle_->cusparse_mat_descr) + { + return hypre_handle_->cusparse_mat_descr; + } + + cusparseMatDescr_t mat_descr; + HYPRE_CUSPARSE_CALL( cusparseCreateMatDescr(&mat_descr) ); + HYPRE_CUSPARSE_CALL( cusparseSetMatType(mat_descr, CUSPARSE_MATRIX_TYPE_GENERAL) ); + HYPRE_CUSPARSE_CALL( cusparseSetMatIndexBase(mat_descr, CUSPARSE_INDEX_BASE_ZERO) ); + + hypre_handle_->cusparse_mat_descr = mat_descr; + + return mat_descr; +} + +#endif /* defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_DEVICE_OPENMP) */ + +static inline void +hypre_HandleCudaComputeStreamSyncPush(hypre_Handle *hypre_handle_, HYPRE_Int sync) +{ +#if defined(HYPRE_USING_CUDA) && defined(HYPRE_USING_UNIFIED_MEMORY) + hypre_HandleCudaComputeStreamSync(hypre_handle_).push_back(sync); #endif +} -extern "C++" { +static inline void +hypre_HandleCudaComputeStreamSyncPop(hypre_Handle *hypre_handle_) +{ +#if defined(HYPRE_USING_CUDA) && defined(HYPRE_USING_UNIFIED_MEMORY) + hypre_HandleCudaComputeStreamSync(hypre_handle_).pop_back(); +#endif +} + +/* synchronize the default stream */ +static inline HYPRE_Int +hypre_SyncCudaComputeStream(hypre_Handle *hypre_handle_) +{ +#if defined(HYPRE_USING_UNIFIED_MEMORY) +#if defined(HYPRE_USING_CUDA) + assert(!hypre_HandleCudaComputeStreamSync(hypre_handle_).empty()); -extern void *cuda_reduce_buffer; + if ( hypre_HandleCudaComputeStreamSync(hypre_handle_).back() ) + { + HYPRE_CUDA_CALL( cudaStreamSynchronize(hypre_HandleCudaComputeStream(hypre_handle_)) ); + } +#endif +#if defined(HYPRE_USING_DEVICE_OPENMP) + HYPRE_CUDA_CALL( cudaDeviceSynchronize() ); +#endif +#endif /* #if defined(HYPRE_USING_UNIFIED_MEMORY) */ + return hypre_error_flag; +} + +#ifdef __cplusplus +} +#endif + +#endif + +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +#ifndef HYPRE_NVTX_H +#define HYPRE_NVTX_H + +#ifdef HYPRE_USING_NVTX + +#include "nvToolsExt.h" +#include "nvToolsExtCudaRt.h" + +static const uint32_t colors[] = { 0x0000ff00, 0x000000ff, 0x00ffff00, 0x00ff00ff, 0x0000ffff, 0x00ff0000, 0x00ffffff }; +static const hypre_int num_colors = sizeof(colors)/sizeof(uint32_t); + +#define PUSH_RANGE(name,cid) { \ + hypre_int color_id = cid; \ + color_id = color_id%num_colors;\ + nvtxEventAttributes_t eventAttrib = {0}; \ + eventAttrib.version = NVTX_VERSION; \ + eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; \ + eventAttrib.colorType = NVTX_COLOR_ARGB; \ + eventAttrib.color = colors[color_id]; \ + eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; \ + eventAttrib.message.ascii = name; \ + nvtxRangePushEx(&eventAttrib); \ +} + +#define POP_RANGE nvtxRangePop(); + +#else /* HYPRE_USING_NVTX */ + +#define PUSH_RANGE(name,cid) +#define POP_RANGE + +#endif /* HYPRE_USING_NVTX */ + +#endif /* HYPRE_NVTX_H */ +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. + * + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ + +/* CUDA reducer class */ + +#ifndef HYPRE_CUDA_REDUCER_H +#define HYPRE_CUDA_REDUCER_H + +#if defined(HYPRE_USING_CUDA) +#if !defined(HYPRE_USING_RAJA) && !defined(HYPRE_USING_KOKKOS) + +#ifdef __cplusplus +extern "C++" { +#endif template void OneBlockReduce(T *d_arr, HYPRE_Int N, T *h_out); @@ -1590,7 +2041,7 @@ #ifdef __CUDA_ARCH__ for (HYPRE_Int offset = warpSize/2; offset > 0; offset /= 2) { - val += WARP_SHFL_DOWN(0xFFFFFFFF, val, offset); + val += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val, offset); } #endif return val; @@ -1601,10 +2052,10 @@ #ifdef __CUDA_ARCH__ for (HYPRE_Int offset = warpSize / 2; offset > 0; offset /= 2) { - val.x += WARP_SHFL_DOWN(0xFFFFFFFF, val.x, offset); - val.y += WARP_SHFL_DOWN(0xFFFFFFFF, val.y, offset); - val.z += WARP_SHFL_DOWN(0xFFFFFFFF, val.z, offset); - val.w += WARP_SHFL_DOWN(0xFFFFFFFF, val.w, offset); + val.x += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.x, offset); + val.y += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.y, offset); + val.z += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.z, offset); + val.w += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.w, offset); } #endif return val; @@ -1615,12 +2066,12 @@ #ifdef __CUDA_ARCH__ for (HYPRE_Int offset = warpSize / 2; offset > 0; offset /= 2) { - val.x += WARP_SHFL_DOWN(0xFFFFFFFF, val.x, offset); - val.y += WARP_SHFL_DOWN(0xFFFFFFFF, val.y, offset); - val.z += WARP_SHFL_DOWN(0xFFFFFFFF, val.z, offset); - val.w += WARP_SHFL_DOWN(0xFFFFFFFF, val.w, offset); - val.u += WARP_SHFL_DOWN(0xFFFFFFFF, val.u, offset); - val.v += WARP_SHFL_DOWN(0xFFFFFFFF, val.v, offset); + val.x += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.x, offset); + val.y += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.y, offset); + val.z += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.z, offset); + val.w += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.w, offset); + val.u += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.u, offset); + val.v += __shfl_down_sync(HYPRE_WARP_FULL_MASK, val.v, offset); } #endif return val; @@ -1634,8 +2085,10 @@ #ifdef __CUDA_ARCH__ //static __shared__ T shared[32]; // Shared mem for 32 partial sums __shared__ T shared[32]; // Shared mem for 32 partial sums - HYPRE_Int lane = threadIdx.x % warpSize; - HYPRE_Int wid = threadIdx.x / warpSize; + //HYPRE_Int lane = threadIdx.x % warpSize; + //HYPRE_Int wid = threadIdx.x / warpSize; + HYPRE_Int lane = threadIdx.x & (warpSize - 1); + HYPRE_Int wid = threadIdx.x >> 5; val = warpReduceSum(val); // Each warp performs partial reduction @@ -1665,6 +2118,23 @@ return val; } +template +__global__ void +OneBlockReduceKernel(T *arr, HYPRE_Int N) +{ + T sum; + sum = 0.0; + if (threadIdx.x < N) + { + sum = arr[threadIdx.x]; + } + sum = blockReduceSum(sum); + if (threadIdx.x == 0) + { + arr[0] = sum; + } +} + /* Reducer class */ template struct ReduceSum @@ -1672,24 +2142,27 @@ T init; /* initial value passed in */ mutable T __thread_sum; /* place to hold local sum of a thread, and partial sum of a block */ - T *d_buf; /* place to store partial sum of a block */ - HYPRE_Int nblocks; /* number of blocks used in the first round */ + T *d_buf; /* place to store partial sum within blocks + in the 1st round, used in the 2nd round */ + HYPRE_Int nblocks; /* number of blocks used in the 1st round */ - /* constructor. + /* constructor * val is the initial value (added to the reduced sum) */ __host__ ReduceSum(T val) { init = val; __thread_sum = 0.0; + nblocks = -1; - if (cuda_reduce_buffer == NULL) + if (hypre_handle->cuda_reduce_buffer == NULL) { /* allocate for the max size for reducing double6 type */ - cuda_reduce_buffer = hypre_TAlloc(HYPRE_double6, 1024, HYPRE_MEMORY_DEVICE); + hypre_handle->cuda_reduce_buffer = + hypre_TAlloc(HYPRE_double6, 1024, HYPRE_MEMORY_DEVICE); } - d_buf = (T*) cuda_reduce_buffer; + d_buf = (T*) hypre_handle->cuda_reduce_buffer; } /* copy constructor */ @@ -1699,6 +2172,7 @@ *this = other; } + /* reduction within blocks */ __host__ __device__ void BlockReduce() const { @@ -1717,16 +2191,18 @@ __thread_sum += val; } - /* we invoke the 2nd reduction at the time we want the sum from the reducer - * class */ + /* invoke the 2nd reduction at the time want the sum from the reducer */ __host__ operator T() { T val; /* 2nd reduction with only *one* block */ - OneBlockReduce(d_buf, nblocks, &val); + assert(nblocks >= 0 && nblocks <= 1024); + const dim3 gDim(1), bDim(1024); + HYPRE_CUDA_LAUNCH( OneBlockReduceKernel, gDim, bDim, d_buf, nblocks ); + hypre_TMemcpy(&val, d_buf, T, 1, HYPRE_MEMORY_HOST, HYPRE_MEMORY_DEVICE); val += init; - //hypre_TFree(d_buf, HYPRE_MEMORY_DEVICE); + return val; } @@ -1737,21 +2213,20 @@ } }; -} // extern "C++" - +#ifdef __cplusplus +} #endif -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +#endif /* #if !defined(HYPRE_USING_RAJA) && !defined(HYPRE_USING_KOKKOS) */ +#endif /* #if defined(HYPRE_USING_CUDA) */ +#endif /* #ifndef HYPRE_CUDA_REDUCER_H */ + +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* amg_linklist.c */ void hypre_dispose_elt ( hypre_LinkList element_ptr ); @@ -1761,7 +2236,7 @@ /* binsearch.c */ HYPRE_Int hypre_BinarySearch ( HYPRE_Int *list , HYPRE_Int value , HYPRE_Int list_length ); -HYPRE_Int hypre_BigBinarySearch ( HYPRE_BigInt *list , HYPRE_BigInt value , HYPRE_Int list_length ); +HYPRE_Int hypre_BigBinarySearch(HYPRE_BigInt *list, HYPRE_BigInt value, HYPRE_Int list_length); HYPRE_Int hypre_BinarySearch2 ( HYPRE_Int *list , HYPRE_Int value , HYPRE_Int low , HYPRE_Int high , HYPRE_Int *spot ); HYPRE_Int *hypre_LowerBound( HYPRE_Int *first, HYPRE_Int *last, HYPRE_Int value ); HYPRE_BigInt *hypre_BigLowerBound( HYPRE_BigInt *first, HYPRE_BigInt *last, HYPRE_BigInt value ); @@ -1780,11 +2255,18 @@ #endif /* hypre_general.c */ -void HYPRE_Init( hypre_int argc, char *argv[] ); -void HYPRE_Finalize(); +HYPRE_Int HYPRE_Init( hypre_int argc, char *argv[] ); +HYPRE_Int HYPRE_Finalize(); +HYPRE_Int hypre_GetDevice(hypre_Handle *hypre_handle); +HYPRE_Int hypre_SetDevice(HYPRE_Int use_device, hypre_Handle *hypre_handle); +HYPRE_Int hypre_SyncCudaDefaultStream(hypre_Handle *hypre_handle); +void hypre_SetExecPolicy( HYPRE_Int policy ); +HYPRE_Int hypre_GetExecPolicy1(HYPRE_Int location); +HYPRE_Int hypre_GetExecPolicy2(HYPRE_Int location1, HYPRE_Int location2); /* hypre_printf.c */ // #ifdef HYPRE_BIGINT +HYPRE_Int hypre_ndigits( HYPRE_BigInt number ); HYPRE_Int hypre_printf( const char *format , ... ); HYPRE_Int hypre_fprintf( FILE *stream , const char *format, ... ); HYPRE_Int hypre_sprintf( char *s , const char *format, ... ); @@ -1814,6 +2296,7 @@ void hypre_BigQsort1 ( HYPRE_BigInt *v , HYPRE_Real *w , HYPRE_Int left , HYPRE_Int right ); void hypre_qsort2i ( HYPRE_Int *v , HYPRE_Int *w , HYPRE_Int left , HYPRE_Int right ); void hypre_qsort2 ( HYPRE_Int *v , HYPRE_Real *w , HYPRE_Int left , HYPRE_Int right ); +void hypre_qsort2abs( HYPRE_Int *v, HYPRE_Real *w, HYPRE_Int left, HYPRE_Int right ); void hypre_qsort3i ( HYPRE_Int *v , HYPRE_Int *w , HYPRE_Int *z , HYPRE_Int left , HYPRE_Int right ); void hypre_qsort3_abs ( HYPRE_Real *v , HYPRE_Int *w , HYPRE_Int *z , HYPRE_Int left , HYPRE_Int right ); void hypre_BigQsort4_abs ( HYPRE_Real *v , HYPRE_BigInt *w , HYPRE_Int *z , HYPRE_Int *y , HYPRE_Int left , HYPRE_Int right ); @@ -1826,6 +2309,8 @@ void hypre_BigQsortb2i( HYPRE_BigInt *v, HYPRE_Int *w, HYPRE_Int *z, HYPRE_Int left, HYPRE_Int right ); void hypre_BigSwap( HYPRE_BigInt *v, HYPRE_Int i, HYPRE_Int j ); void hypre_BigQsort0( HYPRE_BigInt *v, HYPRE_Int left, HYPRE_Int right ); +void hypre_topo_sort(const HYPRE_Int *row_ptr, const HYPRE_Int *col_inds, const HYPRE_Complex *data, HYPRE_Int *ordering, HYPRE_Int n); +void hypre_dense_topo_sort(const HYPRE_Complex *L, HYPRE_Int *ordering, HYPRE_Int n, HYPRE_Int is_col_major); /* qsplit.c */ HYPRE_Int hypre_DoubleQuickSplit ( HYPRE_Real *values , HYPRE_Int *indices , HYPRE_Int list_length , HYPRE_Int NumberKept ); @@ -1902,7 +2387,7 @@ /* Check if atomic operations are available to use concurrent hopscotch hash table */ #if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 -#define HYPRE_USING_ATOMIC +#define HYPRE_USING_ATOMIC //#elif defined _MSC_VER // JSP: haven't tested, so comment out for now //#define HYPRE_USING_ATOMIC //#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_ATOMICS__) @@ -1916,9 +2401,9 @@ #ifdef HYPRE_HOPSCOTCH #ifdef HYPRE_USING_ATOMIC // concurrent hopscotch hashing is possible only with atomic supports -#define HYPRE_CONCURRENT_HOPSCOTCH -#endif -#endif +#define HYPRE_CONCURRENT_HOPSCOTCH +#endif +#endif #ifdef HYPRE_CONCURRENT_HOPSCOTCH typedef struct { @@ -1946,7 +2431,7 @@ #endif HYPRE_Int *volatile key; hypre_uint *volatile hopInfo; - HYPRE_Int *volatile hash; + HYPRE_Int *volatile hash; } hypre_UnorderedIntSet; typedef struct @@ -1985,22 +2470,22 @@ */ typedef struct { - HYPRE_Int volatile segmentMask; - HYPRE_Int volatile bucketMask; + HYPRE_Int volatile segmentMask; + HYPRE_Int volatile bucketMask; #ifdef HYPRE_CONCURRENT_HOPSCOTCH - hypre_HopscotchSegment* volatile segments; + hypre_HopscotchSegment* volatile segments; #endif - hypre_HopscotchBucket* volatile table; + hypre_HopscotchBucket* volatile table; } hypre_UnorderedIntMap; typedef struct { - HYPRE_Int volatile segmentMask; - HYPRE_Int volatile bucketMask; + HYPRE_Int volatile segmentMask; + HYPRE_Int volatile bucketMask; #ifdef HYPRE_CONCURRENT_HOPSCOTCH - hypre_HopscotchSegment* volatile segments; + hypre_HopscotchSegment* volatile segments; #endif - hypre_BigHopscotchBucket* volatile table; + hypre_BigHopscotchBucket* volatile table; } hypre_UnorderedBigIntMap; /** @@ -2010,10 +2495,60 @@ */ void hypre_sort_and_create_inverse_map( HYPRE_Int *in, HYPRE_Int len, HYPRE_Int **out, hypre_UnorderedIntMap *inverse_map); + #ifdef HYPRE_CONCURRENT_HOPSCOTCH void hypre_big_merge_sort(HYPRE_BigInt *in, HYPRE_BigInt *temp, HYPRE_Int len, HYPRE_BigInt **sorted); -void hypre_big_sort_and_create_inverse_map( - HYPRE_BigInt *in, HYPRE_Int len, HYPRE_BigInt **out, hypre_UnorderedBigIntMap *inverse_map); +void hypre_big_sort_and_create_inverse_map(HYPRE_BigInt *in, HYPRE_Int len, HYPRE_BigInt **out, hypre_UnorderedBigIntMap *inverse_map); +#endif + + +/* hypre_cuda_utils.c */ +#if defined(HYPRE_USING_CUDA) +#ifdef __cplusplus +extern "C++" { +#endif +dim3 hypre_GetDefaultCUDABlockDimension(); + +dim3 hypre_GetDefaultCUDAGridDimension( HYPRE_Int n, const char *granularity, dim3 bDim ); + +template HYPRE_Int hypreDevice_StableSortByTupleKey(HYPRE_Int N, T1 *keys1, T2 *keys2, T3 *vals, HYPRE_Int opt); + +#ifdef __cplusplus +} +#endif + +HYPRE_Int hypreDevice_GetRowNnz(HYPRE_Int nrows, HYPRE_Int *d_row_indices, HYPRE_Int *d_diag_ia, HYPRE_Int *d_offd_ia, HYPRE_Int *d_rownnz); + +HYPRE_Int hypreDevice_CopyParCSRRows(HYPRE_Int nrows, HYPRE_Int *d_row_indices, HYPRE_Int job, HYPRE_Int has_offd, HYPRE_Int first_col, HYPRE_Int *d_col_map_offd_A, HYPRE_Int *d_diag_i, HYPRE_Int *d_diag_j, HYPRE_Complex *d_diag_a, HYPRE_Int *d_offd_i, HYPRE_Int *d_offd_j, HYPRE_Complex *d_offd_a, HYPRE_Int *d_ib, HYPRE_BigInt *d_jb, HYPRE_Complex *d_ab); + +HYPRE_Int hypreDevice_IntegerReduceSum(HYPRE_Int m, HYPRE_Int *d_i); + +HYPRE_Int hypreDevice_IntegerInclusiveScan(HYPRE_Int n, HYPRE_Int *d_i); + +HYPRE_Int hypreDevice_IntegerExclusiveScan(HYPRE_Int n, HYPRE_Int *d_i); + +HYPRE_Int* hypreDevice_CsrRowPtrsToIndices(HYPRE_Int nrows, HYPRE_Int nnz, HYPRE_Int *d_row_ptr); + +HYPRE_Int hypreDevice_CsrRowPtrsToIndices_v2(HYPRE_Int nrows, HYPRE_Int *d_row_ptr, HYPRE_Int *d_row_ind); + +HYPRE_Int hypreDevice_CsrRowPtrsToIndicesWithRowNum(HYPRE_Int nrows, HYPRE_Int *d_row_ptr, HYPRE_Int *d_row_num, HYPRE_Int *d_row_ind); + +HYPRE_Int* hypreDevice_CsrRowIndicesToPtrs(HYPRE_Int nrows, HYPRE_Int nnz, HYPRE_Int *d_row_ind); + +HYPRE_Int hypreDevice_CsrRowIndicesToPtrs_v2(HYPRE_Int nrows, HYPRE_Int nnz, HYPRE_Int *d_row_ind, HYPRE_Int *d_row_ptr); + +HYPRE_Int hypreDevice_GenScatterAdd(HYPRE_Real *x, HYPRE_Int ny, HYPRE_Int *map, HYPRE_Real *y); + +HYPRE_Int hypreDevice_ScatterConstant(HYPRE_Int *x, HYPRE_Int n, HYPRE_Int *map, HYPRE_Int v); + +HYPRE_Int hypreDevice_IVAXPY(HYPRE_Int n, HYPRE_Complex *a, HYPRE_Complex *x, HYPRE_Complex *y); + +HYPRE_Int hypreDevice_DiagScaleVector(HYPRE_Int n, HYPRE_Int *A_i, HYPRE_Complex *A_data, HYPRE_Complex *x, HYPRE_Complex *y); + +HYPRE_Int hypreDevice_BigToSmallCopy(HYPRE_Int *tgt, const HYPRE_BigInt *src, HYPRE_Int size); + +void hypre_CudaCompileFlagCheck(); + #endif diff -Nru hypre-2.16.0/src/utilities/HYPRE_utilities.h hypre-2.18.2/src/utilities/HYPRE_utilities.h --- hypre-2.16.0/src/utilities/HYPRE_utilities.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/HYPRE_utilities.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/utilities/HYPRE_version.c hypre-2.18.2/src/utilities/HYPRE_version.c --- hypre-2.16.0/src/utilities/HYPRE_version.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/HYPRE_version.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/utilities/Makefile hypre-2.18.2/src/utilities/Makefile --- hypre-2.16.0/src/utilities/Makefile 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/Makefile 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) include ../config/Makefile.config @@ -28,7 +21,7 @@ exchange_data.h\ fortran.h\ fortran_matrix.h\ - general.h\ + hypre_general.h\ hypre_memory.h\ HYPRE_utilities.h\ mpistubs.h\ @@ -37,6 +30,7 @@ _hypre_utilities.h FILES =\ + F90_HYPRE_error.c\ HYPRE_version.c\ amg_linklist.c\ binsearch.c\ @@ -44,7 +38,15 @@ fortran_matrix.c\ hypre_ap.c\ hypre_complex.c\ + hypre_cuda_utils.c\ + hypre_error.c\ + hypre_general.c\ + hypre_hopscotch_hash.c\ hypre_memory.c\ + hypre_merge_sort.c\ + hypre_mpi_comm_f2c.c\ + hypre_omp_device.c\ + hypre_prefix_sum.c\ hypre_printf.c\ hypre_qsort.c\ mpistubs.c\ @@ -52,17 +54,7 @@ random.c\ threading.c\ timer.c\ - timing.c\ - hypre_mpi_comm_f2c.c\ - hypre_error.c\ - F90_HYPRE_error.c\ - hypre_prefix_sum.c\ - hypre_merge_sort.c\ - hypre_hopscotch_hash.c\ - gpuErrorCheck.c\ - gpuMem.c\ - hypre_general.c\ - hypre_reducesum.c + timing.c OBJS = ${FILES:.c=.o} diff -Nru hypre-2.16.0/src/utilities/memory_dmalloc.c hypre-2.18.2/src/utilities/memory_dmalloc.c --- hypre-2.16.0/src/utilities/memory_dmalloc.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/memory_dmalloc.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,16 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ - - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/utilities/mpistubs.c hypre-2.18.2/src/utilities/mpistubs.c --- hypre-2.16.0/src/utilities/mpistubs.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/mpistubs.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include "_hypre_utilities.h" @@ -91,7 +86,7 @@ HYPRE_Int hypre_MPI_Comm_size( hypre_MPI_Comm comm, HYPRE_Int *size ) -{ +{ *size = 1; return(0); } @@ -99,7 +94,7 @@ HYPRE_Int hypre_MPI_Comm_rank( hypre_MPI_Comm comm, HYPRE_Int *rank ) -{ +{ *rank = 0; return(0); } @@ -175,7 +170,7 @@ void *recvbuf, HYPRE_Int recvcount, hypre_MPI_Datatype recvtype, - hypre_MPI_Comm comm ) + hypre_MPI_Comm comm ) { HYPRE_Int i; @@ -189,7 +184,7 @@ { crecvbuf[i] = csendbuf[i]; } - } + } break; case hypre_MPI_DOUBLE: @@ -200,7 +195,7 @@ { crecvbuf[i] = csendbuf[i]; } - } + } break; case hypre_MPI_CHAR: @@ -211,13 +206,13 @@ { crecvbuf[i] = csendbuf[i]; } - } + } break; case hypre_MPI_BYTE: { hypre_Memcpy(recvbuf, sendbuf, sendcount, HYPRE_MEMORY_HOST, HYPRE_MEMORY_HOST); - } + } break; case hypre_MPI_REAL: @@ -228,7 +223,7 @@ { crecvbuf[i] = csendbuf[i]; } - } + } break; case hypre_MPI_COMPLEX: @@ -239,7 +234,7 @@ { crecvbuf[i] = csendbuf[i]; } - } + } break; } @@ -252,10 +247,10 @@ hypre_MPI_Datatype sendtype, void *recvbuf, HYPRE_Int *recvcounts, - HYPRE_Int *displs, + HYPRE_Int *displs, hypre_MPI_Datatype recvtype, - hypre_MPI_Comm comm ) -{ + hypre_MPI_Comm comm ) +{ return ( hypre_MPI_Allgather(sendbuf, sendcount, sendtype, recvbuf, *recvcounts, recvtype, comm) ); } @@ -323,8 +318,8 @@ HYPRE_Int count, hypre_MPI_Datatype datatype, HYPRE_Int root, - hypre_MPI_Comm comm ) -{ + hypre_MPI_Comm comm ) +{ return(0); } @@ -334,8 +329,8 @@ hypre_MPI_Datatype datatype, HYPRE_Int dest, HYPRE_Int tag, - hypre_MPI_Comm comm ) -{ + hypre_MPI_Comm comm ) +{ return(0); } @@ -347,7 +342,7 @@ HYPRE_Int tag, hypre_MPI_Comm comm, hypre_MPI_Status *status ) -{ +{ return(0); } @@ -359,7 +354,7 @@ HYPRE_Int tag, hypre_MPI_Comm comm, hypre_MPI_Request *request ) -{ +{ return(0); } @@ -371,7 +366,7 @@ HYPRE_Int tag, hypre_MPI_Comm comm, hypre_MPI_Request *request ) -{ +{ return(0); } @@ -380,7 +375,7 @@ HYPRE_Int count, hypre_MPI_Datatype datatype, HYPRE_Int dest, - HYPRE_Int tag, + HYPRE_Int tag, hypre_MPI_Comm comm, hypre_MPI_Request *request ) { @@ -392,7 +387,7 @@ HYPRE_Int count, hypre_MPI_Datatype datatype, HYPRE_Int dest, - HYPRE_Int tag, + HYPRE_Int tag, hypre_MPI_Comm comm, hypre_MPI_Request *request ) { @@ -404,7 +399,7 @@ HYPRE_Int count, hypre_MPI_Datatype datatype, HYPRE_Int dest, - HYPRE_Int tag, + HYPRE_Int tag, hypre_MPI_Comm comm, hypre_MPI_Request *request ) { @@ -487,9 +482,9 @@ hypre_MPI_Datatype datatype, hypre_MPI_Op op, hypre_MPI_Comm comm ) -{ +{ HYPRE_Int i; - + switch (datatype) { case hypre_MPI_INT: @@ -500,8 +495,8 @@ { crecvbuf[i] = csendbuf[i]; } - - } + + } break; case hypre_MPI_DOUBLE: @@ -512,7 +507,7 @@ { crecvbuf[i] = csendbuf[i]; } - } + } break; case hypre_MPI_CHAR: @@ -523,13 +518,13 @@ { crecvbuf[i] = csendbuf[i]; } - } + } break; case hypre_MPI_BYTE: { hypre_Memcpy(recvbuf, sendbuf, count, HYPRE_MEMORY_HOST, HYPRE_MEMORY_HOST); - } + } break; case hypre_MPI_REAL: @@ -540,7 +535,7 @@ { crecvbuf[i] = csendbuf[i]; } - } + } break; case hypre_MPI_COMPLEX: @@ -551,7 +546,7 @@ { crecvbuf[i] = csendbuf[i]; } - } + } break; } @@ -566,7 +561,7 @@ hypre_MPI_Op op, HYPRE_Int root, hypre_MPI_Comm comm ) -{ +{ hypre_MPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm); return 0; } @@ -578,7 +573,7 @@ hypre_MPI_Datatype datatype, hypre_MPI_Op op, hypre_MPI_Comm comm ) -{ +{ hypre_MPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm); return 0; } @@ -741,7 +736,7 @@ HYPRE_Int hypre_MPI_Comm_rank( hypre_MPI_Comm comm, HYPRE_Int *rank ) -{ +{ hypre_int mpi_rank; HYPRE_Int ierr; ierr = (HYPRE_Int) MPI_Comm_rank(comm, &mpi_rank); @@ -841,7 +836,7 @@ void *recvbuf, HYPRE_Int recvcount, hypre_MPI_Datatype recvtype, - hypre_MPI_Comm comm ) + hypre_MPI_Comm comm ) { return (HYPRE_Int) MPI_Allgather(sendbuf, (hypre_int)sendcount, sendtype, recvbuf, (hypre_int)recvcount, recvtype, comm); @@ -853,24 +848,24 @@ hypre_MPI_Datatype sendtype, void *recvbuf, HYPRE_Int *recvcounts, - HYPRE_Int *displs, + HYPRE_Int *displs, hypre_MPI_Datatype recvtype, - hypre_MPI_Comm comm ) + hypre_MPI_Comm comm ) { hypre_int *mpi_recvcounts, *mpi_displs, csize; HYPRE_Int i; HYPRE_Int ierr; MPI_Comm_size(comm, &csize); - mpi_recvcounts = hypre_TAlloc(hypre_int, csize, HYPRE_MEMORY_HOST); - mpi_displs = hypre_TAlloc(hypre_int, csize, HYPRE_MEMORY_HOST); + mpi_recvcounts = hypre_TAlloc(hypre_int, csize, HYPRE_MEMORY_HOST); + mpi_displs = hypre_TAlloc(hypre_int, csize, HYPRE_MEMORY_HOST); for (i = 0; i < csize; i++) { mpi_recvcounts[i] = (hypre_int) recvcounts[i]; mpi_displs[i] = (hypre_int) displs[i]; } ierr = (HYPRE_Int) MPI_Allgatherv(sendbuf, (hypre_int)sendcount, sendtype, - recvbuf, mpi_recvcounts, mpi_displs, + recvbuf, mpi_recvcounts, mpi_displs, recvtype, comm); hypre_TFree(mpi_recvcounts, HYPRE_MEMORY_HOST); hypre_TFree(mpi_displs, HYPRE_MEMORY_HOST); @@ -923,7 +918,7 @@ } } ierr = (HYPRE_Int) MPI_Gatherv(sendbuf, (hypre_int)sendcount, sendtype, - recvbuf, mpi_recvcounts, mpi_displs, + recvbuf, mpi_recvcounts, mpi_displs, recvtype, (hypre_int) root, comm); hypre_TFree(mpi_recvcounts, HYPRE_MEMORY_HOST); hypre_TFree(mpi_displs, HYPRE_MEMORY_HOST); @@ -976,7 +971,7 @@ } } ierr = (HYPRE_Int) MPI_Scatterv(sendbuf, mpi_sendcounts, mpi_displs, sendtype, - recvbuf, (hypre_int) recvcount, + recvbuf, (hypre_int) recvcount, recvtype, (hypre_int) root, comm); hypre_TFree(mpi_sendcounts, HYPRE_MEMORY_HOST); hypre_TFree(mpi_displs, HYPRE_MEMORY_HOST); @@ -989,8 +984,8 @@ HYPRE_Int count, hypre_MPI_Datatype datatype, HYPRE_Int root, - hypre_MPI_Comm comm ) -{ + hypre_MPI_Comm comm ) +{ return (HYPRE_Int) MPI_Bcast(buffer, (hypre_int)count, datatype, (hypre_int)root, comm); } @@ -1001,8 +996,8 @@ hypre_MPI_Datatype datatype, HYPRE_Int dest, HYPRE_Int tag, - hypre_MPI_Comm comm ) -{ + hypre_MPI_Comm comm ) +{ return (HYPRE_Int) MPI_Send(buf, (hypre_int)count, datatype, (hypre_int)dest, (hypre_int)tag, comm); } @@ -1015,7 +1010,7 @@ HYPRE_Int tag, hypre_MPI_Comm comm, hypre_MPI_Status *status ) -{ +{ return (HYPRE_Int) MPI_Recv(buf, (hypre_int)count, datatype, (hypre_int)source, (hypre_int)tag, comm, status); } @@ -1028,7 +1023,7 @@ HYPRE_Int tag, hypre_MPI_Comm comm, hypre_MPI_Request *request ) -{ +{ return (HYPRE_Int) MPI_Isend(buf, (hypre_int)count, datatype, (hypre_int)dest, (hypre_int)tag, comm, request); } @@ -1041,7 +1036,7 @@ HYPRE_Int tag, hypre_MPI_Comm comm, hypre_MPI_Request *request ) -{ +{ return (HYPRE_Int) MPI_Irecv(buf, (hypre_int)count, datatype, (hypre_int)source, (hypre_int)tag, comm, request); } @@ -1051,7 +1046,7 @@ HYPRE_Int count, hypre_MPI_Datatype datatype, HYPRE_Int dest, - HYPRE_Int tag, + HYPRE_Int tag, hypre_MPI_Comm comm, hypre_MPI_Request *request ) { @@ -1065,7 +1060,7 @@ HYPRE_Int count, hypre_MPI_Datatype datatype, HYPRE_Int dest, - HYPRE_Int tag, + HYPRE_Int tag, hypre_MPI_Comm comm, hypre_MPI_Request *request ) { @@ -1079,7 +1074,7 @@ HYPRE_Int count, hypre_MPI_Datatype datatype, HYPRE_Int dest, - HYPRE_Int tag, + HYPRE_Int tag, hypre_MPI_Comm comm, hypre_MPI_Request *request ) { @@ -1194,7 +1189,7 @@ hypre_MPI_Op op, HYPRE_Int root, hypre_MPI_Comm comm ) -{ +{ return (HYPRE_Int) MPI_Reduce(sendbuf, recvbuf, (hypre_int)count, datatype, op, (hypre_int)root, comm); } @@ -1206,7 +1201,7 @@ hypre_MPI_Datatype datatype, hypre_MPI_Op op, hypre_MPI_Comm comm ) -{ +{ return (HYPRE_Int) MPI_Scan(sendbuf, recvbuf, (hypre_int)count, datatype, op, comm); } diff -Nru hypre-2.16.0/src/utilities/mpistubs.h hypre-2.18.2/src/utilities/mpistubs.h --- hypre-2.16.0/src/utilities/mpistubs.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/mpistubs.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -53,83 +48,84 @@ #define MPI_BOTTOM hypre_MPI_BOTTOM #define MPI_FLOAT hypre_MPI_FLOAT -#define MPI_DOUBLE hypre_MPI_DOUBLE +#define MPI_DOUBLE hypre_MPI_DOUBLE #define MPI_LONG_DOUBLE hypre_MPI_LONG_DOUBLE -#define MPI_INT hypre_MPI_INT -#define MPI_LONG_LONG_INT hypre_MPI_INT -#define MPI_CHAR hypre_MPI_CHAR -#define MPI_LONG hypre_MPI_LONG -#define MPI_BYTE hypre_MPI_BYTE +#define MPI_INT hypre_MPI_INT +#define MPI_LONG_LONG_INT hypre_MPI_INT +#define MPI_CHAR hypre_MPI_CHAR +#define MPI_LONG hypre_MPI_LONG +#define MPI_BYTE hypre_MPI_BYTE #define MPI_C_DOUBLE_COMPLEX hypre_MPI_COMPLEX -#define MPI_SUM hypre_MPI_SUM -#define MPI_MIN hypre_MPI_MIN -#define MPI_MAX hypre_MPI_MAX -#define MPI_LOR hypre_MPI_LOR -#define MPI_LAND hypre_MPI_LAND +#define MPI_SUM hypre_MPI_SUM +#define MPI_MIN hypre_MPI_MIN +#define MPI_MAX hypre_MPI_MAX +#define MPI_LOR hypre_MPI_LOR +#define MPI_LAND hypre_MPI_LAND #define MPI_SUCCESS hypre_MPI_SUCCESS #define MPI_STATUSES_IGNORE hypre_MPI_STATUSES_IGNORE -#define MPI_UNDEFINED hypre_MPI_UNDEFINED -#define MPI_REQUEST_NULL hypre_MPI_REQUEST_NULL -#define MPI_ANY_SOURCE hypre_MPI_ANY_SOURCE +#define MPI_UNDEFINED hypre_MPI_UNDEFINED +#define MPI_REQUEST_NULL hypre_MPI_REQUEST_NULL +#define MPI_INFO_NULL hypre_MPI_INFO_NULL +#define MPI_ANY_SOURCE hypre_MPI_ANY_SOURCE #define MPI_ANY_TAG hypre_MPI_ANY_TAG #define MPI_SOURCE hypre_MPI_SOURCE #define MPI_TAG hypre_MPI_TAG -#define MPI_Init hypre_MPI_Init -#define MPI_Finalize hypre_MPI_Finalize -#define MPI_Abort hypre_MPI_Abort -#define MPI_Wtime hypre_MPI_Wtime -#define MPI_Wtick hypre_MPI_Wtick -#define MPI_Barrier hypre_MPI_Barrier -#define MPI_Comm_create hypre_MPI_Comm_create -#define MPI_Comm_dup hypre_MPI_Comm_dup +#define MPI_Init hypre_MPI_Init +#define MPI_Finalize hypre_MPI_Finalize +#define MPI_Abort hypre_MPI_Abort +#define MPI_Wtime hypre_MPI_Wtime +#define MPI_Wtick hypre_MPI_Wtick +#define MPI_Barrier hypre_MPI_Barrier +#define MPI_Comm_create hypre_MPI_Comm_create +#define MPI_Comm_dup hypre_MPI_Comm_dup #define MPI_Comm_f2c hypre_MPI_Comm_f2c -#define MPI_Comm_group hypre_MPI_Comm_group -#define MPI_Comm_size hypre_MPI_Comm_size -#define MPI_Comm_rank hypre_MPI_Comm_rank -#define MPI_Comm_free hypre_MPI_Comm_free -#define MPI_Comm_split hypre_MPI_Comm_split +#define MPI_Comm_group hypre_MPI_Comm_group +#define MPI_Comm_size hypre_MPI_Comm_size +#define MPI_Comm_rank hypre_MPI_Comm_rank +#define MPI_Comm_free hypre_MPI_Comm_free +#define MPI_Comm_split hypre_MPI_Comm_split #define MPI_Comm_split_type hypre_MPI_Comm_split_type -#define MPI_Group_incl hypre_MPI_Group_incl -#define MPI_Group_free hypre_MPI_Group_free -#define MPI_Address hypre_MPI_Address -#define MPI_Get_count hypre_MPI_Get_count -#define MPI_Alltoall hypre_MPI_Alltoall -#define MPI_Allgather hypre_MPI_Allgather -#define MPI_Allgatherv hypre_MPI_Allgatherv -#define MPI_Gather hypre_MPI_Gather -#define MPI_Gatherv hypre_MPI_Gatherv -#define MPI_Scatter hypre_MPI_Scatter -#define MPI_Scatterv hypre_MPI_Scatterv -#define MPI_Bcast hypre_MPI_Bcast -#define MPI_Send hypre_MPI_Send -#define MPI_Recv hypre_MPI_Recv -#define MPI_Isend hypre_MPI_Isend -#define MPI_Irecv hypre_MPI_Irecv -#define MPI_Send_init hypre_MPI_Send_init -#define MPI_Recv_init hypre_MPI_Recv_init -#define MPI_Irsend hypre_MPI_Irsend -#define MPI_Startall hypre_MPI_Startall -#define MPI_Probe hypre_MPI_Probe -#define MPI_Iprobe hypre_MPI_Iprobe -#define MPI_Test hypre_MPI_Test +#define MPI_Group_incl hypre_MPI_Group_incl +#define MPI_Group_free hypre_MPI_Group_free +#define MPI_Address hypre_MPI_Address +#define MPI_Get_count hypre_MPI_Get_count +#define MPI_Alltoall hypre_MPI_Alltoall +#define MPI_Allgather hypre_MPI_Allgather +#define MPI_Allgatherv hypre_MPI_Allgatherv +#define MPI_Gather hypre_MPI_Gather +#define MPI_Gatherv hypre_MPI_Gatherv +#define MPI_Scatter hypre_MPI_Scatter +#define MPI_Scatterv hypre_MPI_Scatterv +#define MPI_Bcast hypre_MPI_Bcast +#define MPI_Send hypre_MPI_Send +#define MPI_Recv hypre_MPI_Recv +#define MPI_Isend hypre_MPI_Isend +#define MPI_Irecv hypre_MPI_Irecv +#define MPI_Send_init hypre_MPI_Send_init +#define MPI_Recv_init hypre_MPI_Recv_init +#define MPI_Irsend hypre_MPI_Irsend +#define MPI_Startall hypre_MPI_Startall +#define MPI_Probe hypre_MPI_Probe +#define MPI_Iprobe hypre_MPI_Iprobe +#define MPI_Test hypre_MPI_Test #define MPI_Testall hypre_MPI_Testall -#define MPI_Wait hypre_MPI_Wait -#define MPI_Waitall hypre_MPI_Waitall -#define MPI_Waitany hypre_MPI_Waitany -#define MPI_Allreduce hypre_MPI_Allreduce -#define MPI_Reduce hypre_MPI_Reduce -#define MPI_Scan hypre_MPI_Scan -#define MPI_Request_free hypre_MPI_Request_free -#define MPI_Type_contiguous hypre_MPI_Type_contiguous -#define MPI_Type_vector hypre_MPI_Type_vector -#define MPI_Type_hvector hypre_MPI_Type_hvector -#define MPI_Type_struct hypre_MPI_Type_struct +#define MPI_Wait hypre_MPI_Wait +#define MPI_Waitall hypre_MPI_Waitall +#define MPI_Waitany hypre_MPI_Waitany +#define MPI_Allreduce hypre_MPI_Allreduce +#define MPI_Reduce hypre_MPI_Reduce +#define MPI_Scan hypre_MPI_Scan +#define MPI_Request_free hypre_MPI_Request_free +#define MPI_Type_contiguous hypre_MPI_Type_contiguous +#define MPI_Type_vector hypre_MPI_Type_vector +#define MPI_Type_hvector hypre_MPI_Type_hvector +#define MPI_Type_struct hypre_MPI_Type_struct #define MPI_Type_commit hypre_MPI_Type_commit -#define MPI_Type_free hypre_MPI_Type_free -#define MPI_Op_free hypre_MPI_Op_free +#define MPI_Type_free hypre_MPI_Type_free +#define MPI_Op_free hypre_MPI_Op_free #define MPI_Op_create hypre_MPI_Op_create #define MPI_User_function hypre_MPI_User_function #define MPI_Info_create hypre_MPI_Info_create @@ -183,6 +179,7 @@ #define hypre_MPI_UNDEFINED -9999 #define hypre_MPI_REQUEST_NULL 0 +#define hypre_MPI_INFO_NULL 0 #define hypre_MPI_ANY_SOURCE 1 #define hypre_MPI_ANY_TAG 1 @@ -206,7 +203,7 @@ #define hypre_MPI_COMM_NULL MPI_COMM_NULL #define hypre_MPI_BOTTOM MPI_BOTTOM #define hypre_MPI_COMM_SELF MPI_COMM_SELF -#define hypre_MPI_COMM_TYPE_SHARED MPI_COMM_TYPE_SHARED +#define hypre_MPI_COMM_TYPE_SHARED MPI_COMM_TYPE_SHARED #define hypre_MPI_FLOAT MPI_FLOAT #define hypre_MPI_DOUBLE MPI_DOUBLE @@ -228,9 +225,10 @@ #define hypre_MPI_SUCCESS MPI_SUCCESS #define hypre_MPI_STATUSES_IGNORE MPI_STATUSES_IGNORE -#define hypre_MPI_UNDEFINED MPI_UNDEFINED +#define hypre_MPI_UNDEFINED MPI_UNDEFINED #define hypre_MPI_REQUEST_NULL MPI_REQUEST_NULL -#define hypre_MPI_ANY_SOURCE MPI_ANY_SOURCE +#define hypre_MPI_INFO_NULL MPI_INFO_NULL +#define hypre_MPI_ANY_SOURCE MPI_ANY_SOURCE #define hypre_MPI_ANY_TAG MPI_ANY_TAG #define hypre_MPI_SOURCE MPI_SOURCE #define hypre_MPI_TAG MPI_TAG diff -Nru hypre-2.16.0/src/utilities/protos hypre-2.18.2/src/utilities/protos --- hypre-2.16.0/src/utilities/protos 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/protos 2019-10-28 22:30:04.000000000 +0000 @@ -1,18 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) while [ $# -ge 1 ]; do echo ""; echo "/* $1 */" diff -Nru hypre-2.16.0/src/utilities/protos.h hypre-2.18.2/src/utilities/protos.h --- hypre-2.16.0/src/utilities/protos.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/protos.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* amg_linklist.c */ void hypre_dispose_elt ( hypre_LinkList element_ptr ); @@ -18,6 +13,7 @@ /* binsearch.c */ HYPRE_Int hypre_BinarySearch ( HYPRE_Int *list , HYPRE_Int value , HYPRE_Int list_length ); +HYPRE_Int hypre_BigBinarySearch(HYPRE_BigInt *list, HYPRE_BigInt value, HYPRE_Int list_length); HYPRE_Int hypre_BinarySearch2 ( HYPRE_Int *list , HYPRE_Int value , HYPRE_Int low , HYPRE_Int high , HYPRE_Int *spot ); HYPRE_Int *hypre_LowerBound( HYPRE_Int *first, HYPRE_Int *last, HYPRE_Int value ); HYPRE_BigInt *hypre_BigLowerBound( HYPRE_BigInt *first, HYPRE_BigInt *last, HYPRE_BigInt value ); @@ -36,11 +32,18 @@ #endif /* hypre_general.c */ -void HYPRE_Init( hypre_int argc, char *argv[] ); -void HYPRE_Finalize(); +HYPRE_Int HYPRE_Init( hypre_int argc, char *argv[] ); +HYPRE_Int HYPRE_Finalize(); +HYPRE_Int hypre_GetDevice(hypre_Handle *hypre_handle); +HYPRE_Int hypre_SetDevice(HYPRE_Int use_device, hypre_Handle *hypre_handle); +HYPRE_Int hypre_SyncCudaDefaultStream(hypre_Handle *hypre_handle); +void hypre_SetExecPolicy( HYPRE_Int policy ); +HYPRE_Int hypre_GetExecPolicy1(HYPRE_Int location); +HYPRE_Int hypre_GetExecPolicy2(HYPRE_Int location1, HYPRE_Int location2); /* hypre_printf.c */ // #ifdef HYPRE_BIGINT +HYPRE_Int hypre_ndigits( HYPRE_BigInt number ); HYPRE_Int hypre_printf( const char *format , ... ); HYPRE_Int hypre_fprintf( FILE *stream , const char *format, ... ); HYPRE_Int hypre_sprintf( char *s , const char *format, ... ); @@ -63,17 +66,28 @@ void hypre_swap2i ( HYPRE_Int *v , HYPRE_Int *w , HYPRE_Int i , HYPRE_Int j ); void hypre_swap3i ( HYPRE_Int *v , HYPRE_Int *w , HYPRE_Int *z , HYPRE_Int i , HYPRE_Int j ); void hypre_swap3_d ( HYPRE_Real *v , HYPRE_Int *w , HYPRE_Int *z , HYPRE_Int i , HYPRE_Int j ); -void hypre_swap4_d ( HYPRE_Real *v , HYPRE_Int *w , HYPRE_Int *z , HYPRE_Int *y , HYPRE_Int i , HYPRE_Int j ); +void hypre_BigSwap4_d ( HYPRE_Real *v , HYPRE_BigInt *w , HYPRE_Int *z , HYPRE_Int *y , HYPRE_Int i , HYPRE_Int j ); void hypre_swap_d ( HYPRE_Real *v , HYPRE_Int i , HYPRE_Int j ); void hypre_qsort0 ( HYPRE_Int *v , HYPRE_Int left , HYPRE_Int right ); void hypre_qsort1 ( HYPRE_Int *v , HYPRE_Real *w , HYPRE_Int left , HYPRE_Int right ); void hypre_BigQsort1 ( HYPRE_BigInt *v , HYPRE_Real *w , HYPRE_Int left , HYPRE_Int right ); void hypre_qsort2i ( HYPRE_Int *v , HYPRE_Int *w , HYPRE_Int left , HYPRE_Int right ); void hypre_qsort2 ( HYPRE_Int *v , HYPRE_Real *w , HYPRE_Int left , HYPRE_Int right ); +void hypre_qsort2abs( HYPRE_Int *v, HYPRE_Real *w, HYPRE_Int left, HYPRE_Int right ); void hypre_qsort3i ( HYPRE_Int *v , HYPRE_Int *w , HYPRE_Int *z , HYPRE_Int left , HYPRE_Int right ); void hypre_qsort3_abs ( HYPRE_Real *v , HYPRE_Int *w , HYPRE_Int *z , HYPRE_Int left , HYPRE_Int right ); -void hypre_qsort4_abs ( HYPRE_Real *v , HYPRE_Int *w , HYPRE_Int *z , HYPRE_Int *y , HYPRE_Int left , HYPRE_Int right ); +void hypre_BigQsort4_abs ( HYPRE_Real *v , HYPRE_BigInt *w , HYPRE_Int *z , HYPRE_Int *y , HYPRE_Int left , HYPRE_Int right ); void hypre_qsort_abs ( HYPRE_Real *w , HYPRE_Int left , HYPRE_Int right ); +void hypre_BigSwapbi(HYPRE_BigInt *v, HYPRE_Int *w, HYPRE_Int i, HYPRE_Int j ); +void hypre_BigQsortbi( HYPRE_BigInt *v, HYPRE_Int *w, HYPRE_Int left, HYPRE_Int right ); +void hypre_BigSwapLoc(HYPRE_BigInt *v, HYPRE_Int *w, HYPRE_Int i, HYPRE_Int j ); +void hypre_BigQsortbLoc( HYPRE_BigInt *v, HYPRE_Int *w, HYPRE_Int left, HYPRE_Int right ); +void hypre_BigSwapb2i(HYPRE_BigInt *v, HYPRE_Int *w, HYPRE_Int *z, HYPRE_Int i, HYPRE_Int j ); +void hypre_BigQsortb2i( HYPRE_BigInt *v, HYPRE_Int *w, HYPRE_Int *z, HYPRE_Int left, HYPRE_Int right ); +void hypre_BigSwap( HYPRE_BigInt *v, HYPRE_Int i, HYPRE_Int j ); +void hypre_BigQsort0( HYPRE_BigInt *v, HYPRE_Int left, HYPRE_Int right ); +void hypre_topo_sort(const HYPRE_Int *row_ptr, const HYPRE_Int *col_inds, const HYPRE_Complex *data, HYPRE_Int *ordering, HYPRE_Int n); +void hypre_dense_topo_sort(const HYPRE_Complex *L, HYPRE_Int *ordering, HYPRE_Int n, HYPRE_Int is_col_major); /* qsplit.c */ HYPRE_Int hypre_DoubleQuickSplit ( HYPRE_Real *values , HYPRE_Int *indices , HYPRE_Int list_length , HYPRE_Int NumberKept ); @@ -142,11 +156,7 @@ void hypre_merge_sort(HYPRE_Int *in, HYPRE_Int *temp, HYPRE_Int len, HYPRE_Int **sorted); -#ifdef HYPRE_CONCURRENT_HOPSCOTCH -void hypre_big_merge_sort(HYPRE_BigInt *in, HYPRE_BigInt *temp, HYPRE_Int len, HYPRE_BigInt **sorted); -#endif - -void hypre_union2(HYPRE_Int n1, HYPRE_Int *arr1, HYPRE_Int n2, HYPRE_Int *arr2, HYPRE_Int *n3, HYPRE_Int *arr3, HYPRE_Int *map1, HYPRE_Int *map2); +void hypre_union2(HYPRE_Int n1, HYPRE_BigInt *arr1, HYPRE_Int n2, HYPRE_BigInt *arr2, HYPRE_Int *n3, HYPRE_BigInt *arr3, HYPRE_Int *map1, HYPRE_Int *map2); /* hypre_hopscotch_hash.c */ @@ -154,7 +164,7 @@ /* Check if atomic operations are available to use concurrent hopscotch hash table */ #if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 -#define HYPRE_USING_ATOMIC +#define HYPRE_USING_ATOMIC //#elif defined _MSC_VER // JSP: haven't tested, so comment out for now //#define HYPRE_USING_ATOMIC //#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_ATOMICS__) @@ -168,9 +178,9 @@ #ifdef HYPRE_HOPSCOTCH #ifdef HYPRE_USING_ATOMIC // concurrent hopscotch hashing is possible only with atomic supports -#define HYPRE_CONCURRENT_HOPSCOTCH -#endif -#endif +#define HYPRE_CONCURRENT_HOPSCOTCH +#endif +#endif #ifdef HYPRE_CONCURRENT_HOPSCOTCH typedef struct { @@ -198,7 +208,7 @@ #endif HYPRE_Int *volatile key; hypre_uint *volatile hopInfo; - HYPRE_Int *volatile hash; + HYPRE_Int *volatile hash; } hypre_UnorderedIntSet; typedef struct @@ -237,22 +247,22 @@ */ typedef struct { - HYPRE_Int volatile segmentMask; - HYPRE_Int volatile bucketMask; + HYPRE_Int volatile segmentMask; + HYPRE_Int volatile bucketMask; #ifdef HYPRE_CONCURRENT_HOPSCOTCH - hypre_HopscotchSegment* volatile segments; + hypre_HopscotchSegment* volatile segments; #endif - hypre_HopscotchBucket* volatile table; + hypre_HopscotchBucket* volatile table; } hypre_UnorderedIntMap; typedef struct { - HYPRE_Int volatile segmentMask; - HYPRE_Int volatile bucketMask; + HYPRE_Int volatile segmentMask; + HYPRE_Int volatile bucketMask; #ifdef HYPRE_CONCURRENT_HOPSCOTCH - hypre_HopscotchSegment* volatile segments; + hypre_HopscotchSegment* volatile segments; #endif - hypre_BigHopscotchBucket* volatile table; + hypre_BigHopscotchBucket* volatile table; } hypre_UnorderedBigIntMap; /** @@ -262,3 +272,59 @@ */ void hypre_sort_and_create_inverse_map( HYPRE_Int *in, HYPRE_Int len, HYPRE_Int **out, hypre_UnorderedIntMap *inverse_map); + +#ifdef HYPRE_CONCURRENT_HOPSCOTCH +void hypre_big_merge_sort(HYPRE_BigInt *in, HYPRE_BigInt *temp, HYPRE_Int len, HYPRE_BigInt **sorted); +void hypre_big_sort_and_create_inverse_map(HYPRE_BigInt *in, HYPRE_Int len, HYPRE_BigInt **out, hypre_UnorderedBigIntMap *inverse_map); +#endif + + +/* hypre_cuda_utils.c */ +#if defined(HYPRE_USING_CUDA) +#ifdef __cplusplus +extern "C++" { +#endif +dim3 hypre_GetDefaultCUDABlockDimension(); + +dim3 hypre_GetDefaultCUDAGridDimension( HYPRE_Int n, const char *granularity, dim3 bDim ); + +template HYPRE_Int hypreDevice_StableSortByTupleKey(HYPRE_Int N, T1 *keys1, T2 *keys2, T3 *vals, HYPRE_Int opt); + +#ifdef __cplusplus +} +#endif + +HYPRE_Int hypreDevice_GetRowNnz(HYPRE_Int nrows, HYPRE_Int *d_row_indices, HYPRE_Int *d_diag_ia, HYPRE_Int *d_offd_ia, HYPRE_Int *d_rownnz); + +HYPRE_Int hypreDevice_CopyParCSRRows(HYPRE_Int nrows, HYPRE_Int *d_row_indices, HYPRE_Int job, HYPRE_Int has_offd, HYPRE_Int first_col, HYPRE_Int *d_col_map_offd_A, HYPRE_Int *d_diag_i, HYPRE_Int *d_diag_j, HYPRE_Complex *d_diag_a, HYPRE_Int *d_offd_i, HYPRE_Int *d_offd_j, HYPRE_Complex *d_offd_a, HYPRE_Int *d_ib, HYPRE_BigInt *d_jb, HYPRE_Complex *d_ab); + +HYPRE_Int hypreDevice_IntegerReduceSum(HYPRE_Int m, HYPRE_Int *d_i); + +HYPRE_Int hypreDevice_IntegerInclusiveScan(HYPRE_Int n, HYPRE_Int *d_i); + +HYPRE_Int hypreDevice_IntegerExclusiveScan(HYPRE_Int n, HYPRE_Int *d_i); + +HYPRE_Int* hypreDevice_CsrRowPtrsToIndices(HYPRE_Int nrows, HYPRE_Int nnz, HYPRE_Int *d_row_ptr); + +HYPRE_Int hypreDevice_CsrRowPtrsToIndices_v2(HYPRE_Int nrows, HYPRE_Int *d_row_ptr, HYPRE_Int *d_row_ind); + +HYPRE_Int hypreDevice_CsrRowPtrsToIndicesWithRowNum(HYPRE_Int nrows, HYPRE_Int *d_row_ptr, HYPRE_Int *d_row_num, HYPRE_Int *d_row_ind); + +HYPRE_Int* hypreDevice_CsrRowIndicesToPtrs(HYPRE_Int nrows, HYPRE_Int nnz, HYPRE_Int *d_row_ind); + +HYPRE_Int hypreDevice_CsrRowIndicesToPtrs_v2(HYPRE_Int nrows, HYPRE_Int nnz, HYPRE_Int *d_row_ind, HYPRE_Int *d_row_ptr); + +HYPRE_Int hypreDevice_GenScatterAdd(HYPRE_Real *x, HYPRE_Int ny, HYPRE_Int *map, HYPRE_Real *y); + +HYPRE_Int hypreDevice_ScatterConstant(HYPRE_Int *x, HYPRE_Int n, HYPRE_Int *map, HYPRE_Int v); + +HYPRE_Int hypreDevice_IVAXPY(HYPRE_Int n, HYPRE_Complex *a, HYPRE_Complex *x, HYPRE_Complex *y); + +HYPRE_Int hypreDevice_DiagScaleVector(HYPRE_Int n, HYPRE_Int *A_i, HYPRE_Complex *A_data, HYPRE_Complex *x, HYPRE_Complex *y); + +HYPRE_Int hypreDevice_BigToSmallCopy(HYPRE_Int *tgt, const HYPRE_BigInt *src, HYPRE_Int size); + +void hypre_CudaCompileFlagCheck(); + +#endif + diff -Nru hypre-2.16.0/src/utilities/qsplit.c hypre-2.18.2/src/utilities/qsplit.c --- hypre-2.16.0/src/utilities/qsplit.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/qsplit.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,10 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ - + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ - #include "_hypre_utilities.h" #include diff -Nru hypre-2.16.0/src/utilities/random.c hypre-2.18.2/src/utilities/random.c --- hypre-2.16.0/src/utilities/random.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/random.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/utilities/threading.c hypre-2.18.2/src/utilities/threading.c --- hypre-2.16.0/src/utilities/threading.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/threading.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #include #include @@ -50,6 +45,12 @@ return my_thread_num; } +void +hypre_SetNumThreads(HYPRE_Int nt) +{ + omp_set_num_threads(nt); +} + #endif /* This next function must be called from within a parallel region! */ diff -Nru hypre-2.16.0/src/utilities/threading.h hypre-2.18.2/src/utilities/threading.h --- hypre-2.16.0/src/utilities/threading.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/threading.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ #ifndef hypre_THREADING_HEADER #define hypre_THREADING_HEADER @@ -18,12 +13,14 @@ HYPRE_Int hypre_NumThreads( void ); HYPRE_Int hypre_NumActiveThreads( void ); HYPRE_Int hypre_GetThreadNum( void ); +void hypre_SetNumThreads(HYPRE_Int nt); #else #define hypre_NumThreads() 1 #define hypre_NumActiveThreads() 1 #define hypre_GetThreadNum() 0 +#define hypre_SetNumThreads(x) #endif diff -Nru hypre-2.16.0/src/utilities/thread_protos.awk hypre-2.18.2/src/utilities/thread_protos.awk --- hypre-2.16.0/src/utilities/thread_protos.awk 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/thread_protos.awk 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #=========================================================================== # To use, do: diff -Nru hypre-2.16.0/src/utilities/thread_wrappers.awk hypre-2.18.2/src/utilities/thread_wrappers.awk --- hypre-2.16.0/src/utilities/thread_wrappers.awk 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/thread_wrappers.awk 2019-10-28 22:30:04.000000000 +0000 @@ -1,17 +1,7 @@ -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** - - - +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #=========================================================================== # To use, do: diff -Nru hypre-2.16.0/src/utilities/timer.c hypre-2.18.2/src/utilities/timer.c --- hypre-2.16.0/src/utilities/timer.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/timer.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. - * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /* * File: timer.c diff -Nru hypre-2.16.0/src/utilities/timing.c hypre-2.18.2/src/utilities/timing.c --- hypre-2.16.0/src/utilities/timing.c 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/timing.c 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * @@ -108,7 +103,7 @@ old_name = (hypre_global_timing_ref(threadid, name)); old_state = (hypre_global_timing_ref(threadid, state)); old_num_regs = (hypre_global_timing_ref(threadid, num_regs)); - + (hypre_global_timing_ref(threadid, wall_time)) = hypre_CTAlloc(HYPRE_Real, (time_index+1), HYPRE_MEMORY_HOST); (hypre_global_timing_ref(threadid, cpu_time)) = @@ -181,7 +176,7 @@ if ((hypre_global_timing -> num_names) == 0) { for (i = 0; i < (hypre_global_timing -> size); i++) - { + { hypre_TFree(hypre_global_timing_ref(i, wall_time), HYPRE_MEMORY_HOST); hypre_TFree(hypre_global_timing_ref(i, cpu_time), HYPRE_MEMORY_HOST); hypre_TFree(hypre_global_timing_ref(i, flops), HYPRE_MEMORY_HOST); @@ -189,7 +184,7 @@ hypre_TFree(hypre_global_timing_ref(i, state), HYPRE_MEMORY_HOST); hypre_TFree(hypre_global_timing_ref(i, num_regs), HYPRE_MEMORY_HOST); } - + hypre_TFree(hypre_global_timing, HYPRE_MEMORY_HOST); hypre_global_timing = NULL; } diff -Nru hypre-2.16.0/src/utilities/timing.h hypre-2.18.2/src/utilities/timing.h --- hypre-2.16.0/src/utilities/timing.h 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/timing.h 2019-10-28 22:30:04.000000000 +0000 @@ -1,14 +1,9 @@ -/*BHEADER********************************************************************** - * Copyright (c) 2008, Lawrence Livermore National Security, LLC. - * Produced at the Lawrence Livermore National Laboratory. - * This file is part of HYPRE. See file COPYRIGHT for details. - * - * HYPRE is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License (as published by the Free - * Software Foundation) version 2.1 dated February 1999. +/****************************************************************************** + * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other + * HYPRE Project Developers. See the top-level COPYRIGHT file for details. * - * $Revision$ - ***********************************************************************EHEADER*/ + * SPDX-License-Identifier: (Apache-2.0 OR MIT) + ******************************************************************************/ /****************************************************************************** * diff -Nru hypre-2.16.0/src/utilities/version hypre-2.18.2/src/utilities/version --- hypre-2.16.0/src/utilities/version 2019-03-20 17:09:58.000000000 +0000 +++ hypre-2.18.2/src/utilities/version 2019-10-28 22:30:04.000000000 +0000 @@ -1,15 +1,8 @@ #!/bin/sh -#BHEADER********************************************************************** -# Copyright (c) 2008, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# This file is part of HYPRE. See file COPYRIGHT for details. +# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. # -# HYPRE is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License (as published by the Free -# Software Foundation) version 2.1 dated February 1999. -# -# $Revision$ -#EHEADER********************************************************************** +# SPDX-License-Identifier: (Apache-2.0 OR MIT) #============================================================================= # This script prints the hypre version number, date, and time.