GithubHelp home page GithubHelp logo

hypre-space / hypredrive Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 2.3 MB

High-level interface for solving linear systems with hypre

License: Other

Makefile 0.48% Shell 0.68% C 85.67% M4 8.64% Python 4.52%

hypredrive's People

Contributors

victorapm avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hypredrive's Issues

Better error handling

Improve error handling in the following scenarios:

  • Filename not found (matrix, RHS, or dofmap)
  • Missing level keyword when using MGR

Fix `LDFLAGS`

Fix LDFLAGS when compiling with externally built Hypre library (GEOS-TPL)

Add system tests

To be added under test/system for the purpose of testing whole system (end-to-end) application, e.g.,

  1. Does YAML parsing succeed?
  2. Does hypre_app finish completion with a zero error code?

Consider using pytest for generating the program calls and checking the output

Add LS partitioning option

Given a linear system, possibly distributed in many files (one of each rank), we would like to allow run a graph partitioner such as parmetis, ptscotch or zoltan.

This should work for redistributing the input LS to any number of ranks. For example, we can read using 8 ranks, and redistribute to 4 or 16...

Allow multiple solver configs with a single input file

We would like to allow something like this:

general:
  warmup: no
  num_repetitions: 1

linear_system:
  type: ij
  rhs_filename: IJ.out.b
  matrix_filename: IJ.out.A

solver:
  pcg:
    relative_tol: 1.0e-9
    max_iter: 500
    print_level: 3

preconditioner:
  amg:
    -
      print_level: 1
      coarsening:
        type: HMIS
        strong_th: 0.25
      interpolation:
        prolongation_type: MM-ext+i
      relaxation:
        down_type: 16
        down_sweeps: 1
        up_type: 16
        up_sweeps: 1

    -
      print_level: 1
      coarsening:
        type: PMIS
        strong_th: 0.5
      interpolation:
        prolongation_type: standard
      relaxation:
        down_type: 8
        down_sweeps: 2
        up_type: 8
        up_sweeps: 2

  # Add more configurations as needed

Also, something like this:

general:
  warmup: no
  num_repetitions: 1

linear_system:
  type: ij
  rhs_filename: IJ.out.b
  matrix_filename: IJ.out.A

solver:
  pcg:
    relative_tol: 1.0e-9
    max_iter: 500
    print_level: 3

preconditioner:
  amg:
    - config_1.yml
    - config_2.yml

And same for solver...

hypre_app would then run all possible combinations.

This can be the early stage of an autotuner.

Update code name

  • Change repo address
  • hypre_app -> hypredrive
  • Append public APIs with HYPREDRIVE_

Create an input argument helper list

The number of input arguments we accept via the YAML file, and their respective valid values, evolve over time. We need a simple way to tell users:

  1. Which options they can use?
  2. Which values are accepted by those options?

One idea is via command line, let's say:

$ ./hypre_app --help

  Usage: ./hypre_app input.yml

  List of valid sections for input.yml:

    general
    linear_system
    solver
    preconditioner

  For more information about which section: ./hypre_app --help <section>

Then, we might do:

$ ./hypre_app --help solver

  List of valid values for the solver:
     pcg - Preconditioned Conjugate Gradient
     gmres - Generalized Minimal RESidual
     fgmres - Flexible Generalized Minimal RESidual
     bicgstab - Bi-Conjugate Gradient STABilized

  List of valid keys under the solver section:

    max_iter: <val> - val is a positive integer number
    print_level: <val> - val is a positive integer number in {0, 1, 2}
    tol: <val> - val is a non-negative real number
    ...

Create a library

Build a library out of the hypre_app project.

We should expose, via a public header file, mainly the functions needed to setup LS, preconditioner, and solver (as we have in main.c). Then, main.c would work by including only such a header

Consider adding an option to allow export only of the public debug symbols

Add script for adding new arguments automatically

The new python script would add new options to a given argument's struct, e.g.,

Suppose we want to add the field iter_setup to ILU:

 $ ./add-option.py -n "iter_setup" -t "HYPRE_Int" -a "ILU_args" -c "HYPRE_ILUSetIterSetup"

And this would update ILU_args struct with a new iter_setup option

Fix `configure.ac` warnings

configure.ac: warning: missing AC_CHECK_FUNCS([memset]) wanted by: src/stats.c:21
configure.ac: warning: missing AC_CHECK_FUNCS([strstr]) wanted by: src/yaml.c:236
configure.ac: warning: missing AC_CHECK_FUNCS([strtol]) wanted by: src/containers.c:261
configure.ac: warning: missing AC_CHECK_HEADERS([stdint.h]) wanted by: include/error.h:15
configure.ac: warning: missing AC_CHECK_HEADER_STDBOOL wanted by: include/error.h:42
configure.ac: warning: missing AC_C_INLINE wanted by: src/yaml.c:347
configure.ac: warning: missing AC_FUNC_REALLOC wanted by: include/yaml.h:103
configure.ac: warning: missing AC_TYPE_UINT32_T wanted by: include/error.h:41

Add concatenation feature for multiple YAML input files

Assuming:

  1. base.yml:
general:
  warmup: no
  num_repetitions: 1

linear_system:
  type: ij
  rhs_filename: IJ.out.b
  matrix_filename: IJ.out.A
  dofmap_filename: dofmap
  1. solver.yml
solver:
  fgmres:
    max_iter: 500
    relative_tol: 1.0e-3
    print_level: 2
  1. prec.yml
preconditioner:
  mgr:
    print_level: 1
    level:
      0:
        f_dofs: [0]
        f_relaxation: single
        g_relaxation: none
        restriction_type: injection
        prolongation_type: jacobi
        coarse_level_type: rap
    coarsest_level:
      amg:
        coarsening:
          strong_th: 0.3

