diff --git a/.gitignore b/.gitignore index 642381d3..096e385b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -quantum_package.rc config/ifort.cfg quantum_package_static.tar.gz build.ninja diff --git a/config/gfortran.cfg b/config/gfortran.cfg index 867f3eee..2ba8c38c 100644 --- a/config/gfortran.cfg +++ b/config/gfortran.cfg @@ -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 ################# diff --git a/config/gfortran_avx.cfg b/config/gfortran_avx.cfg index 47c39602..98ccd01f 100644 --- a/config/gfortran_avx.cfg +++ b/config/gfortran_avx.cfg @@ -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 ################# diff --git a/config/ifort.cfg b/config/ifort.cfg index d40ba26c..e2755e2f 100644 --- a/config/ifort.cfg +++ b/config/ifort.cfg @@ -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 ################# diff --git a/config/ifort_avx.cfg b/config/ifort_avx.cfg new file mode 100644 index 00000000..9810dd33 --- /dev/null +++ b/config/ifort_avx.cfg @@ -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 + diff --git a/config/ifort_avx_mpi.cfg b/config/ifort_avx_mpi.cfg new file mode 100644 index 00000000..682b847c --- /dev/null +++ b/config/ifort_avx_mpi.cfg @@ -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 + diff --git a/config/ifort_debug.cfg b/config/ifort_debug.cfg index eb2c3cc8..1392885e 100644 --- a/config/ifort_debug.cfg +++ b/config/ifort_debug.cfg @@ -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 diff --git a/config/ifort_mpi.cfg b/config/ifort_mpi.cfg index 99dfc0f2..530cbb1e 100644 --- a/config/ifort_mpi.cfg +++ b/config/ifort_mpi.cfg @@ -33,7 +33,6 @@ OPENMP : 1 ; Append OpenMP flags [OPT] FCFLAGS : -xSSE4.2 -O2 -ip -ftz -g -traceback -# !xAVX # Profiling flags ################# # diff --git a/configure b/configure index cb05d609..c6d3e7fb 100755 --- a/configure +++ b/configure @@ -3,6 +3,10 @@ # Quantum Package configuration script # +export QP_ROOT="$( cd "$(dirname "$0")" ; pwd -P )" +echo "QP_ROOT="$QP_ROOT + + help() { cat <, --config define a configuration file, in "${QP_ROOT}/config/". -h, --help print the help message - -i , --install install . Use at your own risk. + -i , --install install . 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 @@ -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 diff --git a/etc/.gitignore b/etc/.gitignore new file mode 100644 index 00000000..6fbf4389 --- /dev/null +++ b/etc/.gitignore @@ -0,0 +1 @@ +00.qp_root diff --git a/etc/README.rst b/etc/README.rst new file mode 100644 index 00000000..68d34c99 --- /dev/null +++ b/etc/README.rst @@ -0,0 +1 @@ +This directory contains all the files to be sourced when the |QP| environment is loaded. diff --git a/etc/ezfio.rc b/etc/ezfio.rc new file mode 100644 index 00000000..f92fec42 --- /dev/null +++ b/etc/ezfio.rc @@ -0,0 +1,15 @@ +if [[ -z $QP_EZFIO ]] +then + + export QP_EZFIO=${QP_ROOT}/external/ezfio + + 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 + +fi + diff --git a/etc/irpf90.rc b/etc/irpf90.rc new file mode 100644 index 00000000..82f0e751 --- /dev/null +++ b/etc/irpf90.rc @@ -0,0 +1,8 @@ +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 +) + diff --git a/etc/libraries.rc b/etc/libraries.rc new file mode 100644 index 00000000..af90c1b0 --- /dev/null +++ b/etc/libraries.rc @@ -0,0 +1,9 @@ +if [[ -z $QP_LIB ]] +then +: + + # Include here the optional external libraries to link with your binaries, + # for example +# export QP_LIB="$QP_LIB -lint" + +fi diff --git a/etc/network.rc b/etc/network.rc new file mode 100644 index 00000000..e02594b7 --- /dev/null +++ b/etc/network.rc @@ -0,0 +1,11 @@ +if [[ -z $QP_NIC ]] +then +: + + # Choose the correct network interface if the default one is incorrect +# export QP_NIC=ib0 +# export QP_NIC=eth0 + +fi + + diff --git a/etc/ninja.rc b/etc/ninja.rc new file mode 100644 index 00000000..59a3e092 --- /dev/null +++ b/etc/ninja.rc @@ -0,0 +1,8 @@ +if [[ -z $NINJA ]] +then + + export NINJA=${QP_ROOT}/bin/ninja + +fi + + diff --git a/etc/ocaml.rc b/etc/ocaml.rc new file mode 100644 index 00000000..fb58ed39 --- /dev/null +++ b/etc/ocaml.rc @@ -0,0 +1,10 @@ +if [[ -z $OPAMROOT ]] +then + + # 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 + +fi + + diff --git a/etc/paths.rc b/etc/paths.rc new file mode 100644 index 00000000..3ab5b547 --- /dev/null +++ b/etc/paths.rc @@ -0,0 +1,41 @@ +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 + diff --git a/quantum_package.rc b/quantum_package.rc new file mode 100644 index 00000000..5dd46920 --- /dev/null +++ b/quantum_package.rc @@ -0,0 +1,19 @@ +#!/bin/bash +# This script loads the Quantum Package environment. It should be invoked as +# source quantum_package.rc + +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 diff --git a/quantum_package.rc.default b/quantum_package.rc.default deleted file mode 100644 index c94ec552..00000000 --- a/quantum_package.rc.default +++ /dev/null @@ -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 - - -