9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-07-19 09:13:26 +02:00

merged the threshold_sav

This commit is contained in:
Emmanuel Giner 2021-12-17 18:32:35 +01:00
commit 043543bc15
52 changed files with 1071 additions and 357 deletions

View File

@ -2,9 +2,9 @@
Installation
============
The |qp| can be downloaded on GitHub as an `archive
<https://github.com/LCPQ/quantum_package/releases/latest>`_ or as a `git
repository <https://github.com/LCPQ/quantum_package>`_.
|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>`_.
.. code:: bash
@ -19,16 +19,16 @@ Before anything, go into your :file:`quantum_package` directory and run
This script will create the :file:`quantum_package.rc` bash script, which
sets all the environment variables required for the normal operation of the
*Quantum Package*. It will also initialize the git submodules that are
sets all the environment variables required for the normal operation of
|qp|. It will also initialize the git submodules that are
required, and tell you which external dependencies are missing and need to be
installed. The required dependencies are located in the
`external/qp2-dependencies` directory, such that once QP is configured the
`external/qp2-dependencies` directory, such that once |qp| is configured the
internet connection is not needed any more.
When all dependencies have been installed, (the :command:`configure` will
inform you) source the :file:`quantum_package.rc` in order to load all
environment variables and compile the |QP|.
inform you what is missing) source the :file:`quantum_package.rc` in order to
load all environment variables and compile |QP|.
Now all the requirements are met, you can compile the programs using
@ -37,6 +37,15 @@ Now all the requirements are met, you can compile the programs using
make
Installation of dependencies via a Conda environment
====================================================
.. code:: bash
conda env create -f qp2.yml
Requirements
============
@ -64,8 +73,8 @@ architecture. Modify it if needed, and run :command:`configure` with
.. code:: bash
cp ./config/gfortran.example config/gfortran.cfg
./configure -c config/gfortran.cfg
cp ./config/gfortran.example config/gfortran_avx.cfg
./configure -c config/gfortran_avx.cfg
.. note::
@ -86,45 +95,33 @@ The command is to be used as follows:
.. code:: bash
./configure --install=<package>
./configure -i <package>
The following packages are supported by the :command:`configure` installer:
* ninja
* irpf90
* zeromq
* f77zmq
* gmp
* ocaml (:math:`\approx` 5 minutes)
* ezfio
* docopt
* resultsFile
* bats
* zlib
Example:
.. code:: bash
./configure -i ezfio
./configure -i ninja
.. note::
When installing the ocaml package, you will be asked the location of where
it should be installed. A safe option is to enter the path proposed by the
|QP|:
QP>> Please install it here: /your_quantum_package_directory/bin
So just enter the proposition of the |QP| and press enter.
If the :command:`configure` executable fails to install a specific dependency
-----------------------------------------------------------------------------
If the :command:`configure` executable does not succeed to install a specific
dependency, there are some proposition of how to download and install the
minimal dependencies to compile and use the |QP|.
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.
Before doing anything below, try to install the packages with your package manager
(:command:`apt`, :command:`yum`, etc).
@ -149,11 +146,11 @@ IRPF90
*IRPF90* is a Fortran code generator for programming using the Implicit Reference
to Parameters (IRP) method.
If you have *pip* for Python2, you can do
If you have *pip* for Python2, you can do
.. code:: bash
python2 -m pip install --user irpf90
python3 -m pip install --user irpf90
Otherwise,
@ -262,53 +259,6 @@ With Debian or Ubuntu, you can use
sudo apt install libgmp-dev
libcap
------
Libcap is a library for getting and setting POSIX.1e draft 15 capabilities.
* Download the latest version of libcap here:
`<https://git.kernel.org/pub/scm/linux/kernel/git/morgan/libcap.git/snapshot/libcap-2.25.tar.gz>`_
and move it in the :file:`${QP_ROOT}/external` directory
* Extract the archive, go into the :file:`libcap-*/libcap` directory and run
the following command
.. code:: bash
prefix=$QP_ROOT make install
With Debian or Ubuntu, you can use
.. code:: bash
sudo apt install libcap-dev
Bubblewrap
----------
Bubblewrap is an unprivileged sandboxing tool.
* Download Bubblewrap here:
`<https://github.com/projectatomic/bubblewrap/releases/download/v0.3.3/bubblewrap-0.3.3.tar.xz>`_
and move it in the :file:`${QP_ROOT}/external` directory
* Extract the archive, go into the :file:`bubblewrap-*` directory and run
the following commands
.. code:: bash
./configure --prefix=$QP_ROOT && make -j 8
make install-exec-am
With Debian or Ubuntu, you can use
.. code:: bash
sudo apt install bubblewrap
OCaml
@ -327,7 +277,7 @@ OCaml
`<https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh>`_
and move it in the :file:`${QP_ROOT}/external` directory
* If you use OCaml only with the |qp|, you can install the OPAM directory
* If you use OCaml only with |qp|, you can install the OPAM directory
containing the compiler and all the installed libraries in the
:file:`${QP_ROOT}/external` directory as
@ -352,14 +302,14 @@ OCaml
.. code:: bash
opam init --comp=4.07.1
opam init --comp=4.11.1
eval `${QP_ROOT}/bin/opam env`
If the installation fails because of bwrap, you can initialize opam using:
.. code:: bash
opam init --disable-sandboxing --comp=4.07.1
opam init --disable-sandboxing --comp=4.11.1
eval `${QP_ROOT}/bin/opam env`
* Install the required external OCaml libraries
@ -369,17 +319,6 @@ OCaml
opam install ocamlbuild cryptokit zmq sexplib ppx_sexp_conv ppx_deriving getopt
EZFIO
-----
*EZFIO* is the Easy Fortran Input/Output library generator.
* Download EZFIO here : `<https://gitlab.com/scemama/EZFIO/-/archive/master/EZFIO-master.tar.gz>`_ and move
the downloaded archive in the :file:`${QP_ROOT}/external` directory
* Extract the archive, and rename it as :file:`${QP_ROOT}/external/ezfio`
Docopt
------
@ -406,7 +345,7 @@ resultsFile
*resultsFile* is a Python package to extract data from output files of quantum chemistry
codes.
If you have *pip* for Python3, you can do
If you have *pip* for Python3, you can do
.. code:: bash
@ -414,3 +353,4 @@ If you have *pip* for Python3, you can do

