Kwant is a free (open source) Python package for numerical calculations on tight-binding models with a strong focus on quantum transport.
We found that performance is improving by changing OMP_NUM_THREADS
export OMP_NUM_THREADS=1
1. Install kwant in Anaconda virtual environment
Create this files to create Anaconda virtual environment:
$ cat /cluster/home/[USERNAME]/anaconda_env_kwant.yml
name: MyKwant
channels:
- conda-forge
- defaults
dependencies:
- kwant
Creat virtual environment:
$ module load Anaconda3/2022.10
(base) $ conda env create --prefix /cluster/home/[USERNAME]/anaconda_env_kwant -f anaconda_env_kwant.yml
Activate new Anaconda virtual environment:
$ module load Anaconda3/2022.10
$ conda activate /cluster/home/[USERNAME]/anaconda_env_kwant
$ export OMP_NUM_THREADS=1
(/cluster/home/[USERNAME]/anaconda_env_kwant) $ python
>>> import kwant
2. (Optional alternative) Build kwant from source code in Python virtual environment
kwant requires sequential MUMPS.
We modified EasyBuild parallel MUMPS file and created new with one change ('usempi': False):
$ grep usempi ./MUMPS-5.4.1-foss-2021b-metis-seq.eb
toolchainopts = {'pic': True, 'usempi': False}
Sequential library file was created:
$ ls -la /cluster/apps/eb/software/MUMPS/5.4.1-foss-2021b-metis-seq/lib/libmpiseq.a
To build kwant load this modules:
module load foss/2021b
module load SciPy-bundle/2021.10-foss-2021b
module load MUMPS/5.4.1-foss-2021b-metis-seq
Create new environment:
python -m venv /cluster/home/[USERNAME]/PyEnvKwant
source /cluster/home/[USERNAME]/PyEnvKwant/bin/activate
Install requered Python modules:
pip install mpmath
pip install sympy==1.4
pip install tinyarray
pip install qsymm
pip install Cython
Download kwant:
curl -O https://downloads.kwant-project.org/kwant/kwant-1.4.3.tar.gz
tar xf kwant-1.4.3.tar.gz
cd kwant-1.4.3
build.conf needs changes for sequential MUMPS (https://kwant-project.org/doc/1.0/pre/install#build-configuration)
$ cat build.conf
[mumps]
libraries = zmumps mumps_common pord metis esmumps scotch scotcherr mpiseq
gfortran
Build
python3 setup.py build
python3 setup.py install
Activate new Python virtual environment:
$ module load foss/2021b
$ module load SciPy-bundle/2021.10-foss-2021b
$ module load MUMPS/5.4.1-foss-2021b-metis-seq
$ source /cluster/home/[USERNAME]/PyEnvKwant/bin/activate
$ export OMP_NUM_THREADS=1
(PyEnvKwant) $ python
>>> import kwant