Skip to content
Draft
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
107 changes: 107 additions & 0 deletions .github/workflows/docker_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Docker-based CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
# schedule:
# - cron: '3 16 * * *'

permissions:
contents: write

jobs:
build-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

# -----------------------------
# Build Docker images
# -----------------------------
- name: Build base image (mesh generation included)
run: docker build -t ci-base -f dockerfiles/Dockerfile.base .

- name: Build Fenics image (simulations included)
run: docker build -t ci-fenics -f dockerfiles/Dockerfile.fenics .

- name: Build Kratos image (simulations included)
run: docker build -t ci-kratos -f dockerfiles/Dockerfile.kratos .

# -----------------------------
# Extract Fenics results
# -----------------------------
- name: Extract Results from Fenics container
run: |
docker create --name fenics_temp ci-fenics
# Copy the results folder as-is from container to host
docker cp fenics_temp:/sim/benchmarks/linear-elastic-plate-with-hole/results ./benchmarks/linear-elastic-plate-with-hole/
docker rm fenics_temp

# -----------------------------
# Extract Kratos results
# -----------------------------
- name: Extract Kratos results
run: |
docker create --name kratos_temp ci-kratos
# Copy the results folder as-is from container to host
docker cp kratos_temp:/sim/benchmarks/linear-elastic-plate-with-hole/results ./benchmarks/linear-elastic-plate-with-hole/
docker rm kratos_temp

# -----------------------------
# Upload Artifacts
# -----------------------------
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: workflow-results
path: |
benchmarks/linear-elastic-plate-with-hole/results/fenics
benchmarks/linear-elastic-plate-with-hole/results/kratos

# # -----------------------------
# # Optional: commit generated results to GitHub
# # -----------------------------
# - name: Commit generated results
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# git config --global user.name "github-actions[bot]"
# git config --global user.email "github-actions[bot]@users.noreply.github.com"

# # Create a flat zip of the simulation results
# cd benchmarks/linear-elastic-plate-with-hole
# tar -cJf simulation_results.tar.xz results
# cd ../..

# # Add only the zip
# git add -f benchmarks/linear-elastic-plate-with-hole/simulation_results.tar.xz

# git commit -m "Add generated simulation results" || echo "No changes to commit"
# git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:main

# - name: Build Postprocessing image
# run: |
# docker build -t ci-postprocessing -f dockerfiles/Dockerfile.postprocessing .

# - name: Postprocessing (metadata + extraction + plot)
# run: |
# docker run --rm \
# -v ${{ github.workspace }}:/workspace \
# -w /workspace/benchmarks/linear-elastic-plate-with-hole \
# ci-postprocessing \
# bash -c '
# echo "Generating metadata...";
# python parameter_extractor.py ./results metadata4ing_provenance.zip;
#
# echo "Extracting ZIP...";
# mkdir -p ./metadata4ing_provenance;
# unzip -o metadata4ing_provenance.zip -d ./metadata4ing_provenance;
#
# echo "Plotting provenance...";
# python plot_provenance.py ./metadata4ing_provenance
# '
108 changes: 0 additions & 108 deletions .github/workflows/run-benchmark.yml

This file was deleted.

32 changes: 31 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,32 @@
.snakemake
site
site

# macOS system files
.DS_Store

# Python cache files
__pycache__/
*.py[cod]

# Benchmark and workflow output files
benchmarks/linear-elastic-plate-with-hole/element_size_vs_stress.pdf
benchmarks/linear-elastic-plate-with-hole/metadata4ing_provenance.zip
benchmarks/linear-elastic-plate-with-hole/workflow_config.json

# Generated folders and outputs
benchmarks/linear-elastic-plate-with-hole/metadata4ing_provenance/
benchmarks/linear-elastic-plate-with-hole/snakemake_results/
benchmarks/linear-elastic-plate-with-hole/results/

# (Optional) ignore all ZIP and PDF files in benchmarks if they are always generated
# benchmarks/**/*.zip
# benchmarks/**/*.pdf

# VS Code / IDE settings (optional, if you use editors)
.vscode/
.idea/