View File

@ -31,6 +31,7 @@
- Fixed bug in molden (Au -> Angs)
- Fixed bug with non-contiguous MOs in active space and deleter MOs
- Complete network-free installation
- Fixed bug in selection when computing full PT2
*** User interface
@ -58,6 +59,7 @@
symmetry in matrices
- qp_export_as_tgz exports also plugin codes
- Added a basis module containing basis set information
- Added qp_run truncate_wf
*** Code
@ -85,7 +87,7 @@
- Using Intel IPP for sorting when using Intel compiler
- Removed parallelism in sorting
- Compute banned_excitations from exchange integrals to accelerate with local MOs

View File

@ -195,48 +195,52 @@ def write_ezfio(res, filename):
# P a r s i n g #
# ~#~#~#~#~#~#~ #
inucl = {}
for i, a in enumerate(res.geometry):
inucl[a.coord] = i
nbasis = 0
nucl_center = []
nucl_index = []
curr_center = -1
nucl_shell_num = []
ang_mom = []
nshell = 0
shell_prim_index = [1]
nshell_tot = 0
shell_index = []
shell_prim_num = []
for b in res.basis:
s = b.sym
if str.count(s, "y") + str.count(s, "x") == 0:
c = b.center
c = inucl[b.center]
nshell += 1
nshell_tot += 1
if c != curr_center:
curr_center = c
nucl_center.append(nbasis+1)
nucl_shell_num.append(nshell)
nshell = 0
nbasis += 1
nucl_index.append(c+1)
coefficient += b.coef[:len(b.prim)]
exponent += [p.expo for p in b.prim]
ang_mom.append(str.count(s, "z"))
shell_prim_index.append(len(exponent)+1)
shell_prim_num.append(len(b.prim))
nucl_shell_num.append(nshell+1)
nucl_shell_num = nucl_shell_num[1:]
shell_index += [nshell_tot+1] * len(b.prim)
# ~#~#~#~#~ #
# W r i t e #
# ~#~#~#~#~ #
ezfio.set_basis_basis("Read from ResultsFile")
ezfio.set_basis_basis_nucleus_index(nucl_center)
ezfio.set_basis_prim_num(len(coefficient))
ezfio.set_basis_shell_num(len(ang_mom))
ezfio.set_basis_basis_nucleus_index(nucl_index)
ezfio.set_basis_prim_num(len(coefficient))
ezfio.set_basis_nucleus_shell_num(nucl_shell_num)
ezfio.set_basis_prim_coef(coefficient)
ezfio.set_basis_prim_expo(exponent)
ezfio.set_basis_shell_ang_mom(ang_mom)
ezfio.set_basis_shell_prim_num(shell_prim_num)
ezfio.set_basis_shell_prim_index(shell_prim_index)
ezfio.set_basis_shell_index(shell_index)
print("OK")
@ -289,12 +293,17 @@ def write_ezfio(res, filename):
for i in range(mo_num):
energies.append(MOs[i].eigenvalue)
OccNum = []
if res.occ_num is not None:
OccNum = []
for i in MOindices:
OccNum.append(res.occ_num[MO_type][i])
else:
for i in range(res.num_beta):
OccNum.append(2.)
for i in range(res.num_beta,res.num_alpha):
OccNum.append(1.)
while len(OccNum) < mo_num:
while len(OccNum) < mo_num:
OccNum.append(0.)
MoMatrix = []
@ -317,8 +326,9 @@ def write_ezfio(res, filename):
# ~#~#~#~#~ #
ezfio.set_mo_basis_mo_num(mo_num)
ezfio.set_mo_basis_mo_occ(OccNum)
ezfio.set_mo_basis_mo_coef(MoMatrix)
ezfio.set_mo_basis_mo_occ(OccNum)
print("OK")

