This patch upgrades the PartitionedArrays dependency from the 0.3.x
release series to 0.5.x (closes#17). Also updates documentation build
dependencies.
This patch adds the functions
`HYPRE.GetFinalRelativeResidualNorm(::HYPRESolver)` and
`HYPRE.GetNumIterations(::HYPRESolver)` for querying final residual norm
and number of iterations from solvers. These functions dispatches on the
solver to the corresponding C API wrappers
`LibHYPRE.HYPRE_${Solver}GetFinalRelativeResidualNorm` and
`LibHYPRE.HYPRE_${Solver}GetNumIterations`, respectively.
This patch adds methods for `Base.unsafe_convert` for `HYPREMatrix`,
`HYPREVector`, and `HYPRESolver`. This means that those objects can be
passed directly to `ccall` and be "converted" (i.e. extracting the
pointer that is stored in the structs) to the appropriate type expected
by the HYPRE C-library. The advantage is that `ccall` then guarantees
that the objects are kept alive for the duration of the call.
This patch tracks all created HYPRE objects (`HYPREMatrix`,
`HYPREVector`, and `HYPRESolver`s) in a global `WeakKeyDict` to make
sure they are all finalized **before** MPI and/or HYPRE is finalized.
These libraries are typically finalized in Julia atexit hooks, but at
that point the object finalizers might yet not have been run. This patch
make sure to explicitly call `finalize` on any remaining HYPRE objects
before finalizing the library.
This patch fixes the buffer length in to_hypre_data(::MatrixAssembler).
Previously the buffer was always too long, which was not problematic for
correctness, but it is unnecessary. This patch also adds some assertions
to check the internal consistency of the buffer lengths.
This patch adds an assembler interface such that it is possible to
directly assemble HYPRE(Vector|Matrix) without going through a sparse
matrix datastructure in Julia. This is done as follows:
1. Create a new (empty) matrix/vector using the constructor.
2. Create an assembler and initialize the assembly using
HYPRE.start_assemble!.
3. Assemble all contributions using HYPRE.assemble!.
4. Finalize the assembly using HYPRE.finish_assemble!.
HYPRE.start_assemble!
The assembler caches some buffers that are (re)used by every call to
HYPRE.assemble! so this should be efficient. All MPI communication
should happen in the finalization step.
This patch wraps the HYPRE_Destroy functions for the HYPRESolvers in a
functtion that checks if the pointer is NULL before calling the Destroy
function. While this makes sense on it self, it also makes it possible
to override a finalizer by adding a second one that sets the pointer to
NULL. This is utilized in the set_precond(::Hybrid, p) function, since
the Hybrid solver currently frees the provied preconditioner too.
This patch stores the MPI communicator in the solvers structs. The
default communicator is changed from COMM_WORLD to COMM_NULL, for
BiCGSTAB, GMRES, and PCG, since their respective HYPRE_Create functions
simply ignore this argument.
This patch adds HYPREError <: Exception which is thrown when a HYPRE_
function returns an error code. HYPRE_ClearAllErrors() are called just
before throwing.
Some solvers have option from the specific ParCSR solver + options for
the general solver. This updates the option generator to handle this
such that the specific method is preferred over the generic one. This
patch also include the result of the generator applied to PCG, which has
some specific options for ParCSRPCG.
This patch adds the function `HYPRE.Init()` which i) calls `MPI.Init`
(unless MPI is already initialized), ii) calls `HYPRE_Init`, and iii)
adds a Julia exit hook which calls `HYPRE_Finalize` (if the keyword
argument `finalize_atexit` is `true`).
This patch adds defaults for ilower and iupper in constructors when i)
using SparseMatrixCS(C|R) and Vector and ii) when no communicator is
passed. In this case we simply assume the users wants a single-processor
solve, and default to passing 1 and size(A, 1) as the default values.
In the future this could possibly use the HYPRE sequential compiler
flag to completely avoid MPI.
This patch changes the argument order from:
HYPREMatrix(::SparseMatrixCS(C|R), ::Integer, ::Integer, ::MPI.Comm)
HYPREVector(::Vector, ::Integer, ::Integer, ::MPI.Comm)
to:
HYPREMatrix(::MPI.Comm, ::SparseMatrixCS(C|R), ::Integer, ::Integer)
HYPREVector(::MPI.Comm, ::Vector, ::Integer, ::Integer)
to match the basic constructor. This also makes it easier to default
owned rows to the full matrix/vector for single process solves. The
methods without the communicator (added in this patch) will in the
future have this default.
This patch adds the communicator and the owned rows to the
`HYPRE(Matrix|Vector)` structs. The `Internals.init_(matrix|vector)`
functions have been removed in favor of:
HYPREMatrix(::MPI.Comm, ::Integer, ::Integer, ::Integer, ::Integer)
HYPREVector(::MPI.Comm, ::Integer, ::Integer)
which more or less mirrors the `IJ(Matrix|Vector)Create` functions.
This patch adds the following methods:
solve( ::HYPRESolver, ::PSparseMatrix, ::PVector)
solve!(::HYPRESolver, ::PVector, ::PSparseMatrix, ::PVector)
which automatically converts to/from HYPRE(Matrix|Vector).
This patch adds a function
solve(::HYPRESolver, ::HYPREMatrix, ::HYPREVector) which initializes an
output vector initialized to 0 and pass it to solve!.