Skip to content

Simple benchmarking tool for the linear solvers of OPM.

License

Notifications You must be signed in to change notification settings

multitalentloes/opm-linear-solver-lab

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opm-linear-solver-lab

Experimental playground for testing out linear solvers in OPM Flow.

Compiling

We assume you have opm and dune in your prefix path. Compiling should just be

mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make

Note that you probably want to specify CMAKE_PREFIX_PATH to point to the locations of the OPM and Dune build folder, that is

# from build. 
# IMPORTANT: Notice the quotation marks around the prefix path. 
# This is IMPORTANT when you have multiple paths
cmake .. -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_PREFIX_PATH="/path/to/opm-common/build;/path/to/opm-grid/build;MOREPATHSHERE"

To simplify this process, we've added the script build_helpers/prefix_path.sh to generate this prefix path. If you directory structure looks like this:

#DUNE
/some/path/for/dune/dune-common/build
/some/path/for/dune/dune-grid/build
/some/path/for/dune/dune-geometry/build
/some/path/for/dune/dune-istl/build

#OPM
/some/path/other/path/for/opm/opm-common/build
/some/path/other/path/for/opm/opm-grid/build
/some/path/other/path/for/opm/opm-models/build
/some/path/other/path/for/opm/opm-simulators/build

you can run cmake as

# from build. 
cmake .. -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_PREFIX_PATH="$(bash ../build_helpers/prefix_path.sh /some/path/other/path/for/opm/ /some/path/for/dune/dune-common/)"

Note on libfmt

You probably need to have libfmt installed. On Ubuntu this can be accomplished by installing

sudo apt install libfmt-dev

Alternatively you can manually donwload and install libfmt. Make sure to extend your CMAKE_PREFIX_PATH to contain the install directory of libfmt.

Running

From the build folder, you can run eg.

./linsolverlab \
    -x ../examples/matrices/spe1/rhs.mm \
    -y  ../examples/matrices/spe1/rhs.mm  \
    -m  ../examples/matrices/spe1/matrix.mm \
    -c ../examples/configurations/cpu/ilu0.json \
    -g ../examples/configurations/gpu/cuilu0.json

Example output

{
    "CPU": {
        "runtime": "21541",
        "failed_by_exception": "false",
        "iterations": "25",
        "reduction": "9.463892568041427e-13",
        "converged": "true",
        "conv_rate": "0.33040209473507992",
        "elapsed": "0.021522673999999999",
        "condition_estimate": "-1"
    },
    "GPU": {
        "runtime": "21831",
        "failed_by_exception": "false",
        "iterations": "25",
        "reduction": "3.532348061635463e-13",
        "converged": "true",
        "conv_rate": "0.31763074967064442",
        "elapsed": "0.02177946",
        "condition_estimate": "-1"
    }
}

Running only preconditioner

./linsolverlab \
    -x ../examples/matrices/spe1/rhs.mm \
    -y  ../examples/matrices/spe1/rhs.mm  \
    -m  ../examples/matrices/spe1/matrix.mm \
    -c ../examples/configurations/cpu/ilu0_onlypreconditioner.json \
    -g ../examples/configurations/gpu/cuilu0_onlypreconditioner.json

Example output

{
    "CPU": {
        "runtime": "6",
        "failed_by_exception": "false",
        "iterations": "1",
        "reduction": "0",
        "converged": "true",
        "conv_rate": "1",
        "elapsed": "0",
        "condition_estimate": "-1"
    },
    "GPU": {
        "runtime": "2396",
        "failed_by_exception": "false",
        "iterations": "1",
        "reduction": "0",
        "converged": "true",
        "conv_rate": "1",
        "elapsed": "0",
        "condition_estimate": "-1"
    }
}

About

Simple benchmarking tool for the linear solvers of OPM.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 86.8%
  • CMake 10.8%
  • Shell 2.4%