Skip to content

Latest commit

 

History

History
91 lines (69 loc) · 4.61 KB

extra.rst

File metadata and controls

91 lines (69 loc) · 4.61 KB

Extra requirements

We have some extra requirements that you don't need to install to use TeNPy, but that you might find usefull to work with. TeNPy does not import the following libraries (at least not globally), but some functions might expect arguments behaving like objects from these libraries.

Matplotlib

The first extra requirement is the [matplotlib] plotting library. Some functions expect a matplotlib.axes.Axes instance as argument to plot some data for visualization.

Intel's Math Kernel Library (MKL)

If you want to run larger simulations, we recommend the use of Intel's MKL. It ships with a Lapack library, and uses optimization for Intel CPUs. Moreover, it uses parallelization of the LAPACK/BLAS routines, which makes execution much faster. As of now, the library itself supports no other way of parallelization.

If you don't have a python version which is built against MKL, we recommend using [conda] or directly intelpython. Conda has the advantage that it allows to use different environments for different projects. Both are available for Linux, Mac and Windows; note that you don't even need administrator rights to install it on linux. Simply follow the (straight-forward) instructions of the web page for the installation. After a successfull installation, if you run python interactively, the first output line should state the python version and contain Anaconda or Intel Corporation, respectively.

If you have a working conda package manager, you can install the numpy build against MKL with:

conda install mkl mkl-devel numpy scipy 

The mkl-devel package is required for linking against MKL, i.e. for compiling the Cython code. As outlined in /install/conda, on Linux/Mac you also need to pin blas to use MKL with the following line, if you use the `conda-forge` channel:

conda install "libblas=*=*mkl"

Compile linking agains MKL

When you compile the Cython files of TeNPy, you have the option to explicilty link against MKL, such that e.g. tenpy.linalg.np_conserved.tensordot is guaranteed to call the corresponding dgemm or zgemm function in the BLAS from MKL. To link against MKL, the MKL library including the headers must be available during the compilation of TeNPy's Cython files. If you have the MKL library installed, you can export the environemnt variable MKLROOT to point to the root folder. Alternatively, TeNPy will recognise if you are in an active conda environment and have the mkl and mkl-devel conda packages installed during compilation. In this case, it will link against the MKL provided as conda package.

tenpy.show_config indicates whether you linked successfully against MKL:

>>> import tenpy
>>> tenpy.show_config()
tenpy 0.7.2.dev130+76c5b7f (compiled with HAVE_MKL),
git revision 76c5b7fe46df3e2241d85c47cbced3400caad05a using
python 3.9.1 | packaged by conda-forge | (default, Jan 10 2021, 02:55:42) 
[GCC 9.3.0]
numpy 1.19.5, scipy 1.6.0

HDF5 file format support

We support exporting data to files in the [HDF5] format through the python interface of the h5py <https://docs.h5py.org/en/stable/> package, see /intro/input_output for more information. However, that requires the installation of the HDF5 library and h5py.

YAML parameter files

The tenpy.tools.params.Config class supports reading and writing YAML files, which requires the package pyyaml; pip install pyyaml.

Tests

To run the tests, you need to install pytest, which you can for example do with pip install pytest. For information how to run the tests, see /install/test.