2018-11-08 13:56:15 +01:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
|
|
# author: Ole Schuett
|
|
|
|
|
|
2022-02-19 14:35:21 +01:00
|
|
|
echo -e "\n========== Installing Dependencies =========="
|
|
|
|
|
apt-get update -qq
|
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
export DEBCONF_NONINTERACTIVE_SEEN=true
|
|
|
|
|
apt-get install -qq --no-install-recommends \
|
|
|
|
|
python3-setuptools \
|
|
|
|
|
python3-wheel \
|
|
|
|
|
python3-pip \
|
2024-04-30 21:46:47 +02:00
|
|
|
python3-venv \
|
2022-02-19 14:35:21 +01:00
|
|
|
python3-dev \
|
|
|
|
|
postgresql \
|
2022-05-18 22:37:42 +02:00
|
|
|
libpq-dev \
|
2022-02-19 14:35:21 +01:00
|
|
|
rabbitmq-server \
|
2024-11-05 23:48:20 +01:00
|
|
|
locales \
|
|
|
|
|
plocate \
|
2022-02-19 14:35:21 +01:00
|
|
|
sudo \
|
2024-05-06 23:25:26 +02:00
|
|
|
git \
|
2025-02-18 10:28:13 +01:00
|
|
|
ssh \
|
|
|
|
|
mpich
|
2025-02-17 15:09:21 +01:00
|
|
|
rm -rf /var/lib/apt/lists/*
|
2022-02-19 14:35:21 +01:00
|
|
|
|
2024-04-30 21:46:47 +02:00
|
|
|
# Create and activate a virtual environment for Python packages.
|
|
|
|
|
python3 -m venv /opt/venv
|
|
|
|
|
export PATH="/opt/venv/bin:$PATH"
|
|
|
|
|
|
2022-02-04 23:57:50 +01:00
|
|
|
# Some buggy Python packages open utf8 files in text mode.
|
|
|
|
|
# As a workaround we set locale.getpreferredencoding() to utf8.
|
|
|
|
|
export LANG="en_US.UTF-8" LANGUAGE="en_US:en" LC_ALL="en_US.UTF-8"
|
2022-05-18 22:37:42 +02:00
|
|
|
locale-gen ${LANG}
|
2022-02-04 23:57:50 +01:00
|
|
|
|
2024-05-06 23:25:26 +02:00
|
|
|
# Pick a compiler (needed to build some Python packages)
|
|
|
|
|
export CC=gcc
|
|
|
|
|
|
2019-09-08 22:08:33 +02:00
|
|
|
echo -e "\n========== Installing AiiDA-CP2K plugin =========="
|
2022-02-19 14:35:21 +01:00
|
|
|
git clone --quiet https://github.com/aiidateam/aiida-cp2k.git /opt/aiida-cp2k/
|
2019-09-08 22:08:33 +02:00
|
|
|
cd /opt/aiida-cp2k/
|
2026-05-17 17:15:00 +08:00
|
|
|
# For compatibility of Python 3.14
|
|
|
|
|
# pip3 install './[dev]'
|
|
|
|
|
pip3 install .
|
|
|
|
|
pip3 install 'pytest>=8.4' 'pgtest~=1.3'
|
2019-09-08 22:08:33 +02:00
|
|
|
|
|
|
|
|
echo -e "\n========== Configuring AiiDA =========="
|
|
|
|
|
AS_UBUNTU_USER="sudo -u ubuntu -H"
|
|
|
|
|
|
|
|
|
|
# start RabbitMQ
|
|
|
|
|
service rabbitmq-server start
|
|
|
|
|
|
|
|
|
|
# start and configure PostgreSQL
|
|
|
|
|
service postgresql start
|
|
|
|
|
|
2024-11-05 23:48:20 +01:00
|
|
|
# create aiida profile
|
|
|
|
|
$AS_UBUNTU_USER /opt/venv/bin/verdi presto
|
|
|
|
|
|
|
|
|
|
# fake the presents of conda
|
|
|
|
|
ln -s /bin/true /usr/bin/conda
|
|
|
|
|
|
2025-02-02 13:19:26 +01:00
|
|
|
# fake the presents of aiida-pseudo
|
|
|
|
|
ln -s /bin/true /usr/bin/aiida-pseudo
|
|
|
|
|
|
2019-09-08 22:08:33 +02:00
|
|
|
# setup code
|
2024-11-05 23:48:20 +01:00
|
|
|
mkdir -p /opt/conda/envs/cp2k/bin/
|
2025-02-17 17:29:37 +01:00
|
|
|
cat > /opt/conda/envs/cp2k/bin/cp2k.psmp << EndOfMessage
|
2018-11-08 13:56:15 +01:00
|
|
|
#!/bin/bash -e
|
2023-05-03 20:28:14 +02:00
|
|
|
export OMP_NUM_THREADS=2
|
2025-02-02 10:26:37 +01:00
|
|
|
source /opt/cp2k-toolchain/install/setup
|
2025-02-17 14:08:34 +01:00
|
|
|
/opt/cp2k/build/bin/cp2k.ssmp "\$@"
|
2018-11-08 13:56:15 +01:00
|
|
|
EndOfMessage
|
2025-02-17 17:29:37 +01:00
|
|
|
chmod +x /opt/conda/envs/cp2k/bin/cp2k.psmp
|
2018-11-08 13:56:15 +01:00
|
|
|
|
|
|
|
|
echo -e "\n========== Running AiiDA-CP2K Tests =========="
|
|
|
|
|
set +e # disable error trapping for remainder of script
|
|
|
|
|
(
|
2021-02-17 17:02:43 +01:00
|
|
|
set -e # abort on error
|
|
|
|
|
ulimit -t 1800 # abort after 30 minutes
|
2025-02-02 13:19:26 +01:00
|
|
|
$AS_UBUNTU_USER /opt/venv/bin/py.test -k "not example_sirius"
|
2018-11-08 13:56:15 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
EXIT_CODE=$?
|
|
|
|
|
|
|
|
|
|
AIIDA_COMMIT=$(git rev-parse --short HEAD)
|
2021-02-17 17:02:43 +01:00
|
|
|
if ((EXIT_CODE)); then
|
2022-02-19 14:35:21 +01:00
|
|
|
echo -e "\nSummary: Something is wrong with aiida-cp2k commit ${AIIDA_COMMIT}."
|
|
|
|
|
echo -e "Status: FAILED\n"
|
2018-11-08 13:56:15 +01:00
|
|
|
else
|
2022-02-19 14:35:21 +01:00
|
|
|
echo -e "\nSummary: aiida-cp2k commit ${AIIDA_COMMIT} works fine."
|
|
|
|
|
echo -e "Status: OK\n"
|
2018-11-08 13:56:15 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
#EOF
|