-
Notifications
You must be signed in to change notification settings - Fork 113
MFC Containerization #971
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
Open
Malmahrouqi3
wants to merge
7
commits into
MFlowCode:master
Choose a base branch
from
Malmahrouqi3:containerization
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
MFC Containerization #971
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
aa5055d
implemented all changes
f348b78
Better handling of manual triggers
0aca803
devcontainer & workflow updates
2ec9209
trying to fix the issue with TAG
3297583
updated workflow
09dc88d
Merge branch 'master' into containerization
Malmahrouqi3 67f67be
Merge branch 'master' into containerization
Malmahrouqi3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "MFC Container", | ||
"image": "sbryngelson/mfc:latest-cpu", | ||
"workspaceFolder": "/opt/MFC", | ||
"settings": { | ||
"terminal.integrated.shell.linux": "/bin/bash", | ||
"editor.formatOnSave": true | ||
}, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
node_modules/ | ||
package.json | ||
yarn.lock | ||
|
||
.venv/ | ||
.vscode/ | ||
src/*/autogen/ | ||
|
||
*.swo | ||
*.swp | ||
|
||
*:Zone.Identifier | ||
|
||
.nfs* | ||
|
||
__pycache__ | ||
|
||
*.egg-info | ||
|
||
.DS_Store | ||
|
||
# NVIDIA Nsight Compute | ||
*.nsys-rep | ||
*.sqlite | ||
|
||
docs/*/initial* | ||
docs/*/result* | ||
docs/documentation/*-example.png | ||
docs/documentation/examples.md | ||
|
||
examples/*batch/*/ | ||
examples/**/D/* | ||
examples/**/p* | ||
examples/**/D_* | ||
examples/**/*.inf | ||
examples/**/*.inp | ||
examples/**/*.dat | ||
examples/**/*.o* | ||
examples/**/silo* | ||
examples/**/restart_data* | ||
examples/**/*.out | ||
examples/**/binary | ||
examples/**/fort.1 | ||
examples/**/*.sh | ||
examples/**/*.err | ||
examples/**/viz/ | ||
examples/*.jpg | ||
examples/*.png | ||
examples/*/workloads/ | ||
examples/*/run-*/ | ||
examples/*/logs/ | ||
examples/**/*.f90 | ||
!examples/3D_lag_bubbles_shbubcollapse/input/lag_bubbles.dat | ||
!examples/3D_lag_bubbles_bubblescreen/input/lag_bubbles.dat | ||
workloads/ | ||
|
||
benchmarks/*batch/*/ | ||
benchmarks/*/D/* | ||
benchmarks/*/p* | ||
benchmarks/*/D_* | ||
benchmarks/*/*.inf | ||
benchmarks/*/*.inp | ||
benchmarks/*/*.dat | ||
benchmarks/*/*.o* | ||
benchmarks/*/silo* | ||
benchmarks/*/restart_data* | ||
benchmarks/*/*.out | ||
benchmarks/*/binary | ||
benchmarks/*/fort.1 | ||
benchmarks/*/*.sh | ||
benchmarks/*/*.err | ||
benchmarks/*/viz/ | ||
benchmarks/*.jpg | ||
benchmarks/*.png | ||
|
||
*.mod | ||
|
||
# Video Files | ||
*.mp4 | ||
*.mov | ||
*.mkv | ||
*.avi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
ARG BASE_IMAGE | ||
FROM ${BASE_IMAGE} | ||
|
||
ARG TARGET | ||
ARG CC_COMPILER | ||
ARG CXX_COMPILER | ||
ARG FC_COMPILER | ||
ARG COMPILER_PATH | ||
ARG COMPILER_LD_LIBRARY_PATH | ||
|
||
RUN apt-get update -y && \ | ||
if [ "$TARGET" != "gpu" ]; then \ | ||
apt-get install -y \ | ||
build-essential git make cmake gcc g++ gfortran \ | ||
python3 python3-venv python3-pip \ | ||
openmpi-bin libopenmpi-dev libfftw3-dev \ | ||
mpich libmpich-dev; \ | ||
else \ | ||
apt-get install -y \ | ||
build-essential git make cmake \ | ||
python3 python3-venv python3-pip \ | ||
libfftw3-dev \ | ||
openmpi-bin libopenmpi-dev; \ | ||
fi && \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
ENV OMPI_ALLOW_RUN_AS_ROOT=1 | ||
ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 | ||
ENV PATH="/opt/MFC:$PATH" | ||
|
||
COPY ../ /opt/MFC | ||
Malmahrouqi3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
ENV CC=${CC_COMPILER} | ||
ENV CXX=${CXX_COMPILER} | ||
ENV FC=${FC_COMPILER} | ||
ENV PATH="${COMPILER_PATH}:$PATH" | ||
ENV LD_LIBRARY_PATH="${COMPILER_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH:-}" | ||
|
||
RUN echo "TARGET=$TARGET CC=$CC_COMPILER FC=$FC_COMPILER" && \ | ||
cd /opt/MFC && \ | ||
if [ "$TARGET" = "gpu" ]; then \ | ||
./mfc.sh build --gpu -j $(nproc); \ | ||
else \ | ||
./mfc.sh build -j $(nproc); \ | ||
fi | ||
|
||
RUN cd /opt/MFC && \ | ||
if [ "$TARGET" = "gpu" ]; then \ | ||
./mfc.sh test --dry-run --gpu -j $(nproc); \ | ||
else \ | ||
./mfc.sh test --dry-run -j $(nproc); \ | ||
fi | ||
|
||
WORKDIR /opt/MFC | ||
ENTRYPOINT ["tail", "-f", "/dev/null"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: Containerization | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: 'tag to containerize' | ||
required: true | ||
|
||
concurrency: | ||
group: Containerization | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
Container: | ||
strategy: | ||
matrix: | ||
config: | ||
- { name: 'cpu', runner: 'ubuntu-22.04', base_image: 'ubuntu:22.04' } | ||
- { name: 'cpu', runner: 'ubuntu-22.04-arm', base_image: 'ubuntu:22.04' } | ||
- { name: 'gpu', runner: 'ubuntu-22.04', base_image: 'nvcr.io/nvidia/nvhpc:23.11-devel-cuda12.3-ubuntu22.04' } | ||
- { name: 'gpu', runner: 'ubuntu-22.04-arm', base_image: 'nvcr.io/nvidia/nvhpc:23.11-devel-cuda12.3-ubuntu22.04' } | ||
runs-on: ${{ matrix.config.runner }} | ||
outputs: | ||
tag: ${{ steps.clone.outputs.tag }} | ||
steps: | ||
- name: Login | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Setup Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Clone | ||
id: clone | ||
run: | | ||
TAG="${{ github.event.inputs.tag || github.ref_name }}" | ||
echo "tag=$TAG" >> $GITHUB_OUTPUT | ||
echo "TAG=$TAG" >> $GITHUB_ENV | ||
git clone --branch "$TAG" --depth 1 https://github.com/MFlowCode/MFC.git mfc | ||
|
||
- name: Stage | ||
run: | | ||
sudo mkdir -p /mnt/share | ||
sudo chmod 777 /mnt/share | ||
cp -r mfc/* /mnt/share/ | ||
cp -r mfc/.git /mnt/share/.git | ||
cp mfc/.github/Dockerfile /mnt/share/ | ||
cp mfc/.github/.dockerignore /mnt/share/ | ||
|
||
- name: Build and Deploy | ||
uses: docker/build-push-action@v6 | ||
with: | ||
builder: default | ||
context: /mnt/share | ||
file: /mnt/share/Dockerfile | ||
build-args: | | ||
BASE_IMAGE=${{ matrix.config.base_image }} | ||
TARGET=${{ matrix.config.name }} | ||
CC_COMPILER=${{ contains(matrix.config.name, 'gpu') && 'nvc' || 'gcc' }} | ||
CXX_COMPILER=${{ contains(matrix.config.name, 'gpu') && 'nvc++' || 'g++' }} | ||
FC_COMPILER=${{ contains(matrix.config.name, 'gpu') && 'nvfortran' || 'gfortran' }} | ||
COMPILER_PATH=${{ contains(matrix.config.name, 'gpu') && '/opt/nvidia/hpc_sdk/Linux_x86_64/compilers/bin' || '/usr/bin' }} | ||
COMPILER_LD_LIBRARY_PATH=${{ contains(matrix.config.name, 'gpu') && '/opt/nvidia/hpc_sdk/Linux_x86_64/compilers/lib' || '/usr/lib' }} | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/mfc:${{ env.TAG }}-${{ matrix.config.name }}-${{ matrix.config.runner}} | ||
push: true | ||
|
||
manifests: | ||
runs-on: ubuntu-latest | ||
needs: Container | ||
steps: | ||
- name: Login | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Create and Push Manifest Lists | ||
env: | ||
TAG: ${{ needs.Container.outputs.tag }} | ||
REGISTRY: ${{ secrets.DOCKERHUB_USERNAME }}/mfc | ||
run: | | ||
docker manifest create $REGISTRY:$TAG-cpu $REGISTRY:$TAG-cpu-ubuntu-22.04 $REGISTRY:$TAG-cpu-ubuntu-22.04-arm | ||
docker manifest create $REGISTRY:$TAG-gpu $REGISTRY:$TAG-gpu-ubuntu-22.04 $REGISTRY:$TAG-gpu-ubuntu-22.04-arm | ||
docker manifest create $REGISTRY:latest-cpu $REGISTRY:$TAG-cpu-ubuntu-22.04 $REGISTRY:$TAG-cpu-ubuntu-22.04-arm | ||
docker manifest create $REGISTRY:latest-gpu $REGISTRY:$TAG-gpu-ubuntu-22.04 $REGISTRY:$TAG-gpu-ubuntu-22.04-arm | ||
|
||
docker manifest push $REGISTRY:$TAG-cpu | ||
docker manifest push $REGISTRY:$TAG-gpu | ||
docker manifest push $REGISTRY:latest-cpu | ||
docker manifest push $REGISTRY:latest-gpu |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.