mirror of
https://github.com/LCPQ/quantum_package
synced 2024-09-27 03:51:01 +02:00
commit
2efdecc167
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,3 @@
|
||||
quantum_package.rc
|
||||
config/ifort.cfg
|
||||
quantum_package_static.tar.gz
|
||||
build.ninja
|
||||
|
11
TODO
11
TODO
@ -43,13 +43,6 @@
|
||||
|
||||
Refaire les benchmarks
|
||||
|
||||
# Commande qp avec completion dans le shell
|
||||
* qp set => ezfio set
|
||||
* qp get => ezfio get
|
||||
* qp run => qp_run
|
||||
* qp srun => qp_run
|
||||
* qp mpirun => qp_run
|
||||
* qp edit => qp_edit
|
||||
* qp set_mo_class => qp_set_mo_class
|
||||
* qp set_frozen_core => qp_set_frozen_core
|
||||
# Documentation de qpsh
|
||||
|
||||
# Documentation de /etc
|
||||
|
@ -35,7 +35,7 @@ OPENMP : 1 ; Append OpenMP flags
|
||||
# -ffast-math and the Fortran-specific
|
||||
# -fno-protect-parens and -fstack-arrays.
|
||||
[OPT]
|
||||
FCFLAGS : -Ofast
|
||||
FCFLAGS : -Ofast -msse4.2
|
||||
|
||||
# Profiling flags
|
||||
#################
|
||||
|
@ -35,7 +35,7 @@ OPENMP : 1 ; Append OpenMP flags
|
||||
# -ffast-math and the Fortran-specific
|
||||
# -fno-protect-parens and -fstack-arrays.
|
||||
[OPT]
|
||||
FCFLAGS : -Ofast
|
||||
FCFLAGS : -Ofast -mavx
|
||||
|
||||
# Profiling flags
|
||||
#################
|
||||
|
@ -32,7 +32,7 @@ OPENMP : 1 ; Append OpenMP flags
|
||||
#
|
||||
[OPT]
|
||||
FC : -traceback
|
||||
FCFLAGS : -xAVX -O2 -ip -ftz -g
|
||||
FCFLAGS : -xSSE4.2 -O2 -ip -ftz -g
|
||||
|
||||
# Profiling flags
|
||||
#################
|
||||
|
63
config/ifort_avx.cfg
Normal file
63
config/ifort_avx.cfg
Normal 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
|
||||
LAPACK_LIB : -mkl=parallel
|
||||
IRPF90 : irpf90
|
||||
IRPF90_FLAGS : --ninja --align=32
|
||||
|
||||
# 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
|
||||
|
64
config/ifort_avx_mpi.cfg
Normal file
64
config/ifort_avx_mpi.cfg
Normal 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
|
||||
LAPACK_LIB : -mkl=parallel
|
||||
IRPF90 : irpf90
|
||||
IRPF90_FLAGS : --ninja --align=32 -DMPI
|
||||
|
||||
# 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 : -xAVX -O2 -ip -ftz -g -traceback
|
||||
|
||||
# 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
|
||||
|
@ -32,7 +32,7 @@ OPENMP : 1 ; Append OpenMP flags
|
||||
#
|
||||
[OPT]
|
||||
FC : -traceback
|
||||
FCFLAGS : -xAVX -O2 -ip -ftz -g
|
||||
FCFLAGS : -xSSE4.2 -O2 -ip -ftz -g
|
||||
|
||||
|
||||
# Profiling flags
|
||||
|
@ -33,7 +33,6 @@ OPENMP : 1 ; Append OpenMP flags
|
||||
[OPT]
|
||||
FCFLAGS : -xSSE4.2 -O2 -ip -ftz -g -traceback
|
||||
|
||||
# !xAVX
|
||||
# Profiling flags
|
||||
#################
|
||||
#
|
||||
|
32
configure
vendored
32
configure
vendored
@ -3,6 +3,10 @@
|
||||
# Quantum Package configuration script
|
||||
#
|
||||
|
||||
export QP_ROOT="$( cd "$(dirname "$0")" ; pwd -P )"
|
||||
echo "QP_ROOT="$QP_ROOT
|
||||
|
||||
|
||||
help()
|
||||
{
|
||||
cat <<EOF
|
||||
@ -17,14 +21,16 @@ Options:
|
||||
-c <file>, --config <file> define a configuration file, in
|
||||
"${QP_ROOT}/config/".
|
||||
-h, --help print the help message
|
||||
-i <package>, --install <package> install <package>. Use at your own risk.
|
||||
-i <package>, --install <package> install <package>. Use at your own
|
||||
risk: no support will be provided
|
||||
for the installation of dependencies.
|
||||
|
||||
Example:
|
||||
./configure -c config/gfortran.cfg
|
||||
|
||||
Note:
|
||||
- Using different configuration files for installing dependencies and
|
||||
compiling QP can improve the user experience.
|
||||
- Users are encouraged to create their own configuration files instead of
|
||||
modifying the existing ones.
|
||||
|
||||
EOF
|
||||
exit
|
||||
@ -42,7 +48,7 @@ while : ; do
|
||||
-i|--install)
|
||||
PACKAGES="${PACKAGE} $2"
|
||||
shift;;
|
||||
-h|--help)
|
||||
-h|-help|--help)
|
||||
help;;
|
||||
*)
|
||||
echo "unknown option $1, try --help"
|
||||
@ -54,20 +60,12 @@ done
|
||||
# Trim leading and trailing spaces
|
||||
PACKAGES=$(echo $PACKAGES | xargs)
|
||||
|
||||
|
||||
|
||||
sed "s!^export QP_ROOT=.*\$!export QP_ROOT=\"$PWD\"!" \
|
||||
quantum_package.rc.default > quantum_package.rc
|
||||
|
||||
echo "quantum_package.rc created."
|
||||
echo "export QP_ROOT=\"$QP_ROOT\"" > ${QP_ROOT}/etc/00.qp_root
|
||||
|
||||
source quantum_package.rc
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function fail() {
|
||||
echo "Please refer to INSTALL.rst to install the missing dependencies."
|
||||
exit 1
|
||||
@ -151,7 +149,7 @@ for PACKAGE in ${PACKAGES} ; do
|
||||
elif [[ ${PACKAGE} = irpf90 ]] ; then
|
||||
|
||||
download \
|
||||
"https://gitlab.com/scemama/irpf90/-/archive/v1.7.3/irpf90-v1.7.3.tar.gz" \
|
||||
"https://gitlab.com/scemama/irpf90/-/archive/v1.7.4/irpf90-v1.7.4.tar.gz" \
|
||||
"${QP_ROOT}"/external/irpf90.tar.gz
|
||||
(
|
||||
cd "${QP_ROOT}"/external
|
||||
@ -380,10 +378,14 @@ echo " ||----w | "
|
||||
echo " || || "
|
||||
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||
echo ""
|
||||
echo "Now:"
|
||||
echo "Now, if you want to use the current shell,"
|
||||
echo ""
|
||||
echo " source $QP_ROOT/quantum_package.rc"
|
||||
echo ""
|
||||
echo "Or if you want to use a Bash shell adapted for QP:"
|
||||
echo ""
|
||||
echo " $QP_ROOT/qpsh"
|
||||
echo ""
|
||||
|
||||
|
||||
|
||||
|
1
etc/.gitignore
vendored
Normal file
1
etc/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
00.qp_root
|
1
etc/README.rst
Normal file
1
etc/README.rst
Normal file
@ -0,0 +1 @@
|
||||
This directory contains all the files to be sourced when the |QP| environment is loaded.
|
12
etc/ezfio.rc
Normal file
12
etc/ezfio.rc
Normal file
@ -0,0 +1,12 @@
|
||||
# Configuration of EZFIO package
|
||||
|
||||
export QP_EZFIO=${QP_ROOT}/external/ezfio
|
||||
|
||||
if [[ -f ${QP_EZFIO}/Bash/ezfio.sh ]]; then
|
||||
if [[ "$(ps -p $$ -ocomm=)" == "zsh" ]] ; then
|
||||
autoload bashcompinit
|
||||
bashcompinit
|
||||
fi
|
||||
source ${QP_EZFIO}/Bash/ezfio.sh
|
||||
fi
|
||||
|
10
etc/irpf90.rc
Normal file
10
etc/irpf90.rc
Normal file
@ -0,0 +1,10 @@
|
||||
# Configuration of IRPF90 package
|
||||
|
||||
export IRPF90=${QP_ROOT}/bin/irpf90
|
||||
|
||||
# Load irpman shell completion
|
||||
(
|
||||
irpman=$(tail -1 "${QP_ROOT}/bin/irpman" | cut --delimiter " " --field=2)
|
||||
source $(dirname ${irpman})/../irpman-completions.bash
|
||||
)
|
||||
|
8
etc/libraries.rc
Normal file
8
etc/libraries.rc
Normal file
@ -0,0 +1,8 @@
|
||||
# Configuration of additional libraries required for modules
|
||||
|
||||
QP_LIB=""
|
||||
|
||||
# Include here the optional external libraries to link with your binaries,
|
||||
# for example :
|
||||
# export QP_LIB="$QP_LIB -lint"
|
||||
|
15
etc/local.rc
Normal file
15
etc/local.rc
Normal file
@ -0,0 +1,15 @@
|
||||
# Configuration specific to the local machine
|
||||
|
||||
# Maximum allowed memory per node
|
||||
# export QP_MAXMEM=64
|
||||
|
||||
# Target number of threads for Davidson's algorithm
|
||||
# export QP_NTHREADS_DAVIDSON=32
|
||||
|
||||
# Target number of threads for the computation of the PT2
|
||||
# export QP_NTHREADS_PT2=32
|
||||
|
||||
# Name of the network interface to be chosen
|
||||
# export QP_NIC=ib0
|
||||
|
||||
|
3
etc/ninja.rc
Normal file
3
etc/ninja.rc
Normal file
@ -0,0 +1,3 @@
|
||||
# Configuration for the Ninja package
|
||||
|
||||
export NINJA=${QP_ROOT}/bin/ninja
|
12
etc/ocaml.rc
Normal file
12
etc/ocaml.rc
Normal file
@ -0,0 +1,12 @@
|
||||
# Configuration for the OCaml compiler
|
||||
|
||||
if [[ -z $OPAMROOT ]]
|
||||
then
|
||||
|
||||
# Comment these lines if you have a system-wide OCaml installation
|
||||
export OPAMROOT=${QP_ROOT}/external/opam
|
||||
|
||||
fi
|
||||
source ${OPAMROOT}/opam-init/init.sh > /dev/null 2> /dev/null || true
|
||||
|
||||
|
43
etc/paths.rc
Normal file
43
etc/paths.rc
Normal file
@ -0,0 +1,43 @@
|
||||
# Configuration of all the paths to executables and libraries
|
||||
|
||||
if [[ -z $QP_PYTHON ]]
|
||||
then
|
||||
|
||||
# Load dependencies
|
||||
for i in ezfio.rc irpf90.rc network.rc ninja.rc ocaml.rc
|
||||
do
|
||||
source $i
|
||||
done
|
||||
|
||||
|
||||
export QP_PYTHON=${QP_PYTHON}:${QP_EZFIO}/Python
|
||||
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/scripts
|
||||
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/scripts/ezfio_interface
|
||||
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/scripts/utility
|
||||
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/scripts/module
|
||||
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/scripts/compilation
|
||||
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/external/Python
|
||||
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/external/Python/resultsFile
|
||||
|
||||
|
||||
function qp_prepend_export () {
|
||||
eval "value_1="\${$1}""
|
||||
if [[ -z $value_1 ]] ; then
|
||||
echo "${2}:"
|
||||
else
|
||||
echo "${2}:${value_1}"
|
||||
fi
|
||||
}
|
||||
|
||||
export PYTHONPATH=$(qp_prepend_export "PYTHONPATH" "${QP_EZFIO}/Python":"${QP_PYTHON}")
|
||||
|
||||
export PATH=$(qp_prepend_export "PATH" "${QP_PYTHON}":"${QP_ROOT}"/bin:"${QP_ROOT}"/ocaml)
|
||||
|
||||
export LD_LIBRARY_PATH=$(qp_prepend_export "LD_LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)
|
||||
|
||||
export LIBRARY_PATH=$(qp_prepend_export "LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)
|
||||
|
||||
export C_INCLUDE_PATH=$(qp_prepend_export "C_INCLUDE_PATH" "${QP_ROOT}"/include)
|
||||
|
||||
fi
|
||||
|
159
etc/qp.rc
Normal file
159
etc/qp.rc
Normal file
@ -0,0 +1,159 @@
|
||||
# Configuration of the qp shell command
|
||||
|
||||
if [[ "$(ps -p $$ -ocomm=)" == "zsh" ]] ; then
|
||||
autoload bashcompinit
|
||||
bashcompinit
|
||||
fi
|
||||
|
||||
source ${QP_ROOT}/etc/ezfio.rc
|
||||
|
||||
function _qp_usage()
|
||||
{
|
||||
echo "
|
||||
Usage:
|
||||
qp set_file EZFIO_DIRECTORY
|
||||
qp unset_file
|
||||
|
||||
qp has DIRECTORY ITEM
|
||||
qp get DIRECTORY ITEM
|
||||
qp set DIRECTORY ITEM VALUE : Scalar values
|
||||
qp set DIRECTORY ITEM : Array values read from stdin
|
||||
|
||||
qp run PROGRAM
|
||||
qp srun PROGRAM
|
||||
qp mpirun PROGRAM
|
||||
|
||||
qp set_frozen_core
|
||||
qp create_ezfio_from_xyz -help
|
||||
qp set_mo_class -help
|
||||
"
|
||||
}
|
||||
|
||||
function qp()
|
||||
{
|
||||
case $1 in
|
||||
"has"|"set"|"get"|"set_file"|"unset_file")
|
||||
ezfio $@
|
||||
;;
|
||||
|
||||
"set_frozen_core")
|
||||
shift
|
||||
qp_set_frozen_core ${EZFIO_FILE}
|
||||
;;
|
||||
|
||||
"create_ezfio_from_xyz")
|
||||
shift
|
||||
[[ -n $EZFIO_FILE ]] && ezfio unset_file
|
||||
NAME=$(qp_create_ezfio_from_xyz $@)
|
||||
ezfio set_file $NAME
|
||||
;;
|
||||
|
||||
"set_mo_class")
|
||||
shift
|
||||
qp_set_mo_class ${EZFIO_FILE} $@
|
||||
;;
|
||||
|
||||
"edit")
|
||||
shift
|
||||
qp_edit ${EZFIO_FILE}
|
||||
;;
|
||||
|
||||
"run")
|
||||
shift
|
||||
qp_run $@ ${EZFIO_FILE}
|
||||
;;
|
||||
|
||||
"srun")
|
||||
shift
|
||||
qp_srun $@ ${EZFIO_FILE}
|
||||
;;
|
||||
|
||||
"mpirun")
|
||||
shift
|
||||
qp_mpirun $@ ${EZFIO_FILE}
|
||||
;;
|
||||
|
||||
*)
|
||||
_qp_usage
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
|
||||
_Complete()
|
||||
{
|
||||
local cur
|
||||
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
prev2="${COMP_WORDS[COMP_CWORD-2]}"
|
||||
|
||||
if [[ -n ${EZFIO_FILE} && -d ${EZFIO_FILE} ]]
|
||||
then
|
||||
|
||||
case "${prev2}" in
|
||||
"set"|has|get)
|
||||
if [[ ${prev} == "qp" ]] ; then
|
||||
COMPREPLY=( $(compgen -W "set set_frozen_core set_mo_class" -- $cur ) )
|
||||
elif [[ ! -d ${EZFIO_FILE}/${prev} ]] ; then
|
||||
COMPREPLY=( $(compgen -W "" -- $cur ) )
|
||||
else
|
||||
COMPREPLY=( $(compgen -W "$(cd ${EZFIO_FILE}/${prev} ; ls | sed 's/\.gz//' )" -- $cur ) )
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=( $(compgen -W "$(\ls)" -- $cur ) )
|
||||
esac
|
||||
|
||||
case "${prev}" in
|
||||
run|srun|mpirun)
|
||||
COMPREPLY=( $(compgen -W "$(cat ${QP_ROOT}/data/executables | cut -d ' ' -f 1)" -- $cur ) )
|
||||
return 0
|
||||
;;
|
||||
unset_file|edit|set_frozen_core)
|
||||
COMPREPLY=()
|
||||
return 0
|
||||
;;
|
||||
set_mo_class)
|
||||
COMPREPLY=( $(compgen -W "-h -core -inact -act -virt -del" -- $cur ) )
|
||||
return 0
|
||||
;;
|
||||
set|has|get)
|
||||
COMPREPLY=( $(compgen -W "$(cd ${EZFIO_FILE} ; \ls -d */ | sed 's|/||g')" -- $cur ) )
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=( $(compgen -W 'has get set unset_file edit \
|
||||
run srun mpirun set_frozen_core \
|
||||
set_mo_class create_ezfio_from_xyz \
|
||||
-h' -- $cur ) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
else
|
||||
|
||||
case "${prev}" in
|
||||
set_file)
|
||||
COMPREPLY=( $(compgen -W "$(\ls -d */ | sed 's|/||g')" -- ${cur} ) )
|
||||
return 0
|
||||
;;
|
||||
create_ezfio_from_xyz)
|
||||
COMPREPLY=( $(compgen -W "$(\ls)" -- ${cur} ) )
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=( $(compgen -W 'set_file \
|
||||
create_ezfio_from_xyz \
|
||||
-h' -- $cur ) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
complete -F _Complete qp
|
@ -660,7 +660,7 @@ let run ?o b au c d m p cart xyz_file =
|
||||
end;
|
||||
raise ex;
|
||||
end
|
||||
in ()
|
||||
in print_endline ezfio_file
|
||||
|
||||
|
||||
|
||||
|
11
qpsh
Executable file
11
qpsh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
export QP_ROOT=$(dirname $0)
|
||||
|
||||
exec bash --init-file <(cat << EOF
|
||||
PS1="[\u@\h \W] |\\\${EZFIO_FILE}> "
|
||||
source $QP_ROOT/quantum_package.rc
|
||||
EOF
|
||||
)
|
||||
|
||||
|
37
quantum_package.rc
Normal file
37
quantum_package.rc
Normal file
@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
# This script loads the Quantum Package environment. It should be invoked as
|
||||
# source quantum_package.rc
|
||||
|
||||
|
||||
QP_ROOT="/NOT/FOUND"
|
||||
case "$(ps -p $$ -ocomm=)" in
|
||||
"zsh")
|
||||
QP_ROOT=$(dirname $0)
|
||||
;;
|
||||
*)
|
||||
QP_ROOT=$(dirname ${BASH_SOURCE}[0])
|
||||
;;
|
||||
esac
|
||||
|
||||
export QP_ROOT="$( cd $QP_ROOT ; pwd -P )"
|
||||
|
||||
|
||||
|
||||
WD=$PWD
|
||||
|
||||
cd $QP_ROOT/etc
|
||||
for SCRIPT in *.rc
|
||||
do
|
||||
source $SCRIPT
|
||||
done
|
||||
cd $WD
|
||||
|
||||
|
||||
|
||||
if [[ -z ${QP_ROOT} ]]
|
||||
then
|
||||
echo The QP_ROOT environment variable is not set. Run
|
||||
|
||||
./configure --help
|
||||
|
||||
fi
|
@ -1,57 +0,0 @@
|
||||
# This line should contain the location of your quantum_package directory
|
||||
export QP_ROOT=
|
||||
|
||||
# Include here the optional external libraries to link with your binaries
|
||||
# export QP_LIB=" -lint"
|
||||
|
||||
#### BEGIN Don't modify
|
||||
|
||||
export IRPF90=${QP_ROOT}/bin/irpf90
|
||||
export NINJA=${QP_ROOT}/bin/ninja
|
||||
export QP_EZFIO=${QP_ROOT}/external/ezfio
|
||||
export QP_PYTHON=${QP_ROOT}/scripts:${QP_ROOT}/scripts/ezfio_interface:${QP_ROOT}/scripts/utility:${QP_ROOT}/scripts/module:${QP_ROOT}/scripts/pseudo:${QP_ROOT}/scripts/compilation:${QP_EZFIO}/Python:${QP_ROOT}/external/Python:${QP_ROOT}/external/Python/resultsFile
|
||||
|
||||
function qp_prepend_export () {
|
||||
eval "value_1="\${$1}""
|
||||
if [[ -z $value_1 ]] ; then
|
||||
echo "${2}:"
|
||||
else
|
||||
echo "${2}:${value_1}"
|
||||
fi
|
||||
}
|
||||
export PYTHONPATH=$(qp_prepend_export "PYTHONPATH" "${QP_EZFIO}/Python":"${QP_PYTHON}")
|
||||
export PATH=$(qp_prepend_export "PATH" "${QP_PYTHON}":"${QP_ROOT}"/bin:"${QP_ROOT}"/ocaml)
|
||||
export LD_LIBRARY_PATH=$(qp_prepend_export "LD_LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)
|
||||
export LIBRARY_PATH=$(qp_prepend_export "LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)
|
||||
export C_INCLUDE_PATH=$(qp_prepend_export "C_INCLUDE_PATH" "${QP_ROOT}"/include)
|
||||
|
||||
function qp() {
|
||||
ezfio $@
|
||||
}
|
||||
|
||||
# EZFIO completion
|
||||
if [[ $SHELL == "/bin/bash" ]] ; then
|
||||
if [[ -f ${QP_EZFIO}/Bash/ezfio.sh ]]; then
|
||||
source ${QP_EZFIO}/Bash/ezfio.sh
|
||||
else
|
||||
echo "EZFIO is not installed."
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#### END Don't modify
|
||||
|
||||
|
||||
|
||||
# Choose the correct network interface if the default one is incorrect
|
||||
# export QP_NIC=ib0
|
||||
# export QP_NIC=eth0
|
||||
|
||||
|
||||
|
||||
# Comment these lines if you have a system-wide OCaml installation
|
||||
export OPAMROOT=${OPAMROOT:-${QP_ROOT}/external/opam}
|
||||
source ${OPAMROOT}/opam-init/init.sh > /dev/null 2> /dev/null || true
|
||||
|
||||
|
||||
|
@ -46,6 +46,9 @@ subroutine run_cipsi
|
||||
psi_coef = psi_coef_sorted
|
||||
N_det = N_det_max
|
||||
soft_touch N_det psi_det psi_coef
|
||||
if (s2_eig) then
|
||||
call make_s2_eigenfunction
|
||||
endif
|
||||
call diagonalize_CI
|
||||
call save_wavefunction
|
||||
endif
|
||||
|
@ -125,7 +125,7 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in)
|
||||
error(:) = 0.d0
|
||||
else
|
||||
|
||||
N = max(N_in,1)
|
||||
N = max(N_in,1) * N_states
|
||||
state_average_weight_save(:) = state_average_weight(:)
|
||||
call create_selection_buffer(N, N*2, b)
|
||||
ASSERT (associated(b%det))
|
||||
@ -185,7 +185,7 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in)
|
||||
ipos=1
|
||||
do i= 1, N_det_generators
|
||||
do j=1,pt2_F(pt2_J(i))
|
||||
write(task(ipos:ipos+30),'(I9,1X,I9,1X,I9,''|'')') j, pt2_J(i), N
|
||||
write(task(ipos:ipos+30),'(I9,1X,I9,1X,I9,''|'')') j, pt2_J(i), N_in
|
||||
ipos += 30
|
||||
if (ipos > 300000-30) then
|
||||
if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task(1:ipos))) == -1) then
|
||||
@ -213,15 +213,49 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in)
|
||||
endif
|
||||
|
||||
|
||||
double precision :: mem_collector, mem, rss
|
||||
|
||||
call resident_memory(rss)
|
||||
|
||||
mem_collector = 8.d0 * & ! bytes
|
||||
( 1.d0*pt2_n_tasks_max & ! task_id, index
|
||||
+ 0.635d0*N_det_generators & ! f,d
|
||||
+ 3.d0*N_det_generators*N_states & ! eI, vI, nI
|
||||
+ 3.d0*pt2_n_tasks_max*N_states & ! eI_task, vI_task, nI_task
|
||||
+ 4.d0*(pt2_N_teeth+1) & ! S, S2, T2, T3
|
||||
+ 1.d0*(N_int*2.d0*N + N) & ! selection buffer
|
||||
+ 1.d0*(N_int*2.d0*N + N) & ! sort selection buffer
|
||||
) / 1024.d0**3
|
||||
|
||||
integer :: nproc_target
|
||||
nproc_target = nproc
|
||||
double precision :: mem
|
||||
mem = 8.d0 * N_det * (N_int * 2.d0 * 3.d0 + 3.d0 + 5.d0) / (1024.d0**3)
|
||||
call write_double(6,mem,'Estimated memory/thread (Gb)')
|
||||
if (qp_max_mem > 0) then
|
||||
nproc_target = max(1,int(dble(qp_max_mem)/mem))
|
||||
nproc_target = min(nproc_target,nproc)
|
||||
endif
|
||||
nproc_target = nthreads_pt2
|
||||
|
||||
do
|
||||
mem = mem_collector + & !
|
||||
nproc_target * 8.d0 * & ! bytes
|
||||
( 0.5d0*pt2_n_tasks_max & ! task_id
|
||||
+ 64.d0*pt2_n_tasks_max & ! task
|
||||
+ 3.d0*pt2_n_tasks_max*N_states & ! pt2, variance, norm
|
||||
+ 1.d0*pt2_n_tasks_max & ! i_generator, subset
|
||||
+ 2.d0*(N_int*2.d0*N_in + N_in) & ! selection buffers
|
||||
+ 1.d0*(N_int*2.d0*N_in + N_in) & ! sort/merge selection buffers
|
||||
) / 1024.d0**3
|
||||
|
||||
if (nproc_target == 0) then
|
||||
call check_mem(mem,irp_here)
|
||||
nproc_target = 1
|
||||
exit
|
||||
endif
|
||||
|
||||
if (mem+rss < qp_max_mem) then
|
||||
exit
|
||||
endif
|
||||
|
||||
nproc_target = nproc_target - 1
|
||||
|
||||
enddo
|
||||
call write_int(6,nproc_target,'Number of threads for PT2')
|
||||
call write_double(6,mem,'Memory (Gb)')
|
||||
|
||||
call omp_set_nested(.false.)
|
||||
|
||||
@ -253,8 +287,11 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in)
|
||||
FREE pt2_stoch_istate
|
||||
|
||||
if (N_in > 0) then
|
||||
b%cur = min(N_in,b%cur)
|
||||
if (s2_eig) then
|
||||
call make_selection_buffer_s2(b)
|
||||
else
|
||||
call remove_duplicates_in_selection_buffer(b)
|
||||
endif
|
||||
call fill_H_apply_buffer_no_selection(b%cur,b%det,N_int,0)
|
||||
endif
|
||||
@ -326,6 +363,8 @@ subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2, error, &
|
||||
rss += memory_of_double(pt2_N_teeth+1)*4.d0
|
||||
call check_mem(rss,irp_here)
|
||||
|
||||
! If an allocation is added here, the estimate of the memory should also be
|
||||
! updated in ZMQ_pt2
|
||||
allocate(task_id(pt2_n_tasks_max), index(pt2_n_tasks_max), f(N_det_generators))
|
||||
allocate(d(N_det_generators+1))
|
||||
allocate(eI(N_states, N_det_generators), eI_task(N_states, pt2_n_tasks_max))
|
||||
|
@ -10,7 +10,7 @@ subroutine create_selection_buffer(N, siz_, res)
|
||||
siz = max(siz_,1)
|
||||
|
||||
double precision :: rss
|
||||
double precision, external :: memory_of_double, memory_of_int
|
||||
double precision, external :: memory_of_double
|
||||
rss = memory_of_double(siz)*(N_int*2+1)
|
||||
call check_mem(rss,irp_here)
|
||||
|
||||
@ -171,7 +171,7 @@ subroutine make_selection_buffer_s2(b)
|
||||
|
||||
n_d = b%cur
|
||||
double precision :: rss
|
||||
double precision, external :: memory_of_double, memory_of_int
|
||||
double precision, external :: memory_of_double
|
||||
rss = (4*N_int+4)*memory_of_double(n_d)
|
||||
call check_mem(rss,irp_here)
|
||||
allocate(o(N_int,2,n_d), iorder(n_d), duplicate(n_d), bit_tmp(n_d), &
|
||||
@ -294,8 +294,112 @@ subroutine make_selection_buffer_s2(b)
|
||||
if (k > n_d) exit
|
||||
enddo
|
||||
deallocate(o)
|
||||
b%N = n_d
|
||||
b%cur = n_d
|
||||
b%N = n_d
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
subroutine remove_duplicates_in_selection_buffer(b)
|
||||
use selection_types
|
||||
type(selection_buffer), intent(inout) :: b
|
||||
|
||||
integer(bit_kind), allocatable :: o(:,:,:)
|
||||
double precision, allocatable :: val(:)
|
||||
|
||||
integer :: n_d
|
||||
integer :: i,k,sze,n_alpha,j,n
|
||||
logical :: dup
|
||||
|
||||
! Sort
|
||||
integer, allocatable :: iorder(:)
|
||||
integer*8, allocatable :: bit_tmp(:)
|
||||
integer*8, external :: det_search_key
|
||||
integer(bit_kind), allocatable :: tmp_array(:,:,:)
|
||||
logical, allocatable :: duplicate(:)
|
||||
|
||||
n_d = b%cur
|
||||
logical :: found_duplicates
|
||||
double precision :: rss
|
||||
double precision, external :: memory_of_double
|
||||
rss = (4*N_int+4)*memory_of_double(n_d)
|
||||
call check_mem(rss,irp_here)
|
||||
|
||||
found_duplicates = .False.
|
||||
allocate(iorder(n_d), duplicate(n_d), bit_tmp(n_d), &
|
||||
tmp_array(N_int,2,n_d), val(n_d) )
|
||||
|
||||
do i=1,n_d
|
||||
iorder(i) = i
|
||||
bit_tmp(i) = det_search_key(b%det(1,1,i),N_int)
|
||||
enddo
|
||||
|
||||
call i8sort(bit_tmp,iorder,n_d)
|
||||
|
||||
do i=1,n_d
|
||||
do k=1,N_int
|
||||
tmp_array(k,1,i) = b%det(k,1,iorder(i))
|
||||
tmp_array(k,2,i) = b%det(k,2,iorder(i))
|
||||
enddo
|
||||
val(i) = b%val(iorder(i))
|
||||
duplicate(i) = .False.
|
||||
enddo
|
||||
|
||||
! Find duplicates
|
||||
do i=1,n_d-1
|
||||
if (duplicate(i)) then
|
||||
cycle
|
||||
endif
|
||||
j = i+1
|
||||
do while (bit_tmp(j)==bit_tmp(i))
|
||||
if (duplicate(j)) then
|
||||
j+=1
|
||||
if (j>n_d) then
|
||||
exit
|
||||
endif
|
||||
cycle
|
||||
endif
|
||||
dup = .True.
|
||||
do k=1,N_int
|
||||
if ( (tmp_array(k,1,i) /= tmp_array(k,1,j)) &
|
||||
.or. (tmp_array(k,2,i) /= tmp_array(k,2,j)) ) then
|
||||
dup = .False.
|
||||
exit
|
||||
endif
|
||||
enddo
|
||||
if (dup) then
|
||||
duplicate(j) = .True.
|
||||
found_duplicates = .True.
|
||||
endif
|
||||
j+=1
|
||||
if (j>n_d) then
|
||||
exit
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
|
||||
if (found_duplicates) then
|
||||
|
||||
! Copy filtered result
|
||||
integer :: n_p
|
||||
n_p=0
|
||||
do i=1,n_d
|
||||
if (duplicate(i)) then
|
||||
cycle
|
||||
endif
|
||||
n_p = n_p + 1
|
||||
do k=1,N_int
|
||||
b%det(k,1,n_p) = tmp_array(k,1,i)
|
||||
b%det(k,2,n_p) = tmp_array(k,2,i)
|
||||
enddo
|
||||
val(n_p) = val(i)
|
||||
enddo
|
||||
b%cur=n_p
|
||||
b%N=n_p
|
||||
|
||||
endif
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
@ -48,6 +48,9 @@ subroutine run_stochastic_cipsi
|
||||
psi_coef = psi_coef_sorted
|
||||
N_det = N_det_max
|
||||
soft_touch N_det psi_det psi_coef
|
||||
if (s2_eig) then
|
||||
call make_s2_eigenfunction
|
||||
endif
|
||||
call diagonalize_CI
|
||||
call save_wavefunction
|
||||
endif
|
||||
|
@ -452,10 +452,10 @@ BEGIN_PROVIDER [ integer, nthreads_davidson ]
|
||||
END_DOC
|
||||
nthreads_davidson = nproc
|
||||
character*(32) :: env
|
||||
call getenv('NTHREADS_DAVIDSON',env)
|
||||
call getenv('QP_NTHREADS_DAVIDSON',env)
|
||||
if (trim(env) /= '') then
|
||||
read(env,*) nthreads_davidson
|
||||
call write_int(6,nthreads_davidson,'Number of threads for <Psi|H|Psi>')
|
||||
call write_int(6,nthreads_davidson,'Target number of threads for <Psi|H|Psi>')
|
||||
endif
|
||||
END_PROVIDER
|
||||
|
||||
|
@ -115,7 +115,7 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_
|
||||
integer :: iter2, itertot
|
||||
double precision, allocatable :: W(:,:), U(:,:), S(:,:), overlap(:,:)
|
||||
double precision, allocatable :: y(:,:), h(:,:), lambda(:), s2(:)
|
||||
double precision, allocatable :: c(:), s_(:,:), s_tmp(:,:)
|
||||
double precision, allocatable :: s_(:,:), s_tmp(:,:)
|
||||
double precision :: diag_h_mat_elem
|
||||
double precision, allocatable :: residual_norm(:)
|
||||
character*(16384) :: write_buffer
|
||||
@ -137,6 +137,13 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_
|
||||
itermax = max(3,min(davidson_sze_max, sze/N_st_diag))
|
||||
itertot = 0
|
||||
|
||||
if (state_following) then
|
||||
allocate(overlap(N_st_diag*itermax, N_st_diag*itermax))
|
||||
else
|
||||
allocate(overlap(1,1)) ! avoid 'if' for deallocate
|
||||
endif
|
||||
overlap = 0.d0
|
||||
|
||||
PROVIDE nuclear_repulsion expected_s2 psi_bilinear_matrix_order psi_bilinear_matrix_order_reverse
|
||||
|
||||
call write_time(6)
|
||||
@ -149,25 +156,51 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_
|
||||
call write_int(6,N_st,'Number of states')
|
||||
call write_int(6,N_st_diag,'Number of states in diagonalization')
|
||||
call write_int(6,sze,'Number of determinants')
|
||||
|
||||
! Find max number of cores to fit in memory
|
||||
! -----------------------------------------
|
||||
|
||||
nproc_target = nproc
|
||||
double precision :: rss
|
||||
integer :: maxab
|
||||
maxab = max(N_det_alpha_unique, N_det_beta_unique)+1
|
||||
|
||||
call resident_memory(rss)
|
||||
r1 = 8.d0*(3.d0*dble(sze*N_st_diag*itermax+5.d0*(N_st_diag*itermax)**2 &
|
||||
+ 3.d0*(N_st_diag*itermax)+nproc*(4.d0*N_det_alpha_unique+2.d0*N_st_diag*sze)))/(1024.d0**3)
|
||||
do while (r1+rss > qp_max_mem)
|
||||
nproc_target = nproc_target - 1
|
||||
r1 = 8.d0*(3.d0*dble(sze*N_st_diag*itermax+5.d0*(N_st_diag*itermax)**2 &
|
||||
+ 3.d0*(N_st_diag*itermax)+nproc_target*(4.d0*N_det_alpha_unique+2.d0*N_st_diag*sze)))/(1024.d0**3)
|
||||
do
|
||||
r1 = 8.d0 * &! bytes
|
||||
( 3.d0*(dble(sze)*(N_st_diag*itermax)) &! W,U,S
|
||||
+ 4.d0*(N_st_diag*itermax)**2 &! h,y,s_,s_tmp
|
||||
+ 2.d0*(N_st_diag*itermax) &! s2,lambda
|
||||
+ 1.d0*(N_st_diag) &! residual_norm
|
||||
! In H_S2_u_0_nstates_zmq
|
||||
+ 3.d0*(N_st_diag*N_det) &! u_t, v_t, s_t on collector
|
||||
+ 3.d0*(N_st_diag*N_det) &! u_t, v_t, s_t on slave
|
||||
+ 0.5d0*maxab &! idx0 in H_S2_u_0_nstates_openmp_work_*
|
||||
+ nproc_target * &! In OMP section
|
||||
( 1.d0*(N_int*maxab) &! buffer
|
||||
+ 3.5d0*(maxab) ) &! singles_a, singles_b, doubles, idx
|
||||
) / 1024.d0**3
|
||||
|
||||
if (nproc_target == 0) then
|
||||
call check_mem(r1,irp_here)
|
||||
nproc_target = 1
|
||||
exit
|
||||
endif
|
||||
|
||||
if (r1+rss < qp_max_mem) then
|
||||
exit
|
||||
endif
|
||||
|
||||
nproc_target = nproc_target - 1
|
||||
|
||||
enddo
|
||||
nthreads_davidson = nproc_target
|
||||
TOUCH nthreads_davidson
|
||||
call write_int(6,nproc_target,'Number of threads for diagonalization')
|
||||
call write_double(6, r1, 'Memory(Gb)')
|
||||
|
||||
!---------------
|
||||
|
||||
write(6,'(A)') ''
|
||||
write_buffer = '====='
|
||||
do i=1,N_st
|
||||
@ -198,9 +231,7 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_
|
||||
s_(N_st_diag*itermax,N_st_diag*itermax), &
|
||||
s_tmp(N_st_diag*itermax,N_st_diag*itermax), &
|
||||
residual_norm(N_st_diag), &
|
||||
c(N_st_diag*itermax), &
|
||||
s2(N_st_diag*itermax), &
|
||||
overlap(N_st_diag*itermax, N_st_diag*itermax), &
|
||||
lambda(N_st_diag*itermax))
|
||||
|
||||
h = 0.d0
|
||||
@ -503,7 +534,7 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_
|
||||
deallocate ( &
|
||||
W, residual_norm, &
|
||||
U, overlap, &
|
||||
c, S, &
|
||||
S, &
|
||||
h, &
|
||||
y, s_, s_tmp, &
|
||||
lambda &
|
||||
|
14
src/fci/environment.irp.f
Normal file
14
src/fci/environment.irp.f
Normal file
@ -0,0 +1,14 @@
|
||||
BEGIN_PROVIDER [ integer, nthreads_pt2 ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Number of threads for Davidson
|
||||
END_DOC
|
||||
nthreads_pt2 = nproc
|
||||
character*(32) :: env
|
||||
call getenv('QP_NTHREADS_PT2',env)
|
||||
if (trim(env) /= '') then
|
||||
read(env,*) nthreads_pt2
|
||||
call write_int(6,nthreads_pt2,'Target number of threads for PT2')
|
||||
endif
|
||||
END_PROVIDER
|
||||
|
Loading…
Reference in New Issue
Block a user