Skip to content

Commit aa5055d

Browse files
author
Malmahrouqi3
committed
implemented all changes
1 parent 16de11c commit aa5055d

File tree

3 files changed

+197
-0
lines changed

3 files changed

+197
-0
lines changed

.github/.dockerignore

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
node_modules/
2+
package.json
3+
yarn.lock
4+
5+
.venv/
6+
.vscode/
7+
src/*/include/case.fpp
8+
src/*/autogen/
9+
10+
*.swo
11+
*.swp
12+
13+
*:Zone.Identifier
14+
15+
.nfs*
16+
17+
__pycache__
18+
19+
*.egg-info
20+
21+
.DS_Store
22+
23+
# NVIDIA Nsight Compute
24+
*.nsys-rep
25+
*.sqlite
26+
27+
docs/*/initial*
28+
docs/*/result*
29+
docs/documentation/*-example.png
30+
docs/documentation/examples.md
31+
32+
examples/*batch/*/
33+
examples/**/D/*
34+
examples/**/p*
35+
examples/**/D_*
36+
examples/**/*.inf
37+
examples/**/*.inp
38+
examples/**/*.dat
39+
examples/**/*.o*
40+
examples/**/silo*
41+
examples/**/restart_data*
42+
examples/**/*.out
43+
examples/**/binary
44+
examples/**/fort.1
45+
examples/**/*.sh
46+
examples/**/*.err
47+
examples/**/viz/
48+
examples/*.jpg
49+
examples/*.png
50+
examples/*/workloads/
51+
examples/*/run-*/
52+
examples/*/logs/
53+
examples/**/*.f90
54+
!examples/3D_lag_bubbles_shbubcollapse/input/lag_bubbles.dat
55+
!examples/3D_lag_bubbles_bubblescreen/input/lag_bubbles.dat
56+
workloads/
57+
58+
benchmarks/*batch/*/
59+
benchmarks/*/D/*
60+
benchmarks/*/p*
61+
benchmarks/*/D_*
62+
benchmarks/*/*.inf
63+
benchmarks/*/*.inp
64+
benchmarks/*/*.dat
65+
benchmarks/*/*.o*
66+
benchmarks/*/silo*
67+
benchmarks/*/restart_data*
68+
benchmarks/*/*.out
69+
benchmarks/*/binary
70+
benchmarks/*/fort.1
71+
benchmarks/*/*.sh
72+
benchmarks/*/*.err
73+
benchmarks/*/viz/
74+
benchmarks/*.jpg
75+
benchmarks/*.png
76+
77+
*.mod
78+
79+
# Video Files
80+
*.mp4
81+
*.mov
82+
*.mkv
83+
*.avi

.github/Dockerfile

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
ARG BASE_IMAGE
2+
FROM ${BASE_IMAGE}
3+
4+
ARG TARGET
5+
ARG CC_COMPILER
6+
ARG CXX_COMPILER
7+
ARG FC_COMPILER
8+
ARG COMPILER_PATH
9+
ARG COMPILER_LD_LIBRARY_PATH
10+
11+
RUN apt-get update -y && \
12+
if [ "$TARGET" != "gpu" ]; then \
13+
apt-get install -y \
14+
build-essential git make cmake gcc g++ gfortran \
15+
python3 python3-venv python3-pip \
16+
openmpi-bin libopenmpi-dev libfftw3-dev \
17+
libatlas-base-dev mpich libmpich-dev; \
18+
else \
19+
apt-get install -y \
20+
build-essential git make cmake \
21+
python3 python3-venv python3-pip \
22+
libfftw3-dev libatlas-base-dev \
23+
openmpi-bin libopenmpi-dev; \
24+
fi && \
25+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
26+
27+
ENV OMPI_ALLOW_RUN_AS_ROOT=1
28+
ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
29+
ENV PATH="/opt/MFC:$PATH"
30+
31+
COPY ../ /opt/MFC
32+
33+
ENV CC=${CC_COMPILER}
34+
ENV CXX=${CXX_COMPILER}
35+
ENV FC=${FC_COMPILER}
36+
ENV PATH="${COMPILER_PATH}:$PATH"
37+
ENV LD_LIBRARY_PATH="${COMPILER_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH:-}"
38+
39+
RUN echo "TARGET=$TARGET CC=$CC_COMPILER FC=$FC_COMPILER" && \
40+
cd /opt/MFC && \
41+
if [ "$TARGET" = "gpu" ]; then \
42+
./mfc.sh build --gpu -j $(nproc); \
43+
else \
44+
./mfc.sh build -j $(nproc); \
45+
fi
46+
47+
RUN cd /opt/MFC && \
48+
if [ "$TARGET" = "gpu" ]; then \
49+
./mfc.sh test --dry-run --gpu -j $(nproc); \
50+
else \
51+
./mfc.sh test --dry-run -j $(nproc); \
52+
fi
53+
54+
WORKDIR /opt/MFC
55+
ENTRYPOINT ["bash"]

.github/workflows/docker.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Containerization
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
Container:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
config:
14+
- { name: 'cpu', base_image: 'ubuntu:22.04'}
15+
- { name: 'gpu', base_image: 'nvcr.io/nvidia/nvhpc:23.11-devel-cuda12.3-ubuntu22.04'}
16+
17+
steps:
18+
- name: Clone
19+
uses: actions/checkout@v4
20+
with:
21+
path: mfc
22+
23+
- name: Login
24+
uses: docker/login-action@v3
25+
with:
26+
username: ${{ secrets.DOCKERHUB_USERNAME }}
27+
password: ${{ secrets.DOCKERHUB_TOKEN }}
28+
29+
- name: Setup
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Stage
33+
run: |
34+
sudo mkdir -p /mnt/share
35+
sudo chmod 777 /mnt/share
36+
cp -r mfc/* /mnt/share/
37+
cp -r mfc/.git /mnt/share/.git
38+
cp mfc/.github/Dockerfile /mnt/share/
39+
cp mfc/.github/.dockerignore /mnt/share/
40+
docker buildx create --name mfcbuilder --driver docker-container --use
41+
42+
- name: Build and Deploy
43+
uses: docker/build-push-action@v5
44+
with:
45+
builder: mfcbuilder
46+
context: /mnt/share
47+
file: /mnt/share/Dockerfile
48+
build-args: |
49+
BASE_IMAGE=${{ matrix.config.base_image }}
50+
TARGET=${{ matrix.config.name }}
51+
CC_COMPILER=${{ contains(matrix.config.name, 'gpu') && 'nvc' || 'gcc' }}
52+
CXX_COMPILER=${{ contains(matrix.config.name, 'gpu') && 'nvc++' || 'g++' }}
53+
FC_COMPILER=${{ contains(matrix.config.name, 'gpu') && 'nvfortran' || 'gfortran' }}
54+
COMPILER_PATH=${{ contains(matrix.config.name, 'gpu') && '/opt/nvidia/hpc_sdk/Linux_x86_64/compilers/bin' || '/usr/bin' }}
55+
COMPILER_LD_LIBRARY_PATH=${{ contains(matrix.config.name, 'gpu') && '/opt/nvidia/hpc_sdk/Linux_x86_64/compilers/lib' || '/usr/lib' }}
56+
tags: sbryngelson/mfc:${{ github.ref_name }}-${{ matrix.config.name }}
57+
push: true
58+
cache-from: type=gha
59+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)