Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: build images with tags on self-hosted runner #4089

Merged
merged 3 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ on:
push:
branches:
- develop
tags:
- 'v*'
workflow_dispatch:

jobs:
build_container_and_push:
runs-on: ubuntu-latest
runs-on: X64
if: github.repository_owner == 'deepmodeling'
strategy:
matrix:
Expand All @@ -16,6 +19,17 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/deepmodeling/abacus-${{ matrix.dockerfile }}
registry.dp.tech/deepmodeling/abacus-${{ matrix.dockerfile }}
tags: |
type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }}
type=raw,value=latest

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -36,10 +50,9 @@ jobs:
- name: Build and Push Container
uses: docker/build-push-action@v5
with:
tags: |
ghcr.io/deepmodeling/abacus-${{ matrix.dockerfile }}:latest
registry.dp.tech/deepmodeling/abacus-${{ matrix.dockerfile }}:latest
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile.${{ matrix.dockerfile }}
push: true
cache-from: type=registry,ref=ghcr.io/deepmodeling/abacus-${{ matrix.dockerfile }}:latest
cache-to: type=inline
push: true
50 changes: 0 additions & 50 deletions .github/workflows/image.yml

This file was deleted.

56 changes: 2 additions & 54 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,9 @@ on:
workflow_dispatch:

jobs:
start-runner:
name: Start self-hosted EC2 runner
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.PAT }}
ec2-image-id: ami-04cd9fec4a7a39019
ec2-instance-type: c5.9xlarge
subnet-id: subnet-72d3e53e
security-group-id: sg-06b0c93122c08aeab

test:
name: Performance test
needs: start-runner
runs-on: ${{ needs.start-runner.outputs.label }}
runs-on: X64
strategy:
matrix:
tag: ["gnu", "intel"]
Expand All @@ -43,39 +18,12 @@ jobs:
- name: Install Requirements
run: |
apt install -y time
- name: Build
run: |
cmake -B build -DENABLE_LIBXC=ON
cmake --build build -j`nproc`
cmake --install build
- name: Test
run: |
test -e /opt/intel/oneapi/setvars.sh && . /opt/intel/oneapi/setvars.sh
. /opt/intel/oneapi/setvars.sh || :
cd tests/performance/
bash run.sh
- name: Show Result
if: always()
run: |
cat tests/performance/sumall.dat

stop-runner:
name: Stop self-hosted EC2 runner
needs:
- start-runner # required to get output from the start-runner job
- test # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.PAT }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}
41 changes: 0 additions & 41 deletions Dockerfile

This file was deleted.

18 changes: 15 additions & 3 deletions Dockerfile.gnu
Original file line number Diff line number Diff line change
@@ -1,29 +1,41 @@
# To build this Dockerfile, run `docker build -t abacus - < Dockerfile.gnu`.
# Build without cloning the repo by `docker build https://github.com/deepmodeling/abacus-develop.git#develop -f Dockerfile.intel`,
# Alternatively, pull the image with `docker pull ghcr.io/deepmodeling/abacus-intel:latest`.
# Also available at `docker pull registry.dp.tech/deepmodeling/abacus-intel:latest`.
# Available image names: abacus-gnu, abacus-intel, abacus-cuda

# Docker images are aimed for evaluating ABACUS.
# For production use, please compile ABACUS from source code and run in bare-metal for a better performace.

FROM ubuntu:22.04
RUN apt update && apt install -y --no-install-recommends \
libopenblas-openmp-dev liblapack-dev libscalapack-mpi-dev libelpa-dev libfftw3-dev libcereal-dev \
libxc-dev libgtest-dev libgmock-dev libbenchmark-dev python3-numpy \
bc cmake git g++ make bc time sudo unzip vim wget gfortran
# If you wish to use the LLVM compiler, replace 'g++' above with 'clang libomp-dev'.

ENV GIT_SSL_NO_VERIFY=true TERM=xterm-256color \
OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 OMPI_MCA_btl_vader_single_copy_mechanism=none
# The above environment variables are for using OpenMPI in Docker.

RUN git clone https://github.com/llohse/libnpy.git && \
cp libnpy/include/npy.hpp /usr/local/include && \
rm -r libnpy

RUN wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.0%2Bcpu.zip \
--no-check-certificate --quiet -O libtorch.zip && \
unzip -q libtorch.zip -d /opt && rm libtorch.zip
unzip -q libtorch.zip -d /opt && rm libtorch.zip

ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake

ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null
# This will fetch the latest commit info, and store in docker building cache.
# If there are newer commits, docker build will ignore the cache and build latest codes.

RUN git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \
cd abacus-develop && \
cmake -B build -DENABLE_DEEPKS=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_RAPIDJSON=ON && \
cmake --build build -j`nproc` && \
cmake --install build && \
rm -rf build && \
cd ..
rm -rf build
#&& rm -rf abacus-develop