1) Setup the environment
$ ./configure <config_file> (--production | --development)
For example you can type
./configure config/gfortran.cfg --production
This command will :
- Download and install all the requirements. Installing OCaml and the Core library may take some time (up to 20min on an old machine).
- Create the file which contains all the dependencies for the
binaries. It’s not a Makefile, but a Ninja file (so don’t type
make
is hopeless, typeninja
instead)
By default, the OCaml compiler and libraries will be installed in
$HOME/.opam
. If you want to install it somewhere else, you
can change this by setting the $OPAMROOT
environment
variable to the location of your choice. For more info about the OCaml
installation, you can visit the Opam website :
https://opam.ocaml.org/doc/Install.html
Compilation Flags
(<config_file>
)
<config_file>
is the path to the file which
contains all the flags useful for the compilation : optimization flags,
Lapack libary, etc. We have two default configuration files in
$QP_ROOT/config
: ifort.cfg
and
gfortran.cfg
. You copy these files to create a new config
file adapted to your architecture.
Note that the popcnt
instruction accelerates a
lot the programs, so the SSE4.2, AVX or AVX2 instruction sets
should be enabled if possible.
If you encounter an error saying that your Fortran compiler can’t
produce executables, it means that the program was built using an
instruction set not supported by the current processor. In that case,
use the -ax
option of the Intel Fortran compiler instead of
the -x
option, or the -march=native
option of
gfortran.
What utilization of the code will you do?
- If you only want the binaries (for production workflow) use the flag
--production
when calling this script. It builds faster. - Else if you are a developer and you want to be able to compile
specific modules,
--development
. It will create for you thebuild.ninja
file in each module.
2) Set environment variables
A configuration file named quantum_package.rc
will be
created. To finish the installation and to start using the quantum
package, source this file in your shell::
`source quantum_package.rc`
And you can also source it inside your .bashrc
file, or
create a system-wide module file.
If you use a C-shell, you will have to translate the
quantum_package.rc
file into C-shell syntax and source it
in your shell.
Optional) Add some new modules
The quantum package has no executable out of the box. You need to
install (and then compile) some modules. The qp_module.py
will help you.
qp_module.py create -n <name> [<children_modules>...]
qp_module.py download -n <name> [<path_folder>...]
qp_module.py install <name>...
qp_module.py list (--installed | --available-local)
qp_module.py uninstall <name>
For exemple you can type : qp_module.py install Full_CI
.
This will install the Full_CI
module. All the modules are
installed in the $QP_ROOT/src/
, and all the available
modules are in $QP_ROOT/plugins/
3) Compiling the Fortran
Just type ninja
if you are in $QP_ROOT
(or
ninja -f $QP_ROOT/build.ninja
elsewhere). The compilation
will take approximately 3 min.
If you have set the --developement
flag in a specific
module you can go in the corresponding module
$QP_ROOT/src/module_name
directory and run
ninja
to build only this module. You can type
ninja all
in a module to compile all the submodules.
4) Testing if all is OK
Some unit tests are available in the test
directory. To
run the tests:
cd $QP_ROOT/tests
./run_tests.sh