mirror of
https://gitlab.com/scemama/qmcchem.git
synced 2024-08-29 06:22:00 +02:00
Install scripts
This commit is contained in:
parent
33637e1ed4
commit
eecf75171e
13
README.md
13
README.md
@ -29,6 +29,19 @@ diffusion Monte Carlo algorithm.
|
||||
software including (via compiler) GPL-licensed code must also be made available
|
||||
under the GPL along with build & install instructions.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
* Ninja building system (replacement for GNU make)
|
||||
* EZFIO library generator
|
||||
* ZeroMQ library
|
||||
* ZeroMQ Fortran77 binding
|
||||
* IRPF90 Fortran code generator
|
||||
* OCaml compiler
|
||||
* Fortran compiler (Intel Fortran recommended)
|
||||
|
||||
All the dependencies will be downloaded automatically
|
||||
|
||||
Example of a QMC=Chem calculation
|
||||
---------------------------------
|
||||
|
||||
|
17
configure.sh
Executable file
17
configure.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -u
|
||||
cd install
|
||||
mkdir -p Downloads _build
|
||||
mkdir -p bin
|
||||
if [[ ! -x ../bin/ninja ]]
|
||||
then
|
||||
echo "Installing Ninja"
|
||||
./scripts/install_ninja.sh &> _build/ninja.log
|
||||
touch _build/ninja.ok
|
||||
fi
|
||||
touch ../{src,ocaml}/ls_md5
|
||||
exec ../bin/ninja "$@"
|
||||
|
||||
|
76
install/build.ninja
Normal file
76
install/build.ninja
Normal file
@ -0,0 +1,76 @@
|
||||
# This script should be run in the install dircetory
|
||||
|
||||
# URLs
|
||||
######
|
||||
|
||||
URL_OPAM ="http://raw.github.com/ocaml/opam/master/shell/opam_installer.sh"
|
||||
URL_IRPF90="http://github.com/scemama/irpf90/archive/v1.6.7.tar.gz"
|
||||
URL_EZFIO ="http://github.com/scemama/EZFIO/archive/v1.3.1.tar.gz"
|
||||
|
||||
URL_ZMQ ="http://download.zeromq.org/zeromq-4.0.7.tar.gz"
|
||||
#URL_ZMQ ="http://download.zeromq.org/zeromq-4.1.3.tar.gz"
|
||||
URL_F77ZMQ="http://github.com/scemama/f77_zmq/archive/v4.1.3.tar.gz"
|
||||
|
||||
# Rules
|
||||
#######
|
||||
|
||||
rule download
|
||||
command = wget ${url} -O ${out} -o /dev/null
|
||||
description = Downloading ${descr}
|
||||
|
||||
rule install
|
||||
command = ./scripts/install_${target}.sh > _build/${target}.log 2>&1 && touch _build/${target}.ok || cat _build/${target}.log
|
||||
description = Installing ${descr}
|
||||
|
||||
|
||||
# Builds
|
||||
########
|
||||
|
||||
build Downloads/irpf90.tar.gz: download
|
||||
url = ${URL_IRPF90}
|
||||
descr = IRPF90 code generator
|
||||
|
||||
build Downloads/ezfio.tar.gz: download
|
||||
url = ${URL_EZFIO}
|
||||
descr = EZFIO I/O library generator
|
||||
|
||||
build Downloads/zmq.tar.gz: download
|
||||
url = ${URL_ZMQ}
|
||||
descr = ZeroMQ communication library
|
||||
|
||||
build Downloads/f77_zmq.tar.gz: download
|
||||
url = ${URL_F77ZMQ}
|
||||
descr = Fortran ZeroMQ interface
|
||||
|
||||
build Downloads/opam_installer.sh: download
|
||||
url = ${URL_OPAM}
|
||||
descr = OCaml OPAM installer
|
||||
|
||||
build _build/irpf90.ok ../bin/irpman ../bin/irpf90: install | Downloads/irpf90.tar.gz
|
||||
target = irpf90
|
||||
descr = IRPF90
|
||||
|
||||
build _build/zmq.ok ../lib/libzmq.a ../lib/libzmq.so.4 ../lib/libzmq.so ../lib/zmq.h ../lib/zmq_utils.h: install | Downloads/zmq.tar.gz
|
||||
target = zmq
|
||||
descr = ZeroMQ
|
||||
|
||||
build _build/ezfio.ok: install | Downloads/ezfio.tar.gz _build/irpf90.ok ../bin/irpman ../bin/irpf90
|
||||
target = ezfio
|
||||
descr = EZFIO
|
||||
|
||||
build _build/f77_zmq.ok ../src/ZMQ/f77_zmq.h ../lib/libf77zmq.a ../lib/libf77zmq.so: install | Downloads/f77_zmq.tar.gz _build/zmq.ok ../lib/libzmq.a ../lib/libzmq.so.4 ../lib/libzmq.so ../lib/zmq.h ../lib/zmq_utils.h
|
||||
target = f77_zmq
|
||||
descr = Fortran ZeroMQ interface
|
||||
|
||||
build _build/qmcchemrc.ok ../qmcchemrc: install | _build/irpf90.ok ../bin/irpman ../bin/irpf90 _build/ezfio.ok
|
||||
target = qmcchemrc
|
||||
description = QMC=Chem environment variables
|
||||
|
||||
build _build/ocaml.ok ../bin/opam: install | Downloads/opam_installer.sh _build/qmcchemrc.ok ../qmcchemrc
|
||||
target = ocaml
|
||||
descr = Ocaml compiler
|
||||
|
||||
build _build/ocaml_zmq.ok: install | ../bin/opam ../lib/libzmq.so ../lib/zmq.h ../lib/zmq_utils.h _build/ocaml.ok _build/zmq.ok ../lib/libzmq.a ../lib/libzmq.so.4 ../lib/libzmq.so ../lib/zmq.h ../lib/zmq_utils.h
|
||||
target = ocaml_zmq
|
||||
descr = Ocaml ZeroMQ interface
|
||||
|
14
install/scripts/build.sh
Executable file
14
install/scripts/build.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash -x
|
||||
# This script should be included by all other scripts in this directory
|
||||
|
||||
set -u # All variables should be defined
|
||||
set -e # The script should exit if something goes wrong
|
||||
|
||||
BUILD="_build/${TARGET}"
|
||||
rm -rf -- "${BUILD}"
|
||||
mkdir "${BUILD}"
|
||||
tar -zxf "Downloads/${TARGET}.tar.gz" --strip-components=1 --directory="${BUILD}"
|
||||
_install
|
||||
rm -rf -- "${BUILD}" "${BUILD}.log"
|
||||
exit 0
|
||||
|
22
install/scripts/install_ezfio.sh
Executable file
22
install/scripts/install_ezfio.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
TARGET=ezfio
|
||||
|
||||
function _install()
|
||||
{
|
||||
set -e
|
||||
set -u
|
||||
cd ..
|
||||
QMCCHEM_PATH="$PWD"
|
||||
cd -
|
||||
rm -rf "${QMCCHEM_PATH}"/EZFIO
|
||||
cd "${BUILD}"/config
|
||||
rm -f -- qmc.config properties.config
|
||||
touch "${QMCCHEM_PATH}"/ezfio_config/properties.config
|
||||
ln -s "${QMCCHEM_PATH}"/ezfio_config/qmc.config qmc.config
|
||||
ln -s "${QMCCHEM_PATH}"/ezfio_config/properties.config properties.config
|
||||
cd -
|
||||
mv "${BUILD}" "${QMCCHEM_PATH}"/EZFIO
|
||||
}
|
||||
|
||||
source scripts/build.sh
|
22
install/scripts/install_f77_zmq.sh
Executable file
22
install/scripts/install_f77_zmq.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
TARGET=f77_zmq
|
||||
function _install()
|
||||
{
|
||||
set +u
|
||||
export C_INCLUDE_PATH=$C_INCLUDE_PATH:../../../lib
|
||||
set -e
|
||||
set -u
|
||||
cd "${BUILD}"
|
||||
export ZMQ_H=../../../lib/zmq.h
|
||||
cp "${ZMQ_H}" .
|
||||
make -j
|
||||
cd -
|
||||
rm -f -- "../src/ZMQ/f77_zmq.h" "../lib/libf77zmq.a" "../lib/libf77zmq.so"
|
||||
cp "${BUILD}"/libf77zmq.{a,so} ../lib/
|
||||
cp "${BUILD}"/f77_zmq.h ../src/ZMQ/
|
||||
return 0
|
||||
}
|
||||
|
||||
source scripts/build.sh
|
||||
|
28
install/scripts/install_irpf90.sh
Executable file
28
install/scripts/install_irpf90.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
TARGET=irpf90
|
||||
function _install()
|
||||
{
|
||||
set -e
|
||||
set -u
|
||||
make -C "${BUILD}" -j
|
||||
rm -rf -- ../irpf90
|
||||
mv "${BUILD}" ../
|
||||
# Check the build is OK
|
||||
[[ -x ../irpf90/bin/irpf90 ]]
|
||||
[[ -x ../irpf90/bin/irpman ]]
|
||||
for i in irpf90 irpman
|
||||
do
|
||||
rm -rf -- ../bin/$i
|
||||
cat << EOF > ../bin/$i
|
||||
#!/bin/bash -u
|
||||
exec "\${QMCCHEM_PATH}"/irpf90/bin/$i "\$@"
|
||||
EOF
|
||||
chmod +x ../bin/$i
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
source scripts/build.sh
|
||||
|
||||
|
25
install/scripts/install_ninja.sh
Executable file
25
install/scripts/install_ninja.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
set -u
|
||||
set -e
|
||||
|
||||
TARGET=ninja
|
||||
URL="http://github.com/martine/ninja/archive/v1.5.3.tar.gz"
|
||||
|
||||
function _install()
|
||||
{
|
||||
set -e
|
||||
set -u
|
||||
cd "${BUILD}"
|
||||
./configure.py --bootstrap
|
||||
cd -
|
||||
mv "${BUILD}/ninja" ../bin/
|
||||
return 0
|
||||
}
|
||||
|
||||
if [[ ! -f "Downloads/${TARGET}.tar.gz" ]]
|
||||
then
|
||||
wget ${URL} -O "Downloads/${TARGET}.tar.gz"
|
||||
fi
|
||||
source scripts/build.sh
|
||||
|
47
install/scripts/install_ocaml.sh
Executable file
47
install/scripts/install_ocaml.sh
Executable file
@ -0,0 +1,47 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
set -u
|
||||
set -e
|
||||
|
||||
PACKAGES="core cryptokit ocamlfind sexplib"
|
||||
|
||||
declare -i i
|
||||
i=$(gcc -dumpversion | cut -d '.' -f 2)
|
||||
if [[ i -lt 6 ]]
|
||||
then
|
||||
echo "GCC version $(gcc -dumpversion) too old. GCC >= 4.6 required."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source ../qmcchemrc
|
||||
cd Downloads
|
||||
chmod +x opam_installer.sh
|
||||
|
||||
if [[ -d "${HOME}"/.opam ]]
|
||||
then
|
||||
set +e
|
||||
set +u
|
||||
source "${HOME}"/.opam/opam-init/init.sh
|
||||
set -e
|
||||
set -u
|
||||
fi
|
||||
|
||||
echo N | ./opam_installer.sh "${QMCCHEM_PATH}"/bin/
|
||||
if [[ ! -f "${QMCCHEM_PATH}"/bin/opam ]]
|
||||
then
|
||||
echo "Installation of OPAM failed"
|
||||
exit 2
|
||||
fi
|
||||
"${QMCCHEM_PATH}"/bin/opam config setup -a --dot-profile "${QMCCHEM_PATH}"/qmcchemrc
|
||||
touch "${QMCCHEM_PATH}"/bin/opam
|
||||
|
||||
set +u
|
||||
export LD_LIBRARY_PATH="${QMCCHEM_PATH}/lib:${LD_LIBRARY_PATH}"
|
||||
export LIBRARY_PATH="${QMCCHEM_PATH}/lib:${LIBRARY_PATH}"
|
||||
export C_INCLUDE_PATH="${QMCCHEM_PATH}/lib:${C_INCLUDE_PATH}"
|
||||
set -u
|
||||
opam install ${PACKAGES}
|
||||
rm ../_build/ocaml.log
|
||||
exit 0
|
||||
|
||||
|
21
install/scripts/install_ocaml_zmq.sh
Executable file
21
install/scripts/install_ocaml_zmq.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
declare -i i
|
||||
i=$(gcc -dumpversion | cut -d '.' -f 2)
|
||||
if [[ i -lt 6 ]]
|
||||
then
|
||||
echo "GCC version $(gcc -dumpversion) too old. GCC >= 4.6 required."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set +u
|
||||
source ../qmcchemrc
|
||||
set -u
|
||||
opam install zmq
|
||||
rm -f _build/ocaml_zmq.log
|
||||
exit 0
|
||||
|
||||
|
19
install/scripts/install_qmcchemrc.sh
Executable file
19
install/scripts/install_qmcchemrc.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd ..
|
||||
cat << EOF > qmcchemrc
|
||||
# QMC=Chem environment variables
|
||||
export QMCCHEM_PATH=${PWD}
|
||||
export PATH="\${QMCCHEM_PATH}/bin:\${PATH}"
|
||||
export LD_LIBRARY_PATH="\${QMCCHEM_PATH}/lib:\${LD_LIBRARY_PATH}"
|
||||
export LIBRARY_PATH="\${QMCCHEM_PATH}/lib:\${LIBRARY_PATH}"
|
||||
export QMCCHEM_MPIRUN="mpirun"
|
||||
export QMCCHEM_MPIRUN_FLAGS="--bind-to-core"
|
||||
#export QMCCHEM_NIC=ib0
|
||||
source \${QMCCHEM_PATH}/irpf90/bin/irpman
|
||||
source \${QMCCHEM_PATH}/EZFIO/Bash/ezfio.sh
|
||||
EOF
|
||||
|
||||
cd -
|
||||
rm -f _build/qmcchemrc.log
|
||||
exit 0
|
28
install/scripts/install_zmq.sh
Executable file
28
install/scripts/install_zmq.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
TARGET=zmq
|
||||
function _install()
|
||||
{
|
||||
LIBVERSION=4
|
||||
set +u
|
||||
export C_INCLUDE_PATH="${C_INCLUDE_PATH}":./
|
||||
set -e
|
||||
set -u
|
||||
cd "${BUILD}"
|
||||
./configure --without-libsodium
|
||||
make -j 8
|
||||
cd -
|
||||
rm -f -- ../lib/libzmq.a ../lib/libzmq.so ../lib/libzmq.so.$LIBVERSION
|
||||
# cp "${BUILD}"/.libs/libzmq.a ../lib/
|
||||
# cp "${BUILD}"/.libs/libzmq.so ../lib/libzmq.so.$LIBVERSION
|
||||
cp "${BUILD}"/src/.libs/libzmq.a ../lib/
|
||||
cp "${BUILD}"/src/.libs/libzmq.so ../lib/libzmq.so.$LIBVERSION
|
||||
cp "${BUILD}"/include/{zmq,zmq_utils}.h ../lib/
|
||||
cd ../lib
|
||||
ln libzmq.so.$LIBVERSION libzmq.so || cp libzmq.so.$LIBVERSION libzmq.so
|
||||
cd -
|
||||
return 0
|
||||
}
|
||||
|
||||
source scripts/build.sh
|
||||
|
Loading…
Reference in New Issue
Block a user