83
bin/qp_gaussian Executable file
View File

@ -0,0 +1,83 @@
#!/usr/bin/env python3
#
"""
Runs a Quantum Package calculation using a Gaussian input file.
Usage:
qp_gaussian INPUT
"""
# Requires pymatgen (https://pymatgen.org/)
# pip install pymatgen
import os
import sys
import os.path
try:
import qp_path
except ImportError:
print("source quantum_package.rc")
from docopt import docopt
import pymatgen
from pymatgen.io.gaussian import GaussianInput
def main(arguments):
filename = arguments["INPUT"]
with open(filename,'r') as f:
text = f.read()
in_file = GaussianInput.from_string(text)
d = in_file.as_dict()
charge = ("%d"%(d["charge"])).replace('-','m')
basis = d["basis_set"]
mult = d["spin_multiplicity"]
natoms = len(d["molecule"]["sites"])
with open("g09.xyz","w") as f:
f.write("%d\n"%natoms)
f.write("%s\n"%d["title"])
f.write("%s\n"%in_file.get_cart_coords())
if basis is None:
print("Basis set not found. Use '/' before basis set")
sys.exit(1)
command = f"rm -rf g09.ezfio"
os.system(command)
command = f"qp_create_ezfio -c {charge} -m {mult} g09.xyz -b {basis} -o g09.ezfio"
os.system(command)
command = f"rm -rf g09.xyz"
os.system(command)
command = f"qp_run scf g09.ezfio"
os.system(command)
command = f"qp_set_frozen_core g09.ezfio"
os.system(command)
if d["functional"] == "FCI":
command = f"qp_run fci g09.ezfio"
elif d["functional"] == "CIS":
command = f"qp_run cis g09.ezfio"
elif d["functional"] == "CISD":
command = f"qp_run cisd g09.ezfio"
os.system(command)
if __name__ == '__main__':
ARGUMENTS = docopt(__doc__)
main(ARGUMENTS)

View File

@ -13,7 +13,7 @@
FC : gfortran -g -ffree-line-length-none -I . -fPIC
LAPACK_LIB : -lblas -llapack
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 --assert
IRPF90_FLAGS : --ninja --align=32 --assert -DSET_NESTED
# Global options
################
@ -35,14 +35,14 @@ OPENMP : 1 ; Append OpenMP flags
# -ffast-math and the Fortran-specific
# -fno-protect-parens and -fstack-arrays.
[OPT]
FCFLAGS : -Ofast
FCFLAGS : -Ofast
# Profiling flags
#################
#
[PROFILE]
FC : -p -g
FCFLAGS : -Ofast
FCFLAGS : -Ofast
# Debugging flags
#################
@ -58,5 +58,5 @@ FCFLAGS : -g -msse4.2 -fcheck=all -Waliasing -Wampersand -Wconversion -Wsurpris
#
[OPENMP]
FC : -fopenmp
IRPF90_FLAGS : --openmp
IRPF90_FLAGS : --openmp

View File

@ -13,7 +13,7 @@
FC : gfortran -ffree-line-length-none -I . -mavx -g -fPIC
LAPACK_LIB : -llapack -lblas
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32
IRPF90_FLAGS : --ninja --align=32 -DSET_NESTED
# Global options
################
@ -42,7 +42,7 @@ FCFLAGS : -Ofast -mavx
#
[PROFILE]
FC : -p -g
FCFLAGS : -Ofast
FCFLAGS : -Ofast
# Debugging flags
#################
@ -51,12 +51,12 @@ FCFLAGS : -Ofast
# -g : Extra debugging information
#
[DEBUG]
FCFLAGS : -fcheck=all -g
FCFLAGS : -fcheck=all -g
# OpenMP flags
#################
#
[OPENMP]
FC : -fopenmp
IRPF90_FLAGS : --openmp
IRPF90_FLAGS : --openmp

View File

@ -13,7 +13,7 @@
FC : gfortran -g -ffree-line-length-none -I . -fPIC
LAPACK_LIB : -lblas -llapack
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 --assert
IRPF90_FLAGS : --ninja --align=32 --assert -DSET_NESTED
# Global options
################
@ -35,14 +35,14 @@ OPENMP : 1 ; Append OpenMP flags
# -ffast-math and the Fortran-specific
# -fno-protect-parens and -fstack-arrays.
[OPT]
FCFLAGS : -Ofast
FCFLAGS : -Ofast
# Profiling flags
#################
#
[PROFILE]
FC : -p -g
FCFLAGS : -Ofast
FCFLAGS : -Ofast
# Debugging flags
#################
@ -59,5 +59,5 @@ FCFLAGS : -g -msse4.2 -fcheck=all -Waliasing -Wampersand -Wconversion -Wsurpris
#
[OPENMP]
FC : -fopenmp
IRPF90_FLAGS : --openmp
IRPF90_FLAGS : --openmp

View File

