DBCSR@MatrixSwitch

Purpose of Module

MatrixSwitch is a module which acts as an intermediary interface layer between high-level and low-level routines dealing with matrix storage and manipulation. It allows a seamlessly switch between different software implementations of the matrix operations.

DBCSR is an optimized library to deal with sparse matrices, which appear frequently in many kind of numerical simulations. In DBCSR@MatrixSwitch DBCSR capabilities have been added to MatrixSwitch as an optional library dependency.

Background Information

MatrixSwitch, DBCSR, and DBCSR@MatrixSwitch are software libraries to be used within a calling code. MatrixSwitch has been developed within the same repository of other self-contained libraries, all them collected in the omm-bundle project (see the Source Code section below). As DBCSR has been added to MatrixSwitch in a modular way, all them can be used together or separated.

To carry out calculations in serial mode may be too slow sometimes and a paralellisation strategy is needed. In serial/parallel MatrixSwitch employs Lapack/ScaLapack to perform matrix operations, irrespective of their dense or sparse character. The disadvantage of the Lapack/ScaLapack schemes is that they are not optimized for sparse matrices. DBCSR provides the necessary algorithms to solve this problem and in addition is specially suited to work in parallel.

Installation

The source code of the MatrixSwitch module is contained in a subdirectory of of the omm-bundle package with the same name, omm/MatrixSwitch. ‘omm-bundle’ is in a git repository and can be obtained in this way:

The DBCSR library was originally developed as part of the CP2K code, it is now available as a standalone library, and can be found in the CP2K releases directory:

Build instructions for the DBCSR library are available on the project page.

To enable DBCSR@MatrixSwitch in the omm-bundle package follow the steps below:

  1. Enter the omm directory.
  2. Copy make.inc.example to make.inc and modify it to suit your needs. To use DBCSR in MatrixSwitch include in your make.inc the path to the DBCSR library and add to FPPFLAGS the new flag -DHAVE_DBCSR (this requires that -DHAVE_MPI is also enabled).
  3. Type make -f Makefile.manual.
  4. Type make -f Makefile.manual install.

Testing

The examples directory of MatrixSwitch contains example_pdcsr_pddbc.F90. It explains the use of DBCSR@MatrixSwitch and how DBCSR works. DBCSR results are compared to those obtained with Scapalack to check the validity of the new procedure. If this comparison fails, the program will exit immediately. To compile it:

  1. Enter the omm/MatrixSwitch/examples directory.
  2. Copy make.inc.example to make.inc and modify it to suit your needs. Be aware that make.inc in the src directory will also be used.
  3. Type make -f Makefile.manual.

As in the other examples in MatrixSwitch, example_pdcsr_pddbc.F90 contains a header explaining what the program does and provides a sample output to compare with.

Source Code

In the E-CAM Gitlab can be found all the source codes of MatrixSwitch and omm-bundle, while DBCSR itself is in the set of CP2K Github repositories.