ug4
|
HLibPro is a parallel H-matrix library for shared and distributed memory machines. Hierarchical matrices, or H-matrices for short, are a powerful tool for numerical applications allowing the usage of the complete matrix algebra, e.g. matrix multiplication and inversion, with almost linear complexity (short description from http://www.hlibpro.com/).
NOTE: HLibPro is an external library, for which we do not provide the sources! Nevertheless our group has access to the HLibPro sources within "ASIL" project. Otherwise you may get a license contacting Dr. Ronald Kriemann, rok@m. is.m pg.de
Some functionality of HLibPro is used to define a sparse matrix solver (type 'IMatrixOperatorInverse'), based on the functions of the HLibPro C interface. See 'ugbase/lib_algebra/operator/linear_solver/hlibpro.h'.
For importing the system matrix assembled by UG to HLibPro a sparse matrix format is used. This format is implemented by a class 'CRSMatrix', which is also defined in 'hlibpro.h'.
The solver is registered as 'HLIBSolver' in 'lib_algebra_bridge.cpp'.
TODO: Import of coordinates and construction of cluster trees based on coordinates aren't implemented yet.
To use this HLibPro functionality from within ug4,
get a copy of HLibPro (sources are not provided with ug4!) and place it somewhere on your filesystem, e.g. ~/bin/hlibpro-0.13.6/, then configure and build HLibPro. See below for some hints to do this!
Check 'cmake/ug_includes.cmake': If necessary adapt path after 'PATH_SUFFIXES' (last argument of 'find_path()' call). In the moment this path is given relative to the location of 'cmake'.
E.g., if your HLibPro main directory resides in '~/bin/', then use
This works e.g. on 'cekon.gcsc.uni-frankfurt.de'. Sometimes it seems to be necessary to give 'PATH_SUFFIXES' relative to the ug4 main directory (observed e.g. on 'quadruped.gcsc.uni-frankfurt.de'):
Everything else (e.g. include paths, including the path to the C interface header file 'hlib-c.hh') depends on 'PATH_SUFFIXES' and is automatically set.
Configure ug4 for using HLibPro, e.g.:
To disable usage of HLibPro:
Compile ug4.
Script code for testing HLibPro is provided in
scripts/hlibtest.lua
Execute this script by running e.g.
For (preliminary) tests for systems of pdes see scripts/systemlaplace_hlib.lua scripts/navierstokes_hlib.lua
To use the HLibPro configuration system, a Python interpreter is needed. Furthermore, the build system for HLibpro is 'SCons' (http://www.scons.org), which also is based on Python.
For further information to the build process of HLibpro we refer to the documentation included in the HLibpro sources, but for convenience we sketch the typical steps here (version 0.13.6; we assume, that the tar ball is placed in '~/bin/' (which probably isn't the most elegant place ...); consider also the "remarks" below):
extract tar ball:
change into HLibPro main directory and configure HLibPro:
compile HLibPro via 'scons' by simply typing
Maybe execute the stand-alone test executables now available in the sub directory 'examples/':
etc.
HLibPro's 'configure' script needs a "not to old python version", especially one whichs knows "subprocesses"! E.g. Python 2.4.3 is ok, Python 2.3.4 is not! So, if you get a message like the following
You have to update your Python installation first!
To do this (or to install it for the first time), get a copy of its current sources (see http://www.python.org) and proceed as follows (this method does not require root access and is also feasible if there is no package available for your machine; in this example we place it in '~/bin/'):
The build process consists of the usual
in the "python main directory".
After all, to finally configure HLibPro you have to check the first line in HLibPro's 'configure' script,
and adapt it if needed to point to your new Python interpreter, e.g. change it to something like:
Then you can type (as mentioned above):
to configure HLibPro.
If you have to build and install 'SCons', get a copy of its current sources unpack them, change into the "scons main directory" and execute its Python- based setup script, e.g. (again we place everything in '~/bin/'):
To finally compile HLibPro execute this version of 'scons' in the "HLibPro main directory" e.g. by typing:
Internally, HLibpro uses LAPACK for most arithmetic operations. For the case no such implementation is available, HLibpro can use a modified version of CLAPACK as a substitute for LAPACK. CLAPACK is contained in the sources of HLibPro.
By default HLibpro is linked against the substitute library, 'libclapack.a' ("by default" according to the provided documentation, 'hlibpro-user.pdf', but I'm in doubt about that, at least on OS X ...), which might result in a reduced performance of HLibpro.
In case an (probably) optimised version of LAPACK is available for your system it is therefore highly recommended to use this instead of CLAPACK. To do so, configure HLibpro this way:
While building the executables in the 'examples/' directory the linker may drop the following error message:
/usr/bin/ld: Undefined symbols: __Unwind_Resume collect2: ld returned 1 exit status scons: *** [examples/bem1d] Error 1 scons: building terminated because of errors.
This seems to be a quite common problem with older versions of OS X / XCode when linking C++ software with gcc instead of g++.
Remedy: Use 'g++' for linking the HLibPro examples! Reason: 'g++' automatically links other system libraries than 'gcc' does, so that the otherwise undefined symbol can be resolved!
To achieve this, do:
When attempting to start one of HLibPro's example executables maybe the following error message shows up, e.g.
This behavior seems to be due to a too old (?) version of LAPACK on your system! It was observed with 3.0.3.(currently installed on 'quadruped'). In contrast, e.g. with Lapack 3.1.1 (currently installed on 'cekon') this problem does not occur.
Remedy: Use the substitute library 'libclapack.a' instead, i.e. configure HLibPro accordingly (cf. above):
to enforce building of 'libclapack.a'.
Independent of (but obviously directly related to) the problem above you may run in a similar problem when attempting to start 'ugshell' compiled with HLibPro:
This may happen even if the stand-alone examples of HLibPro work properly - which is the case if HLibPro is linked against CLAPACK, but ug4's configuration via 'cmake' has automatically chosen the (too old) version of LAPACK installed on your system!
Remedy: Link ug4 also against the "LAPACK substitute", 'libclapack.a'!
To achieve this, add also 'libclapack.a' to the 'UG_LIBRARIES', i.e., edit the appropriate part in 'cmake/ug_includes.cmake':
(Perhaps/probably there exists a more elegant way, but it works ...)