@ -13,7 +13,7 @@
FC : mpif90 -ffree-line-length-none -I . -g -fPIC
LAPACK_LIB : -lblas -llapack
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DMPI
IRPF90_FLAGS : --ninja --align=32 -DMPI -DSET_NESTED
# Global options
################
@ -35,14 +35,14 @@ OPENMP : 1 ; Append OpenMP flags
# -ffast-math and the Fortran-specific
# -fno-protect-parens and -fstack-arrays.
[OPT]
FCFLAGS : -Ofast -msse4.2
FCFLAGS : -Ofast -msse4.2
# Profiling flags
#################
#
[PROFILE]
FC : -p -g
FCFLAGS : -Ofast -msse4.2
FCFLAGS : -Ofast -msse4.2
# Debugging flags
#################
@ -51,7 +51,7 @@ FCFLAGS : -Ofast -msse4.2
# -g : Extra debugging information
#
[DEBUG]
FCFLAGS : -fcheck=all -g
FCFLAGS : -fcheck=all -g
# OpenMP flags
#################

View File

@ -9,7 +9,7 @@
FC : ifort -fpic
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DINTEL
IRPF90_FLAGS : --ninja --align=32 -DINTEL -DSET_NESTED
# Global options
################

View File

@ -9,7 +9,7 @@
FC : mpiifort -fpic
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL
IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL -DSET_NESTED
# Global options
################

View File

@ -9,7 +9,7 @@
FC : ifort -fpic
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DINTEL
IRPF90_FLAGS : --ninja --align=32 -DINTEL -DSET_NESTED
# Global options
################

View File

@ -9,7 +9,7 @@
FC : ifort -fpic
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DINTEL
IRPF90_FLAGS : --ninja --align=32 -DINTEL -DSET_NESTED
# Global options
################

View File

@ -9,7 +9,7 @@
FC : mpiifort -fpic
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL
IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL -DSET_NESTED
# Global options
################

View File

@ -9,7 +9,7 @@
FC : ifort -fpic
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=64 -DINTEL
IRPF90_FLAGS : --ninja --align=64 -DINTEL -DSET_NESTED
# Global options
################

63
config/ifort_2021_avx.cfg Normal file
View File

@ -0,0 +1,63 @@
# Common flags
##############
#
# -mkl=[parallel|sequential] : Use the MKL library
# --ninja : Allow the utilisation of ninja. It is mandatory !
# --align=32 : Align all provided arrays on a 32-byte boundary
#
[COMMON]
FC : ifort -fpic
LAPACK_LIB : -qmkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DINTEL
# Global options
################
#
# 1 : Activate
# 0 : Deactivate
#
[OPTION]
MODE : OPT ; [ OPT | PROFILE | DEBUG ] : Chooses the section below
CACHE : 0 ; Enable cache_compile.py
OPENMP : 1 ; Append OpenMP flags
# Optimization flags
####################
#
# -xHost : Compile a binary optimized for the current architecture
# -O2 : O3 not better than O2.
# -ip : Inter-procedural optimizations
# -ftz : Flushes denormal results to zero
#
[OPT]
FC : -traceback
FCFLAGS : -xAVX -O2 -ip -ftz -g
# Profiling flags
#################
#
[PROFILE]
FC : -p -g
FCFLAGS : -xSSE4.2 -O2 -ip -ftz
# Debugging flags
#################
#
# -traceback : Activate backtrace on runtime
# -fpe0 : All floating point exaceptions
# -C : Checks uninitialized variables, array subscripts, etc...
# -g : Extra debugging information
# -xSSE2 : Valgrind needs a very simple x86 executable
#
[DEBUG]
FC : -g -traceback
FCFLAGS : -xSSE2 -C -fpe0 -implicitnone
# OpenMP flags
#################
#
[OPENMP]
FC : -qopenmp
IRPF90_FLAGS : --openmp

View File

@ -0,0 +1,64 @@
# Common flags
##############
#
# -mkl=[parallel|sequential] : Use the MKL library
# --ninja : Allow the utilisation of ninja. It is mandatory !
# --align=32 : Align all provided arrays on a 32-byte boundary
#
[COMMON]
FC : mpiifort -fpic
LAPACK_LIB : -qmkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL
# Global options
################
#
# 1 : Activate
# 0 : Deactivate
#
[OPTION]
MODE : OPT ; [ OPT | PROFILE | DEBUG ] : Chooses the section below
CACHE : 0 ; Enable cache_compile.py
OPENMP : 1 ; Append OpenMP flags
# Optimization flags
####################
#
# -xHost : Compile a binary optimized for the current architecture
# -O2 : O3 not better than O2.
# -ip : Inter-procedural optimizations
# -ftz : Flushes denormal results to zero
#
[OPT]
FCFLAGS : -mavx -axAVX -O2 -ip -ftz -g -traceback
# Profiling flags
#################
#
[PROFILE]
FC : -p -g
FCFLAGS : -march=corei7 -O2 -ip -ftz
# Debugging flags
#################
#
# -traceback : Activate backtrace on runtime
# -fpe0 : All floating point exaceptions
# -C : Checks uninitialized variables, array subscripts, etc...
# -g : Extra debugging information
# -xSSE2 : Valgrind needs a very simple x86 executable
#
[DEBUG]
FC : -g -traceback
FCFLAGS : -xSSE2 -C -fpe0 -implicitnone
# OpenMP flags
#################
#
[OPENMP]
FC : -qopenmp
IRPF90_FLAGS : --openmp

