Installing QimPy

Prerequisites

QimPy requires a python environment with PyTorch for the core calculations, along with mpi4py and h5py for communication and disk I/O respectively (in addition to standard libaries such as NumPy, SciPy and matplotlib). QimPy’s installation below will pull in most of these dependencies automatically, but the installation of mpi4py and h5py typically require care and should be done beforehand.

Using conda

Create a new conda environment (recommended) called, say, qimpy:

$ conda create -n qimpy python
$ conda activate qimpy
(qimpy) $

or activate the existing environment you intend to use. The path from where you run these commands should not matter. (See Managing environments in the conda documentation.)

Install mpi4py and parallel h5py:

(qimpy) $ conda install -c conda-forge mpi4py h5py=*=mpi*

Verify that mpi4py and h5py are working correctly in parallel mode following the examples on the parallel h5py page.

We may as well install the other core dependencies from conda as well:

(qimpy) $ conda install numpy scipy pyyaml
(qimpy) $ conda install pytorch -c pytorch -c nvidia

See the PyTorch getting-started page for options on selecting the PyTorch build suitable for your GPU / CUDA configuration.

Installation

To install the last versioned QimPy from PyPI, simply:

(qimpy) $ pip install qimpy

For the latest version from git:

(qimpy) codes$ git clone https://github.com/shankar1729/qimpy.git
(qimpy) codes$ cd qimpy
(qimpy) qimpy$ python setup.py install

Do this within the directory where you want to keep the code, say codes (just make sure you don’t create a venv called qimpy and fetch the code called qimpy from git into the same directory).

If you want to set-up for development, replace that last line:

(qimpy) qimpy$ python setup.py develop

which will allow you to modify the code, and have it take effect directly in the active environment (without installing again).