# Conda and environment files (optional safety)
*.lock
*.log
.env
8 changes: 6 additions & 2 deletions benchmarks/linear-elastic-plate-with-hole/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ rule create_mesh:
parameters = lambda wildcards: configuration_to_parameter_file[wildcards.configuration],
output:
mesh = f"{result_dir}/mesh/mesh_{{configuration}}.msh",
conda: "environment_mesh.yml"
# conda: "environment_mesh.yml"
shell:
"""
source /opt/miniforge/etc/profile.d/conda.sh
conda activate mesh
python3 {input.script} --input_parameter_file {input.parameters} --output_mesh_file {output.mesh}
"""

Expand Down Expand Up @@ -55,9 +57,11 @@ rule summary:
),
output:
summary_json = f"{result_dir}/{{tool}}/summary.json",
conda: "environment_postprocessing.yml",
# conda: "environment_postprocessing.yml",
shell:
"""
source /opt/miniforge/etc/profile.d/conda.sh
conda activate postprocessing
python3 {input.script} \
--input_configuration {configurations} \
--input_parameter_file {input.parameters} \
Expand Down
20 changes: 17 additions & 3 deletions benchmarks/linear-elastic-plate-with-hole/fenics/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,23 @@ rule run_fenics_simulation:
output:
zip = f"{result_dir}/{{tool}}/solution_field_data_{{configuration}}.zip",
metrics = f"{result_dir}/{{tool}}/solution_metrics_{{configuration}}.json",
conda:
"environment_simulation.yml",
# conda:
# "environment_simulation.yml",
shell:
"""
python3 {input.script} --input_parameter_file {input.parameters} --input_mesh_file {input.mesh} --output_solution_file_zip {output.zip} --output_metrics_file {output.metrics}
# Disable 'unbound variable' errors to avoid ADDR2LINE issues
set +u
# Load conda
source /opt/miniforge/etc/profile.d/conda.sh
# Activate the FEniCS environment
conda activate fenics-sim
# Prevent OpenMP crash under qemu (macOS/arm64 emulation)
export OMP_NUM_THREADS=1

# Run the actual simulation
python3 {input.script} \
--input_parameter_file {input.parameters} \
--input_mesh_file {input.mesh} \
--output_solution_file_zip {output.zip} \
--output_metrics_file {output.metrics}
"""
18 changes: 12 additions & 6 deletions benchmarks/linear-elastic-plate-with-hole/kratos/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ rule mesh_to_mdpa:
script = f"{tool}/msh_to_mdpa.py",
output:
mdpa = f"{result_dir}/{tool}/mesh_{{configuration}}.mdpa",
conda:
"environment_simulation.yml",
# conda:
# "environment_simulation.yml",
shell:
"""
source /opt/miniforge/etc/profile.d/conda.sh
conda activate kratos-sim
python3 {input.script} \
--input_parameter_file {input.parameters} \
--input_mesh_file {input.mesh} \
Expand All @@ -44,10 +46,12 @@ rule create_kratos_input_and_run_simulation:
kratos_inputfile = f"{result_dir}/{tool}/ProjectParameters_{{configuration}}.json",
kratos_materialfile = f"{result_dir}/{tool}/MaterialParameters_{{configuration}}.json",
result_vtk = f"{result_dir}/{tool}/{{configuration}}/Structure_0_1.vtk",
conda:
"environment_simulation.yml",
# conda:
# "environment_simulation.yml",
shell:
"""
source /opt/miniforge/etc/profile.d/conda.sh
conda activate kratos-sim
python3 {input.script_create_kratos_input} \
--input_parameter_file {input.parameters} \
--input_mdpa_file {input.mdpa} \
Expand All @@ -70,10 +74,12 @@ rule postprocess_kratos_results:
output:
zip = f"{result_dir}/{tool}/solution_field_data_{{configuration}}.zip",
metrics = f"{result_dir}/{tool}/solution_metrics_{{configuration}}.json",
conda:
"environment_simulation.yml",
# conda:
# "environment_simulation.yml",
shell:
"""
source /opt/miniforge/etc/profile.d/conda.sh
conda activate kratos-sim
python3 {input.script} \
--input_parameter_file {input.parameters} \
--input_result_vtk {input.result_vtk} \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
- python-gmsh
- pint
- pyvista
- sympy
- pip
- pip:
- KratosMultiphysics-all
- sympy
- KratosMultiphysics-all==9.0.2
Loading