View File

@ -0,0 +1,63 @@
# Common flags
##############
#
# -mkl=[parallel|sequential] : Use the MKL library
# --ninja : Allow the utilisation of ninja. It is mandatory !
# --align=32 : Align all provided arrays on a 32-byte boundary
#
[COMMON]
FC : ifort -fpic
LAPACK_LIB : -qmkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DINTEL
# Global options
################
#
# 1 : Activate
# 0 : Deactivate
#
[OPTION]
MODE : OPT ; [ OPT | PROFILE | DEBUG ] : Chooses the section below
CACHE : 0 ; Enable cache_compile.py
OPENMP : 1 ; Append OpenMP flags
# Optimization flags
####################
#
# -xHost : Compile a binary optimized for the current architecture
# -O2 : O3 not better than O2.
# -ip : Inter-procedural optimizations
# -ftz : Flushes denormal results to zero
#
[OPT]
FC : -traceback
FCFLAGS : -xSSE4.2 -O2 -ip -ftz -g
# Profiling flags
#################
#
[PROFILE]
FC : -p -g
FCFLAGS : -xSSE4.2 -O2 -ip -ftz
# Debugging flags
#################
#
# -traceback : Activate backtrace on runtime
# -fpe0 : All floating point exaceptions
# -C : Checks uninitialized variables, array subscripts, etc...
# -g : Extra debugging information
# -xSSE2 : Valgrind needs a very simple x86 executable
#
[DEBUG]
FC : -g -traceback
FCFLAGS : -xSSE2 -C -fpe0 -implicitnone
# OpenMP flags
#################
#
[OPENMP]
FC : -qopenmp
IRPF90_FLAGS : --openmp

View File

@ -0,0 +1,64 @@
# Common flags
##############
#
# -mkl=[parallel|sequential] : Use the MKL library
# --ninja : Allow the utilisation of ninja. It is mandatory !
# --align=32 : Align all provided arrays on a 32-byte boundary
#
[COMMON]
FC : mpiifort -fpic
LAPACK_LIB : -qmkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL
# Global options
################
#
# 1 : Activate
# 0 : Deactivate
#
[OPTION]
MODE : OPT ; [ OPT | PROFILE | DEBUG ] : Chooses the section below
CACHE : 0 ; Enable cache_compile.py
OPENMP : 1 ; Append OpenMP flags
# Optimization flags
####################
#
# -xHost : Compile a binary optimized for the current architecture
# -O2 : O3 not better than O2.
# -ip : Inter-procedural optimizations
# -ftz : Flushes denormal results to zero
#
[OPT]
FCFLAGS : -msse4.2 -O2 -ip -ftz -g -traceback
# Profiling flags
#################
#
[PROFILE]
FC : -p -g
FCFLAGS : -msse4.2 -O2 -ip -ftz
# Debugging flags
#################
#
# -traceback : Activate backtrace on runtime
# -fpe0 : All floating point exaceptions
# -C : Checks uninitialized variables, array subscripts, etc...
# -g : Extra debugging information
# -xSSE2 : Valgrind needs a very simple x86 executable
#
[DEBUG]
FC : -g -traceback
FCFLAGS : -xSSE2 -C -fpe0 -implicitnone
# OpenMP flags
#################
#
[OPENMP]
FC : -qopenmp
IRPF90_FLAGS : --openmp

View File

@ -0,0 +1,63 @@
# Common flags
##############
#
# -mkl=[parallel|sequential] : Use the MKL library
# --ninja : Allow the utilisation of ninja. It is mandatory !
# --align=32 : Align all provided arrays on a 32-byte boundary
#
[COMMON]
FC : ifort -fpic
LAPACK_LIB : -qmkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=64 -DINTEL
# Global options
################
#
# 1 : Activate
# 0 : Deactivate
#
[OPTION]
MODE : OPT ; [ OPT | PROFILE | DEBUG ] : Chooses the section below
CACHE : 0 ; Enable cache_compile.py
OPENMP : 1 ; Append OpenMP flags
# Optimization flags
####################
#
# -xHost : Compile a binary optimized for the current architecture
# -O2 : O3 not better than O2.
# -ip : Inter-procedural optimizations
# -ftz : Flushes denormal results to zero
#
[OPT]
FC : -traceback
FCFLAGS : -xHost -O2 -ip -ftz -g
# Profiling flags
#################
#
[PROFILE]
FC : -p -g
FCFLAGS : -xSSE4.2 -O2 -ip -ftz
# Debugging flags
#################
#
# -traceback : Activate backtrace on runtime
# -fpe0 : All floating point exaceptions
# -C : Checks uninitialized variables, array subscripts, etc...
# -g : Extra debugging information
# -xSSE2 : Valgrind needs a very simple x86 executable
#
[DEBUG]
FC : -g -traceback
FCFLAGS : -xSSE2 -C -fpe0 -implicitnone
# OpenMP flags
#################
#
[OPENMP]
FC : -qopenmp
IRPF90_FLAGS : --openmp

