diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 723b008214..6d2113efb6 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -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: @@ -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 @@ -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 diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml deleted file mode 100644 index 9203a72f6c..0000000000 --- a/.github/workflows/image.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Build Image - -on: - workflow_dispatch: - push: - tags: - - 'v*' -jobs: - build_container_and_push: - runs-on: ubuntu-latest - if: github.repository_owner == 'deepmodeling' - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: | - ghcr.io/deepmodeling/abacus - registry.dp.tech/deepmodeling/abacus - tags: | - type=semver,pattern={{version}} - type=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' }} - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Login to Aliyun Registry - uses: docker/login-action@v3 - with: - registry: registry.dp.tech - username: ${{ secrets.DP_HARBOR_USERNAME }} - password: ${{ secrets.DP_HARBOR_PASSWORD }} - - - name: Build and Push Container - uses: docker/build-push-action@v5 - with: - tags: ${{ steps.meta.outputs.tags }} - file: Dockerfile - push: true - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index 4acfd2991c..589a85e584 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -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"] @@ -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 }} diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 68c47048ac..0000000000 --- a/Dockerfile +++ /dev/null @@ -1,41 +0,0 @@ -# To build this Dockerfile, run `docker build -t abacus - < Dockerfile`. -# Build without cloning the repo by `docker build https://github.com/deepmodeling/abacus-develop.git#develop`, -# and optionally choose the Dockerfile in use by appending e.g. `-f Dockerfile.gnu`. -# Alternatively, pull the image with `docker pull ghcr.io/deepmodeling/abacus:latest`. -# Also available at `docker pull registry.dp.tech/deepmodeling/abacus:latest`. - -# 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 \ - g++ make cmake bc time sudo vim git -# 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 - -# 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. -ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null - -RUN git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \ - cd abacus-develop && \ - cmake -B build && \ - cmake --build build -j`nproc` && \ - cmake --install build && \ - rm -rf build && \ - cd .. - #&& rm -rf abacus-develop -# If you have trouble cloning repo, replace "github.com" with "gitee.com". -CMD mpirun --use-hwthread-cpus abacus - -# To run ABACUS built by this image with all available threads, execute `docker run -v : -w abacus:latest`. -# Replace '' with the path to all files(including pseudopotential files), '' with a path to working directory, and '' with the path to input folder(containing 'INPUT', 'STRU', etc.). -# e.g. after cloning the repo to `$HOME` and pulling image, execute `docker run -v ~/abacus-develop/tests/integrate:/workspace -w /workspace/101_PW_15_f_pseudopots abacus:latest`. -# To run ABACUS with a given MPI process number, execute `docker run -v : -w -it --entrypoint mpirun abacus:latest -np abacus`. -# Note: It would be better using all available CPUs. Docker uses CFS to share the CPU resources, which will result in bad CPU affinity. - -# To use this image as developing environment, execute `docker run -it --entrypoint /bin/bash abacus`. -# Please refer to https://docs.docker.com/engine/reference/commandline/run/ for more details. diff --git a/Dockerfile.gnu b/Dockerfile.gnu index c8316479c9..23b44f1e4c 100644 --- a/Dockerfile.gnu +++ b/Dockerfile.gnu @@ -1,11 +1,22 @@ +# 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 && \ @@ -13,17 +24,18 @@ RUN git clone https://github.com/llohse/libnpy.git && \ 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