Skip to content

Commit cd758a2

Browse files
committed
Merge branch 'stage-1.0' into release
2 parents 98131ee + 41f5993 commit cd758a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+8114
-4369
lines changed

.travis.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
os: linux
2+
dist: focal
3+
4+
# NOTE: Focal offers broken CMake-export file for ScaLAPACK containing a
5+
# a non-existent path for the library. On those systems, the CMake export file
6+
# based auto-detection must be disabled by providing the -DSCALAPACK_LIBRARY
7+
# option.
8+
9+
language: python
10+
python: 3.7
11+
12+
13+
env:
14+
- BUILD_SHARED_LIBS=False
15+
- BUILD_SHARED_LIBS=True
16+
17+
addons:
18+
apt:
19+
packages:
20+
- cmake
21+
- gfortran
22+
- libblas-dev
23+
- liblapack-dev
24+
- libopenmpi-dev
25+
- libscalapack-openmpi-dev
26+
27+
install:
28+
- pip install fypp
29+
30+
script:
31+
- >
32+
FC=gfortran
33+
cmake -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
34+
-DSCALAPACK_LIBRARY="scalapack-openmpi"
35+
-DCMAKE_INSTALL_PREFIX=${PWD}/_install
36+
-B _build .
37+
&& cmake --build _build -- -j
38+
&& cmake --install _build
39+
- >
40+
CMAKE_PREFIX_PATH="${PWD}/_install:${CMAKE_PREFIX_PATH}"
41+
./test/integration/cmake/runtest.sh _build_cmake
42+
-DSCALAPACK_LIBRARY="scalapack-openmpi"
43+
- >
44+
PKG_CONFIG_PATH="${PWD}/_install/lib/pkgconfig:${PKG_CONFIG_PATH}"
45+
FC=mpifort
46+
./test/integration/pkgconfig/runtest.sh _build_pkgconfig

CHANGELOG.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**********
2+
Change Log
3+
**********
4+
5+
Notable project changes in various releases.
6+
7+
8+
1.0
9+
===
10+
11+
Added
12+
-----
13+
14+
* Various improvements in the CMake-build system.
15+
16+
* CMake and PKG-Config export files when ScalapackFx is installed.
17+
18+
19+
Changed
20+
-------
21+
22+
* The Fypp-preprocessor is not shipped with ScalapackFx but is an external
23+
requirement.
24+
25+
* Name convention for processes (master -> lead, slave -> follow).

CMakeLists.txt

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
3+
include(CMakePackageConfigHelpers)
4+
5+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake
6+
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
7+
include(ScalapackFxUtils)
8+
9+
include(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake)
10+
11+
project(ScalapackFx VERSION 1.0 LANGUAGES Fortran)
12+
13+
setup_build_type()
14+
15+
#
16+
# Prerequisites
17+
#
18+
find_package(CustomScalapack REQUIRED QUIET)
19+
find_package(CustomLapack REQUIRED)
20+
find_program(FYPP fypp)
21+
if(NOT FYPP)
22+
message(FATAL_ERROR "Preprocessor fypp could not be found")
23+
endif()
24+
25+
#
26+
# Build instructions
27+
#
28+
include(GNUInstallDirs)
29+
30+
add_subdirectory(lib)
31+
if(NOT BUILD_EXPORTED_TARGETS_ONLY)
32+
add_subdirectory(test)
33+
endif()
34+
35+
#
36+
# Installation
37+
#
38+
add_library(ScalapackFx INTERFACE)
39+
target_link_libraries(ScalapackFx INTERFACE scalapackfx)
40+
install(TARGETS ScalapackFx EXPORT scalapackfx-targets)
41+
42+
install(EXPORT scalapackfx-targets
43+
FILE scalapackfx-targets.cmake
44+
NAMESPACE ScalapackFx::
45+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/scalapackfx"
46+
EXPORT_LINK_INTERFACE_LIBRARIES)
47+
48+
configure_package_config_file(
49+
${CMAKE_CURRENT_SOURCE_DIR}/utils/export/scalapackfx-config.cmake.in
50+
${CMAKE_CURRENT_BINARY_DIR}/cmake/scalapackfx-config.cmake
51+
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/scalapackfx)
52+
53+
write_basic_package_version_file(
54+
${CMAKE_CURRENT_BINARY_DIR}/cmake/scalapackfx-config-version.cmake
55+
VERSION ${PROJECT_VERSION}
56+
COMPATIBILITY SameMajorVersion)
57+
58+
install(
59+
FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/scalapackfx-config.cmake
60+
${CMAKE_CURRENT_BINARY_DIR}/cmake/scalapackfx-config-version.cmake
61+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/scalapackfx)
62+
63+
install(
64+
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules
65+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/scalapackfx)
66+
67+
get_pkgconfig_params(PKGCONFIG_REQUIRES PKGCONFIG_LIBS PKGCONFIG_LIBS_PRIVATE PKGCONFIG_C_FLAGS)
68+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/utils/export/scalapackfx.pc.in
69+
${CMAKE_CURRENT_BINARY_DIR}/scalapackfx.pc @ONLY)
70+
install(
71+
FILES "${CMAKE_CURRENT_BINARY_DIR}/scalapackfx.pc"
72+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")

README.rst

Lines changed: 117 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,117 @@
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>`_.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Finds customized libraries.
2+
#
3+
# The customized list of libraries can contain library names, file names or linker options.
4+
# Libraries are searched for by the find_library() function, file names are checked on existence and
5+
# linker options (names starting with "-") are added unchanged.
6+
#
7+
# libs [in]: List of libraries to find.
8+
# libdirs [in]: Directories to look up for the libraries.
9+
# find_quietly [in]: Whether the libraries should be found quietly.
10+
# libs_found [out]: Contains the list of the detected libraries with their full path. If any of
11+
# the libraries/files could not be found, the corresponding entry is replaced by
12+
# "_libpath-NOT_FOUND".
13+
#
14+
function(find_custom_libraries libs libdirs find_quietly libs_found)
15+
16+
set(_libs)
17+
foreach(_lib IN LISTS libs)
18+
if(_lib MATCHES "^[ ]*-.*" OR EXISTS "${_lib}")
19+
list(APPEND _libs ${_lib})
20+
else()
21+
find_library(_libpath ${_lib} HINTS ${libdirs})
22+
list(APPEND _libs ${_libpath})
23+
if(NOT _libpath AND NOT find_quietly)
24+
message(WARNING "Could not find library '${_lib}' (path hints '${libdirs}'")
25+
endif()
26+
unset(_libpath CACHE)
27+
endif()
28+
endforeach()
29+
set(${libs_found} "${_libs}" PARENT_SCOPE)
30+
31+
endfunction()

0 commit comments

Comments
 (0)