Skip to content

Install MACE in CI #628

Install MACE in CI

Install MACE in CI #628

Workflow file for this run

# This is testing the python versions *other than* the
# one in the QUIP Docker, which is 3.7.10 at the time
# of writing this. Coverage is disabled.
name: Python Package and tests
# on all push actions AND can be triggered manually as well
on:
workflow_dispatch:
pull_request:
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.8 ]
max-parallel: 5
env:
coverage-on-version: 3.8
use-mpi: True
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
# - name: Install Dependencies from Conda
# run: conda env update --file=devtools/conda-envs/environment.yml --name=base
- name: Install pip from Conda
run: conda install pip
- name: Install dependencies from pip (some will already be taken care of by conda's phonop3py and its dependencies)
run: pip install wheel setuptools numpy scipy click matplotlib pandas pyyaml spglib rdkit-pypi flake8 pytest pytest-cov
- name: Install latest ASE from gitlab
run: pip install git+https://gitlab.com/ase/ase.git
- name: Install intel-mkl-full for phono3py
run: |
# based on
# https://www.intel.com/content/www/us/en/docs/oneapi/installation-guide-linux/2023-0/apt.html
# download the key to system keyring
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
# add signed entry to apt sources and configure the APT client to use Intel repository:
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt update
sudo apt install intel-mkl
- name: Install phono3py from source
run: |
echo "mkl packages installed"
apt list --installed | grep mkl
echo "dpkg -L intel-mkl"
dpkg -L intel-mkl
echo "dpkg-query -L intel-mkl"
dpkg-query -L intel-mkl
echo "try to set mklvars"
mklvars=$( dpkg -L intel-mkl | egrep '/mklvars.sh$' )
source $mklvars intel64
git clone https://github.com/phonopy/phonopy
cd phonopy
python3 setup.py build
python3 -m pip install .
cd ..
git clone https://github.com/phonopy/phono3py
cd phono3py
python3 setup.py build
python3 setup.py install
cd ..
- name: Install Quippy from PyPI
run: pip install quippy-ase
- name: Julia and ace fit
run: |
pip install pip install threadpoolctl
wget https://julialang-s3.julialang.org/bin/linux/x64/1.8/julia-1.8.1-linux-x86_64.tar.gz
tar xzf julia-1.8.1-linux-x86_64.tar.gz
# note that this hardwires a particular compatible ACE1pack version
echo 'using Pkg; pkg"registry add https://github.com/JuliaRegistries/General"; pkg"registry add https://github.com/JuliaMolSim/MolSim.git"; pkg"add [email protected], ACE1, JuLIP, IPFitting, ASE"' > ace1pack_install.jl
${PWD}/julia-1.8.1/bin/julia ace1pack_install.jl
- name: MACE
run: |
pip install git+https://github.com/ACEsuit/mace.git@develop
python3 -c "import mace; print(mace.__file__)"
- name: Install wfl (expyre and universalSOAP are dependencies)
run: pip install .
- name: Install Quantum Espresso
run: |
sudo apt-get install --no-install-recommends quantum-espresso
- name: Install MOPAC
run: |
wget https://github.com/openmopac/mopac/releases/download/v22.0.6/mopac-22.0.6-linux.tar.gz
tar -xzvf mopac-22.0.6-linux.tar.gz
- name: add mopac to path
run: echo $GITHUB_WORKSPACE/mopac-22.0.6-linux/bin >> $GITHUB_PATH
- name: Install buildcell
run: |
sudo apt-get install gfortran
wget https://www.mtg.msm.cam.ac.uk/system/files/documents/airss-0.9.1.tgz
tar xzf airss-0.9.1.tgz
cd airss-0.9.1
make buildcell
mkdir -p $HOME/bin
cp src/buildcell/src/buildcell $HOME/bin/
cd ..
- name: Add buildcell to system path
run: |
echo $HOME/bin >> $GITHUB_PATH
- name: Install xTB
run: |
conda install -c conda-forge xtb-python
pip install typing-extensions
- name: Install MPI dependencies
if: env.use-mpi
run: |
# this can eaily be turned off if needed
conda install -c conda-forge mpi4py openmpi pytest-mpi
pip install mpipool
- name: Install and configure slurm and ExPyRe
run: |
sudo apt-get install -u slurm-wlm mailutils
echo "SLURM apt-get done, doing local configuration"
host_s=$( hostname -s )
if [ -f /etc/slurm/slurm.conf ]; then sudo mv /etc/slurm/slurm.conf /etc/slurm/slurm.conf.orig; fi
sudo bash -c 'gzip -cd /usr/share/doc/slurmd/examples/slurm.conf.simple.gz > /etc/slurm/slurm.conf'
# sudo sed -E -i -e "s/^\s*ClusterName\s*=.*/ClusterName=github_expyre_test/" /etc/slurm/slurm.conf
sudo bash -c 'sed -E -i -e "s/^\s*SlurmctldHost\s*=.*/SlurmctldHost=_HOST_/" /etc/slurm/slurm.conf'
# sudo sed -E -i -e "s/^\s*DefaultStorageHost\s*=.*/DefaultStorageHost=none" /etc/slurm/slurm.conf
sudo bash -c 'echo "NodeName=_HOST_ CPUs=2 Weight=1 Sockets=1 CoresPerSocket=2 ThreadsPerCore=1 RealMemory=1000" >> /etc/slurm/slurm.conf'
sudo bash -c 'echo "PartitionName=standard Default=YES AllocNodes=_HOST_ Nodes=ALL State=UP" >> /etc/slurm/slurm.conf'
sudo sed -i -e "s/_HOST_/$host_s/g" /etc/slurm/slurm.conf
sudo mkdir -p /var/log/slurm
sudo mkdir -p /var/spool/slurmd
sudo service slurmd start
sudo service slurmctld start
sleep 5
echo "sinfo -s --long"
sinfo -s --long
mkdir $HOME/.expyre
cp .github/workflows_assets/config.json $HOME/.expyre
echo "which pw.x"
which pw.x
ls -l /usr/bin/pw.x
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 wfl/ --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings.
flake8 wfl/ --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics
- name: Test with pytest - plain
if: env.coverage-on-version != matrix.python-version
run: |
rm -rf $HOME/pytest_plain
mkdir $HOME/pytest_plain
#
export EXPYRE_PYTEST_SYSTEMS=github
export WFL_PYTEST_BUILDCELL=$HOME/bin/buildcell
export WFL_NUM_PYTHON_SUBPROCESSES=2
export OMP_NUM_THREADS=1
export WFL_JULIA_COMMAND=${PWD}/julia-1.8.1/bin/julia
pytest --runremote --basetemp $HOME/pytest_plain -rxXs
- name: Test with pytest - coverage
if: env.coverage-on-version == matrix.python-version
run: |
rm -rf $HOME/pytest_cov
mkdir $HOME/pytest_cov
#
export EXPYRE_PYTEST_SYSTEMS=github
export WFL_PYTEST_BUILDCELL=$HOME/bin/buildcell
export WFL_NUM_PYTHON_SUBPROCESSES=2
export OMP_NUM_THREADS=1
export WFL_JULIA_COMMAND=${PWD}/julia-1.8.1/bin/julia
pytest -v --cov=wfl --cov-report term --cov-report html --cov-config=tests/.coveragerc --cov-report term-missing --cov-report term:skip-covered --runremote --basetemp $HOME/pytest_cov -rxXs
# # DEBUGGING
# - name: Setup tmate session
# if: failure()
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 15
- name: MPI tests -- plain
if: ${{ env.use-mpi && env.coverage-on-version != matrix.python-version}}
run: |
# envvar and test run - No coverage
export WFL_MPIPOOL=2
export WFL_NUM_PYTHON_SUBPROCESSES=2
export OMP_NUM_THREADS=1
mpirun -n 2 pytest --with-mpi -k mpi
- name: MPI tests -- coverage
if: ${{ env.use-mpi && env.coverage-on-version == matrix.python-version}}
run: |
# envvar and coverage Appended to the previous
export WFL_MPIPOOL=2
export WFL_NUM_PYTHON_SUBPROCESSES=2
export OMP_NUM_THREADS=1
export WFL_JULIA_COMMAND=${PWD}/julia-1.8.1/bin/julia
mpirun -n 2 pytest --cov=wfl --cov-report term --cov-config=tests/.coveragerc --cov-report term-missing --cov-report term:skip-covered --with-mpi -k mpi --cov-append
- name: 'Upload Coverage Data'
uses: actions/upload-artifact@v2
if: env.coverage-on-version == matrix.python-version
with:
name: coverage-html-${{ matrix.python-version }}
path: coverage-html/
retention-days: 7