View File

@ -1,66 +0,0 @@
# Common flags
##############
#
# -mkl=[parallel|sequential] : Use the MKL library
# --ninja : Allow the utilisation of ninja. It is mandatory !
# --align=32 : Align all provided arrays on a 32-byte boundary
#
[COMMON]
FC : ifort -fpic
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 --assert -DINTEL
# Global options
################
#
# 1 : Activate
# 0 : Deactivate
#
[OPTION]
MODE : DEBUG ; [ OPT | PROFILE | DEBUG ] : Chooses the section below
CACHE : 0 ; Enable cache_compile.py
OPENMP : 1 ; Append OpenMP flags
# Optimization flags
####################
#
# -xHost : Compile a binary optimized for the current architecture
# -O2 : O3 not better than O2.
# -ip : Inter-procedural optimizations
# -ftz : Flushes denormal results to zero
#
[OPT]
FC : -traceback
FCFLAGS : -msse4.2 -O2 -ip -ftz -g
# Profiling flags
#################
#
[PROFILE]
FC : -p -g
FCFLAGS : -msse4.2 -O2 -ip -ftz
# Debugging flags
#################
#
# -traceback : Activate backtrace on runtime
# -fpe0 : All floating point exaceptions
# -C : Checks uninitialized variables, array subscripts, etc...
# -g : Extra debugging information
# -msse4.2 : Valgrind needs a very simple x86 executable
#
[DEBUG]
FC : -g -traceback
FCFLAGS : -msse4.2 -check all -debug all -fpe-all=0 -implicitnone
# OpenMP flags
#################
#
[OPENMP]
FC : -qopenmp
IRPF90_FLAGS : --openmp

63
configure vendored
View File

@ -3,8 +3,6 @@
# Quantum Package configuration script
#
TEMP=$(getopt -o d:c:i:h -l download:,config:,install:,help -n $0 -- "$@") || exit 1
eval set -- "$TEMP"
export QP_ROOT="$( cd "$(dirname "$0")" ; pwd -P )"
echo "QP_ROOT="$QP_ROOT
@ -24,17 +22,17 @@ function help()
Quantum Package configuration script.
Usage:
$(basename $0) -c <file> | --config=<file>
$(basename $0) -h | --help
$(basename $0) -i <package> | --install=<package>
$(basename $0) -c <file>
$(basename $0) -h
$(basename $0) -i <package>
Options:
-c, --config=<file> Define a COMPILATION configuration file,
in "${QP_ROOT}/config/".
-h, --help Print the HELP message
-i, --install=<package> INSTALL <package>. Use at your OWN RISK:
no support will be provided for the installation of
dependencies.
-c <file> Define a COMPILATION configuration file,
in "${QP_ROOT}/config/".
-h Print the HELP message
-i <package> INSTALL <package>. Use at your OWN RISK:
no support will be provided for the installation of
dependencies.
Example:
./$(basename $0) -c config/gfortran.cfg
@ -68,32 +66,31 @@ function execute () {
}
PACKAGES=""
echo $@
while true ; do
case "$1" in
-c|--config)
case "$2" in
while getopts "d:c:i:h" c ; do
case "$c" in
c)
case "$OPTARG" in
"") help ; break;;
*) if [[ -f $2 ]] ; then
CONFIG="$2"
*) if [[ -f $OPTARG ]] ; then
CONFIG="$OPTARG"
else
error "error: configuration file $2 not found."
error "error: configuration file $OPTARG not found."
exit 1
fi
esac
shift 2;;
-i|--install)
case "$2" in
esac;;
i)
case "$OPTARG" in
"") help ; break;;
*) PACKAGES="${PACKAGE} $2"
esac
shift 2;;
-h|-help|--help)
*) PACKAGES="${PACKAGE} $OPTARG"
esac;;
h)
help
exit 0;;
--) shift ; break ;;
*)
error $(basename $0)": unknown option $1, try --help"
error $(basename $0)": unknown option $c, try --help"
exit 2;;
esac
done
@ -226,13 +223,11 @@ EOF
execute << EOF
cd "\${QP_ROOT}"/external
tar --gunzip --extract --file qp2-dependencies/f77_zmq-4.2.5.tar.gz
cd f77_zmq-*
tar --gunzip --extract --file qp2-dependencies/f77-zmq-4.3.2.tar.gz
cd f77-zmq-*
./configure --prefix=\$QP_ROOT
export ZMQ_H="\$QP_ROOT"/include/zmq.h
make
cp libf77zmq.a "\${QP_ROOT}"/lib
cp libf77zmq.so "\${QP_ROOT}"/lib
cp f77_zmq_free.h "\${QP_ROOT}"/include
make && make check && make install
EOF