We would like to do:

  $ ./hypre_app base.yml prec.yml solver.yml

and the YAML inputs would get concatenated internally as:

general:
  warmup: no
  num_repetitions: 1

linear_system:
  type: ij
  rhs_filename: IJ.out.b
  matrix_filename: IJ.out.A
  dofmap_filename: dofmap
preconditioner:
  mgr:
    print_level: 1
    level:
      0:
        f_dofs: [0]
        f_relaxation: single
        g_relaxation: none
        restriction_type: injection
        prolongation_type: jacobi
        coarse_level_type: rap
    coarsest_level:
      amg:
        coarsening:
          strong_th: 0.3
solver:
  fgmres:
    max_iter: 500
    relative_tol: 1.0e-3
    print_level: 2

We shouldn't have limitations on the number of input files.

Note the order of solver/preconditioner shouldn't matter

JOSS Paper Comments

In reference to JOSS review thread: openjournals/joss-reviews#6654.

With regard to the state of the field, are there other solver libraries/languages that have quick solver prototyping? For example, MATLAB has rapid prototyping for choosing solvers and options. What specifically about PETSc inspires this work?

With regard to the statement of need, who is the target audience (hypre developers, hypre users, external users, application developers)?

Implement warmup stage

The warmup stage is not timed and it could consist of:

  • Solving a small 7-pt poisson problem
  • Solve the test case itself (but do not count toward timings)

First idea seems more adequate.

Simplify setup of `f_dofs` for MGR

Instead of passing in numbers, we would like to inform labels (suggested by Matteo), e.g.,

preconditioner:
  mgre:
    level:
      0:
        f_dofs: [wells]
      1:
        f_dofs: [water_density]
      2:
        f_dofs: [oil_density]

This will require a mapping between dof markers and labels, e.g.:

linear_system:
  dof_labels:
    wells: 3
    water_density: 1
    oil_density: 2
    pressure: 0

or

linear_system:
  dof_labels:
    3: wells
    1: water_density
    2: oil_density
    0: pressure

Add examples

  • Solving a sequence of linear systems (with AMG?)

Fix YAML syntax

We need to fix some issues in the syntax of our YAML strategy, which is not currently compliant with the standard.

Target one should be something like:

general:
  warmup: no
  num_repetitions: 1

linear_system:
  type: ij
  rhs_filename: IJ.out.b
  matrix_filename: IJ.out.A
  dofmap_filename: dofmap.out

solver:
  type: fgmres
  print_level: 2
  tolerance: 1.0e-6
  max_iterations: 500
  subspace_dim: 30

preconditioner:
  type: mgr
  print_level: 1
  pmax: 0
  levels:
    0:
      f_dofs: [0]
      f_relaxation:
        type: jacobi
        sweeps: 1
      g_relaxation: none
      restriction_type: injection
      prolongation_type: jacobi
      coarse_level_type: rap # coarse_level? schur_comp? reduction_strategy?
    1:
      f_dofs: [1]
      f_relaxation: none
      g_relaxation:
        type: ilu
        subtype: fill
        fill: 0
        sweeps: 1
      restriction_type: injection
      prolongation_type: jacobi
      coarse_level_type: cpr-like-bdiag

  coarse_solver: # coarsest_solver?
    type: boomeramg
    print_level: 0
    strong_th: 0.3
    pmax: 6

Add preconditioner reuse

Implement preconditioner reuse at every "n" linear system solves

This requires hypre_app to work with a sequence of linear systems, thus depends on #3

Read sequence of linear systems

We currently support only one linear system (matrix, rhs, dofmap) per YAML input.

The idea here is to allow users to pass in a sequence of linear systems (different matrices and vectors) to be solved by the given preconditioner/solver strategy defined in the YAML input.

Need to allow for a new linear_system structure in the YAML file. Example:

linear_system:
  directory:
    base: hypre-data/ls_
    init_suffix: 00000
    last_suffix: 00349
  matrix_filename: IJ.A.out
  rhs_filename: IJ.b.out
  dofmap_filename: dofmap.out 

This would read all:

  • matrices with prefix name as IJ.A.out defined in the sub-directories starting from ./hypre-data/ls_00000 up to ./hypre-data/ls_00349.
  • Same as above for the rhs vectors
  • Same as above for the dofmap vectors

Enhance input arguments setup

Allow users to oversubscribe input arguments passed from the YAML file via command line.

Example:

Suppose we have a YAML input like:

solver: gmres
  max_iter: 50
  print_level: 1
  tol: 1.0e-9

The idea is to allow users to oversubscribe, let's say the max_iter parameter, via command line such as:

$ ./hypre_app input.yml --solver:gmres:max_iter 100

Note the YAML (key, val) pairs are effectively being concatenated with the : character.

Also, we would like this to work:

  $ ./hypre_app input.yml --linear_system:execution_policy host
  $ ./hypre_app input.yml --linear_system:execution_policy device

Update folders structure

Consider a new organization structure:

├── data
├── src
    ├── solver
    ├── precon
    ├── linsys
    ├── misc
├── include
├── examples
    ├── amg
    ├── mgr
     ...
└── test
    ├── system

The folders:

  1. examples: quick-start examples for users
  2. data: some example matrices/vectors
  3. test/system: test whole system (end-to-end) application

Add hypre_data struct

This new struct will hold pointers to the linear system data (matrix, vectors) and secondary info like the dofmap array.

It will adjust according to the conceptual linear system interface in use.

It will have set/get functions for accessing the internal data

Implement timers

We need to have simple timers based on MPI_Wtime on the most relevant stages of the driver (read LS, setup, solve)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.