qp2/INSTALL.rst

357 lines
8.4 KiB
ReStructuredText
Raw Normal View History

2019-01-25 11:39:31 +01:00
============
Installation
============
2021-11-29 10:39:34 +01:00
|qp| can be downloaded on GitHub as an `archive
<https://github.com/QuantumPackage/qp2/releases>`_ or as a `git
repository <https://github.com/QuantumPackage/qp2>`_.
2019-01-25 11:39:31 +01:00
.. code:: bash
git clone https://github.com/QuantumPackage/qp2
2019-01-25 11:39:31 +01:00
Before anything, go into your :file:`quantum_package` directory and run
.. code:: bash
./configure
This script will create the :file:`quantum_package.rc` bash script, which
2021-11-29 10:39:34 +01:00
sets all the environment variables required for the normal operation of
|qp|. It will also initialize the git submodules that are
2021-07-05 19:14:59 +02:00
required, and tell you which external dependencies are missing and need to be
installed. The required dependencies are located in the
2021-11-29 10:39:34 +01:00
`external/qp2-dependencies` directory, such that once |qp| is configured the
2021-07-05 19:14:59 +02:00
internet connection is not needed any more.
2019-01-25 11:39:31 +01:00
2021-07-05 19:14:59 +02:00
When all dependencies have been installed, (the :command:`configure` will
2021-11-29 10:39:34 +01:00
inform you what is missing) source the :file:`quantum_package.rc` in order to
load all environment variables and compile |QP|.
2019-01-25 11:39:31 +01:00
2020-12-04 14:31:05 +01:00
Now all the requirements are met, you can compile the programs using
.. code:: bash
make
2019-01-25 11:39:31 +01:00
2021-11-29 10:39:34 +01:00
Installation of dependencies via a Conda environment
====================================================
.. code:: bash
conda env create -f qp2.yml
2019-01-25 11:39:31 +01:00
Requirements
============
- Linux OS
- Fortran compiler : GNU Fortran, Intel Fortran or IBM XL Fortran
- `GNU make`_
- `Autoconf`_
- `Python`_ > 3.7
2019-01-25 11:39:31 +01:00
- |IRPF90| : Fortran code generator
- |EZFIO| : Easy Fortran Input/Output library generator
- |BLAS| and |LAPACK|
- `Zlib`_
- `GNU Patch`_
- |ZeroMQ| : networking library
- `GMP <https://gmplib.org/>`_ : Gnu Multiple Precision Arithmetic Library
2020-03-17 16:39:43 +01:00
- |OCaml| compiler with |OPAM| package manager
2019-01-25 11:39:31 +01:00
- |Ninja| : a parallel build system
2020-12-06 15:58:48 +01:00
- |pkg-config| : a tool which returns information about installed libraries
2019-01-25 11:39:31 +01:00
When all the dependencies have been installed, go into the :file:`config`
directory, and copy the configuration file that corresponds to your
architecture. Modify it if needed, and run :command:`configure` with
:option:`configure -c`.
.. code:: bash
2021-11-29 10:39:34 +01:00
cp ./config/gfortran.example config/gfortran_avx.cfg
./configure -c config/gfortran_avx.cfg
2019-01-25 11:39:31 +01:00
.. note::
The ``popcnt`` instruction accelerates *a lot* the programs, so the
SSE4.2, AVX or AVX2 instruction sets should be enabled in the
configuration file if possible.
Help for installing external dependencies
=========================================
Using the :command:`configure` executable
-----------------------------------------
2020-03-17 16:39:43 +01:00
The :command:`configure` executable can help you in installing the minimal dependencies you will need to compile the |QP|.
The command is to be used as follows:
2019-01-25 11:39:31 +01:00
.. code:: bash
2021-11-29 10:39:34 +01:00
./configure -i <package>
2019-01-25 11:39:31 +01:00
2020-03-17 16:39:43 +01:00
The following packages are supported by the :command:`configure` installer:
2019-01-25 11:39:31 +01:00
2020-03-17 16:39:43 +01:00
* ninja
* zeromq
2019-01-25 11:39:31 +01:00
* f77zmq
* gmp
2021-07-05 19:14:59 +02:00
* ocaml (:math:`\approx` 5 minutes)
2020-03-17 16:39:43 +01:00
* docopt
* resultsFile
2019-01-25 11:39:31 +01:00
* bats
2021-11-29 10:39:34 +01:00
* zlib
2019-01-25 11:39:31 +01:00
2020-03-17 16:39:43 +01:00
Example:
2019-01-25 11:39:31 +01:00
.. code:: bash
2021-11-29 10:39:34 +01:00
./configure -i ninja
2019-01-25 11:39:31 +01:00
If the :command:`configure` executable fails to install a specific dependency
-----------------------------------------------------------------------------
2021-11-29 10:39:34 +01:00
If the :command:`configure` executable does not succeed in installing a specific
dependency, you should try to install the dependency on your system by yourself.
2019-01-25 11:39:31 +01:00
Before doing anything below, try to install the packages with your package manager
(:command:`apt`, :command:`yum`, etc).
2019-01-25 11:39:31 +01:00
Ninja
-----
*Ninja* is a build system (like GNU make), with a focus on speed.
* Download the latest binary version of Ninja
here : `<https://github.com/ninja-build/ninja/releases/latest>`_
* Unzip the ninja-linux.zip file, and move the ninja binary into
the :file:`${QP_ROOT}/bin` directory.
IRPF90
------
*IRPF90* is a Fortran code generator for programming using the Implicit Reference
2020-03-17 16:39:43 +01:00
to Parameters (IRP) method.
2019-01-25 11:39:31 +01:00
2021-11-29 10:39:34 +01:00
If you have *pip* for Python2, you can do
.. code:: bash
2021-11-29 10:39:34 +01:00
python3 -m pip install --user irpf90
Otherwise,
2019-01-25 11:39:31 +01:00
* Download the latest version of IRPF90
2019-07-01 12:14:52 +02:00
here : `<https://gitlab.com/scemama/irpf90/-/archive/v1.7.2/irpf90-v1.7.2.tar.gz>`_ and move
2019-01-25 11:39:31 +01:00
the downloaded archive in the :file:`${QP_ROOT}/external` directory
* Extract the archive and go into the :file:`irpf90-*` directory to run
:command:`make`
.. note::
The :envvar:`IRPF90_PATH` variable may need to be updated in the configuration
file :file:`${QP_ROOT}/etc/irpf90.rc`.
ZeroMQ and its Fortran binding
------------------------------
*ZeroMQ* is a high-performance asynchronous messaging library.
* Download the latest stable version of ZeroMQ
here : `<https://github.com/zeromq/libzmq/releases/latest>`_ and move the
downloaded archive in the :file:`${QP_ROOT}/external` directory
* Extract the archive, go into the :file:`zeromq-*` directory and run
the following commands
.. code:: bash
./configure --prefix="${QP_ROOT}" --without-libsodium
make
make install
* Download the Fortran binding
here : `<https://github.com/zeromq/f77_zmq/releases/latest>`_ and move
the downloaded archive in the :file:`${QP_ROOT}/external` directory
* Extract the archive, go into the :file:`f77_zmq-*` directory and run
the following commands
.. code:: bash
export ZMQ_H=${QP_ROOT}/include/zmq.h
make
cp libf77zmq.a ${QP_ROOT}/lib
cp libf77zmq.so ${QP_ROOT}/lib
* Copy the :file:`f77_zmq_free.h` file in the ``ZMQ`` module as follows:
.. code:: bash
2021-09-28 00:30:10 +02:00
cp f77_zmq_free.h ${QP_ROOT}/src/zmq/f77_zmq.h
2019-01-25 11:39:31 +01:00
Zlib
----
*Zlib* is the compression library used by *gzip*.
* Download the latest version of Zlib here:
`<https://www.zlib.net/zlib-1.2.11.tar.gz>`_
and move it in the :file:`${QP_ROOT}/external` directory
* Extract the archive, go into the :file:`zlib-*` directory and run
the following commands
.. code:: bash
./configure --prefix=${QP_ROOT}
make
make install
2019-02-04 13:14:57 +01:00
With Debian or Ubuntu, you can use
.. code:: bash
sudo apt install zlib1g-dev
GMP
---
GMP is the GNU Multiple Precision Arithmetic Library.
* Download the latest version of gmp here:
`<ftp://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.bz2>`_
and move it in the :file:`${QP_ROOT}/external` directory
* Extract the archive, go into the :file:`gmp-*` directory and run
the following commands
.. code:: bash
./configure --prefix=${QP_ROOT}
make
make install
With Debian or Ubuntu, you can use
.. code:: bash
sudo apt install libgmp-dev
2019-01-25 11:39:31 +01:00
2019-06-05 17:28:15 +02:00
2019-01-25 11:39:31 +01:00
OCaml
-----
*OCaml* is a general purpose programming language with an emphasis on expressiveness and safety.
2019-02-04 13:14:57 +01:00
* The following packages are required (Debian or Ubuntu):
.. code:: bash
sudo apt install libncurses5-dev pkg-config libgmp3-dev m4
2019-01-25 11:39:31 +01:00
* Download the installer of the OPAM package manager here :
`<https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh>`_
and move it in the :file:`${QP_ROOT}/external` directory
2021-11-29 10:39:34 +01:00
* If you use OCaml only with |qp|, you can install the OPAM directory
2019-01-25 11:39:31 +01:00
containing the compiler and all the installed libraries in the
:file:`${QP_ROOT}/external` directory as
.. code:: bash
2020-03-17 16:39:43 +01:00
2019-01-25 11:39:31 +01:00
export OPAMROOT=${QP_ROOT}/external/opam
* Run the installer
.. code:: bash
2020-03-17 16:39:43 +01:00
2019-01-25 11:39:31 +01:00
echo ${QP_ROOT}/bin
${QP_ROOT}/external/opam_installer.sh --no-backup --fresh
2019-07-24 08:11:17 +02:00
The :command:`opam` command can be installed in the :file:`${QP_ROOT}/bin`
2019-01-25 11:39:31 +01:00
directory. To do this, take the output of ``echo ${QP_ROOT}/bin`` and
use it as an answer to where :command:`opam` should be installed.
2020-03-17 16:39:43 +01:00
2019-01-25 11:39:31 +01:00
* Install the OCaml compiler
.. code:: bash
2021-11-29 10:39:34 +01:00
opam init --comp=4.11.1
2019-07-24 08:11:17 +02:00
eval `${QP_ROOT}/bin/opam env`
2019-07-24 08:12:22 +02:00
If the installation fails because of bwrap, you can initialize opam using:
2019-07-24 08:11:17 +02:00
.. code:: bash
2021-11-29 10:39:34 +01:00
opam init --disable-sandboxing --comp=4.11.1
2019-01-25 11:39:31 +01:00
eval `${QP_ROOT}/bin/opam env`
* Install the required external OCaml libraries
.. code:: bash
2023-02-24 18:05:45 +01:00
opam install ocamlbuild zmq sexplib ppx_sexp_conv ppx_deriving getopt
2019-01-25 11:39:31 +01:00
Docopt
------
*Docopt* is a Python package defining a command-line interface description language.
2020-03-17 16:39:43 +01:00
If you have *pip* for Python3, you can do
2019-01-25 11:39:31 +01:00
.. code:: bash
2020-03-17 16:39:43 +01:00
python3 -m pip install --user docopt
2019-01-25 11:39:31 +01:00
Otherwise,
* Download the archive here : `<https://github.com/docopt/docopt/releases/tag/0.6.2>`_
* Extract the archive
* Copy :file:`docopt-0.6.2/docopt.py` in the :file:`${QP_ROOT}/scripts` directory
resultsFile
-----------
*resultsFile* is a Python package to extract data from output files of quantum chemistry
codes.
2021-11-29 10:39:34 +01:00
If you have *pip* for Python3, you can do
.. code:: bash
python3 -m pip install --user resultsFile
2021-11-29 10:39:34 +01:00