View File

@ -585,12 +585,16 @@ let run ?o b au c d m p cart xyz_file =
let shell_prim_num =
list_map List.length lc
in
let shell_prim_idx =
let shell_idx =
let rec make_list n accu = function
| 0 -> accu
| i -> make_list n (n :: accu) (i-1)
in
let rec aux count accu = function
| [] -> List.rev accu
| l::rest ->
let newcount = count+(List.length l) in
aux newcount (count::accu) rest
let new_l = make_list count accu (List.length l) in
aux (count+1) new_l rest
in
aux 1 [] lc
in
@ -602,20 +606,12 @@ let run ?o b au c d m p cart xyz_file =
~rank:1 ~dim:[| shell_num |] ~data:shell_prim_num);
Ezfio.set_basis_shell_ang_mom (Ezfio.ezfio_array_of_list
~rank:1 ~dim:[| shell_num |] ~data:ang_mom ) ;
Ezfio.set_basis_shell_prim_index (Ezfio.ezfio_array_of_list
~rank:1 ~dim:[| shell_num |] ~data:shell_prim_idx) ;
Ezfio.set_basis_shell_index (Ezfio.ezfio_array_of_list
~rank:1 ~dim:[| prim_num |] ~data:shell_idx) ;
Ezfio.set_basis_basis_nucleus_index (Ezfio.ezfio_array_of_list
~rank:1 ~dim:[| nucl_num |]
~data:(
list_map (fun (_,n) -> Nucl_number.to_int n) basis
|> List.fold_left (fun accu i ->
match accu with
| [] -> []
| (h,j) :: rest -> if j == i then ((h+1,j)::rest) else ((h+1,i)::(h+1,j)::rest)
) [(0,0)]
|> List.rev
|> List.map fst
)) ;
~rank:1 ~dim:[| shell_num |]
~data:( list_map (fun (_,n) -> Nucl_number.to_int n) basis)
) ;
Ezfio.set_basis_nucleus_shell_num(Ezfio.ezfio_array_of_list
~rank:1 ~dim:[| nucl_num |]
~data:(

View File

@ -0,0 +1,175 @@
program check_omp_v2
use omp_lib
implicit none
integer :: accu, accu2
integer :: s, n_setting
logical :: verbose, test_versions
logical, allocatable :: is_working(:)
verbose = .False.
test_versions = .True.
n_setting = 4
allocate(is_working(n_setting))
is_working = .False.
! set the number of threads
call omp_set_num_threads(2)
do s = 1, n_setting
accu = 0
accu2 = 0
call omp_set_max_active_levels(1)
call omp_set_nested(.False.)
if (s==1) then
!call set_multiple_levels_omp()
cycle
elseif (s==2) then
call omp_set_max_active_levels(5)
elseif (s==3) then
call omp_set_nested(.True.)
else
call omp_set_nested(.True.)
call omp_set_max_active_levels(5)
endif
! Level 1
!$OMP PARALLEL
if (verbose) then
print*,'Num threads level 1:',omp_get_num_threads()
endif
! Level 2
!$OMP PARALLEL
if (verbose) then
print*,'Num threads level 2:',omp_get_num_threads()
endif
! Level 3
!$OMP PARALLEL
if (verbose) then
print*,'Num threads level 3:',omp_get_num_threads()
endif
call check_omp_in_subroutine(accu2)
! Level 4
!$OMP PARALLEL
if (verbose) then
print*,'Num threads level 4:',omp_get_num_threads()
endif
!$OMP ATOMIC
accu = accu + 1
!$OMP END ATOMIC
!$OMP END PARALLEL
!$OMP END PARALLEL
!$OMP END PARALLEL
!$OMP END PARALLEL
if (verbose) then
print*,'Setting:',s,'accu=',accu
print*,'Setting:',s,'accu2=',accu2
endif
if (accu == 16 .and. accu2 == 16) then
is_working(s) = .True.
endif
enddo
if (verbose) then
if (is_working(2)) then
print*,'The parallelization works on 4 levels with:'
print*,'call omp_set_max_active_levels(5)'
print*,''
print*,'Please use the irpf90 flags -DSET_MAX_ACT in qp2/config/${compiler_name}.cfg'
elseif (is_working(3)) then
print*,'The parallelization works on 4 levels with:'
print*,'call omp_set_nested(.True.)'
print*,''
print*,'Please use the irpf90 flag -DSET_NESTED in qp2/config/${compiler_name}.cfg'
elseif (is_working(4)) then
print*,'The parallelization works on 4 levels with:'
print*,'call omp_set_nested(.True.)'
print*,'+'
print*,'call omp_set_max_active_levels(5)'
print*,''
print*,'Please use the irpf90 flags -DSET_NESTED -DSET_MAX_ACT in qp2/config/${compiler_name}.cfg'
else
print*,'The parallelization on multiple levels does not work with:'
print*,'call omp_set_max_active_levels(5)'
print*,'or'
print*,'call omp_set_nested(.True.)'
print*,'or'
print*,'call omp_set_nested(.True.)'
print*,'+'
print*,'call omp_set_max_active_levels(5)'
print*,''
print*,'Try an other compiler and good luck...'
endif
! if (is_working(1)) then
! print*,''
! print*,'=========================================================='
! print*,'Your actual set up works for parallelization with 4 levels'
! print*,'=========================================================='
! print*,''
! else
! print*,''
! print*,'==================================================================='
! print*,'Your actual set up does not work for parallelization with 4 levels'
! print*,'Please look at the previous messages to understand the requirements'
! print*,'==================================================================='
! print*,''
! endif
endif
! List of working flags
if (test_versions) then
print*,'Tests:',is_working(2:4)
endif
! IRPF90_FLAGS
if (is_working(2)) then
print*,'-DSET_MAX_ACT'
elseif (is_working(3)) then
print*,'-DSET_NESTED'
elseif (is_working(4)) then
print*,'-DSET_MAX_ACT -DSET_NESTED'
else
print*,'ERROR'
endif
end
subroutine check_omp_in_subroutine(accu2)
implicit none
integer, intent(inout) :: accu2
!$OMP PARALLEL
!$OMP ATOMIC
accu2 = accu2 + 1
!$OMP END ATOMIC
!$OMP END PARALLEL
end

View File

@ -0,0 +1,19 @@
#!/bin/sh
# take one argument which is the compiler used
# return the required IRPF90_FLAGS for the $1 compiler
if [ -z "$1" ]
then
echo "Give the compiler in argument"
else
$1 --version > /dev/null \
&& $1 -O0 -fopenmp check_omp.f90 \
&& ./a.out | tail -n 1
# if there is an error or if the compiler is not found
$1 --version > /dev/null || echo 'compiler not found'
fi

30
scripts/verif_omp/study_omp.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh
# list of compilers
list_comp="ifort gfortran-7 gfortran-8 gfortran-9"
# file to store the results
FILE=results.dat
touch $FILE
rm $FILE
# Comments
echo "1: omp_set_max_active_levels(5)" >> $FILE
echo "2: omp_set_nested(.True.)" >> $FILE
echo "3: 1 + 2" >> $FILE
echo "" >> $FILE
echo "1 2 3" >> $FILE
# loop on the comp
for comp in $list_comp
do
$comp --version > /dev/null \
&& $comp -O0 -fopenmp check_omp.f90 \
&& echo $(./a.out | grep "Tests:" | cut -d ":" -f2- ) $(echo " : ") $($comp --version | head -n 1) >> $FILE
done
# Display
cat $FILE

View File

@ -0,0 +1,49 @@
#!/bin/bash
# Compiler
COMP=$1
# Path to file.cfg
config_PATH="../../config/"
END="*.cfg"
CONFIG="/config/"
#LIST=${config_PATH}${COMP}${END} # without ${QP_ROOT}
LIST=${QP_ROOT}${CONFIG}${COMP}${END}
if [ -z "$1" ]
then
echo "Give the compiler in argument"
else
# List of the config files for the compiler
#list_files=$(ls ../../config/$comp*.cfg) #does not give the right list
list_files=${LIST}
echo "Files that will be modified:"
echo $list_files
# Flags that must be added
FLAGS=$(./check_required_setup.sh $COMP)
# Add the flags
for file in $list_files
do
echo $file
BASE="IRPF90_FLAGS : --ninja"
ACTUAL=$(grep "$BASE" $file)
# To have only one time each flag
grep " -DSET_MAX_ACT" $file && ${ACTUAL/" -DSET_MAX"/""}
grep " -DSET_NESTED" $file && ${ACTUAL/" -DSET_NESTED"/""}
SPACE=" "
NEW=${ACTUAL}${SPACE}${FLAGS}
# Debug
#echo ${NEW}
sed "s/${ACTUAL}/${NEW}/" $file
# -i # to change the files
done
fi

View File

@ -21,6 +21,21 @@ BEGIN_PROVIDER [ integer, ao_shell, (ao_num) ]
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [ integer, ao_first_of_shell, (shell_num) ]
implicit none
BEGIN_DOC
! Index of the shell to which the AO corresponds
END_DOC
integer :: i, j, k, n
k=1
do i=1,shell_num
ao_first_of_shell(i) = k
n = shell_ang_mom(i)+1
k = k+(n*(n+1))/2
enddo
END_PROVIDER
BEGIN_PROVIDER [ double precision, ao_coef_normalized, (ao_num,ao_prim_num_max) ]

View File

@ -28,6 +28,7 @@ BEGIN_PROVIDER [ double precision, ao_pseudo_integrals, (ao_num,ao_num)]
END_PROVIDER
BEGIN_PROVIDER [ double precision, ao_pseudo_integrals_local, (ao_num,ao_num)]
use omp_lib
implicit none
BEGIN_DOC
! Local pseudo-potential
@ -42,7 +43,6 @@ BEGIN_PROVIDER [ double precision, ao_pseudo_integrals_local, (ao_num,ao_num)]