|
1 | | -SCALAPACKFX - Modern Fortran Interface for SCALAPACK, PBLAS and BLACS |
2 | | -===================================================================== |
3 | | - |
4 | | -The open source library `SCALAPACKFX |
5 | | -<https://www.bitbucket.org/aradi/scalapackfx>`_ is an effort to provide modern |
6 | | -Fortran (Fortran 2003) wrappers around routines of the SCALAPACK, PBLAS and |
7 | | -BLACS libraries to make their use as simple as possible. |
8 | | - |
9 | | -A few essential routines (especially those related to diagonalization) are |
10 | | -already covered. See the documentation or the `online API documentation |
11 | | -<https://aradi.bitbucket.org/scalapackfx/api/annotated.html>`_ whether the |
12 | | -routines you need are there. If not, you are cordially invited to extend |
13 | | -SCALAPACKFX and to share it in order to let others profit from your |
14 | | -work. SCALAPACKFX is licensed under the **simplified BSD license**. |
15 | | - |
16 | | -Information about installation and usage of the library you find in the |
17 | | -documentation in the source or in the `online documentation |
18 | | -<https://aradi.bitbucket.org/scalapackfx/>`_. Project status, current source |
19 | | -code, bugtracker etc. can be found on the `SCALAPACKFX project home page |
20 | | -<https://www.bitbucket.org/aradi/scalapackfx>`_. |
| 1 | +**************************************************** |
| 2 | +ScalapackFx - Modern Fortran Interface for ScaLAPACK |
| 3 | +**************************************************** |
| 4 | + |
| 5 | +The open source library `ScalapackFx <https://github.com/dftbplus/scalapackfx>`_ |
| 6 | +provides convenient modern Fortran (Fortran 2003) wrappers for the routines of |
| 7 | +the ScaLAPACK library. Currently mostly the routines related to diagonalization |
| 8 | +are covered. |
| 9 | + |
| 10 | +The documentation is included inside the repository, but is also available at |
| 11 | +`dftbplus.github.io <https://dftbplus.github.io/>`_. |
| 12 | + |
| 13 | + |
| 14 | +Installation |
| 15 | +============ |
| 16 | + |
| 17 | +Prerequisites |
| 18 | +------------- |
| 19 | + |
| 20 | +* CMake (version >= 3.16) |
| 21 | + |
| 22 | +* Fortran 2003 compatible Fortran compiler |
| 23 | + |
| 24 | +* MPI-library and wrappers for your compiler |
| 25 | + |
| 26 | +* ScaLAPACK and LAPACK libraries |
| 27 | + |
| 28 | +* `Fypp preprocessor <https://github.com/aradi/fypp>`_ |
| 29 | + |
| 30 | + |
| 31 | +Building and installing the library |
| 32 | +----------------------------------- |
| 33 | + |
| 34 | +The library can be built and installed with the usual CMake-workflow:: |
| 35 | + |
| 36 | + FC=gfortran cmake -B _build -DCMAKE_INSTALL_PREFIX=$HOME/opt/scalapackfx |
| 37 | + cmake --build _build |
| 38 | + cmake --install _build |
| 39 | + |
| 40 | +You can influence the configuration via CMake-variables. A list of those |
| 41 | +variables can be found in `config.cmake <config.cmake>`_. You can either modify |
| 42 | +the values directly there or pass them as command line option at the |
| 43 | +configuration phase, e.g.:: |
| 44 | + |
| 45 | + FC=ifort cmake -B _build \ |
| 46 | + -DSCALAPACK_LIBRARY=mkl_scalapack_lp64;mkl_blacs_intelmpi_lp64 \ |
| 47 | + -DLAPACK_LIBRARY=mkl_intel_lp64;mkl_sequential;mkl_core |
| 48 | + |
| 49 | +When customizing the external libraries as above, each of them will be searched |
| 50 | +for and checked for existence. You can disable these checks by setting the |
| 51 | +``SCALAPACK_DETECTION`` and ``LAPACK_DETECTION`` variables to ``False`` (not |
| 52 | +recommended). |
| 53 | + |
| 54 | + |
| 55 | +Testing |
| 56 | +------- |
| 57 | + |
| 58 | +A few tests (and usage examples) can be found in the `test/` subdirectory. The |
| 59 | +compiled test examples must be invoked from this directory, e.g.:: |
| 60 | + |
| 61 | + cd test |
| 62 | + mpirun -n 2 ../_build/test/test_det |
| 63 | + |
| 64 | + |
| 65 | +Using the library |
| 66 | +================= |
| 67 | + |
| 68 | +CMake build |
| 69 | +----------- |
| 70 | + |
| 71 | +* Make sure to add the root folder of the installed library to the |
| 72 | + ``CMAKE_PREFIX_PATH`` environment variable. |
| 73 | + |
| 74 | +* Use ``find_package()`` in `CMakeLists.txt` to locate the library and link |
| 75 | + ``ScalapackFx::ScalapackFx`` to every target which relies directly on the |
| 76 | + library :: |
| 77 | + |
| 78 | + cmake_minimum_required(VERSION 3.16) |
| 79 | + |
| 80 | + project(TestScalapackFxBuild LANGUAGES Fortran) |
| 81 | + |
| 82 | + find_package(ScalapackFx REQUIRED) |
| 83 | + |
| 84 | + add_executable(test_build test_build.f90) |
| 85 | + target_link_libraries(test_build ScalapackFx::ScalapackFx) |
| 86 | + |
| 87 | +Note: When ScalapackFx is found by CMake, it will try to resolve its own |
| 88 | +dependencies (ScaLAPACK and LAPACK) via the ``find_dependency()`` function. You |
| 89 | +can use your own finders for those dependencies as long as they export the |
| 90 | +targets ``Scalapack::Scalapack`` and ``LAPACK::LAPACK`` with the proper |
| 91 | +configuration as ScalapackFx uses those as link targets through the |
| 92 | +``target_link_libraries()`` function. If those targets do not exists when |
| 93 | +ScalapackFx is being searched for, the custom finders shipped with ScalapackFx |
| 94 | +will be invoked to search for the necessary libraries. |
| 95 | + |
| 96 | + |
| 97 | +Pkg-config build |
| 98 | +---------------- |
| 99 | + |
| 100 | +* Make sure to add the `lib/pkgconfig` folder of the installed library to the |
| 101 | + ``PKG_CONFIG_PATH`` environment variable. |
| 102 | + |
| 103 | +* Query the include and library options needed for the build with the usual |
| 104 | + ``pkg-config`` commands:: |
| 105 | + |
| 106 | + mpifort $(pkg-config --cflags mpifx) test_mpifxbuild.f90 $(pkg-config --libs mpifx) |
| 107 | + |
| 108 | + Note, that neither ``-cflags`` or ``--libs`` return any options related to |
| 109 | + your MPI-framework nor is the MPI-framework specified as dependency in the |
| 110 | + pkg-config file. Use the MPI-wrapper of your compiler to compile and link your |
| 111 | + executable or pass the additional include and library options by hand. |
| 112 | + |
| 113 | + |
| 114 | +License |
| 115 | +======= |
| 116 | + |
| 117 | +ScalapackFx is licensed under the `BSD-2-Clause License <LICENSE>`_. |
0 commit comments